Crypto: Align PSA headers entirely to Mbed TLS 3.6.0
This also simplifies the client attributes translation between
client view and service view and reorganized how the Mbed TLS
config files are handled between NS/S (client/service) sides.
At the same time, perform a CMake targets refactoring to allow
exporting a client side view of the config files.
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: I9a715f9ef40fc223992575ecbac5cf23d162a326
diff --git a/interface/src/tfm_crypto_api.c b/interface/src/tfm_crypto_api.c
index d7e693e..65eae46 100644
--- a/interface/src/tfm_crypto_api.c
+++ b/interface/src/tfm_crypto_api.c
@@ -5,8 +5,11 @@
*
*/
+#include <stdlib.h>
+#include <string.h>
+
#include "tfm_crypto_defs.h"
-#include "psa/crypto.h"
+
#include "psa/client.h"
#include "psa_manifest/sid.h"
@@ -140,22 +143,6 @@
return API_DISPATCH(in_vec, out_vec);
}
-TFM_CRYPTO_API(void, psa_reset_key_attributes)(psa_key_attributes_t *attributes)
-{
- struct tfm_crypto_pack_iovec iov = {
- .function_id = TFM_CRYPTO_RESET_KEY_ATTRIBUTES_SID,
- };
- psa_invec in_vec[] = {
- {.base = &iov, .len = sizeof(struct tfm_crypto_pack_iovec)},
- };
- psa_outvec out_vec[] = {
- {.base = attributes, .len = sizeof(psa_key_attributes_t)},
- };
-
- (void)API_DISPATCH(in_vec, out_vec);
- return;
-}
-
TFM_CRYPTO_API(psa_status_t, psa_export_key)(psa_key_id_t key,
uint8_t *data,
size_t data_size,
@@ -1692,3 +1679,14 @@
/* To be implemented when the PSA backend supports it */
return PSA_ERROR_NOT_SUPPORTED;
}
+
+/* The implementation of the following helper function is marked
+ * weak to allow for those integrations where this is directly
+ * provided by the psa_crypto_client.c module of Mbed TLS
+ */
+__attribute__((weak))
+TFM_CRYPTO_API(void, psa_reset_key_attributes)(
+ psa_key_attributes_t *attributes)
+{
+ memset(attributes, 0, sizeof(*attributes));
+}