mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_mbedlts_ds_memory_leak_v4.3' into 'release/v4.3'
esp-tls: Fix memory leak in mbedtls ds peripheral when MBEDTLS_THREADING_C enabled (backport v4.3) See merge request espressif/esp-idf!20595
This commit is contained in:
commit
d4789383a4
@ -757,14 +757,17 @@ static esp_err_t esp_mbedtls_init_pk_ctx_for_ds(const void *pki)
|
||||
if ((ret = mbedtls_pk_setup_rsa_alt(((const esp_tls_pki_t*)pki)->pk_key, &rsakey, NULL, esp_ds_rsa_sign,
|
||||
esp_ds_get_keylen )) != 0) {
|
||||
ESP_LOGE(TAG, "Error in mbedtls_pk_setup_rsa_alt, returned %02x", ret);
|
||||
return ESP_FAIL;
|
||||
ret = ESP_FAIL;
|
||||
goto exit;
|
||||
}
|
||||
ret = esp_ds_init_data_ctx(((const esp_tls_pki_t*)pki)->esp_ds_data);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to initialize DS parameters from nvs");
|
||||
return ESP_FAIL;
|
||||
goto exit;
|
||||
}
|
||||
ESP_LOGD(TAG, "DS peripheral params initialized.");
|
||||
return ESP_OK;
|
||||
exit:
|
||||
mbedtls_rsa_free(&rsakey);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_ESP_TLS_USE_DS_PERIPHERAL */
|
||||
|
Loading…
x
Reference in New Issue
Block a user