Remove unneccessary guard for key unlock
Also make sure failure is not hidden by key unlock failure Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
e95259f833
commit
6981fbcf10
@ -3282,13 +3282,10 @@ psa_status_t psa_aead_encrypt_setup( psa_aead_operation_t *operation,
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if( slot )
|
unlock_status = psa_unlock_key_slot( slot );
|
||||||
{
|
|
||||||
unlock_status = psa_unlock_key_slot( slot );
|
|
||||||
|
|
||||||
if( unlock_status != PSA_SUCCESS )
|
if( status == PSA_SUCCESS )
|
||||||
status = unlock_status;
|
status = unlock_status;
|
||||||
}
|
|
||||||
|
|
||||||
if( status == PSA_SUCCESS )
|
if( status == PSA_SUCCESS )
|
||||||
operation->alg = psa_aead_get_base_algorithm( alg );
|
operation->alg = psa_aead_get_base_algorithm( alg );
|
||||||
@ -3320,6 +3317,7 @@ psa_status_t psa_aead_decrypt_setup( psa_aead_operation_t *operation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( operation->nonce_set || operation->ad_started ||
|
if( operation->nonce_set || operation->ad_started ||
|
||||||
|
|
||||||
operation->body_started )
|
operation->body_started )
|
||||||
{
|
{
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
@ -3347,13 +3345,10 @@ psa_status_t psa_aead_decrypt_setup( psa_aead_operation_t *operation,
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if( slot )
|
unlock_status = psa_unlock_key_slot( slot );
|
||||||
{
|
|
||||||
unlock_status = psa_unlock_key_slot( slot );
|
|
||||||
|
|
||||||
if( unlock_status != PSA_SUCCESS )
|
if( status == PSA_SUCCESS )
|
||||||
status = unlock_status;
|
status = unlock_status;
|
||||||
}
|
|
||||||
|
|
||||||
if( status == PSA_SUCCESS )
|
if( status == PSA_SUCCESS )
|
||||||
operation->alg = psa_aead_get_base_algorithm( alg );
|
operation->alg = psa_aead_get_base_algorithm( alg );
|
||||||
|
Loading…
Reference in New Issue
Block a user