Fix multi-part termination on error
For multi-part operations, the PSA Crypto API specifies that if
the final operation does not return PSA_SUCCESS, the abort
operaion must be called by a client to clean-up the operation.
This change modifies the behaviour of the crypto provider
to only clear its operation context on success. This leaves
the operation context allocated, ensuring that the correct
PSA API status is returned when a client makes the mandatory
call to abort the failed operation. If the client never calls
abort, the context will eventually get recycled.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I9a6e2f2b96febec2e1b1b91c5d4f5189b1b24f8f
diff --git a/components/service/crypto/client/psa/psa_cipher.c b/components/service/crypto/client/psa/psa_cipher.c
index 24a8c28..d6e6540 100644
--- a/components/service/crypto/client/psa/psa_cipher.c
+++ b/components/service/crypto/client/psa/psa_cipher.c
@@ -149,6 +149,10 @@
*output_length = bytes_output + finish_output_len;
}
+ else {
+
+ psa_cipher_abort(operation);
+ }
}
else {