Return CORRUPTION_DETECTED instead of BAD_SLOT when the slot's state is wrong
These error codes are only returned if the program has been tampered with,
so they should be CORRUPTION_DETECTED.
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
diff --git a/include/psa/crypto.h b/include/psa/crypto.h
index fd1928a..fe10ee0 100644
--- a/include/psa/crypto.h
+++ b/include/psa/crypto.h
@@ -415,9 +415,7 @@
* \retval #PSA_ERROR_BAD_STATE
* The library has not been previously initialized by psa_crypto_init().
* It is implementation-dependent whether a failure to initialize
- * results in this error code. Or,
- * this call was operating on a key slot and found the slot in
- * an invalid state for the operation.
+ * results in this error code.
*/
psa_status_t psa_purge_key(mbedtls_svc_key_id_t key);
@@ -557,9 +555,7 @@
* \retval #PSA_ERROR_BAD_STATE
* The library has not been previously initialized by psa_crypto_init().
* It is implementation-dependent whether a failure to initialize
- * results in this error code. Or,
- * this call was operating on a key slot and found the slot in
- * an invalid state for the operation.
+ * results in this error code.
*/
psa_status_t psa_destroy_key(mbedtls_svc_key_id_t key);
diff --git a/include/psa/crypto_compat.h b/include/psa/crypto_compat.h
index bfc0016..f896fae 100644
--- a/include/psa/crypto_compat.h
+++ b/include/psa/crypto_compat.h
@@ -142,9 +142,7 @@
* \retval #PSA_ERROR_BAD_STATE
* The library has not been previously initialized by psa_crypto_init().
* It is implementation-dependent whether a failure to initialize
- * results in this error code. Or,
- * this call was operating on a key slot and found the slot in
- * an invalid state for the operation.
+ * results in this error code.
*/
psa_status_t psa_close_key(psa_key_handle_t handle);