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>
This commit is contained in:
Paul Elliott 2021-04-28 13:23:27 +01:00
parent ac3c20013c
commit 72baf65819

View file

@ -1330,8 +1330,7 @@ psa_status_t psa_driver_wrapper_aead_encrypt_setup(
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 @@ psa_status_t psa_driver_wrapper_aead_decrypt_setup(
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 );