aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJens Wiklander <jens.wiklander@linaro.org>2019-03-28 10:14:32 +0100
committerJérôme Forissier <jerome.forissier@linaro.org>2019-03-28 14:11:23 +0100
commitc7e27e8340c4ce03dad5a92ac7716d147e584715 (patch)
treec0711f41ddcc2f1f126906ce5f29d1440eb89e94 /core
parenta1cbb728630308fcf902a8953a32cc972d14757e (diff)
core: tomcrypt.c: conditionally init for aciphers
Adds #if defined(_CFG_CORE_LTC_ACIPHER) around code only needed if LTC is configured for asymmetric ciphers (RSA, DSA, DH or ECC). Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core')
-rw-r--r--core/lib/libtomcrypt/tomcrypt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/lib/libtomcrypt/tomcrypt.c b/core/lib/libtomcrypt/tomcrypt.c
index 52e26155..42240617 100644
--- a/core/lib/libtomcrypt/tomcrypt.c
+++ b/core/lib/libtomcrypt/tomcrypt.c
@@ -15,6 +15,7 @@
#include <kernel/thread.h>
#endif
+#if defined(_CFG_CORE_LTC_ACIPHER)
/* Random generator */
static int prng_crypto_start(union Prng_state *prng __unused)
{
@@ -79,6 +80,7 @@ static const struct ltc_prng_descriptor prng_crypto_desc = {
.pimport = &prng_crypto_import,
.test = &prng_crypto_test,
};
+#endif /*_CFG_CORE_LTC_ACIPHER*/
/*
* tee_ltc_reg_algs(): Registers
@@ -114,12 +116,16 @@ static void tee_ltc_reg_algs(void)
#if defined(_CFG_CORE_LTC_SHA512) || defined(_CFG_CORE_LTC_SHA512_DESC)
register_hash(&sha512_desc);
#endif
+#if defined(_CFG_CORE_LTC_ACIPHER)
register_prng(&prng_crypto_desc);
+#endif
}
TEE_Result crypto_init(void)
{
+#if defined(_CFG_CORE_LTC_ACIPHER)
init_mp_tomcrypt();
+#endif
tee_ltc_reg_algs();
return TEE_SUCCESS;