mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-03 13:41:08 +00:00
Merge pull request #5601 from SiliconLabs/erase_secret_before_free_backport_2_28
Backport 2.28: Erase secrets in allocated memory before freeing said memory
This commit is contained in:
commit
76d1cb26ef
4
ChangeLog.d/zeroize_key_buffers_before_free.txt
Normal file
4
ChangeLog.d/zeroize_key_buffers_before_free.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Security
|
||||||
|
* Zeroize dynamically-allocated buffers used by the PSA Crypto key storage
|
||||||
|
module before freeing them. These buffers contain secret key material, and
|
||||||
|
could thus potentially leak the key through freed heap.
|
|
@ -347,6 +347,7 @@ psa_status_t psa_save_persistent_key( const psa_core_key_attributes_t *attr,
|
||||||
status = psa_crypto_storage_store( attr->id,
|
status = psa_crypto_storage_store( attr->id,
|
||||||
storage_data, storage_data_length );
|
storage_data, storage_data_length );
|
||||||
|
|
||||||
|
mbedtls_platform_zeroize( storage_data, storage_data_length );
|
||||||
mbedtls_free( storage_data );
|
mbedtls_free( storage_data );
|
||||||
|
|
||||||
return( status );
|
return( status );
|
||||||
|
@ -392,6 +393,7 @@ psa_status_t psa_load_persistent_key( psa_core_key_attributes_t *attr,
|
||||||
status = PSA_ERROR_STORAGE_FAILURE;
|
status = PSA_ERROR_STORAGE_FAILURE;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
mbedtls_platform_zeroize( loaded_data, storage_data_length );
|
||||||
mbedtls_free( loaded_data );
|
mbedtls_free( loaded_data );
|
||||||
return( status );
|
return( status );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue