Ensure operation id gets set even if failure
Although this deviates from the standard "auto-generated" code, the
M-AEAD setup functions set the key and thus allocate memory. If the
failure occurs after this (invalid tag size for example) then not having
the id set to the internal drivers means that abort does not get called,
and this causes the allocated data to leak.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
diff --git a/library/psa_crypto_driver_wrappers.c b/library/psa_crypto_driver_wrappers.c
index ce49a22..1e17435 100644
--- a/library/psa_crypto_driver_wrappers.c
+++ b/library/psa_crypto_driver_wrappers.c
@@ -1330,8 +1330,7 @@
key_buffer, key_buffer_size,
alg );
- if( status == PSA_SUCCESS )
- operation->id = PSA_CRYPTO_MBED_TLS_DRIVER_ID;
+ operation->id = PSA_CRYPTO_MBED_TLS_DRIVER_ID;
return( status );
@@ -1382,8 +1381,7 @@
key_buffer, key_buffer_size,
alg );
- if( status == PSA_SUCCESS )
- operation->id = PSA_CRYPTO_MBED_TLS_DRIVER_ID;
+ operation->id = PSA_CRYPTO_MBED_TLS_DRIVER_ID;
return( status );