Fix up LTC macro inclusions: don't pull in tab files or algorithms unless we're actua...
authorMarc Cannon <vyhdycokio@gmail.com>
Thu, 24 Jan 2013 11:35:24 +0000 (06:35 -0500)
committerPat Mac <itgpmc@gmail.com>
Thu, 7 Feb 2013 09:36:19 +0000 (01:36 -0800)
src/libtomcrypt/src/ciphers/aes/aes_tab.c
src/libtomcrypt/src/ciphers/safer/safer_tab.c
src/libtomcrypt/src/ciphers/twofish/twofish_tab.c
src/libtomcrypt/src/hashes/sha2/sha224.c
src/libtomcrypt/src/hashes/sha2/sha384.c
src/libtomcrypt/src/hashes/whirl/whirltab.c
src/libtomcrypt/src/prngs/sober128tab.c

index ca7008d..9057af5 100644 (file)
@@ -23,6 +23,9 @@ Td3[x] = Si[x].[09, 0d, 0b, 0e];
 Td4[x] = Si[x].[01, 01, 01, 01];
 */
 
+#ifdef LTC_RIJNDAEL
+#include "tomcrypt_macros.h"
+
 /**
   @file aes_tab.c
   AES tables
@@ -1023,6 +1026,8 @@ static const ulong32 rcon[] = {
     0x1B000000UL, 0x36000000UL, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
 };
 
+#endif /* LTC_RIJNDAEL */
+
 /* $Source$ */
 /* $Revision$ */
 /* $Date$ */
index 9a515ff..6ed6ff6 100644 (file)
@@ -14,9 +14,9 @@
   Tables for LTC_SAFER block ciphers
 */ 
  
-#include "tomcrypt.h"
 
 #if defined(LTC_SAFERP) || defined(LTC_SAFER)
+#include "tomcrypt.h"
 
 /* This is the box defined by ebox[x] = 45^x mod 257.  
  * Its assumed that the value "256" corresponds to zero. */
index ea3eb21..cba52dd 100644 (file)
@@ -14,6 +14,7 @@
     Twofish tables, Tom St Denis
  */
 #ifdef LTC_TWOFISH_TABLES
+#include "tomcrypt_macros.h"
 
 /* pre generated 8x8 tables from the four 4x4s */
 static const unsigned char SBOX[2][256] = {
index 5d7dfb2..655e203 100644 (file)
@@ -8,6 +8,10 @@
  *
  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
  */
+#include "tomcrypt.h"
+
+#ifdef LTC_SHA224
+
 /**
    @param sha224.c
    LTC_SHA-224 new NIST standard based off of LTC_SHA-256 truncated to 224 bits (Tom St Denis)
@@ -119,6 +123,7 @@ int  sha224_test(void)
  #endif
 }
 
+#endif /* LTC_SHA224 */
 
 /* $Source$ */
 /* $Revision$ */
index cf4d7dc..2a67df6 100644 (file)
@@ -8,6 +8,10 @@
  *
  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
  */
+#include "tomcrypt.h"
+
+#ifdef LTC_SHA384
+
 /** 
    @param sha384.c
    LTC_SHA384 hash included in sha512.c, Tom St Denis
@@ -125,10 +129,7 @@ int  sha384_test(void)
  #endif
 }
 
-
-
-
-
+#endif /* LTC_SHA384 */
 
 /* $Source$ */
 /* $Revision$ */
index 85ba312..a99778e 100644 (file)
@@ -2,6 +2,10 @@
    @file whirltab.c
    LTC_WHIRLPOOL tables, Tom St Denis
 */   
+
+#if defined(LTC_WHIRLPOOL) || 1
+#include "tomcrypt_macros.h"
+
 static const ulong64 sbox0[] = {
 CONST64(0x18186018c07830d8), CONST64(0x23238c2305af4626), CONST64(0xc6c63fc67ef991b8), CONST64(0xe8e887e8136fcdfb), 
 CONST64(0x878726874ca113cb), CONST64(0xb8b8dab8a9626d11), CONST64(0x0101040108050209), CONST64(0x4f4f214f426e9e0d), 
@@ -577,6 +581,7 @@ CONST64(0xca2dbf07ad5a8333),
 CONST64(0x6302aa71c81949d9),
 };
 
+#endif /* LTC_WHIRLPOOL */
 
 /* $Source$ */
 /* $Revision$ */
index a5754c7..a446266 100644 (file)
@@ -5,6 +5,10 @@
 /* $ID$ */
 /* @(#)TuringMultab.h   1.3 (QUALCOMM) 02/09/03 */
 /* Multiplication table for Turing using 0xD02B4367 */
+
+#ifdef LTC_SOBER128
+#include "tomcrypt_macros.h"
+
 static const ulong32 Multab[256] = {
     0x00000000, 0xD02B4367, 0xED5686CE, 0x3D7DC5A9,
     0x97AC41D1, 0x478702B6, 0x7AFAC71F, 0xAAD18478,
@@ -157,6 +161,8 @@ static const ulong32 Sbox[256] = {
     0xf9e6053f, 0xa4b0d300, 0xd499cbcc, 0xb95e3d40,
 };
 
+#endif /* LTC_SOBER128 */
+
 /* $Source$ */
 /* $Revision$ */
 /* $Date$ */