Skip to content

Commit 2a08ed9

Browse files
committed
Fixes for idf v5.0
1 parent 93cb278 commit 2a08ed9

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

components/button/CMakeLists.txt

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
set(COMPONENT_ADD_INCLUDEDIRS button/include)
2-
set(COMPONENT_SRCS "button/button.c"
3-
"button/button_obj.cpp")
4-
5-
register_component()
1+
idf_component_register(SRCS "button/button.c" "button/button_obj.cpp"
2+
INCLUDE_DIRS "button/include"
3+
REQUIRES "driver")

components/esp_rainmaker/src/core/esp_rmaker_claim.c

+17-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,17 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <mbedtls/version.h>
16+
/* Keep forward-compatibility with Mbed TLS 3.x */
17+
#if (MBEDTLS_VERSION_NUMBER < 0x03000000)
18+
#define MBEDTLS_2_X_COMPAT
19+
#else /* !(MBEDTLS_VERSION_NUMBER < 0x03000000) */
20+
/* Macro wrapper for struct's private members */
21+
#ifndef MBEDTLS_ALLOW_PRIVATE_ACCESS
22+
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
23+
#endif /* MBEDTLS_ALLOW_PRIVATE_ACCESS */
24+
#endif /* !(MBEDTLS_VERSION_NUMBER < 0x03000000) */
1525

16-
#include "mbedtls/config.h"
1726
#include "mbedtls/platform.h"
1827
#include "mbedtls/pk.h"
1928
#include "mbedtls/rsa.h"
@@ -45,6 +54,7 @@
4554
#include "esp_rmaker_client_data.h"
4655
#include "esp_rmaker_claim.h"
4756

57+
4858
static const char *TAG = "esp_claim";
4959

5060
#define ESP_RMAKER_RANDOM_NUMBER_LEN 64
@@ -796,7 +806,12 @@ esp_err_t __esp_rmaker_claim_init(esp_rmaker_claim_data_t *claim_data)
796806
if (key) {
797807
mbedtls_pk_free(&claim_data->key);
798808
mbedtls_pk_init(&claim_data->key);
799-
if (mbedtls_pk_parse_key(&claim_data->key, (uint8_t *)key, strlen(key) + 1, NULL, 0) == 0) {
809+
#ifdef MBEDTLS_2_X_COMPAT
810+
int ret = mbedtls_pk_parse_key(&claim_data->key, (uint8_t *)key, strlen(key) + 1, NULL, 0);
811+
#else
812+
int ret = mbedtls_pk_parse_key(&claim_data->key, (uint8_t *)key, strlen(key) + 1, NULL, 0, mbedtls_ctr_drbg_random, NULL);
813+
#endif
814+
if (ret == 0) {
800815
ESP_LOGI(TAG, "Private key already exists. No need to re-initialise it.");
801816
claim_data->state = RMAKER_CLAIM_STATE_PK_GENERATED;
802817
}

examples/homekit_switch/main/app_homekit.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <freertos/FreeRTOS.h>
1212
#include <freertos/task.h>
1313
#include <esp_log.h>
14-
14+
#include <esp_netif_types.h>
1515
#include <esp_rmaker_core.h>
1616
#include <esp_rmaker_standard_params.h>
1717

0 commit comments

Comments
 (0)