From 725f22a545c12b135bbd68ca42f4cefae40baf88 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 25 Jul 2019 11:31:48 +0200 Subject: [PATCH] Bug fix: save the driver's persistent data in destroy_key --- library/psa_crypto.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 92364ca4c..eefb26116 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -1007,7 +1007,11 @@ psa_status_t psa_destroy_key( psa_key_handle_t handle ) #if defined(MBEDTLS_PSA_CRYPTO_SE_C) if( driver != NULL ) { - status = psa_crypto_stop_transaction( ); + psa_status_t status2; + status = psa_save_se_persistent_data( driver ); + status2 = psa_crypto_stop_transaction( ); + if( status == PSA_SUCCESS ) + status = status2; if( status != PSA_SUCCESS ) { /* TOnogrepDO: destroy what can be destroyed anyway */