Check return value of psa_destroy_key
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
parent
833713c35c
commit
8d5a4cbfdb
@ -153,6 +153,7 @@ psa_status_t mbedtls_psa_hkdf_expand( psa_algorithm_t alg,
|
|||||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||||
psa_mac_operation_t operation = PSA_MAC_OPERATION_INIT;
|
psa_mac_operation_t operation = PSA_MAC_OPERATION_INIT;
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
|
psa_status_t destroy_status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
unsigned char t[PSA_MAC_MAX_SIZE];
|
unsigned char t[PSA_MAC_MAX_SIZE];
|
||||||
|
|
||||||
if( okm == NULL )
|
if( okm == NULL )
|
||||||
@ -250,11 +251,13 @@ psa_status_t mbedtls_psa_hkdf_expand( psa_algorithm_t alg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
psa_destroy_key( key );
|
if( status != PSA_SUCCESS )
|
||||||
mbedtls_platform_zeroize( t, sizeof( t ) );
|
psa_mac_abort( &operation );
|
||||||
psa_mac_abort( &operation );
|
destroy_status = psa_destroy_key( key );
|
||||||
|
|
||||||
return( status );
|
mbedtls_platform_zeroize( t, sizeof( t ) );
|
||||||
|
|
||||||
|
return( ( status == PSA_SUCCESS ) ? destroy_status : status );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_TEST_HOOKS */
|
#endif /* MBEDTLS_TEST_HOOKS */
|
||||||
|
Loading…
Reference in New Issue
Block a user