Remove code duplication and fix formatting
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 9fb3a20..64c05ea 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -3549,7 +3549,7 @@
}
if( operation->nonce_set || operation->ad_started ||
- operation->body_started || operation->is_encrypt == 0 )
+ operation->body_started || !operation->is_encrypt )
{
status = PSA_ERROR_BAD_STATE;
goto exit;
@@ -3635,7 +3635,7 @@
}
if( operation->lengths_set || operation->ad_started ||
- operation->body_started)
+ operation->body_started )
{
status = PSA_ERROR_BAD_STATE;
goto exit;
@@ -3761,7 +3761,7 @@
static psa_status_t psa_aead_final_checks( psa_aead_operation_t *operation )
{
- if( operation->id == 0 || operation->nonce_set == 0 )
+ if( operation->id == 0 || !operation->nonce_set )
return( PSA_ERROR_BAD_STATE );
if( operation->lengths_set && (operation->ad_remaining != 0 ||
@@ -3790,7 +3790,7 @@
if( status != PSA_SUCCESS )
goto exit;
- if( operation->is_encrypt == 0 )
+ if( !operation->is_encrypt )
{
status = PSA_ERROR_BAD_STATE;
goto exit;
@@ -3831,17 +3831,12 @@
if( status != PSA_SUCCESS )
goto exit;
- if( operation->is_encrypt == 1 )
+ if( operation->is_encrypt )
{
status = PSA_ERROR_BAD_STATE;
goto exit;
}
- status = psa_aead_final_checks( operation );
-
- if( status != PSA_SUCCESS )
- goto exit;
-
status = psa_driver_wrapper_aead_verify( operation, plaintext,
plaintext_size,
plaintext_length,