aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Wiklander <jens.wiklander@linaro.org>2019-03-27 17:01:37 +0100
committerJérôme Forissier <jerome.forissier@linaro.org>2019-03-28 14:11:23 +0100
commita70f4504e3fa19452f19948e6fe6e139f74c31a4 (patch)
treedef931b1893a54a8ae72d77a6ff97ae0f4359e92
parentc7e27e8340c4ce03dad5a92ac7716d147e584715 (diff)
core: ltc: add tomcrypt_init() when not crypto lib
Adds tomcrypt_init() which is only available when LTC isn't configured as the crypto lib. tomcrypt_init() performs the same initialization as crypto_init() does when LTC is configured as the crypto lib. Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r--core/lib/libtomcrypt/include/tomcrypt_init.h11
-rw-r--r--core/lib/libtomcrypt/tomcrypt.c15
2 files changed, 25 insertions, 1 deletions
diff --git a/core/lib/libtomcrypt/include/tomcrypt_init.h b/core/lib/libtomcrypt/include/tomcrypt_init.h
new file mode 100644
index 00000000..ca123228
--- /dev/null
+++ b/core/lib/libtomcrypt/include/tomcrypt_init.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (c) 2015, Linaro Limited
+ */
+
+#ifndef __TOMCRYPT_INIT_H
+#define __TOMCRYPT_INIT_H
+
+void tomcrypt_init(void);
+
+#endif /*__TOMCRYPT_INIT_H*/
diff --git a/core/lib/libtomcrypt/tomcrypt.c b/core/lib/libtomcrypt/tomcrypt.c
index 42240617..09c0d86e 100644
--- a/core/lib/libtomcrypt/tomcrypt.c
+++ b/core/lib/libtomcrypt/tomcrypt.c
@@ -7,6 +7,7 @@
#include <tee_api_types.h>
#include <tee_api_defines.h>
#include <tomcrypt.h>
+#include <tomcrypt_init.h>
#include "tomcrypt_mp.h"
#include <trace.h>
@@ -121,15 +122,27 @@ static void tee_ltc_reg_algs(void)
#endif
}
-TEE_Result crypto_init(void)
+static void ltc_init(void)
{
#if defined(_CFG_CORE_LTC_ACIPHER)
init_mp_tomcrypt();
#endif
tee_ltc_reg_algs();
+}
+
+#if defined(CFG_CRYPTOLIB_NAME_tomcrypt)
+TEE_Result crypto_init(void)
+{
+ ltc_init();
return TEE_SUCCESS;
}
+#else
+void tomcrypt_init(void)
+{
+ ltc_init();
+}
+#endif
#if defined(CFG_WITH_VFP)
void tomcrypt_arm_neon_enable(struct tomcrypt_arm_neon_state *state)