Crypto: Modularise the interaction with crypto primitives
This patch creates an engine layer inside the service to
modularise all the operations that involve cryptography
primitives.
It also updates the service documentation, fixes some minor
issues in the NS crypto interface test suite, and updates the
manifest file for the crypto service removing outdated functions.
Change-Id: Id2d0e2140741debd22c145f816a4df2ab0351b58
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
diff --git a/secure_fw/services/crypto/crypto_key.c b/secure_fw/services/crypto/crypto_key.c
index a6769d4..d6b99c7 100644
--- a/secure_fw/services/crypto/crypto_key.c
+++ b/secure_fw/services/crypto/crypto_key.c
@@ -8,23 +8,10 @@
#include <limits.h>
#include "tfm_crypto_defs.h"
-
-/* Pre include Mbed TLS headers */
-#define LIB_PREFIX_NAME __tfm_crypto__
-#include "mbedtls_global_symbols.h"
-
-/* Include the Mbed TLS configuration file, the way Mbed TLS does it
- * in each of its header files.
- */
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "platform/ext/common/tfm_mbedtls_config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
#include "psa_crypto.h"
#include "tfm_crypto_struct.h"
+#include "secure_fw/core/secure_utilities.h"
/**
* \brief This value defines the maximum number of simultaneous key stores
@@ -47,6 +34,13 @@
*/
/*!@{*/
+enum tfm_crypto_err_t tfm_crypto_init_key(void)
+{
+ /* Clear the contents of the local key_storage */
+ tfm_memset(key_storage, 0, sizeof(key_storage));
+ return TFM_CRYPTO_ERR_PSA_SUCCESS;
+}
+
enum tfm_crypto_err_t tfm_crypto_import_key(psa_key_slot_t key,
psa_key_type_t type,
const uint8_t *data,