Browse Source

`undef` Macros after usage & rename duplicate symbols

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 3 years ago
parent
commit
3cc754610d
52 changed files with 372 additions and 63 deletions
  1. 7 1
      src/ciphers/aes/aes.c
  2. 17 0
      src/ciphers/anubis.c
  3. 2 0
      src/ciphers/blowfish.c
  4. 2 0
      src/ciphers/camellia.c
  5. 4 0
      src/ciphers/cast5.c
  6. 3 0
      src/ciphers/des.c
  7. 8 0
      src/ciphers/idea.c
  8. 4 0
      src/ciphers/kasumi.c
  9. 2 0
      src/ciphers/khazad.c
  10. 3 0
      src/ciphers/kseed.c
  11. 7 0
      src/ciphers/noekeon.c
  12. 3 0
      src/ciphers/rc5.c
  13. 4 2
      src/ciphers/rc6.c
  14. 8 3
      src/ciphers/safer/safer.c
  15. 11 2
      src/ciphers/safer/saferp.c
  16. 42 0
      src/ciphers/serpent.c
  17. 5 0
      src/ciphers/skipjack.c
  18. 3 0
      src/ciphers/tea.c
  19. 11 0
      src/ciphers/twofish/twofish.c
  20. 4 0
      src/encauth/gcm/gcm_gf_mult.c
  21. 3 0
      src/encauth/ocb/ocb_init.c
  22. 3 0
      src/encauth/ocb3/ocb3_init.c
  23. 17 17
      src/hashes/blake2b.c
  24. 16 16
      src/hashes/blake2s.c
  25. 20 0
      src/hashes/md4.c
  26. 9 2
      src/hashes/md5.c
  27. 13 1
      src/hashes/rmd128.c
  28. 16 1
      src/hashes/rmd160.c
  29. 13 0
      src/hashes/rmd256.c
  30. 16 0
      src/hashes/rmd320.c
  31. 9 0
      src/hashes/sha1.c
  32. 9 0
      src/hashes/sha2/sha256.c
  33. 9 3
      src/hashes/sha2/sha512.c
  34. 5 0
      src/hashes/tiger.c
  35. 2 0
      src/hashes/whirl/whirl.c
  36. 2 0
      src/mac/pelican/pelican.c
  37. 3 0
      src/mac/pmac/pmac_init.c
  38. 3 0
      src/modes/cfb/cfb_decrypt.c
  39. 3 0
      src/modes/cfb/cfb_encrypt.c
  40. 7 1
      src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c
  41. 4 2
      src/pk/asn1/der/generalizedtime/der_encode_generalizedtime.c
  42. 2 1
      src/pk/asn1/der/set/der_encode_set.c
  43. 3 0
      src/pk/asn1/der/set/der_encode_setof.c
  44. 6 1
      src/pk/asn1/der/utctime/der_decode_utctime.c
  45. 3 2
      src/pk/asn1/der/utctime/der_encode_utctime.c
  46. 5 0
      src/pk/ec25519/tweetnacl.c
  47. 2 0
      src/stream/chacha/chacha_crypt.c
  48. 2 3
      src/stream/chacha/chacha_setup.c
  49. 2 0
      src/stream/salsa20/salsa20_crypt.c
  50. 2 3
      src/stream/salsa20/salsa20_setup.c
  51. 1 2
      src/stream/salsa20/xsalsa20_setup.c
  52. 12 0
      src/stream/sober128/sober128_stream.c

+ 7 - 1
src/ciphers/aes/aes.c

@@ -726,5 +726,11 @@ int ECB_KS(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-#endif
+#undef SETUP
+#undef ECB_ENC
+#undef ECB_DEC
+#undef ECB_DONE
+#undef ECB_TEST
+#undef ECB_KS
 
 
+#endif

+ 17 - 0
src/ciphers/anubis.c

@@ -26,6 +26,14 @@ const struct ltc_cipher_descriptor anubis_desc = {
 
 
 #define MAX_N           10
 #define MAX_N           10
 
 
+
+#define T0 anubis_T0
+#define T1 anubis_T1
+#define T2 anubis_T2
+#define T3 anubis_T3
+#define T4 anubis_T4
+#define T5 anubis_T5
+#define rc anubis_rc
 /*
 /*
  * Though Anubis is endianness-neutral, the encryption tables are listed
  * Though Anubis is endianness-neutral, the encryption tables are listed
  * in BIG-ENDIAN format, which is adopted throughout this implementation
  * in BIG-ENDIAN format, which is adopted throughout this implementation
@@ -1546,5 +1554,14 @@ int anubis_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef MAX_N
+#undef T0
+#undef T1
+#undef T2
+#undef T3
+#undef T4
+#undef T5
+#undef rc
+
 #endif
 #endif
 
 

+ 2 - 0
src/ciphers/blowfish.c

@@ -654,5 +654,7 @@ int blowfish_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef F
+
 #endif
 #endif
 
 

+ 2 - 0
src/ciphers/camellia.c

@@ -717,4 +717,6 @@ int camellia_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef loc
+
 #endif
 #endif

+ 4 - 0
src/ciphers/cast5.c

@@ -491,6 +491,7 @@ int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_
 }
 }
 #endif
 #endif
 
 
+#define FI cast5_FI
 LTC_INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
 LTC_INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
 {
 {
    ulong32 I;
    ulong32 I;
@@ -702,4 +703,7 @@ int cast5_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef GB
+#undef FI
+
 #endif
 #endif

+ 3 - 0
src/ciphers/des.c

@@ -2238,5 +2238,8 @@ int des3_keysize(int *keysize)
     return CRYPT_OK;
     return CRYPT_OK;
 }
 }
 
 
+#undef EN0
+#undef DE1
+
 #endif
 #endif
 
 

+ 8 - 0
src/ciphers/idea.c

@@ -66,6 +66,7 @@ static ushort16 s_add_inv(ushort16 x)
    return LOW16(0 - x);
    return LOW16(0 - x);
 }
 }
 
 
+#define s_setup_key s_idea_setup_key
 static int s_setup_key(const unsigned char *key, symmetric_key *skey)
 static int s_setup_key(const unsigned char *key, symmetric_key *skey)
 {
 {
    int i, j;
    int i, j;
@@ -247,4 +248,11 @@ int idea_test(void)
 #endif
 #endif
 }
 }
 
 
+#undef LOW16
+#undef HIGH16
+#undef MUL
+#undef STORE16
+#undef LOAD16
+#undef s_setup_key
+
 #endif
 #endif

+ 4 - 0
src/ciphers/kasumi.c

@@ -28,6 +28,7 @@ const struct ltc_cipher_descriptor kasumi_desc = {
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
 };
 
 
+#define FI kasumi_FI
 static u16 FI( u16 in, u16 subkey )
 static u16 FI( u16 in, u16 subkey )
 {
 {
    u16 nine, seven;
    u16 nine, seven;
@@ -304,4 +305,7 @@ int kasumi_test(void)
 #endif
 #endif
 }
 }
 
 
+#undef ROL16
+#undef FI
+
 #endif
 #endif

+ 2 - 0
src/ciphers/khazad.c

@@ -837,4 +837,6 @@ int khazad_keysize(int *keysize)
    return CRYPT_INVALID_KEYSIZE;
    return CRYPT_INVALID_KEYSIZE;
 }
 }
 
 
+#undef R
+
 #endif
 #endif

+ 3 - 0
src/ciphers/kseed.c

@@ -363,4 +363,7 @@ int kseed_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef G
+#undef F
+
 #endif
 #endif

+ 7 - 0
src/ciphers/noekeon.c

@@ -313,5 +313,12 @@ int noekeon_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef kTHETA
+#undef THETA
+#undef GAMMA
+#undef PI1
+#undef PI2
+#undef ROUND
+
 #endif
 #endif
 
 

+ 3 - 0
src/ciphers/rc5.c

@@ -24,6 +24,7 @@ const struct ltc_cipher_descriptor rc5_desc =
     NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
     NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
 };
 
 
+#define stab rc5_stab
 static const ulong32 stab[50] = {
 static const ulong32 stab[50] = {
 0xb7e15163UL, 0x5618cb1cUL, 0xf45044d5UL, 0x9287be8eUL, 0x30bf3847UL, 0xcef6b200UL, 0x6d2e2bb9UL, 0x0b65a572UL,
 0xb7e15163UL, 0x5618cb1cUL, 0xf45044d5UL, 0x9287be8eUL, 0x30bf3847UL, 0xcef6b200UL, 0x6d2e2bb9UL, 0x0b65a572UL,
 0xa99d1f2bUL, 0x47d498e4UL, 0xe60c129dUL, 0x84438c56UL, 0x227b060fUL, 0xc0b27fc8UL, 0x5ee9f981UL, 0xfd21733aUL,
 0xa99d1f2bUL, 0x47d498e4UL, 0xe60c129dUL, 0x84438c56UL, 0x227b060fUL, 0xc0b27fc8UL, 0x5ee9f981UL, 0xfd21733aUL,
@@ -317,6 +318,8 @@ int rc5_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef stab
+
 #endif
 #endif
 
 
 
 

+ 4 - 2
src/ciphers/rc6.c

@@ -23,6 +23,7 @@ const struct ltc_cipher_descriptor rc6_desc =
     NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
     NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
 };
 
 
+#define stab rc6_stab
 static const ulong32 stab[44] = {
 static const ulong32 stab[44] = {
 0xb7e15163UL, 0x5618cb1cUL, 0xf45044d5UL, 0x9287be8eUL, 0x30bf3847UL, 0xcef6b200UL, 0x6d2e2bb9UL, 0x0b65a572UL,
 0xb7e15163UL, 0x5618cb1cUL, 0xf45044d5UL, 0x9287be8eUL, 0x30bf3847UL, 0xcef6b200UL, 0x6d2e2bb9UL, 0x0b65a572UL,
 0xa99d1f2bUL, 0x47d498e4UL, 0xe60c129dUL, 0x84438c56UL, 0x227b060fUL, 0xc0b27fc8UL, 0x5ee9f981UL, 0xfd21733aUL,
 0xa99d1f2bUL, 0x47d498e4UL, 0xe60c129dUL, 0x84438c56UL, 0x227b060fUL, 0xc0b27fc8UL, 0x5ee9f981UL, 0xfd21733aUL,
@@ -319,6 +320,7 @@ int rc6_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-#endif /*LTC_RC6*/
-
+#undef RND
+#undef stab
 
 
+#endif /*LTC_RC6*/

+ 8 - 3
src/ciphers/safer/safer.c

@@ -24,8 +24,10 @@
 
 
 #ifdef LTC_SAFER
 #ifdef LTC_SAFER
 
 
+#ifndef LTC_SAFER_TAB_C
 #define LTC_SAFER_TAB_C
 #define LTC_SAFER_TAB_C
 #include "safer_tab.c"
 #include "safer_tab.c"
+#endif
 
 
 const struct ltc_cipher_descriptor safer_k64_desc = {
 const struct ltc_cipher_descriptor safer_k64_desc = {
    "safer-k64",
    "safer-k64",
@@ -478,7 +480,10 @@ int safer_sk128_test(void)
  #endif
  #endif
 }
 }
 
 
-#endif
-
-
+#undef ROL8
+#undef EXP
+#undef LOG
+#undef PHT
+#undef IPHT
 
 
+#endif

+ 11 - 2
src/ciphers/safer/saferp.c

@@ -9,8 +9,10 @@
 
 
 #ifdef LTC_SAFERP
 #ifdef LTC_SAFERP
 
 
+#ifndef LTC_SAFER_TAB_C
 #define LTC_SAFER_TAB_C
 #define LTC_SAFER_TAB_C
 #include "safer_tab.c"
 #include "safer_tab.c"
+#endif
 
 
 const struct ltc_cipher_descriptor saferp_desc =
 const struct ltc_cipher_descriptor saferp_desc =
 {
 {
@@ -562,6 +564,13 @@ int saferp_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-#endif
-
+#undef ROUND
+#undef iROUND
+#undef PHT
+#undef iPHT
+#undef SHUF
+#undef iSHUF
+#undef LT
+#undef iLT
 
 
+#endif

+ 42 - 0
src/ciphers/serpent.c

@@ -443,6 +443,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    k[(8-r)*4 + 7] = d;  \
    k[(8-r)*4 + 7] = d;  \
 }
 }
 
 
+#define s_setup_key s_serpent_setup_key
 static int s_setup_key(const unsigned char *key, int keylen, int rounds, ulong32 *k)
 static int s_setup_key(const unsigned char *key, int keylen, int rounds, ulong32 *k)
 {
 {
    int i;
    int i;
@@ -714,4 +715,45 @@ int serpent_test(void)
 #endif
 #endif
 }
 }
 
 
+#undef s_lt
+#undef s_ilt
+#undef s_beforeS0
+#undef s_afterS0
+#undef s_afterS1
+#undef s_afterS2
+#undef s_afterS3
+#undef s_afterS4
+#undef s_afterS5
+#undef s_afterS6
+#undef s_afterS7
+#undef s_beforeI7
+#undef s_afterI7
+#undef s_afterI6
+#undef s_afterI5
+#undef s_afterI4
+#undef s_afterI3
+#undef s_afterI2
+#undef s_afterI1
+#undef s_afterI0
+#undef s_s0
+#undef s_i0
+#undef s_s1
+#undef s_i1
+#undef s_s2
+#undef s_i2
+#undef s_s3
+#undef s_i3
+#undef s_s4
+#undef s_i4
+#undef s_s5
+#undef s_i5
+#undef s_s6
+#undef s_i6
+#undef s_s7
+#undef s_i7
+#undef s_kx
+#undef s_lk
+#undef s_sk
+#undef s_setup_key
+
 #endif
 #endif

+ 5 - 0
src/ciphers/skipjack.c

@@ -331,4 +331,9 @@ int skipjack_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef RULE_A
+#undef RULE_B
+#undef RULE_A1
+#undef RULE_B1
+
 #endif
 #endif

+ 3 - 0
src/ciphers/tea.c

@@ -205,5 +205,8 @@ int tea_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef DELTA
+#undef SUM
+
 #endif
 #endif
 
 

+ 11 - 0
src/ciphers/twofish/twofish.c

@@ -702,5 +702,16 @@ int twofish_keysize(int *keysize)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef MDS_POLY
+#undef RS_POLY
+#undef sbox
+#undef mds_column_mult
+#undef S1
+#undef S2
+#undef S3
+#undef S4
+#undef g_func
+#undef g1_func
+
 #endif
 #endif
 
 

+ 4 - 0
src/encauth/gcm/gcm_gf_mult.c

@@ -203,6 +203,10 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
 
 
 }
 }
 
 
+#undef M
+#undef BPD
+#undef WPV
+
 #endif
 #endif
 
 
 #endif
 #endif

+ 3 - 0
src/encauth/ocb/ocb_init.c

@@ -9,6 +9,7 @@
 
 
 #ifdef LTC_OCB_MODE
 #ifdef LTC_OCB_MODE
 
 
+#define polys ocb_polys
 static const struct {
 static const struct {
     int           len;
     int           len;
     unsigned char poly_div[MAXBLOCKSIZE],
     unsigned char poly_div[MAXBLOCKSIZE],
@@ -126,4 +127,6 @@ int ocb_init(ocb_state *ocb, int cipher,
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef polys
+
 #endif
 #endif

+ 3 - 0
src/encauth/ocb3/ocb3_init.c

@@ -54,6 +54,7 @@ static void s_ocb3_int_calc_offset_zero(ocb3_state *ocb, const unsigned char *no
    }
    }
 }
 }
 
 
+#define polys ocb3_polys
 static const struct {
 static const struct {
     int           len;
     int           len;
     unsigned char poly_mul[MAXBLOCKSIZE];
     unsigned char poly_mul[MAXBLOCKSIZE];
@@ -183,4 +184,6 @@ int ocb3_init(ocb3_state *ocb, int cipher,
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef polys
+
 #endif
 #endif

+ 17 - 17
src/hashes/blake2b.c

@@ -32,18 +32,18 @@ enum blake2b_constant {
 
 
 /* param offsets */
 /* param offsets */
 enum {
 enum {
-   O_DIGEST_LENGTH = 0,
-   O_KEY_LENGTH = 1,
-   O_FANOUT = 2,
-   O_DEPTH = 3,
-   O_LEAF_LENGTH = 4,
-   O_NODE_OFFSET = 8,
-   O_XOF_LENGTH = 12,
-   O_NODE_DEPTH = 16,
-   O_INNER_LENGTH = 17,
-   O_RESERVED = 18,
-   O_SALT = 32,
-   O_PERSONAL = 48
+   BLAKE2B_O_DIGEST_LENGTH = 0,
+   BLAKE2B_O_KEY_LENGTH = 1,
+   BLAKE2B_O_FANOUT = 2,
+   BLAKE2B_O_DEPTH = 3,
+   BLAKE2B_O_LEAF_LENGTH = 4,
+   BLAKE2B_O_NODE_OFFSET = 8,
+   BLAKE2B_O_XOF_LENGTH = 12,
+   BLAKE2B_O_NODE_DEPTH = 16,
+   BLAKE2B_O_INNER_LENGTH = 17,
+   BLAKE2B_O_RESERVED = 18,
+   BLAKE2B_O_SALT = 32,
+   BLAKE2B_O_PERSONAL = 48
 };
 };
 
 
 /*
 /*
@@ -190,7 +190,7 @@ static int s_blake2b_init_param(hash_state *md, const unsigned char *P)
       md->blake2b.h[i] ^= tmp;
       md->blake2b.h[i] ^= tmp;
    }
    }
 
 
-   md->blake2b.outlen = P[O_DIGEST_LENGTH];
+   md->blake2b.outlen = P[BLAKE2B_O_DIGEST_LENGTH];
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
@@ -223,10 +223,10 @@ int blake2b_init(hash_state *md, unsigned long outlen, const unsigned char *key,
 
 
    XMEMSET(P, 0, sizeof(P));
    XMEMSET(P, 0, sizeof(P));
 
 
-   P[O_DIGEST_LENGTH] = (unsigned char)outlen;
-   P[O_KEY_LENGTH] = (unsigned char)keylen;
-   P[O_FANOUT] = 1;
-   P[O_DEPTH] = 1;
+   P[BLAKE2B_O_DIGEST_LENGTH] = (unsigned char)outlen;
+   P[BLAKE2B_O_KEY_LENGTH] = (unsigned char)keylen;
+   P[BLAKE2B_O_FANOUT] = 1;
+   P[BLAKE2B_O_DEPTH] = 1;
 
 
    err = s_blake2b_init_param(md, P);
    err = s_blake2b_init_param(md, P);
    if (err != CRYPT_OK) return err;
    if (err != CRYPT_OK) return err;

+ 16 - 16
src/hashes/blake2s.c

@@ -32,17 +32,17 @@ enum blake2s_constant {
 
 
 /* param offsets */
 /* param offsets */
 enum {
 enum {
-   O_DIGEST_LENGTH = 0,
-   O_KEY_LENGTH = 1,
-   O_FANOUT = 2,
-   O_DEPTH = 3,
-   O_LEAF_LENGTH = 4,
-   O_NODE_OFFSET = 8,
-   O_XOF_LENGTH = 12,
-   O_NODE_DEPTH = 14,
-   O_INNER_LENGTH = 15,
-   O_SALT = 16,
-   O_PERSONAL = 24
+   BLAKE2S_O_DIGEST_LENGTH = 0,
+   BLAKE2S_O_KEY_LENGTH = 1,
+   BLAKE2S_O_FANOUT = 2,
+   BLAKE2S_O_DEPTH = 3,
+   BLAKE2S_O_LEAF_LENGTH = 4,
+   BLAKE2S_O_NODE_OFFSET = 8,
+   BLAKE2S_O_XOF_LENGTH = 12,
+   BLAKE2S_O_NODE_DEPTH = 14,
+   BLAKE2S_O_INNER_LENGTH = 15,
+   BLAKE2S_O_SALT = 16,
+   BLAKE2S_O_PERSONAL = 24
 };
 };
 
 
 /*
 /*
@@ -184,7 +184,7 @@ static int s_blake2s_init_param(hash_state *md, const unsigned char *P)
       md->blake2s.h[i] ^= tmp;
       md->blake2s.h[i] ^= tmp;
    }
    }
 
 
-   md->blake2s.outlen = P[O_DIGEST_LENGTH];
+   md->blake2s.outlen = P[BLAKE2S_O_DIGEST_LENGTH];
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
@@ -217,10 +217,10 @@ int blake2s_init(hash_state *md, unsigned long outlen, const unsigned char *key,
 
 
    XMEMSET(P, 0, sizeof(P));
    XMEMSET(P, 0, sizeof(P));
 
 
-   P[O_DIGEST_LENGTH] = (unsigned char)outlen;
-   P[O_KEY_LENGTH] = (unsigned char)keylen;
-   P[O_FANOUT] = 1;
-   P[O_DEPTH] = 1;
+   P[BLAKE2S_O_DIGEST_LENGTH] = (unsigned char)outlen;
+   P[BLAKE2S_O_KEY_LENGTH] = (unsigned char)keylen;
+   P[BLAKE2S_O_FANOUT] = 1;
+   P[BLAKE2S_O_DEPTH] = 1;
 
 
    err = s_blake2s_init_param(md, P);
    err = s_blake2s_init_param(md, P);
    if (err != CRYPT_OK) return err;
    if (err != CRYPT_OK) return err;

+ 20 - 0
src/hashes/md4.c

@@ -291,6 +291,26 @@ int md4_test(void)
   #endif
   #endif
 }
 }
 
 
+#undef F
+#undef G
+#undef H
+#undef FF
+#undef GG
+#undef HH
+#undef S11
+#undef S12
+#undef S13
+#undef S14
+#undef S21
+#undef S22
+#undef S23
+#undef S24
+#undef S31
+#undef S32
+#undef S33
+#undef S34
+#undef ROTATE_LEFT
+
 #endif
 #endif
 
 
 
 

+ 9 - 2
src/hashes/md5.c

@@ -351,6 +351,13 @@ int  md5_test(void)
  #endif
  #endif
 }
 }
 
 
-#endif
-
+#undef F
+#undef G
+#undef H
+#undef I
+#undef FF
+#undef GG
+#undef HH
+#undef II
 
 
+#endif

+ 13 - 1
src/hashes/rmd128.c

@@ -392,5 +392,17 @@ int rmd128_test(void)
 #endif
 #endif
 }
 }
 
 
-#endif
+#undef F
+#undef G
+#undef H
+#undef I
+#undef FF
+#undef GG
+#undef HH
+#undef II
+#undef FFF
+#undef GGG
+#undef HHH
+#undef III
 
 
+#endif

+ 16 - 1
src/hashes/rmd160.c

@@ -451,5 +451,20 @@ int rmd160_test(void)
 #endif
 #endif
 }
 }
 
 
-#endif
+#undef F
+#undef G
+#undef H
+#undef I
+#undef J
+#undef FF
+#undef GG
+#undef HH
+#undef II
+#undef JJ
+#undef FFF
+#undef GGG
+#undef HHH
+#undef III
+#undef JJJ
 
 
+#endif

+ 13 - 0
src/hashes/rmd256.c

@@ -417,4 +417,17 @@ int rmd256_test(void)
 #endif
 #endif
 }
 }
 
 
+#undef F
+#undef G
+#undef H
+#undef I
+#undef FF
+#undef GG
+#undef HH
+#undef II
+#undef FFF
+#undef GGG
+#undef HHH
+#undef III
+
 #endif
 #endif

+ 16 - 0
src/hashes/rmd320.c

@@ -482,4 +482,20 @@ int rmd320_test(void)
 #endif
 #endif
 }
 }
 
 
+#undef F
+#undef G
+#undef H
+#undef I
+#undef J
+#undef FF
+#undef GG
+#undef HH
+#undef II
+#undef JJ
+#undef FFF
+#undef GGG
+#undef HHH
+#undef III
+#undef JJJ
+
 #endif
 #endif

+ 9 - 0
src/hashes/sha1.c

@@ -271,6 +271,15 @@ int  sha1_test(void)
   #endif
   #endif
 }
 }
 
 
+#undef F0
+#undef F1
+#undef F2
+#undef F3
+#undef FF0
+#undef FF1
+#undef FF2
+#undef FF3
+
 #endif
 #endif
 
 
 
 

+ 9 - 0
src/hashes/sha2/sha256.c

@@ -317,6 +317,15 @@ int  sha256_test(void)
  #endif
  #endif
 }
 }
 
 
+#undef Ch
+#undef Maj
+#undef S
+#undef R
+#undef Sigma0
+#undef Sigma1
+#undef Gamma0
+#undef Gamma1
+
 #endif
 #endif
 
 
 
 

+ 9 - 3
src/hashes/sha2/sha512.c

@@ -297,7 +297,13 @@ int  sha512_test(void)
   #endif
   #endif
 }
 }
 
 
-#endif
-
-
+#undef Ch
+#undef Maj
+#undef S
+#undef R
+#undef Sigma0
+#undef Sigma1
+#undef Gamma0
+#undef Gamma1
 
 
+#endif

+ 5 - 0
src/hashes/tiger.c

@@ -888,6 +888,11 @@ int tiger2_test(void)
    return s_tiger_test(1);
    return s_tiger_test(1);
 }
 }
 
 
+#undef t1
+#undef t2
+#undef t3
+#undef t4
+
 #endif
 #endif
 
 
 /*
 /*

+ 2 - 0
src/hashes/whirl/whirl.c

@@ -291,6 +291,8 @@ int  whirlpool_test(void)
  #endif
  #endif
 }
 }
 
 
+#undef GB
+#undef theta_pi_gamma
 
 
 #endif
 #endif
 
 

+ 2 - 0
src/mac/pelican/pelican.c

@@ -9,10 +9,12 @@
 
 
 #ifdef LTC_PELICAN
 #ifdef LTC_PELICAN
 
 
+#ifndef LTC_AES_TAB_C
 #define LTC_AES_TAB_C
 #define LTC_AES_TAB_C
 #define ENCRYPT_ONLY
 #define ENCRYPT_ONLY
 #define PELI_TAB
 #define PELI_TAB
 #include "../../ciphers/aes/aes_tab.c"
 #include "../../ciphers/aes/aes_tab.c"
+#endif
 
 
 /**
 /**
    Initialize a Pelican state
    Initialize a Pelican state

+ 3 - 0
src/mac/pmac/pmac_init.c

@@ -9,6 +9,7 @@
 
 
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC
 
 
+#define polys pmac_polys
 static const struct {
 static const struct {
     int           len;
     int           len;
     unsigned char poly_div[MAXBLOCKSIZE],
     unsigned char poly_div[MAXBLOCKSIZE],
@@ -135,4 +136,6 @@ error:
    return err;
    return err;
 }
 }
 
 
+#undef polys
+
 #endif
 #endif

+ 3 - 0
src/modes/cfb/cfb_decrypt.c

@@ -9,6 +9,8 @@
 
 
 #ifdef LTC_CFB_MODE
 #ifdef LTC_CFB_MODE
 
 
+#ifndef LTC_CFB_SHIFT1LEFT
+#define LTC_CFB_SHIFT1LEFT
 static LTC_INLINE void s_shift1left_64(unsigned char *b, unsigned char v)
 static LTC_INLINE void s_shift1left_64(unsigned char *b, unsigned char v)
 {
 {
    ulong64 bval;
    ulong64 bval;
@@ -30,6 +32,7 @@ static LTC_INLINE void s_shift1left_128(unsigned char *b, unsigned char v)
    STORE64H(bval[0], b);
    STORE64H(bval[0], b);
    STORE64H(bval[1], b + 8);
    STORE64H(bval[1], b + 8);
 }
 }
+#endif /* LTC_CFB_SHIFT1LEFT */
 
 
 /**
 /**
    CFB decrypt
    CFB decrypt

+ 3 - 0
src/modes/cfb/cfb_encrypt.c

@@ -9,6 +9,8 @@
 
 
 #ifdef LTC_CFB_MODE
 #ifdef LTC_CFB_MODE
 
 
+#ifndef LTC_CFB_SHIFT1LEFT
+#define LTC_CFB_SHIFT1LEFT
 static LTC_INLINE void s_shift1left_64(unsigned char *b, unsigned char v)
 static LTC_INLINE void s_shift1left_64(unsigned char *b, unsigned char v)
 {
 {
    ulong64 bval;
    ulong64 bval;
@@ -30,6 +32,7 @@ static LTC_INLINE void s_shift1left_128(unsigned char *b, unsigned char v)
    STORE64H(bval[0], b);
    STORE64H(bval[0], b);
    STORE64H(bval[1], b + 8);
    STORE64H(bval[1], b + 8);
 }
 }
+#endif /* LTC_CFB_SHIFT1LEFT */
 
 
 /**
 /**
   CFB encrypt
   CFB encrypt

+ 7 - 1
src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c

@@ -10,7 +10,9 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 
 
-static int s_char_to_int(unsigned char x)
+#ifndef LTC_DER_CHAR_TO_INT
+#define LTC_DER_CHAR_TO_INT
+static LTC_INLINE int s_char_to_int(unsigned char x)
 {
 {
    switch (x)  {
    switch (x)  {
       case '0': return 0;
       case '0': return 0;
@@ -26,6 +28,7 @@ static int s_char_to_int(unsigned char x)
       default:  return 100;
       default:  return 100;
    }
    }
 }
 }
+#endif
 
 
 #define DECODE_V(y, max) do {\
 #define DECODE_V(y, max) do {\
    y  = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \
    y  = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \
@@ -132,4 +135,7 @@ YYYYMMDDhhmmss.fs-hh'mm'
     return CRYPT_INVALID_PACKET;
     return CRYPT_INVALID_PACKET;
 }
 }
 
 
+#undef DECODE_V
+#undef DECODE_V4
+
 #endif
 #endif

+ 4 - 2
src/pk/asn1/der/generalizedtime/der_encode_generalizedtime.c

@@ -10,8 +10,6 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 
 
-static const char * const baseten = "0123456789";
-
 #define STORE_V(y) do {\
 #define STORE_V(y) do {\
     out[x++] = der_ia5_char_encode(baseten[(y/10) % 10]); \
     out[x++] = der_ia5_char_encode(baseten[(y/10) % 10]); \
     out[x++] = der_ia5_char_encode(baseten[y % 10]); \
     out[x++] = der_ia5_char_encode(baseten[y % 10]); \
@@ -34,6 +32,7 @@ static const char * const baseten = "0123456789";
 int der_encode_generalizedtime(const ltc_generalizedtime *gtime,
 int der_encode_generalizedtime(const ltc_generalizedtime *gtime,
                                      unsigned char       *out, unsigned long *outlen)
                                      unsigned char       *out, unsigned long *outlen)
 {
 {
+    const char * const baseten = "0123456789";
     unsigned long x, tmplen;
     unsigned long x, tmplen;
     int           err;
     int           err;
 
 
@@ -95,4 +94,7 @@ int der_encode_generalizedtime(const ltc_generalizedtime *gtime,
     return CRYPT_OK;
     return CRYPT_OK;
 }
 }
 
 
+#undef STORE_V
+#undef STORE_V4
+
 #endif
 #endif

+ 2 - 1
src/pk/asn1/der/set/der_encode_set.c

@@ -15,7 +15,7 @@ static int s_ltc_to_asn1(ltc_asn1_type v)
    return der_asn1_type_to_identifier_map[v];
    return der_asn1_type_to_identifier_map[v];
 }
 }
 
 
-
+#define s_qsort_helper s_set_qsort_helper
 static int s_qsort_helper(const void *a, const void *b)
 static int s_qsort_helper(const void *a, const void *b)
 {
 {
    ltc_asn1_list *A = (ltc_asn1_list *)a, *B = (ltc_asn1_list *)b;
    ltc_asn1_list *A = (ltc_asn1_list *)a, *B = (ltc_asn1_list *)b;
@@ -70,5 +70,6 @@ int der_encode_set(const ltc_asn1_list *list, unsigned long inlen,
    return err;
    return err;
 }
 }
 
 
+#undef s_qsort_helper
 
 
 #endif
 #endif

+ 3 - 0
src/pk/asn1/der/set/der_encode_setof.c

@@ -14,6 +14,7 @@ struct edge {
    unsigned long  size;
    unsigned long  size;
 };
 };
 
 
+#define s_qsort_helper s_setof_qsort_helper
 static int s_qsort_helper(const void *a, const void *b)
 static int s_qsort_helper(const void *a, const void *b)
 {
 {
    struct edge   *A = (struct edge *)a, *B = (struct edge *)b;
    struct edge   *A = (struct edge *)a, *B = (struct edge *)b;
@@ -148,4 +149,6 @@ int der_encode_setof(const ltc_asn1_list *list, unsigned long inlen,
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef s_qsort_helper
+
 #endif
 #endif

+ 6 - 1
src/pk/asn1/der/utctime/der_decode_utctime.c

@@ -9,7 +9,9 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 
 
-static int s_char_to_int(unsigned char x)
+#ifndef LTC_DER_CHAR_TO_INT
+#define LTC_DER_CHAR_TO_INT
+static LTC_INLINE int s_char_to_int(unsigned char x)
 {
 {
    switch (x)  {
    switch (x)  {
       case '0': return 0;
       case '0': return 0;
@@ -25,6 +27,7 @@ static int s_char_to_int(unsigned char x)
       default:  return 100;
       default:  return 100;
    }
    }
 }
 }
+#endif
 
 
 #define DECODE_V(y, max) \
 #define DECODE_V(y, max) \
    y  = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \
    y  = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \
@@ -113,4 +116,6 @@ YYMMDDhhmmss-hh'mm'
     return CRYPT_INVALID_PACKET;
     return CRYPT_INVALID_PACKET;
 }
 }
 
 
+#undef DECODE_V
+
 #endif
 #endif

+ 3 - 2
src/pk/asn1/der/utctime/der_encode_utctime.c

@@ -9,8 +9,6 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 
 
-static const char * const baseten = "0123456789";
-
 #define STORE_V(y) \
 #define STORE_V(y) \
     out[x++] = der_ia5_char_encode(baseten[(y/10) % 10]); \
     out[x++] = der_ia5_char_encode(baseten[(y/10) % 10]); \
     out[x++] = der_ia5_char_encode(baseten[y % 10]);
     out[x++] = der_ia5_char_encode(baseten[y % 10]);
@@ -25,6 +23,7 @@ static const char * const baseten = "0123456789";
 int der_encode_utctime(const ltc_utctime   *utctime,
 int der_encode_utctime(const ltc_utctime   *utctime,
                              unsigned char *out,   unsigned long *outlen)
                              unsigned char *out,   unsigned long *outlen)
 {
 {
+    const char * const baseten = "0123456789";
     unsigned long x, tmplen;
     unsigned long x, tmplen;
     int           err;
     int           err;
 
 
@@ -68,4 +67,6 @@ int der_encode_utctime(const ltc_utctime   *utctime,
     return CRYPT_OK;
     return CRYPT_OK;
 }
 }
 
 
+#undef STORE_V
+
 #endif
 #endif

+ 5 - 0
src/pk/ec25519/tweetnacl.c

@@ -4,6 +4,7 @@
 
 
 /* automatically generated file, do not edit */
 /* automatically generated file, do not edit */
 
 
+#define add tnacl_add
 #define FOR(i,n) for (i = 0;i < n;++i)
 #define FOR(i,n) for (i = 0;i < n;++i)
 #define sv static void
 #define sv static void
 
 
@@ -489,3 +490,7 @@ int tweetnacl_crypto_ph(u8 *out,const u8 *msg,u64 msglen)
 {
 {
   return tweetnacl_crypto_hash(out, msg, msglen);
   return tweetnacl_crypto_hash(out, msg, msglen);
 }
 }
+
+#undef add
+#undef FOR
+#undef sv

+ 2 - 0
src/stream/chacha/chacha_crypt.c

@@ -88,4 +88,6 @@ int chacha_crypt(chacha_state *st, const unsigned char *in, unsigned long inlen,
    }
    }
 }
 }
 
 
+#undef QUARTERROUND
+
 #endif
 #endif

+ 2 - 3
src/stream/chacha/chacha_setup.c

@@ -10,9 +10,6 @@
 
 
 #ifdef LTC_CHACHA
 #ifdef LTC_CHACHA
 
 
-static const char * const sigma = "expand 32-byte k";
-static const char * const tau   = "expand 16-byte k";
-
 /**
 /**
    Initialize an ChaCha context (only the key)
    Initialize an ChaCha context (only the key)
    @param st        [out] The destination of the ChaCha state
    @param st        [out] The destination of the ChaCha state
@@ -23,6 +20,8 @@ static const char * const tau   = "expand 16-byte k";
 */
 */
 int chacha_setup(chacha_state *st, const unsigned char *key, unsigned long keylen, int rounds)
 int chacha_setup(chacha_state *st, const unsigned char *key, unsigned long keylen, int rounds)
 {
 {
+   const char * const sigma = "expand 32-byte k";
+   const char * const tau   = "expand 16-byte k";
    const char *constants;
    const char *constants;
 
 
    LTC_ARGCHK(st  != NULL);
    LTC_ARGCHK(st  != NULL);

+ 2 - 0
src/stream/salsa20/salsa20_crypt.c

@@ -83,4 +83,6 @@ int salsa20_crypt(salsa20_state *st, const unsigned char *in, unsigned long inle
    }
    }
 }
 }
 
 
+#undef QUARTERROUND
+
 #endif
 #endif

+ 2 - 3
src/stream/salsa20/salsa20_setup.c

@@ -11,9 +11,6 @@
 
 
 #ifdef LTC_SALSA20
 #ifdef LTC_SALSA20
 
 
-static const char * const sigma = "expand 32-byte k";
-static const char * const tau   = "expand 16-byte k";
-
 /**
 /**
    Initialize an Salsa20 context (only the key)
    Initialize an Salsa20 context (only the key)
    @param st        [out] The destination of the Salsa20 state
    @param st        [out] The destination of the Salsa20 state
@@ -24,6 +21,8 @@ static const char * const tau   = "expand 16-byte k";
 */
 */
 int salsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long keylen, int rounds)
 int salsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long keylen, int rounds)
 {
 {
+   const char * const sigma = "expand 32-byte k";
+   const char * const tau   = "expand 16-byte k";
    const char *constants;
    const char *constants;
 
 
    LTC_ARGCHK(st  != NULL);
    LTC_ARGCHK(st  != NULL);

+ 1 - 2
src/stream/salsa20/xsalsa20_setup.c

@@ -12,8 +12,6 @@
 
 
 #ifdef LTC_XSALSA20
 #ifdef LTC_XSALSA20
 
 
-static const char * const constants = "expand 32-byte k";
-
 #define QUARTERROUND(a,b,c,d) \
 #define QUARTERROUND(a,b,c,d) \
     x[b] ^= (ROL((x[a] + x[d]),  7)); \
     x[b] ^= (ROL((x[a] + x[d]),  7)); \
     x[c] ^= (ROL((x[b] + x[a]),  9)); \
     x[c] ^= (ROL((x[b] + x[a]),  9)); \
@@ -55,6 +53,7 @@ int xsalsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long ke
                                       const unsigned char *nonce, unsigned long noncelen,
                                       const unsigned char *nonce, unsigned long noncelen,
                                       int rounds)
                                       int rounds)
 {
 {
+   const char * const constants = "expand 32-byte k";
    const int sti[] = {0, 5, 10, 15, 6, 7, 8, 9};  /* indices used to build subkey fm x */
    const int sti[] = {0, 5, 10, 15, 6, 7, 8, 9};  /* indices used to build subkey fm x */
    ulong32       x[64];                           /* input to & output fm doubleround */
    ulong32       x[64];                           /* input to & output fm doubleround */
    unsigned char subkey[32];
    unsigned char subkey[32];

+ 12 - 0
src/stream/sober128/sober128_stream.c

@@ -330,4 +330,16 @@ int sober128_stream_done(sober128_state *st)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
+#undef N
+#undef INITKONST
+#undef KEYP
+#undef FOLDP
+#undef OFF
+#undef STEP
+#undef NLFUNC
+#undef ADDKEY
+#undef XORNL
+#undef DROUND
+#undef SROUND
+
 #endif
 #endif