Fix state logic and return codes

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
Paul Elliott 2021-05-25 15:48:09 +01:00
parent 83f09ef056
commit 40ef3a9454

View File

@ -3555,8 +3555,8 @@ psa_status_t psa_aead_generate_nonce( psa_aead_operation_t *operation,
goto exit; goto exit;
} }
if( operation->nonce_set || operation->lengths_set || if( operation->nonce_set || operation->ad_started ||
operation->ad_started || operation->body_started ) operation->body_started )
{ {
status = PSA_ERROR_BAD_STATE; status = PSA_ERROR_BAD_STATE;
goto exit; goto exit;
@ -3845,7 +3845,7 @@ psa_status_t psa_aead_verify( psa_aead_operation_t *operation,
if( operation->lengths_set && (operation->ad_remaining != 0 || if( operation->lengths_set && (operation->ad_remaining != 0 ||
operation->body_remaining != 0 ) ) operation->body_remaining != 0 ) )
{ {
status = PSA_ERROR_BAD_STATE; status = PSA_ERROR_INVALID_ARGUMENT;
goto exit; goto exit;
} }