fix(esp-tls): fix pointer cast and condition for CONFIG_ATECC608A_TCUSTOM

Closes https://github.com/espressif/esp-idf/pull/11923
This commit is contained in:
Alex 2023-07-20 15:12:29 +01:00 committed by Mahavir Jain
parent 25876e8f49
commit 1360b5fa83
No known key found for this signature in database
GPG Key ID: 99324EF4A00734E0

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -947,8 +947,9 @@ static esp_err_t esp_set_atecc608a_pki_context(esp_tls_t *tls, const void *pki)
} }
mbedtls_x509_crt_init(&tls->clientcert); mbedtls_x509_crt_init(&tls->clientcert);
if(cfg->clientcert_buf != NULL) { esp_tls_pki_t *pki_l = (esp_tls_pki_t *) pki;
ret = mbedtls_x509_crt_parse(&tls->clientcert, (const unsigned char*)((esp_tls_pki_t *)pki->publiccert_pem_buf), (esp_tls_pki_t *)pki->publiccert_pem_bytes); if (pki_l->publiccert_pem_buf != NULL) {
ret = mbedtls_x509_crt_parse(&tls->clientcert, pki_l->publiccert_pem_buf, pki_l->publiccert_pem_bytes);
if (ret < 0) { if (ret < 0) {
ESP_LOGE(TAG, "mbedtls_x509_crt_parse of client cert returned -0x%04X", -ret); ESP_LOGE(TAG, "mbedtls_x509_crt_parse of client cert returned -0x%04X", -ret);
mbedtls_print_error_msg(ret); mbedtls_print_error_msg(ret);