Fix state logic and return codes
@@ -3555,8 +3555,8 @@ psa_status_t psa_aead_generate_nonce( psa_aead_operation_t *operation,
goto exit;
}
- if( operation->nonce_set || operation->lengths_set ||
- operation->ad_started || operation->body_started )
+ if( operation->nonce_set || operation->ad_started ||
+ operation->body_started )
{
status = PSA_ERROR_BAD_STATE;
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 ||
operation->body_remaining != 0 ) )
{
- status = PSA_ERROR_BAD_STATE;
+ status = PSA_ERROR_INVALID_ARGUMENT;
goto exit;
}
