mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Finish / Verify state checks
Ensure finish only called when encrypting and verify only called for decrypting, and add tests to ensure this. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
@ -3780,7 +3780,7 @@ psa_status_t psa_aead_finish( psa_aead_operation_t *operation,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if( !operation->nonce_set )
|
||||
if( !operation->nonce_set || operation->is_encrypt == 0 )
|
||||
{
|
||||
status = PSA_ERROR_BAD_STATE;
|
||||
goto exit;
|
||||
@ -3829,7 +3829,7 @@ psa_status_t psa_aead_verify( psa_aead_operation_t *operation,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if( !operation->nonce_set )
|
||||
if( !operation->nonce_set || operation->is_encrypt == 1 )
|
||||
{
|
||||
status = PSA_ERROR_BAD_STATE;
|
||||
goto exit;
|
||||
|
Reference in New Issue
Block a user