Crypto: Return correctly PSA_ERROR_INVALID_HANDLE
When the handle passed as input in a multipart operation is
invalid, make sure to return the PSA_ERROR_INVALID_HANDLE
error code.
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: I1cb70fc655d67b4aaf65fa8f5f47f0fd0a057e4c
diff --git a/secure_fw/partitions/crypto/crypto_alloc.c b/secure_fw/partitions/crypto/crypto_alloc.c
index be68be0..b0fa4dc 100644
--- a/secure_fw/partitions/crypto/crypto_alloc.c
+++ b/secure_fw/partitions/crypto/crypto_alloc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -106,7 +106,7 @@
/* Handle must be initialised before calling a setup function */
if (*handle != TFM_CRYPTO_INVALID_HANDLE) {
- return PSA_ERROR_BAD_STATE;
+ return PSA_ERROR_INVALID_HANDLE;
}
/* Init to invalid values */