From 3b7c6512ac77dd13f53be0905ea972de4ffd5a54 Mon Sep 17 00:00:00 2001 From: mudzot Date: Sun, 17 Nov 2013 09:53:14 +0700 Subject: [PATCH] Add #ifdef to make it easier to embed libtomcrypt with LTC_NOTHING Restore LTC_NO_MATH and make rand_prime.c depend on LTC_NO_MATH & LTC_NO_PRNGS --- src/headers/tomcrypt_custom.h | 5 +++++ src/math/rand_prime.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/headers/tomcrypt_custom.h b/src/headers/tomcrypt_custom.h index b87700a..e34beb1 100644 --- a/src/headers/tomcrypt_custom.h +++ b/src/headers/tomcrypt_custom.h @@ -68,6 +68,7 @@ /* shortcut to disable automatic inclusion */ #if defined LTC_NOTHING && !defined LTC_EASY + #define LTC_NO_MATH #define LTC_NO_CIPHERS #define LTC_NO_MODES #define LTC_NO_HASHES @@ -143,12 +144,16 @@ /* #define LTC_NO_BSWAP */ /* ---> math provider? <--- */ +#ifndef LTC_NO_MATH + /* LibTomMath */ /* #define LTM_DESC */ /* TomsFastMath */ /* #define TFM_DESC */ +#endif /* LTC_NO_MATH */ + /* GNU Multiple Precision Arithmetic Library */ /* #define GMP_DESC */ diff --git a/src/math/rand_prime.c b/src/math/rand_prime.c index f228429..30a03d6 100644 --- a/src/math/rand_prime.c +++ b/src/math/rand_prime.c @@ -10,6 +10,8 @@ */ #include "tomcrypt.h" +#if !defined LTC_NO_MATH && !defined LTC_NO_PRNGS + /** @file rand_prime.c Generate a random prime, Tom St Denis @@ -80,6 +82,7 @@ int rand_prime(void *N, long len, prng_state *prng, int wprng) return CRYPT_OK; } +#endif /* LTC_NO_MATH */ /* $Source$ */