From 40ef3a945490550a5abaaad546ca4c88bde592fb Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Tue, 25 May 2021 15:48:09 +0100 Subject: [PATCH] Fix state logic and return codes Signed-off-by: Paul Elliott --- library/psa_crypto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 39a6b7257..e82412346 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -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; }