diff --git a/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c b/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c index 27306537e04..c8a55717897 100644 --- a/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c +++ b/components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c @@ -129,7 +129,7 @@ psa_status_t psa_mac_update(psa_mac_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err = psa_call(operation->handle, in_vec, 2, NULL, 0); @@ -153,7 +153,7 @@ psa_status_t psa_mac_sign_finish(psa_mac_operation_t *operation, psa_outvec out_vec[2] = { { mac, mac_size }, { mac_length, sizeof(*mac_length) } }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err_call = psa_call(operation->handle, in_vec, 2, out_vec, 2); @@ -178,7 +178,7 @@ psa_status_t psa_mac_verify_finish(psa_mac_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err_call = psa_call(operation->handle, in_vec, 3, NULL, 0); @@ -248,7 +248,7 @@ psa_status_t psa_hash_update(psa_hash_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err = psa_call(operation->handle, in_vec, 2, NULL, 0); @@ -274,7 +274,7 @@ psa_status_t psa_hash_finish(psa_hash_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err_call = psa_call(operation->handle, in_vec, 2, out_vec, 2); @@ -299,7 +299,7 @@ psa_status_t psa_hash_verify(psa_hash_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err_call = psa_call(operation->handle, in_vec, 3, NULL, 0); @@ -1103,7 +1103,7 @@ psa_status_t psa_get_generator_capacity(const psa_crypto_generator_t *generator, psa_outvec out_vec = { capacity, sizeof(*capacity) }; if (generator->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err_call = psa_call(generator->handle, &in_vec, 1, &out_vec, 1); @@ -1122,7 +1122,7 @@ psa_status_t psa_generator_read(psa_crypto_generator_t *generator, psa_outvec out_vec = { output, output_length }; if (generator->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err_call = psa_call(generator->handle, &in_vec, 1, &out_vec, 1); @@ -1145,7 +1145,7 @@ psa_status_t psa_generator_import_key(psa_key_handle_t key_handle, }; if (generator->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err_call = psa_call(generator->handle, in_vec, 3, NULL, 0); @@ -1306,7 +1306,7 @@ psa_status_t psa_cipher_generate_iv(psa_cipher_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err = psa_call(operation->handle, &in_vec, 1, out_vec, 2); @@ -1332,7 +1332,7 @@ psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err = psa_call(operation->handle, in_vec, 2, NULL, 0); @@ -1370,7 +1370,7 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err = psa_call(operation->handle, in_vec, 2, out_vec, 2); @@ -1403,7 +1403,7 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation, }; if (operation->handle <= 0) { - return (PSA_ERROR_INVALID_ARGUMENT); + return (PSA_ERROR_BAD_STATE); } err_call = psa_call(operation->handle, &in_vec, 1, out_vec, 2);