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>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 7a7238c..c1071b0 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -3780,7 +3780,7 @@
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 @@
goto exit;
}
- if( !operation->nonce_set )
+ if( !operation->nonce_set || operation->is_encrypt == 1 )
{
status = PSA_ERROR_BAD_STATE;
goto exit;