Browse Source

Merge pull request #534 from libtom/pr/macro-names-cleanup

Clean up macro names and static functions
Steffen Jaeckel 5 years ago
parent
commit
40eea675cd
100 changed files with 976 additions and 985 deletions
  1. 5 5
      demos/constants.c
  2. 2 2
      demos/hashsum.c
  3. 3 3
      demos/openssl-enc.c
  4. 5 5
      demos/sizes.c
  5. 9 9
      doc/crypt.tex
  6. 8 3
      helper.pl
  7. 5 5
      src/ciphers/aes/aes.c
  8. 2 2
      src/ciphers/aes/aes_tab.c
  9. 2 2
      src/ciphers/anubis.c
  10. 4 4
      src/ciphers/blowfish.c
  11. 9 15
      src/ciphers/cast5.c
  12. 6 6
      src/ciphers/des.c
  13. 45 45
      src/ciphers/idea.c
  14. 27 27
      src/ciphers/multi2.c
  15. 4 4
      src/ciphers/noekeon.c
  16. 4 4
      src/ciphers/rc2.c
  17. 6 6
      src/ciphers/rc5.c
  18. 6 6
      src/ciphers/rc6.c
  19. 13 13
      src/ciphers/safer/safer.c
  20. 2 2
      src/ciphers/safer/safer_tab.c
  21. 9 9
      src/ciphers/safer/saferp.c
  22. 74 74
      src/ciphers/serpent.c
  23. 4 4
      src/ciphers/skipjack.c
  24. 11 11
      src/ciphers/twofish/twofish.c
  25. 2 2
      src/ciphers/twofish/twofish_tab.c
  26. 2 2
      src/encauth/gcm/gcm_gf_mult.c
  27. 3 3
      src/encauth/ocb3/ocb3_add_aad.c
  28. 2 2
      src/encauth/ocb3/ocb3_init.c
  29. 21 21
      src/hashes/blake2b.c
  30. 21 21
      src/hashes/blake2s.c
  31. 6 6
      src/hashes/chc/chc.c
  32. 7 7
      src/hashes/md2.c
  33. 7 7
      src/hashes/md4.c
  34. 7 7
      src/hashes/md5.c
  35. 7 7
      src/hashes/rmd128.c
  36. 7 7
      src/hashes/rmd160.c
  37. 7 7
      src/hashes/rmd256.c
  38. 7 7
      src/hashes/rmd320.c
  39. 7 7
      src/hashes/sha1.c
  40. 7 7
      src/hashes/sha2/sha256.c
  41. 7 7
      src/hashes/sha2/sha512.c
  42. 15 15
      src/hashes/sha3.c
  43. 15 21
      src/hashes/tiger.c
  44. 8 8
      src/hashes/whirl/whirl.c
  45. 2 2
      src/hashes/whirl/whirltab.c
  46. 26 26
      src/headers/tomcrypt_macros.h
  47. 13 13
      src/headers/tomcrypt_pk.h
  48. 1 1
      src/headers/tomcrypt_private.h
  49. 5 5
      src/mac/pelican/pelican.c
  50. 4 4
      src/mac/poly1305/poly1305.c
  51. 28 28
      src/math/fp/ltc_ecc_fp_mulmod.c
  52. 9 9
      src/misc/adler32.c
  53. 7 7
      src/misc/base64/base64_decode.c
  54. 4 4
      src/misc/base64/base64_encode.c
  55. 5 5
      src/misc/bcrypt/bcrypt.c
  56. 3 3
      src/misc/compare_testvector.c
  57. 3 3
      src/misc/crc32.c
  58. 95 95
      src/misc/crypt/crypt_constants.c
  59. 98 98
      src/misc/crypt/crypt_sizes.c
  60. 2 2
      src/misc/padding/padding_pad.c
  61. 23 23
      src/misc/pbes/pbes1.c
  62. 21 21
      src/misc/pbes/pbes2.c
  63. 3 3
      src/misc/pkcs5/pkcs_5_1.c
  64. 3 3
      src/modes/ctr/ctr_encrypt.c
  65. 4 4
      src/modes/xts/xts_decrypt.c
  66. 4 4
      src/modes/xts/xts_encrypt.c
  67. 4 4
      src/modes/xts/xts_test.c
  68. 4 4
      src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c
  69. 6 6
      src/pk/asn1/der/sequence/der_decode_sequence_flexi.c
  70. 3 3
      src/pk/asn1/der/sequence/der_decode_sequence_multi.c
  71. 4 4
      src/pk/asn1/der/set/der_encode_set.c
  72. 2 2
      src/pk/asn1/der/set/der_encode_setof.c
  73. 2 2
      src/pk/asn1/der/utctime/der_decode_utctime.c
  74. 2 2
      src/pk/dh/dh_generate_key.c
  75. 2 2
      src/pk/dsa/dsa_generate_pqg.c
  76. 4 4
      src/pk/ec25519/tweetnacl.c
  77. 8 8
      src/pk/ecc/ecc_find_curve.c
  78. 4 4
      src/pk/ecc/ecc_import_openssl.c
  79. 4 4
      src/pk/ecc/ecc_import_pkcs8.c
  80. 4 4
      src/pk/ecc/ecc_import_x509.c
  81. 10 10
      src/pk/ecc/ecc_set_curve_internal.c
  82. 2 2
      src/pk/ed25519/ed25519_import_x509.c
  83. 2 2
      src/pk/rsa/rsa_import_x509.c
  84. 2 2
      src/pk/rsa/rsa_key.c
  85. 2 2
      src/pk/x25519/x25519_import_x509.c
  86. 1 1
      src/prngs/chacha20.c
  87. 17 17
      src/prngs/fortuna.c
  88. 1 1
      src/prngs/rc4.c
  89. 6 6
      src/prngs/rng_get_bytes.c
  90. 1 1
      src/prngs/sober128.c
  91. 1 1
      src/prngs/yarrow.c
  92. 2 2
      src/stream/chacha/chacha_crypt.c
  93. 11 11
      src/stream/rabbit/rabbit.c
  94. 2 2
      src/stream/salsa20/salsa20_crypt.c
  95. 2 2
      src/stream/salsa20/xsalsa20_setup.c
  96. 2 2
      src/stream/salsa20/xsalsa20_test.c
  97. 1 1
      src/stream/sober128/sober128_stream.c
  98. 2 2
      src/stream/sober128/sober128tab.c
  99. 6 6
      src/stream/sosemanuk/sosemanuk.c
  100. 57 59
      tests/der_test.c

+ 5 - 5
demos/constants.c

@@ -17,7 +17,7 @@
   Larry Bugbee, February 2013
   Larry Bugbee, February 2013
 */
 */
 
 
-static void _print_line(const char* cmd, const char* desc)
+static void s_print_line(const char* cmd, const char* desc)
 {
 {
    printf("  %-16s - %s\n", cmd, desc);
    printf("  %-16s - %s\n", cmd, desc);
 }
 }
@@ -48,10 +48,10 @@ int main(int argc, char **argv)
       if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
       if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
          char* base = strdup(basename(argv[0]));
          char* base = strdup(basename(argv[0]));
          printf("Usage: %s [-a] [-s name]\n\n", base);
          printf("Usage: %s [-a] [-s name]\n\n", base);
-         _print_line("<no argument>", "The old behavior of the demo");
-         _print_line("-a", "Only lists all constants");
-         _print_line("-s name", "List a single constant given as argument");
-         _print_line("-h", "The help you're looking at");
+         s_print_line("<no argument>", "The old behavior of the demo");
+         s_print_line("-a", "Only lists all constants");
+         s_print_line("-s name", "List a single constant given as argument");
+         s_print_line("-h", "The help you're looking at");
          free(base);
          free(base);
       } else if (strcmp(argv[1], "-a") == 0) {
       } else if (strcmp(argv[1], "-a") == 0) {
          char *names_list;
          char *names_list;

+ 2 - 2
demos/hashsum.c

@@ -24,11 +24,11 @@
 #endif
 #endif
 
 
 /* thanks http://stackoverflow.com/a/8198009 */
 /* thanks http://stackoverflow.com/a/8198009 */
-#define _base(x) ((x >= '0' && x <= '9') ? '0' : \
+#define s_base(x) ((x >= '0' && x <= '9') ? '0' : \
          (x >= 'a' && x <= 'f') ? 'a' - 10 : \
          (x >= 'a' && x <= 'f') ? 'a' - 10 : \
          (x >= 'A' && x <= 'F') ? 'A' - 10 : \
          (x >= 'A' && x <= 'F') ? 'A' - 10 : \
             '\255')
             '\255')
-#define HEXOF(x) (x - _base(x))
+#define HEXOF(x) (x - s_base(x))
 
 
 static char* hashsum;
 static char* hashsum;
 
 

+ 3 - 3
demos/openssl-enc.c

@@ -166,7 +166,7 @@ void dump_bytes(unsigned char *in, unsigned long len)
  * Output:       number of bytes after padding resp. after unpadding
  * Output:       number of bytes after padding resp. after unpadding
  * Side Effects: none
  * Side Effects: none
  */
  */
-static size_t _pkcs7_pad(union paddable *buf, size_t nb, int block_length,
+static size_t s_pkcs7_pad(union paddable *buf, size_t nb, int block_length,
                  int is_padding)
                  int is_padding)
 {
 {
    unsigned long length;
    unsigned long length;
@@ -224,7 +224,7 @@ int do_crypt(FILE *infd, FILE *outfd, unsigned char *key, unsigned char *iv,
          /* We're encrypting, so pad first (if at EOF) and then
          /* We're encrypting, so pad first (if at EOF) and then
             crypt */
             crypt */
          if(feof(infd))
          if(feof(infd))
-            nb = _pkcs7_pad(&inbuf, nb,
+            nb = s_pkcs7_pad(&inbuf, nb,
                            aes_desc.block_length, 1);
                            aes_desc.block_length, 1);
 
 
          ret = cbc_encrypt(inbuf.pad, outbuf.pad, nb, &cbc);
          ret = cbc_encrypt(inbuf.pad, outbuf.pad, nb, &cbc);
@@ -239,7 +239,7 @@ int do_crypt(FILE *infd, FILE *outfd, unsigned char *key, unsigned char *iv,
             return ret;
             return ret;
 
 
          if(feof(infd))
          if(feof(infd))
-            nb = _pkcs7_pad(&outbuf, nb,
+            nb = s_pkcs7_pad(&outbuf, nb,
                            aes_desc.block_length, 0);
                            aes_desc.block_length, 0);
          if(nb == 0)
          if(nb == 0)
             /* The file didn't decrypt correctly */
             /* The file didn't decrypt correctly */

+ 5 - 5
demos/sizes.c

@@ -15,7 +15,7 @@
   like Python - Larry Bugbee, February 2013
   like Python - Larry Bugbee, February 2013
 */
 */
 
 
-static void _print_line(const char* cmd, const char* desc)
+static void s_print_line(const char* cmd, const char* desc)
 {
 {
    printf("  %-16s - %s\n", cmd, desc);
    printf("  %-16s - %s\n", cmd, desc);
 }
 }
@@ -44,10 +44,10 @@ int main(int argc, char **argv)
       if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
       if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
          char* base = strdup(basename(argv[0]));
          char* base = strdup(basename(argv[0]));
          printf("Usage: %s [-a] [-s name]\n\n", base);
          printf("Usage: %s [-a] [-s name]\n\n", base);
-         _print_line("<no argument>", "The old behavior of the demo");
-         _print_line("-a", "Only lists all sizes");
-         _print_line("-s name", "List a single size given as argument");
-         _print_line("-h", "The help you're looking at");
+         s_print_line("<no argument>", "The old behavior of the demo");
+         s_print_line("-a", "Only lists all sizes");
+         s_print_line("-s name", "List a single size given as argument");
+         s_print_line("-h", "The help you're looking at");
          free(base);
          free(base);
       } else if (strcmp(argv[1], "-a") == 0) {
       } else if (strcmp(argv[1], "-a") == 0) {
          char *sizes_list;
          char *sizes_list;

+ 9 - 9
doc/crypt.tex

@@ -560,7 +560,7 @@ of this array has the following (partial) format (See Section \ref{sec:cipherdes
 
 
 \begin{small}
 \begin{small}
 \begin{verbatim}
 \begin{verbatim}
-struct _cipher_descriptor {
+struct ltc_cipher_descriptor {
    /** name of cipher */
    /** name of cipher */
    char *name;
    char *name;
 
 
@@ -745,14 +745,14 @@ A good safety would be to check the return value of \textit{find\_cipher()} befo
 to use a cipher with the descriptor table you must register it first using:
 to use a cipher with the descriptor table you must register it first using:
 \index{register\_cipher()}
 \index{register\_cipher()}
 \begin{verbatim}
 \begin{verbatim}
-int register_cipher(const struct _cipher_descriptor *cipher);
+int register_cipher(const struct ltc_cipher_descriptor *cipher);
 \end{verbatim}
 \end{verbatim}
 Which accepts a pointer to a descriptor and returns the index into the global descriptor table.  If an error occurs such
 Which accepts a pointer to a descriptor and returns the index into the global descriptor table.  If an error occurs such
 as there is no more room (it can have 32 ciphers at most) it will return {\bf{-1}}.  If you try to add the same cipher more
 as there is no more room (it can have 32 ciphers at most) it will return {\bf{-1}}.  If you try to add the same cipher more
 than once it will just return the index of the first copy.  To remove a cipher call:
 than once it will just return the index of the first copy.  To remove a cipher call:
 \index{unregister\_cipher()}
 \index{unregister\_cipher()}
 \begin{verbatim}
 \begin{verbatim}
-int unregister_cipher(const struct _cipher_descriptor *cipher);
+int unregister_cipher(const struct ltc_cipher_descriptor *cipher);
 \end{verbatim}
 \end{verbatim}
 Which returns {\bf CRYPT\_OK} if it removes the cipher, otherwise it returns {\bf CRYPT\_ERROR}.
 Which returns {\bf CRYPT\_OK} if it removes the cipher, otherwise it returns {\bf CRYPT\_ERROR}.
 \begin{small}
 \begin{small}
@@ -2594,7 +2594,7 @@ int main(void)
 Like the set of ciphers, the set of hashes have descriptors as well.  They are stored in an array called \textit{hash\_descriptor} and
 Like the set of ciphers, the set of hashes have descriptors as well.  They are stored in an array called \textit{hash\_descriptor} and
 are defined by:
 are defined by:
 \begin{verbatim}
 \begin{verbatim}
-struct _hash_descriptor {
+struct ltc_hash_descriptor {
     char *name;
     char *name;
 
 
     unsigned long hashsize;    /* digest output size in bytes  */
     unsigned long hashsize;    /* digest output size in bytes  */
@@ -2753,9 +2753,9 @@ Similar to the cipher descriptor table you must register your hash algorithms be
 work exactly like those of the cipher registration code.  The functions are:
 work exactly like those of the cipher registration code.  The functions are:
 \index{register\_hash()} \index{unregister\_hash()}
 \index{register\_hash()} \index{unregister\_hash()}
 \begin{verbatim}
 \begin{verbatim}
-int register_hash(const struct _hash_descriptor *hash);
+int register_hash(const struct ltc_hash_descriptor *hash);
 
 
-int unregister_hash(const struct _hash_descriptor *hash);
+int unregister_hash(const struct ltc_hash_descriptor *hash);
 \end{verbatim}
 \end{verbatim}
 
 
 The following hashes are provided as of this release within the LibTomCrypt library:
 The following hashes are provided as of this release within the LibTomCrypt library:
@@ -3824,7 +3824,7 @@ int main(void)
 PRNGs have descriptors that allow plugin driven functions to be created using PRNGs. The plugin descriptors are stored in the structure \textit{prng\_descriptor}.  The
 PRNGs have descriptors that allow plugin driven functions to be created using PRNGs. The plugin descriptors are stored in the structure \textit{prng\_descriptor}.  The
 format of an element is:
 format of an element is:
 \begin{verbatim}
 \begin{verbatim}
-struct _prng_descriptor {
+struct ltc_prng_descriptor {
     char *name;
     char *name;
     int  export_size;    /* size in bytes of exported state */
     int  export_size;    /* size in bytes of exported state */
 
 
@@ -3860,8 +3860,8 @@ Just like the ciphers and hashes, you must register your prng before you can use
 They are the following:
 They are the following:
 \index{register\_prng()} \index{unregister\_prng()}
 \index{register\_prng()} \index{unregister\_prng()}
 \begin{verbatim}
 \begin{verbatim}
-int register_prng(const struct _prng_descriptor *prng);
-int unregister_prng(const struct _prng_descriptor *prng);
+int register_prng(const struct ltc_prng_descriptor *prng);
+int unregister_prng(const struct ltc_prng_descriptor *prng);
 \end{verbatim}
 \end{verbatim}
 
 
 The register function will register the PRNG, and return the index into the table where it was placed (or -1 for error).  It will avoid registering the same
 The register function will register the PRNG, and return the index into the table where it was placed (or -1 for error).  It will avoid registering the same

+ 8 - 3
helper.pl

@@ -61,12 +61,17 @@ sub check_source {
       push @{$troubles->{sizeof_no_brackets}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bsizeof\s*[^\(]/;
       push @{$troubles->{sizeof_no_brackets}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bsizeof\s*[^\(]/;
       if ($file =~ m|src/.*\.c$| &&
       if ($file =~ m|src/.*\.c$| &&
           $file !~ m|src/ciphers/.*\.c$| &&
           $file !~ m|src/ciphers/.*\.c$| &&
-          $file !~ m|src/hashes/.*\.c$| &&
           $file !~ m|src/math/.+_desc.c$| &&
           $file !~ m|src/math/.+_desc.c$| &&
           $file !~ m|src/pk/ec25519/tweetnacl.c$| &&
           $file !~ m|src/pk/ec25519/tweetnacl.c$| &&
           $file !~ m|src/stream/sober128/sober128_stream.c$| &&
           $file !~ m|src/stream/sober128/sober128_stream.c$| &&
-          $l =~ /^static(\s+[a-zA-Z0-9_]+)+\s+([^_][a-zA-Z0-9_]+)\s*\(/) {
-        push @{$troubles->{staticfunc_name}}, "$lineno($2)";
+          $l =~ /^static(\s+[a-zA-Z0-9_]+)+\s++([^s][a-zA-Z0-9_]+)\s*\(/) {
+        push @{$troubles->{staticfunc_name}}, "$2";
+      }
+      if ($file =~ m|src/.*\.[ch]$| && $l =~ /^\s*#\s*define\s+(_[A-Z_][a-zA-Z0-9_]*)\b/) {
+        my $n = $1;
+        push @{$troubles->{invalid_macro_name}}, "$lineno($n)"
+                unless ($file eq 'src/headers/tomcrypt_cfg.h' &&  $n eq '__has_builtin') ||
+                       ($file eq 'src/prngs/rng_get_bytes.c' &&  $n eq '_WIN32_WINNT');
       }
       }
       $lineno++;
       $lineno++;
     }
     }

+ 5 - 5
src/ciphers/aes/aes.c

@@ -80,7 +80,7 @@ const struct ltc_cipher_descriptor aes_enc_desc =
 
 
 #endif
 #endif
 
 
-#define __LTC_AES_TAB_C__
+#define LTC_AES_TAB_C
 #include "aes_tab.c"
 #include "aes_tab.c"
 
 
 static ulong32 setup_mix(ulong32 temp)
 static ulong32 setup_mix(ulong32 temp)
@@ -275,7 +275,7 @@ int SETUP(const unsigned char *key, int keylen, int num_rounds, symmetric_key *s
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rijndael_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
+static int s_rijndael_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #else
 #else
 int ECB_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int ECB_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #endif
 #endif
@@ -443,7 +443,7 @@ int ECB_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *ske
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int ECB_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int ECB_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err = _rijndael_ecb_encrypt(pt, ct, skey);
+   int err = s_rijndael_ecb_encrypt(pt, ct, skey);
    burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2);
    burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2);
    return err;
    return err;
 }
 }
@@ -459,7 +459,7 @@ int ECB_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *ske
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rijndael_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
+static int s_rijndael_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #else
 #else
 int ECB_DEC(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int ECB_DEC(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #endif
 #endif
@@ -628,7 +628,7 @@ int ECB_DEC(const unsigned char *ct, unsigned char *pt, const symmetric_key *ske
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int ECB_DEC(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int ECB_DEC(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err = _rijndael_ecb_decrypt(ct, pt, skey);
+   int err = s_rijndael_ecb_decrypt(ct, pt, skey);
    burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2);
    burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2);
    return err;
    return err;
 }
 }

+ 2 - 2
src/ciphers/aes/aes_tab.c

@@ -15,7 +15,7 @@ Td3[x] = Si[x].[09, 0d, 0b, 0e];
 Td4[x] = Si[x].[01, 01, 01, 01];
 Td4[x] = Si[x].[01, 01, 01, 01];
 */
 */
 
 
-#ifdef __LTC_AES_TAB_C__
+#ifdef LTC_AES_TAB_C
 
 
 /**
 /**
   @file aes_tab.c
   @file aes_tab.c
@@ -1019,4 +1019,4 @@ static const ulong32 rcon[] = {
 };
 };
 #endif
 #endif
 
 
-#endif /* __LTC_AES_TAB_C__ */
+#endif /* LTC_AES_TAB_C */

+ 2 - 2
src/ciphers/anubis.c

@@ -876,7 +876,7 @@ static const ulong32 rc[] = {
     @return CRYPT_OK if successful
     @return CRYPT_OK if successful
  */
  */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
+static int s_anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #else
 #else
 int  anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int  anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #endif
 #endif
@@ -1013,7 +1013,7 @@ int  anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
 int  anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int  anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 {
 {
   int err;
   int err;
-  err = _anubis_setup(key, keylen, num_rounds, skey);
+  err = s_anubis_setup(key, keylen, num_rounds, skey);
   burn_stack(sizeof(int) * 5 + sizeof(ulong32) * (MAX_N + MAX_N + 5));
   burn_stack(sizeof(int) * 5 + sizeof(ulong32) * (MAX_N + MAX_N + 5));
   return err;
   return err;
 }
 }

+ 4 - 4
src/ciphers/blowfish.c

@@ -472,7 +472,7 @@ int blowfish_setup_with_data(const unsigned char *key, int keylen,
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
+static int s_blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #else
 #else
 int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #endif
 #endif
@@ -499,7 +499,7 @@ int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symme
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-    int err = _blowfish_ecb_encrypt(pt, ct, skey);
+    int err = s_blowfish_ecb_encrypt(pt, ct, skey);
     burn_stack(sizeof(ulong32) * 2 + sizeof(int));
     burn_stack(sizeof(ulong32) * 2 + sizeof(int));
     return err;
     return err;
 }
 }
@@ -513,7 +513,7 @@ int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symme
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
+static int s_blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #else
 #else
 int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #endif
 #endif
@@ -560,7 +560,7 @@ int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symme
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-    int err = _blowfish_ecb_decrypt(ct, pt, skey);
+    int err = s_blowfish_ecb_decrypt(ct, pt, skey);
     burn_stack(sizeof(ulong32) * 2 + sizeof(int));
     burn_stack(sizeof(ulong32) * 2 + sizeof(int));
     return err;
     return err;
 }
 }

+ 9 - 15
src/ciphers/cast5.c

@@ -398,7 +398,7 @@ static const ulong32 S8[256] = {
     @return CRYPT_OK if successful
     @return CRYPT_OK if successful
  */
  */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
+static int s_cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #else
 #else
 int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #endif
 #endif
@@ -485,19 +485,13 @@ int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_
 int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 {
 {
    int z;
    int z;
-   z = _cast5_setup(key, keylen, num_rounds, skey);
+   z = s_cast5_setup(key, keylen, num_rounds, skey);
    burn_stack(sizeof(ulong32)*8 + 16 + sizeof(int)*2);
    burn_stack(sizeof(ulong32)*8 + 16 + sizeof(int)*2);
    return z;
    return z;
 }
 }
 #endif
 #endif
 
 
-#ifdef _MSC_VER
-   #define INLINE __inline
-#else
-   #define INLINE
-#endif
-
-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;
    I = (Km + R);
    I = (Km + R);
@@ -505,7 +499,7 @@ INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
    return ((S1[LTC_BYTE(I, 3)] ^ S2[LTC_BYTE(I,2)]) - S3[LTC_BYTE(I,1)]) + S4[LTC_BYTE(I,0)];
    return ((S1[LTC_BYTE(I, 3)] ^ S2[LTC_BYTE(I,2)]) - S3[LTC_BYTE(I,1)]) + S4[LTC_BYTE(I,0)];
 }
 }
 
 
-INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
+LTC_INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
 {
 {
    ulong32 I;
    ulong32 I;
    I = (Km ^ R);
    I = (Km ^ R);
@@ -513,7 +507,7 @@ INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
    return ((S1[LTC_BYTE(I, 3)] - S2[LTC_BYTE(I,2)]) + S3[LTC_BYTE(I,1)]) ^ S4[LTC_BYTE(I,0)];
    return ((S1[LTC_BYTE(I, 3)] - S2[LTC_BYTE(I,2)]) + S3[LTC_BYTE(I,1)]) ^ S4[LTC_BYTE(I,0)];
 }
 }
 
 
-INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr)
+LTC_INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr)
 {
 {
    ulong32 I;
    ulong32 I;
    I = (Km - R);
    I = (Km - R);
@@ -528,7 +522,7 @@ INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr)
   @param skey The key as scheduled
   @param skey The key as scheduled
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
+static int s_cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #else
 #else
 int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #endif
 #endif
@@ -568,7 +562,7 @@ int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetri
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err =_cast5_ecb_encrypt(pt,ct,skey);
+   int err = s_cast5_ecb_encrypt(pt,ct,skey);
    burn_stack(sizeof(ulong32)*3);
    burn_stack(sizeof(ulong32)*3);
    return err;
    return err;
 }
 }
@@ -581,7 +575,7 @@ int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetri
   @param skey The key as scheduled
   @param skey The key as scheduled
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
+static int s_cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #else
 #else
 int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #endif
 #endif
@@ -621,7 +615,7 @@ int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetri
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err = _cast5_ecb_decrypt(ct,pt,skey);
+   int err = s_cast5_ecb_decrypt(ct,pt,skey);
    burn_stack(sizeof(ulong32)*3);
    burn_stack(sizeof(ulong32)*3);
    return err;
    return err;
 }
 }

+ 6 - 6
src/ciphers/des.c

@@ -1293,7 +1293,7 @@ static const ulong64 des_fp[8][256] = {
 static void cookey(const ulong32 *raw1, ulong32 *keyout);
 static void cookey(const ulong32 *raw1, ulong32 *keyout);
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static void _deskey(const unsigned char *key, short edf, ulong32 *keyout)
+static void s_deskey(const unsigned char *key, short edf, ulong32 *keyout)
 #else
 #else
 static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
 static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
 #endif
 #endif
@@ -1347,13 +1347,13 @@ static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
 static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
 {
 {
-   _deskey(key, edf, keyout);
+   s_deskey(key, edf, keyout);
    burn_stack(sizeof(int)*5 + sizeof(ulong32)*32 + sizeof(unsigned char)*112);
    burn_stack(sizeof(int)*5 + sizeof(ulong32)*32 + sizeof(unsigned char)*112);
 }
 }
 #endif
 #endif
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static void _cookey(const ulong32 *raw1, ulong32 *keyout)
+static void s_cookey(const ulong32 *raw1, ulong32 *keyout)
 #else
 #else
 static void cookey(const ulong32 *raw1, ulong32 *keyout)
 static void cookey(const ulong32 *raw1, ulong32 *keyout)
 #endif
 #endif
@@ -1383,7 +1383,7 @@ static void cookey(const ulong32 *raw1, ulong32 *keyout)
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 static void cookey(const ulong32 *raw1, ulong32 *keyout)
 static void cookey(const ulong32 *raw1, ulong32 *keyout)
 {
 {
-   _cookey(raw1, keyout);
+   s_cookey(raw1, keyout);
    burn_stack(sizeof(ulong32 *) * 2 + sizeof(ulong32)*32 + sizeof(int));
    burn_stack(sizeof(ulong32 *) * 2 + sizeof(ulong32)*32 + sizeof(int));
 }
 }
 #endif
 #endif
@@ -1391,7 +1391,7 @@ static void cookey(const ulong32 *raw1, ulong32 *keyout)
 #ifndef LTC_CLEAN_STACK
 #ifndef LTC_CLEAN_STACK
 static void desfunc(ulong32 *block, const ulong32 *keys)
 static void desfunc(ulong32 *block, const ulong32 *keys)
 #else
 #else
-static void _desfunc(ulong32 *block, const ulong32 *keys)
+static void s_desfunc(ulong32 *block, const ulong32 *keys)
 #endif
 #endif
 {
 {
     ulong32 work, right, leftt;
     ulong32 work, right, leftt;
@@ -1505,7 +1505,7 @@ static void _desfunc(ulong32 *block, const ulong32 *keys)
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 static void desfunc(ulong32 *block, const ulong32 *keys)
 static void desfunc(ulong32 *block, const ulong32 *keys)
 {
 {
-   _desfunc(block, keys);
+   s_desfunc(block, keys);
    burn_stack(sizeof(ulong32) * 4 + sizeof(int));
    burn_stack(sizeof(ulong32) * 4 + sizeof(int));
 }
 }
 #endif
 #endif

+ 45 - 45
src/ciphers/idea.c

@@ -35,38 +35,38 @@ const struct ltc_cipher_descriptor idea_desc = {
 
 
 typedef unsigned short int ushort16;
 typedef unsigned short int ushort16;
 
 
-#define _LOW16(x)     ((x)&0xffff)  /* compiler should be able to optimize this away if x is 16 bits */
-#define _HIGH16(x)    ((x)>>16)
-#define _MUL(a,b)     {                                               \
-                         ulong32 p = (ulong32)_LOW16(a) * b;          \
+#define LOW16(x)     ((x)&0xffff)  /* compiler should be able to optimize this away if x is 16 bits */
+#define HIGH16(x)    ((x)>>16)
+#define MUL(a,b)     {                                               \
+                         ulong32 p = (ulong32)LOW16(a) * b;          \
                          if (p) {                                     \
                          if (p) {                                     \
-                            p = _LOW16(p) - _HIGH16(p);               \
-                            a = (ushort16)p - (ushort16)_HIGH16(p);   \
+                            p = LOW16(p) - HIGH16(p);               \
+                            a = (ushort16)p - (ushort16)HIGH16(p);   \
                          }                                            \
                          }                                            \
                          else                                         \
                          else                                         \
                             a = 1 - a - b;                            \
                             a = 1 - a - b;                            \
                       }
                       }
-#define _STORE16(x,y) { (y)[0] = (unsigned char)(((x)>>8)&255); (y)[1] = (unsigned char)((x)&255); }
-#define _LOAD16(x,y)  { x = ((ushort16)((y)[0] & 255)<<8) | ((ushort16)((y)[1] & 255)); }
+#define STORE16(x,y) { (y)[0] = (unsigned char)(((x)>>8)&255); (y)[1] = (unsigned char)((x)&255); }
+#define LOAD16(x,y)  { x = ((ushort16)((y)[0] & 255)<<8) | ((ushort16)((y)[1] & 255)); }
 
 
-static ushort16 _mul_inv(ushort16 x)
+static ushort16 s_mul_inv(ushort16 x)
 {
 {
    ushort16 y = x;
    ushort16 y = x;
    unsigned i;
    unsigned i;
 
 
    for (i = 0; i < 15; i++) {
    for (i = 0; i < 15; i++) {
-      _MUL(y, _LOW16(y));
-      _MUL(y, x);
+      MUL(y, LOW16(y));
+      MUL(y, x);
    }
    }
-   return _LOW16(y);
+   return LOW16(y);
 }
 }
 
 
-static ushort16 _add_inv(ushort16 x)
+static ushort16 s_add_inv(ushort16 x)
 {
 {
-   return _LOW16(0 - x);
+   return LOW16(0 - x);
 }
 }
 
 
-static int _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;
    ushort16 *e_key = skey->idea.ek;
    ushort16 *e_key = skey->idea.ek;
@@ -74,49 +74,49 @@ static int _setup_key(const unsigned char *key, symmetric_key *skey)
 
 
    /* prepare enc key */
    /* prepare enc key */
    for (i = 0; i < 8; i++) {
    for (i = 0; i < 8; i++) {
-      _LOAD16(e_key[i], key + 2 * i);
+      LOAD16(e_key[i], key + 2 * i);
    }
    }
    for (; i < LTC_IDEA_KEYLEN; i++) {
    for (; i < LTC_IDEA_KEYLEN; i++) {
       j = (i - i % 8) - 8;
       j = (i - i % 8) - 8;
-      e_key[i] = _LOW16((e_key[j+(i+1)%8] << 9) | (e_key[j+(i+2)%8] >> 7));
+      e_key[i] = LOW16((e_key[j+(i+1)%8] << 9) | (e_key[j+(i+2)%8] >> 7));
    }
    }
 
 
    /* prepare dec key */
    /* prepare dec key */
    for (i = 0; i < LTC_IDEA_ROUNDS; i++) {
    for (i = 0; i < LTC_IDEA_ROUNDS; i++) {
-      d_key[i*6+0] = _mul_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+0]);
-      d_key[i*6+1] = _add_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+1+(i>0 ? 1 : 0)]);
-      d_key[i*6+2] = _add_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+2-(i>0 ? 1 : 0)]);
-      d_key[i*6+3] = _mul_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+3]);
-      d_key[i*6+4] =          e_key[(LTC_IDEA_ROUNDS-1-i)*6+4];
-      d_key[i*6+5] =          e_key[(LTC_IDEA_ROUNDS-1-i)*6+5];
+      d_key[i*6+0] = s_mul_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+0]);
+      d_key[i*6+1] = s_add_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+1+(i>0 ? 1 : 0)]);
+      d_key[i*6+2] = s_add_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+2-(i>0 ? 1 : 0)]);
+      d_key[i*6+3] = s_mul_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+3]);
+      d_key[i*6+4] =           e_key[(LTC_IDEA_ROUNDS-1-i)*6+4];
+      d_key[i*6+5] =           e_key[(LTC_IDEA_ROUNDS-1-i)*6+5];
    }
    }
-   d_key[i*6+0] = _mul_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+0]);
-   d_key[i*6+1] = _add_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+1]);
-   d_key[i*6+2] = _add_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+2]);
-   d_key[i*6+3] = _mul_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+3]);
+   d_key[i*6+0] = s_mul_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+0]);
+   d_key[i*6+1] = s_add_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+1]);
+   d_key[i*6+2] = s_add_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+2]);
+   d_key[i*6+3] = s_mul_inv(e_key[(LTC_IDEA_ROUNDS-i)*6+3]);
 
 
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-static int _process_block(const unsigned char *in, unsigned char *out, const ushort16 *m_key)
+static int s_process_block(const unsigned char *in, unsigned char *out, const ushort16 *m_key)
 {
 {
    int i;
    int i;
    ushort16 x0, x1, x2, x3, t0, t1;
    ushort16 x0, x1, x2, x3, t0, t1;
 
 
-   _LOAD16(x0, in + 0);
-   _LOAD16(x1, in + 2);
-   _LOAD16(x2, in + 4);
-   _LOAD16(x3, in + 6);
+   LOAD16(x0, in + 0);
+   LOAD16(x1, in + 2);
+   LOAD16(x2, in + 4);
+   LOAD16(x3, in + 6);
 
 
    for (i = 0; i < LTC_IDEA_ROUNDS; i++) {
    for (i = 0; i < LTC_IDEA_ROUNDS; i++) {
-      _MUL(x0, m_key[i*6+0]);
+      MUL(x0, m_key[i*6+0]);
       x1 += m_key[i*6+1];
       x1 += m_key[i*6+1];
       x2 += m_key[i*6+2];
       x2 += m_key[i*6+2];
-      _MUL(x3, m_key[i*6+3]);
+      MUL(x3, m_key[i*6+3]);
       t0 = x0^x2;
       t0 = x0^x2;
-      _MUL(t0, m_key[i*6+4]);
+      MUL(t0, m_key[i*6+4]);
       t1 = t0 + (x1^x3);
       t1 = t0 + (x1^x3);
-      _MUL(t1, m_key[i*6+5]);
+      MUL(t1, m_key[i*6+5]);
       t0 += t1;
       t0 += t1;
       x0 ^= t1;
       x0 ^= t1;
       x3 ^= t0;
       x3 ^= t0;
@@ -125,15 +125,15 @@ static int _process_block(const unsigned char *in, unsigned char *out, const ush
       x2 = t0;
       x2 = t0;
    }
    }
 
 
-   _MUL(x0, m_key[LTC_IDEA_ROUNDS*6+0]);
+   MUL(x0, m_key[LTC_IDEA_ROUNDS*6+0]);
    x2 += m_key[LTC_IDEA_ROUNDS*6+1];
    x2 += m_key[LTC_IDEA_ROUNDS*6+1];
    x1 += m_key[LTC_IDEA_ROUNDS*6+2];
    x1 += m_key[LTC_IDEA_ROUNDS*6+2];
-   _MUL(x3, m_key[LTC_IDEA_ROUNDS*6+3]);
+   MUL(x3, m_key[LTC_IDEA_ROUNDS*6+3]);
 
 
-   _STORE16(x0, out + 0);
-   _STORE16(x2, out + 2);
-   _STORE16(x1, out + 4);
-   _STORE16(x3, out + 6);
+   STORE16(x0, out + 0);
+   STORE16(x2, out + 2);
+   STORE16(x1, out + 4);
+   STORE16(x3, out + 6);
 
 
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
@@ -146,12 +146,12 @@ int idea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_k
    if (num_rounds != 0 && num_rounds != 8) return CRYPT_INVALID_ROUNDS;
    if (num_rounds != 0 && num_rounds != 8) return CRYPT_INVALID_ROUNDS;
    if (keylen != 16) return CRYPT_INVALID_KEYSIZE;
    if (keylen != 16) return CRYPT_INVALID_KEYSIZE;
 
 
-   return _setup_key(key, skey);
+   return s_setup_key(key, skey);
 }
 }
 
 
 int idea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int idea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err = _process_block(pt, ct, skey->idea.ek);
+   int err = s_process_block(pt, ct, skey->idea.ek);
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
    burn_stack(sizeof(ushort16) * 6 + sizeof(int));
    burn_stack(sizeof(ushort16) * 6 + sizeof(int));
 #endif
 #endif
@@ -160,7 +160,7 @@ int idea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric
 
 
 int idea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int idea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err = _process_block(ct, pt, skey->idea.dk);
+   int err = s_process_block(ct, pt, skey->idea.dk);
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
    burn_stack(sizeof(ushort16) * 6 + sizeof(int));
    burn_stack(sizeof(ushort16) * 6 + sizeof(int));
 #endif
 #endif

+ 27 - 27
src/ciphers/multi2.c

@@ -9,12 +9,12 @@
 
 
 #ifdef LTC_MULTI2
 #ifdef LTC_MULTI2
 
 
-static void pi1(ulong32 *p)
+static void s_pi1(ulong32 *p)
 {
 {
    p[1] ^= p[0];
    p[1] ^= p[0];
 }
 }
 
 
-static void pi2(ulong32 *p, const ulong32 *k)
+static void s_pi2(ulong32 *p, const ulong32 *k)
 {
 {
    ulong32 t;
    ulong32 t;
    t = (p[1] + k[0]) & 0xFFFFFFFFUL;
    t = (p[1] + k[0]) & 0xFFFFFFFFUL;
@@ -23,7 +23,7 @@ static void pi2(ulong32 *p, const ulong32 *k)
    p[0] ^= t;
    p[0] ^= t;
 }
 }
 
 
-static void pi3(ulong32 *p, const ulong32 *k)
+static void s_pi3(ulong32 *p, const ulong32 *k)
 {
 {
    ulong32 t;
    ulong32 t;
    t = p[0] + k[1];
    t = p[0] + k[1];
@@ -35,7 +35,7 @@ static void pi3(ulong32 *p, const ulong32 *k)
    p[1] ^= t;
    p[1] ^= t;
 }
 }
 
 
-static void pi4(ulong32 *p, const ulong32 *k)
+static void s_pi4(ulong32 *p, const ulong32 *k)
 {
 {
    ulong32 t;
    ulong32 t;
    t = (p[1] + k[3])  & 0xFFFFFFFFUL;
    t = (p[1] + k[3])  & 0xFFFFFFFFUL;
@@ -43,7 +43,7 @@ static void pi4(ulong32 *p, const ulong32 *k)
    p[0] ^= t;
    p[0] ^= t;
 }
 }
 
 
-static void setup(const ulong32 *dk, const ulong32 *k, ulong32 *uk)
+static void s_setup(const ulong32 *dk, const ulong32 *k, ulong32 *uk)
 {
 {
    int n, t;
    int n, t;
    ulong32 p[2];
    ulong32 p[2];
@@ -52,46 +52,46 @@ static void setup(const ulong32 *dk, const ulong32 *k, ulong32 *uk)
 
 
    t = 4;
    t = 4;
    n = 0;
    n = 0;
-      pi1(p);
-      pi2(p, k);
+      s_pi1(p);
+      s_pi2(p, k);
       uk[n++] = p[0];
       uk[n++] = p[0];
-      pi3(p, k);
+      s_pi3(p, k);
       uk[n++] = p[1];
       uk[n++] = p[1];
-      pi4(p, k);
+      s_pi4(p, k);
       uk[n++] = p[0];
       uk[n++] = p[0];
-      pi1(p);
+      s_pi1(p);
       uk[n++] = p[1];
       uk[n++] = p[1];
-      pi2(p, k+t);
+      s_pi2(p, k+t);
       uk[n++] = p[0];
       uk[n++] = p[0];
-      pi3(p, k+t);
+      s_pi3(p, k+t);
       uk[n++] = p[1];
       uk[n++] = p[1];
-      pi4(p, k+t);
+      s_pi4(p, k+t);
       uk[n++] = p[0];
       uk[n++] = p[0];
-      pi1(p);
+      s_pi1(p);
       uk[n++] = p[1];
       uk[n++] = p[1];
 }
 }
 
 
-static void encrypt(ulong32 *p, int N, const ulong32 *uk)
+static void s_encrypt(ulong32 *p, int N, const ulong32 *uk)
 {
 {
    int n, t;
    int n, t;
    for (t = n = 0; ; ) {
    for (t = n = 0; ; ) {
-      pi1(p); if (++n == N) break;
-      pi2(p, uk+t); if (++n == N) break;
-      pi3(p, uk+t); if (++n == N) break;
-      pi4(p, uk+t); if (++n == N) break;
+      s_pi1(p); if (++n == N) break;
+      s_pi2(p, uk+t); if (++n == N) break;
+      s_pi3(p, uk+t); if (++n == N) break;
+      s_pi4(p, uk+t); if (++n == N) break;
       t ^= 4;
       t ^= 4;
    }
    }
 }
 }
 
 
-static void decrypt(ulong32 *p, int N, const ulong32 *uk)
+static void s_decrypt(ulong32 *p, int N, const ulong32 *uk)
 {
 {
    int n, t;
    int n, t;
    for (t = 4*(((N-1)>>2)&1), n = N; ;  ) {
    for (t = 4*(((N-1)>>2)&1), n = N; ;  ) {
       switch (n<=4 ? n : ((n-1)%4)+1) {
       switch (n<=4 ? n : ((n-1)%4)+1) {
-         case 4: pi4(p, uk+t); --n; /* FALLTHROUGH */
-         case 3: pi3(p, uk+t); --n; /* FALLTHROUGH */
-         case 2: pi2(p, uk+t); --n; /* FALLTHROUGH */
-         case 1: pi1(p); --n; break;
+         case 4: s_pi4(p, uk+t); --n; /* FALLTHROUGH */
+         case 3: s_pi3(p, uk+t); --n; /* FALLTHROUGH */
+         case 2: s_pi2(p, uk+t); --n; /* FALLTHROUGH */
+         case 1: s_pi1(p); --n; break;
          case 0: return;
          case 0: return;
       }
       }
       t ^= 4;
       t ^= 4;
@@ -128,7 +128,7 @@ int  multi2_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
    }
    }
    LOAD32H(dk[0], key + 32);
    LOAD32H(dk[0], key + 32);
    LOAD32H(dk[1], key + 36);
    LOAD32H(dk[1], key + 36);
-   setup(dk, sk, skey->multi2.uk);
+   s_setup(dk, sk, skey->multi2.uk);
 
 
    zeromem(sk, sizeof(sk));
    zeromem(sk, sizeof(sk));
    zeromem(dk, sizeof(dk));
    zeromem(dk, sizeof(dk));
@@ -150,7 +150,7 @@ int multi2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetr
    LTC_ARGCHK(skey != NULL);
    LTC_ARGCHK(skey != NULL);
    LOAD32H(p[0], pt);
    LOAD32H(p[0], pt);
    LOAD32H(p[1], pt+4);
    LOAD32H(p[1], pt+4);
-   encrypt(p, skey->multi2.N, skey->multi2.uk);
+   s_encrypt(p, skey->multi2.N, skey->multi2.uk);
    STORE32H(p[0], ct);
    STORE32H(p[0], ct);
    STORE32H(p[1], ct+4);
    STORE32H(p[1], ct+4);
    return CRYPT_OK;
    return CRYPT_OK;
@@ -171,7 +171,7 @@ int multi2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetr
    LTC_ARGCHK(skey != NULL);
    LTC_ARGCHK(skey != NULL);
    LOAD32H(p[0], ct);
    LOAD32H(p[0], ct);
    LOAD32H(p[1], ct+4);
    LOAD32H(p[1], ct+4);
-   decrypt(p, skey->multi2.N, skey->multi2.uk);
+   s_decrypt(p, skey->multi2.N, skey->multi2.uk);
    STORE32H(p[0], pt);
    STORE32H(p[0], pt);
    STORE32H(p[1], pt+4);
    STORE32H(p[1], pt+4);
    return CRYPT_OK;
    return CRYPT_OK;

+ 4 - 4
src/ciphers/noekeon.c

@@ -102,7 +102,7 @@ int noekeon_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
+static int s_noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #else
 #else
 int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #endif
 #endif
@@ -142,7 +142,7 @@ int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmet
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err = _noekeon_ecb_encrypt(pt, ct, skey);
+   int err = s_noekeon_ecb_encrypt(pt, ct, skey);
    burn_stack(sizeof(ulong32) * 5 + sizeof(int));
    burn_stack(sizeof(ulong32) * 5 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -156,7 +156,7 @@ int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmet
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
+static int s_noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #else
 #else
 int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #endif
 #endif
@@ -195,7 +195,7 @@ int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmet
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err = _noekeon_ecb_decrypt(ct, pt, skey);
+   int err = s_noekeon_ecb_decrypt(ct, pt, skey);
    burn_stack(sizeof(ulong32) * 5 + sizeof(int));
    burn_stack(sizeof(ulong32) * 5 + sizeof(int));
    return err;
    return err;
 }
 }

+ 4 - 4
src/ciphers/rc2.c

@@ -139,7 +139,7 @@ int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rc2_ecb_encrypt( const unsigned char *pt,
+static int s_rc2_ecb_encrypt( const unsigned char *pt,
                             unsigned char *ct,
                             unsigned char *ct,
                             const symmetric_key *skey)
                             const symmetric_key *skey)
 #else
 #else
@@ -200,7 +200,7 @@ int rc2_ecb_encrypt( const unsigned char *pt,
                             unsigned char *ct,
                             unsigned char *ct,
                             const symmetric_key *skey)
                             const symmetric_key *skey)
 {
 {
-    int err = _rc2_ecb_encrypt(pt, ct, skey);
+    int err = s_rc2_ecb_encrypt(pt, ct, skey);
     burn_stack(sizeof(unsigned *) + sizeof(unsigned) * 5);
     burn_stack(sizeof(unsigned *) + sizeof(unsigned) * 5);
     return err;
     return err;
 }
 }
@@ -217,7 +217,7 @@ int rc2_ecb_encrypt( const unsigned char *pt,
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rc2_ecb_decrypt( const unsigned char *ct,
+static int s_rc2_ecb_decrypt( const unsigned char *ct,
                             unsigned char *pt,
                             unsigned char *pt,
                             const symmetric_key *skey)
                             const symmetric_key *skey)
 #else
 #else
@@ -279,7 +279,7 @@ int rc2_ecb_decrypt( const unsigned char *ct,
                             unsigned char *pt,
                             unsigned char *pt,
                             const symmetric_key *skey)
                             const symmetric_key *skey)
 {
 {
-    int err = _rc2_ecb_decrypt(ct, pt, skey);
+    int err = s_rc2_ecb_decrypt(ct, pt, skey);
     burn_stack(sizeof(unsigned *) + sizeof(unsigned) * 4 + sizeof(int));
     burn_stack(sizeof(unsigned *) + sizeof(unsigned) * 4 + sizeof(int));
     return err;
     return err;
 }
 }

+ 6 - 6
src/ciphers/rc5.c

@@ -43,7 +43,7 @@ static const ulong32 stab[50] = {
     @return CRYPT_OK if successful
     @return CRYPT_OK if successful
  */
  */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
+static int s_rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #else
 #else
 int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #endif
 #endif
@@ -104,7 +104,7 @@ int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
 int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 {
 {
    int x;
    int x;
-   x = _rc5_setup(key, keylen, num_rounds, skey);
+   x = s_rc5_setup(key, keylen, num_rounds, skey);
    burn_stack(sizeof(ulong32) * 122 + sizeof(int));
    burn_stack(sizeof(ulong32) * 122 + sizeof(int));
    return x;
    return x;
 }
 }
@@ -118,7 +118,7 @@ int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
+static int s_rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #else
 #else
 int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #endif
 #endif
@@ -164,7 +164,7 @@ int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err = _rc5_ecb_encrypt(pt, ct, skey);
+   int err = s_rc5_ecb_encrypt(pt, ct, skey);
    burn_stack(sizeof(ulong32) * 2 + sizeof(int));
    burn_stack(sizeof(ulong32) * 2 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -178,7 +178,7 @@ int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
+static int s_rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #else
 #else
 int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #endif
 #endif
@@ -225,7 +225,7 @@ int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err = _rc5_ecb_decrypt(ct, pt, skey);
+   int err = s_rc5_ecb_decrypt(ct, pt, skey);
    burn_stack(sizeof(ulong32) * 2 + sizeof(int));
    burn_stack(sizeof(ulong32) * 2 + sizeof(int));
    return err;
    return err;
 }
 }

+ 6 - 6
src/ciphers/rc6.c

@@ -40,7 +40,7 @@ static const ulong32 stab[44] = {
     @return CRYPT_OK if successful
     @return CRYPT_OK if successful
  */
  */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
+static int s_rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #else
 #else
 int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #endif
 #endif
@@ -99,7 +99,7 @@ int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
 int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 {
 {
    int x;
    int x;
-   x = _rc6_setup(key, keylen, num_rounds, skey);
+   x = s_rc6_setup(key, keylen, num_rounds, skey);
    burn_stack(sizeof(ulong32) * 122);
    burn_stack(sizeof(ulong32) * 122);
    return x;
    return x;
 }
 }
@@ -112,7 +112,7 @@ int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
   @param skey The key as scheduled
   @param skey The key as scheduled
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
+static int s_rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #else
 #else
 int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #endif
 #endif
@@ -154,7 +154,7 @@ int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err = _rc6_ecb_encrypt(pt, ct, skey);
+   int err = s_rc6_ecb_encrypt(pt, ct, skey);
    burn_stack(sizeof(ulong32) * 6 + sizeof(int));
    burn_stack(sizeof(ulong32) * 6 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -167,7 +167,7 @@ int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_
   @param skey The key as scheduled
   @param skey The key as scheduled
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
+static int s_rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #else
 #else
 int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #endif
 #endif
@@ -211,7 +211,7 @@ int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err = _rc6_ecb_decrypt(ct, pt, skey);
+   int err = s_rc6_ecb_decrypt(ct, pt, skey);
    burn_stack(sizeof(ulong32) * 6 + sizeof(int));
    burn_stack(sizeof(ulong32) * 6 + sizeof(int));
    return err;
    return err;
 }
 }

+ 13 - 13
src/ciphers/safer/safer.c

@@ -24,7 +24,7 @@
 
 
 #ifdef LTC_SAFER
 #ifdef LTC_SAFER
 
 
-#define __LTC_SAFER_TAB_C__
+#define LTC_SAFER_TAB_C
 #include "safer_tab.c"
 #include "safer_tab.c"
 
 
 const struct ltc_cipher_descriptor safer_k64_desc = {
 const struct ltc_cipher_descriptor safer_k64_desc = {
@@ -91,13 +91,13 @@ const struct ltc_cipher_descriptor safer_k64_desc = {
 /******************* Types ****************************************************/
 /******************* Types ****************************************************/
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static void _Safer_Expand_Userkey(const unsigned char *userkey_1,
+static void s_safer_expand_userkey(const unsigned char *userkey_1,
                                  const unsigned char *userkey_2,
                                  const unsigned char *userkey_2,
                                  unsigned int nof_rounds,
                                  unsigned int nof_rounds,
                                  int strengthened,
                                  int strengthened,
                                  safer_key_t key)
                                  safer_key_t key)
 #else
 #else
-static void Safer_Expand_Userkey(const unsigned char *userkey_1,
+static void safer_expand_userkey(const unsigned char *userkey_1,
                                  const unsigned char *userkey_2,
                                  const unsigned char *userkey_2,
                                  unsigned int nof_rounds,
                                  unsigned int nof_rounds,
                                  int strengthened,
                                  int strengthened,
@@ -160,13 +160,13 @@ static void Safer_Expand_Userkey(const unsigned char *userkey_1,
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static void Safer_Expand_Userkey(const unsigned char *userkey_1,
+static void safer_expand_userkey(const unsigned char *userkey_1,
                                  const unsigned char *userkey_2,
                                  const unsigned char *userkey_2,
                                  unsigned int nof_rounds,
                                  unsigned int nof_rounds,
                                  int strengthened,
                                  int strengthened,
                                  safer_key_t key)
                                  safer_key_t key)
 {
 {
-   _Safer_Expand_Userkey(userkey_1, userkey_2, nof_rounds, strengthened, key);
+   s_safer_expand_userkey(userkey_1, userkey_2, nof_rounds, strengthened, key);
    burn_stack(sizeof(unsigned char) * (2 * (LTC_SAFER_BLOCK_LEN + 1)) + sizeof(unsigned int)*2);
    burn_stack(sizeof(unsigned char) * (2 * (LTC_SAFER_BLOCK_LEN + 1)) + sizeof(unsigned int)*2);
 }
 }
 #endif
 #endif
@@ -184,7 +184,7 @@ int safer_k64_setup(const unsigned char *key, int keylen, int num_rounds, symmet
       return CRYPT_INVALID_KEYSIZE;
       return CRYPT_INVALID_KEYSIZE;
    }
    }
 
 
-   Safer_Expand_Userkey(key, key, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
+   safer_expand_userkey(key, key, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
@@ -201,7 +201,7 @@ int safer_sk64_setup(const unsigned char *key, int keylen, int num_rounds, symme
       return CRYPT_INVALID_KEYSIZE;
       return CRYPT_INVALID_KEYSIZE;
    }
    }
 
 
-   Safer_Expand_Userkey(key, key, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
+   safer_expand_userkey(key, key, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
@@ -218,7 +218,7 @@ int safer_k128_setup(const unsigned char *key, int keylen, int num_rounds, symme
       return CRYPT_INVALID_KEYSIZE;
       return CRYPT_INVALID_KEYSIZE;
    }
    }
 
 
-   Safer_Expand_Userkey(key, key+8, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
+   safer_expand_userkey(key, key+8, (unsigned int)(num_rounds != 0 ?num_rounds:LTC_SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
@@ -235,12 +235,12 @@ int safer_sk128_setup(const unsigned char *key, int keylen, int num_rounds, symm
       return CRYPT_INVALID_KEYSIZE;
       return CRYPT_INVALID_KEYSIZE;
    }
    }
 
 
-   Safer_Expand_Userkey(key, key+8, (unsigned int)(num_rounds != 0?num_rounds:LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
+   safer_expand_userkey(key, key+8, (unsigned int)(num_rounds != 0?num_rounds:LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _safer_ecb_encrypt(const unsigned char *pt,
+static int s_safer_ecb_encrypt(const unsigned char *pt,
                              unsigned char *ct,
                              unsigned char *ct,
                              const symmetric_key *skey)
                              const symmetric_key *skey)
 #else
 #else
@@ -287,14 +287,14 @@ int safer_ecb_encrypt(const unsigned char *pt,
                              unsigned char *ct,
                              unsigned char *ct,
                              const symmetric_key *skey)
                              const symmetric_key *skey)
 {
 {
-    int err = _safer_ecb_encrypt(pt, ct, skey);
+    int err = s_safer_ecb_encrypt(pt, ct, skey);
     burn_stack(sizeof(unsigned char) * 9 + sizeof(unsigned int) + sizeof(unsigned char *));
     burn_stack(sizeof(unsigned char) * 9 + sizeof(unsigned int) + sizeof(unsigned char *));
     return err;
     return err;
 }
 }
 #endif
 #endif
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _safer_ecb_decrypt(const unsigned char *ct,
+static int s_safer_ecb_decrypt(const unsigned char *ct,
                              unsigned char *pt,
                              unsigned char *pt,
                              const symmetric_key *skey)
                              const symmetric_key *skey)
 #else
 #else
@@ -342,7 +342,7 @@ int safer_ecb_decrypt(const unsigned char *ct,
                              unsigned char *pt,
                              unsigned char *pt,
                              const symmetric_key *skey)
                              const symmetric_key *skey)
 {
 {
-    int err = _safer_ecb_decrypt(ct, pt, skey);
+    int err = s_safer_ecb_decrypt(ct, pt, skey);
     burn_stack(sizeof(unsigned char) * 9 + sizeof(unsigned int) + sizeof(unsigned char *));
     burn_stack(sizeof(unsigned char) * 9 + sizeof(unsigned int) + sizeof(unsigned char *));
     return err;
     return err;
 }
 }

+ 2 - 2
src/ciphers/safer/safer_tab.c

@@ -6,7 +6,7 @@
   Tables for LTC_SAFER block ciphers
   Tables for LTC_SAFER block ciphers
 */
 */
 
 
-#ifdef __LTC_SAFER_TAB_C__
+#ifdef LTC_SAFER_TAB_C
 
 
 /* This is the box defined by ebox[x] = 45^x mod 257.
 /* This is the box defined by ebox[x] = 45^x mod 257.
  * Its assumed that the value "256" corresponds to zero. */
  * Its assumed that the value "256" corresponds to zero. */
@@ -49,6 +49,6 @@ static const unsigned char safer_lbox[256] = {
 184,  64, 120,  45,  58, 233, 100,  31, 146, 144, 125,  57, 111, 224, 137,  48
 184,  64, 120,  45,  58, 233, 100,  31, 146, 144, 125,  57, 111, 224, 137,  48
 };
 };
 
 
-#endif /* __LTC_SAFER_TAB_C__ */
+#endif /* LTC_SAFER_TAB_C */
 
 
 
 

+ 9 - 9
src/ciphers/safer/saferp.c

@@ -9,7 +9,7 @@
 
 
 #ifdef LTC_SAFERP
 #ifdef LTC_SAFERP
 
 
-#define __LTC_SAFER_TAB_C__
+#define LTC_SAFER_TAB_C
 #include "safer_tab.c"
 #include "safer_tab.c"
 
 
 const struct ltc_cipher_descriptor saferp_desc =
 const struct ltc_cipher_descriptor saferp_desc =
@@ -137,37 +137,37 @@ const struct ltc_cipher_descriptor saferp_desc =
 
 
 #ifdef LTC_SMALL_CODE
 #ifdef LTC_SMALL_CODE
 
 
-static void _round(unsigned char *b, int i, const symmetric_key *skey)
+static void s_round(unsigned char *b, int i, const symmetric_key *skey)
 {
 {
    ROUND(b, i);
    ROUND(b, i);
 }
 }
 
 
-static void _iround(unsigned char *b, int i, const symmetric_key *skey)
+static void s_iround(unsigned char *b, int i, const symmetric_key *skey)
 {
 {
    iROUND(b, i);
    iROUND(b, i);
 }
 }
 
 
-static void _lt(unsigned char *b, unsigned char *b2)
+static void s_lt(unsigned char *b, unsigned char *b2)
 {
 {
    LT(b, b2);
    LT(b, b2);
 }
 }
 
 
-static void _ilt(unsigned char *b, unsigned char *b2)
+static void s_ilt(unsigned char *b, unsigned char *b2)
 {
 {
    iLT(b, b2);
    iLT(b, b2);
 }
 }
 
 
 #undef ROUND
 #undef ROUND
-#define ROUND(b, i) _round(b, i, skey)
+#define ROUND(b, i) s_round(b, i, skey)
 
 
 #undef iROUND
 #undef iROUND
-#define iROUND(b, i) _iround(b, i, skey)
+#define iROUND(b, i) s_iround(b, i, skey)
 
 
 #undef LT
 #undef LT
-#define LT(b, b2) _lt(b, b2)
+#define LT(b, b2) s_lt(b, b2)
 
 
 #undef iLT
 #undef iLT
-#define iLT(b, b2) _ilt(b, b2)
+#define iLT(b, b2) s_ilt(b, b2)
 
 
 #endif
 #endif
 
 

+ 74 - 74
src/ciphers/serpent.c

@@ -27,7 +27,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
 };
 };
 
 
 /* linear transformation */
 /* linear transformation */
-#define _LT(i,a,b,c,d,e)  {                                 \
+#define s_lt(i,a,b,c,d,e)  {                                 \
                             a = ROLc(a, 13);                \
                             a = ROLc(a, 13);                \
                             c = ROLc(c, 3);                 \
                             c = ROLc(c, 3);                 \
                             d = ROLc(d ^ c ^ (a << 3), 7);  \
                             d = ROLc(d ^ c ^ (a << 3), 7);  \
@@ -37,7 +37,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
                           }
                           }
 
 
 /* inverse linear transformation */
 /* inverse linear transformation */
-#define _ILT(i,a,b,c,d,e) {                                 \
+#define s_ilt(i,a,b,c,d,e) {                                 \
                             c = RORc(c, 22);                \
                             c = RORc(c, 22);                \
                             a = RORc(a, 5);                 \
                             a = RORc(a, 5);                 \
                             c ^= d ^ (b << 7);              \
                             c ^= d ^ (b << 7);              \
@@ -50,32 +50,32 @@ const struct ltc_cipher_descriptor serpent_desc = {
                           }
                           }
 
 
 /* order of output from S-box functions */
 /* order of output from S-box functions */
-#define _beforeS0(f) f(0,a,b,c,d,e)
-#define _afterS0(f)  f(1,b,e,c,a,d)
-#define _afterS1(f)  f(2,c,b,a,e,d)
-#define _afterS2(f)  f(3,a,e,b,d,c)
-#define _afterS3(f)  f(4,e,b,d,c,a)
-#define _afterS4(f)  f(5,b,a,e,c,d)
-#define _afterS5(f)  f(6,a,c,b,e,d)
-#define _afterS6(f)  f(7,a,c,d,b,e)
-#define _afterS7(f)  f(8,d,e,b,a,c)
+#define s_beforeS0(f) f(0,a,b,c,d,e)
+#define s_afterS0(f)  f(1,b,e,c,a,d)
+#define s_afterS1(f)  f(2,c,b,a,e,d)
+#define s_afterS2(f)  f(3,a,e,b,d,c)
+#define s_afterS3(f)  f(4,e,b,d,c,a)
+#define s_afterS4(f)  f(5,b,a,e,c,d)
+#define s_afterS5(f)  f(6,a,c,b,e,d)
+#define s_afterS6(f)  f(7,a,c,d,b,e)
+#define s_afterS7(f)  f(8,d,e,b,a,c)
 
 
 /* order of output from inverse S-box functions */
 /* order of output from inverse S-box functions */
-#define _beforeI7(f) f(8,a,b,c,d,e)
-#define _afterI7(f)  f(7,d,a,b,e,c)
-#define _afterI6(f)  f(6,a,b,c,e,d)
-#define _afterI5(f)  f(5,b,d,e,c,a)
-#define _afterI4(f)  f(4,b,c,e,a,d)
-#define _afterI3(f)  f(3,a,b,e,c,d)
-#define _afterI2(f)  f(2,b,d,e,c,a)
-#define _afterI1(f)  f(1,a,b,c,e,d)
-#define _afterI0(f)  f(0,a,d,b,e,c)
+#define s_beforeI7(f) f(8,a,b,c,d,e)
+#define s_afterI7(f)  f(7,d,a,b,e,c)
+#define s_afterI6(f)  f(6,a,b,c,e,d)
+#define s_afterI5(f)  f(5,b,d,e,c,a)
+#define s_afterI4(f)  f(4,b,c,e,a,d)
+#define s_afterI3(f)  f(3,a,b,e,c,d)
+#define s_afterI2(f)  f(2,b,d,e,c,a)
+#define s_afterI1(f)  f(1,a,b,c,e,d)
+#define s_afterI0(f)  f(0,a,d,b,e,c)
 
 
 /* The instruction sequences for the S-box functions
 /* The instruction sequences for the S-box functions
  * come from Dag Arne Osvik's paper "Speeding up Serpent".
  * come from Dag Arne Osvik's paper "Speeding up Serpent".
  */
  */
 
 
-#define _S0(i, r0, r1, r2, r3, r4) { \
+#define s_s0(i, r0, r1, r2, r3, r4) { \
    r3 ^= r0;   \
    r3 ^= r0;   \
    r4 = r1;    \
    r4 = r1;    \
    r1 &= r3;   \
    r1 &= r3;   \
@@ -96,7 +96,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r4 ^= r3;   \
    r4 ^= r3;   \
 }
 }
 
 
-#define _I0(i, r0, r1, r2, r3, r4) { \
+#define s_i0(i, r0, r1, r2, r3, r4) { \
    r2 = ~r2;   \
    r2 = ~r2;   \
    r4 = r1;    \
    r4 = r1;    \
    r1 |= r0;   \
    r1 |= r0;   \
@@ -118,7 +118,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r4 ^= r2;   \
    r4 ^= r2;   \
 }
 }
 
 
-#define _S1(i, r0, r1, r2, r3, r4) { \
+#define s_s1(i, r0, r1, r2, r3, r4) { \
    r0 = ~r0;   \
    r0 = ~r0;   \
    r2 = ~r2;   \
    r2 = ~r2;   \
    r4 = r0;    \
    r4 = r0;    \
@@ -139,7 +139,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r0 ^= r4;   \
    r0 ^= r4;   \
 }
 }
 
 
-#define _I1(i, r0, r1, r2, r3, r4) { \
+#define s_i1(i, r0, r1, r2, r3, r4) { \
    r4 = r1;    \
    r4 = r1;    \
    r1 ^= r3;   \
    r1 ^= r3;   \
    r3 &= r1;   \
    r3 &= r1;   \
@@ -161,7 +161,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r3 ^= r1;   \
    r3 ^= r1;   \
 }
 }
 
 
-#define _S2(i, r0, r1, r2, r3, r4) { \
+#define s_s2(i, r0, r1, r2, r3, r4) { \
    r4 = r0;    \
    r4 = r0;    \
    r0 &= r2;   \
    r0 &= r2;   \
    r0 ^= r3;   \
    r0 ^= r3;   \
@@ -180,7 +180,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r4 = ~r4;   \
    r4 = ~r4;   \
 }
 }
 
 
-#define _I2(i, r0, r1, r2, r3, r4) { \
+#define s_i2(i, r0, r1, r2, r3, r4) { \
    r2 ^= r3;   \
    r2 ^= r3;   \
    r3 ^= r0;   \
    r3 ^= r0;   \
    r4 = r3;    \
    r4 = r3;    \
@@ -202,7 +202,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r3 ^= r0;   \
    r3 ^= r0;   \
 }
 }
 
 
-#define _S3(i, r0, r1, r2, r3, r4) { \
+#define s_s3(i, r0, r1, r2, r3, r4) { \
    r4 = r0;    \
    r4 = r0;    \
    r0 |= r3;   \
    r0 |= r3;   \
    r3 ^= r1;   \
    r3 ^= r1;   \
@@ -224,7 +224,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r1 ^= r0;   \
    r1 ^= r0;   \
 }
 }
 
 
-#define _I3(i, r0, r1, r2, r3, r4) { \
+#define s_i3(i, r0, r1, r2, r3, r4) { \
    r4 = r2;    \
    r4 = r2;    \
    r2 ^= r1;   \
    r2 ^= r1;   \
    r1 &= r2;   \
    r1 &= r2;   \
@@ -245,7 +245,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r2 ^= r4;   \
    r2 ^= r4;   \
 }
 }
 
 
-#define _S4(i, r0, r1, r2, r3, r4) { \
+#define s_s4(i, r0, r1, r2, r3, r4) { \
    r1 ^= r3;   \
    r1 ^= r3;   \
    r3 = ~r3;   \
    r3 = ~r3;   \
    r2 ^= r3;   \
    r2 ^= r3;   \
@@ -268,7 +268,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r4 ^= r2;   \
    r4 ^= r2;   \
 }
 }
 
 
-#define _I4(i, r0, r1, r2, r3, r4) { \
+#define s_i4(i, r0, r1, r2, r3, r4) { \
    r4 = r2;    \
    r4 = r2;    \
    r2 &= r3;   \
    r2 &= r3;   \
    r2 ^= r1;   \
    r2 ^= r1;   \
@@ -291,7 +291,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r2 ^= r1;   \
    r2 ^= r1;   \
 }
 }
 
 
-#define _S5(i, r0, r1, r2, r3, r4) { \
+#define s_s5(i, r0, r1, r2, r3, r4) { \
    r0 ^= r1;   \
    r0 ^= r1;   \
    r1 ^= r3;   \
    r1 ^= r3;   \
    r3 = ~r3;   \
    r3 = ~r3;   \
@@ -313,7 +313,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r2 ^= r4;   \
    r2 ^= r4;   \
 }
 }
 
 
-#define _I5(i, r0, r1, r2, r3, r4) { \
+#define s_i5(i, r0, r1, r2, r3, r4) { \
    r1 = ~r1;   \
    r1 = ~r1;   \
    r4 = r3;    \
    r4 = r3;    \
    r2 ^= r1;   \
    r2 ^= r1;   \
@@ -335,7 +335,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r4 = ~r4;   \
    r4 = ~r4;   \
 }
 }
 
 
-#define _S6(i, r0, r1, r2, r3, r4) { \
+#define s_s6(i, r0, r1, r2, r3, r4) { \
    r2 = ~r2;   \
    r2 = ~r2;   \
    r4 = r3;    \
    r4 = r3;    \
    r3 &= r0;   \
    r3 &= r0;   \
@@ -356,7 +356,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r2 ^= r3;   \
    r2 ^= r3;   \
 }
 }
 
 
-#define _I6(i, r0, r1, r2, r3, r4) { \
+#define s_i6(i, r0, r1, r2, r3, r4) { \
    r0 ^= r2;   \
    r0 ^= r2;   \
    r4 = r2;    \
    r4 = r2;    \
    r2 &= r0;   \
    r2 &= r0;   \
@@ -376,7 +376,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r4 ^= r0;   \
    r4 ^= r0;   \
 }
 }
 
 
-#define _S7(i, r0, r1, r2, r3, r4) { \
+#define s_s7(i, r0, r1, r2, r3, r4) { \
    r4 = r2;    \
    r4 = r2;    \
    r2 &= r1;   \
    r2 &= r1;   \
    r2 ^= r3;   \
    r2 ^= r3;   \
@@ -399,7 +399,7 @@ const struct ltc_cipher_descriptor serpent_desc = {
    r4 ^= r1;   \
    r4 ^= r1;   \
 }
 }
 
 
-#define _I7(i, r0, r1, r2, r3, r4) { \
+#define s_i7(i, r0, r1, r2, r3, r4) { \
    r4 = r2;    \
    r4 = r2;    \
    r2 ^= r0;   \
    r2 ^= r0;   \
    r0 &= r3;   \
    r0 &= r3;   \
@@ -422,28 +422,28 @@ const struct ltc_cipher_descriptor serpent_desc = {
 }
 }
 
 
 /* key xor */
 /* key xor */
-#define _KX(r, a, b, c, d, e) { \
+#define s_kx(r, a, b, c, d, e) { \
    a ^= k[4 * r + 0];   \
    a ^= k[4 * r + 0];   \
    b ^= k[4 * r + 1];   \
    b ^= k[4 * r + 1];   \
    c ^= k[4 * r + 2];   \
    c ^= k[4 * r + 2];   \
    d ^= k[4 * r + 3];   \
    d ^= k[4 * r + 3];   \
 }
 }
 
 
-#define _LK(r, a, b, c, d, e) { \
+#define s_lk(r, a, b, c, d, e) { \
    a = k[(8-r)*4 + 0];  \
    a = k[(8-r)*4 + 0];  \
    b = k[(8-r)*4 + 1];  \
    b = k[(8-r)*4 + 1];  \
    c = k[(8-r)*4 + 2];  \
    c = k[(8-r)*4 + 2];  \
    d = k[(8-r)*4 + 3];  \
    d = k[(8-r)*4 + 3];  \
 }
 }
 
 
-#define _SK(r, a, b, c, d, e) { \
+#define s_sk(r, a, b, c, d, e) { \
    k[(8-r)*4 + 4] = a;  \
    k[(8-r)*4 + 4] = a;  \
    k[(8-r)*4 + 5] = b;  \
    k[(8-r)*4 + 5] = b;  \
    k[(8-r)*4 + 6] = c;  \
    k[(8-r)*4 + 6] = c;  \
    k[(8-r)*4 + 7] = d;  \
    k[(8-r)*4 + 7] = d;  \
 }
 }
 
 
-static int _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;
    ulong32 t;
    ulong32 t;
@@ -467,22 +467,22 @@ static int _setup_key(const unsigned char *key, int keylen, int rounds, ulong32
    k -= 20;
    k -= 20;
 
 
    for (i = 0; i < rounds/8; i++) {
    for (i = 0; i < rounds/8; i++) {
-      _afterS2(_LK);  _afterS2(_S3);  _afterS3(_SK);
-      _afterS1(_LK);  _afterS1(_S2);  _afterS2(_SK);
-      _afterS0(_LK);  _afterS0(_S1);  _afterS1(_SK);
-      _beforeS0(_LK); _beforeS0(_S0); _afterS0(_SK);
+      s_afterS2(s_lk);  s_afterS2(s_s3);  s_afterS3(s_sk);
+      s_afterS1(s_lk);  s_afterS1(s_s2);  s_afterS2(s_sk);
+      s_afterS0(s_lk);  s_afterS0(s_s1);  s_afterS1(s_sk);
+      s_beforeS0(s_lk); s_beforeS0(s_s0); s_afterS0(s_sk);
       k += 8*4;
       k += 8*4;
-      _afterS6(_LK); _afterS6(_S7); _afterS7(_SK);
-      _afterS5(_LK); _afterS5(_S6); _afterS6(_SK);
-      _afterS4(_LK); _afterS4(_S5); _afterS5(_SK);
-      _afterS3(_LK); _afterS3(_S4); _afterS4(_SK);
+      s_afterS6(s_lk); s_afterS6(s_s7); s_afterS7(s_sk);
+      s_afterS5(s_lk); s_afterS5(s_s6); s_afterS6(s_sk);
+      s_afterS4(s_lk); s_afterS4(s_s5); s_afterS5(s_sk);
+      s_afterS3(s_lk); s_afterS3(s_s4); s_afterS4(s_sk);
    }
    }
-   _afterS2(_LK); _afterS2(_S3); _afterS3(_SK);
+   s_afterS2(s_lk); s_afterS2(s_s3); s_afterS3(s_sk);
 
 
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-static int _enc_block(const unsigned char *in, unsigned char *out, const ulong32 *k)
+static int s_enc_block(const unsigned char *in, unsigned char *out, const ulong32 *k)
 {
 {
    ulong32 a, b, c, d, e;
    ulong32 a, b, c, d, e;
    unsigned int i = 1;
    unsigned int i = 1;
@@ -493,14 +493,14 @@ static int _enc_block(const unsigned char *in, unsigned char *out, const ulong32
    LOAD32L(d, in + 12);
    LOAD32L(d, in + 12);
 
 
    do {
    do {
-      _beforeS0(_KX); _beforeS0(_S0); _afterS0(_LT);
-      _afterS0(_KX);  _afterS0(_S1);  _afterS1(_LT);
-      _afterS1(_KX);  _afterS1(_S2);  _afterS2(_LT);
-      _afterS2(_KX);  _afterS2(_S3);  _afterS3(_LT);
-      _afterS3(_KX);  _afterS3(_S4);  _afterS4(_LT);
-      _afterS4(_KX);  _afterS4(_S5);  _afterS5(_LT);
-      _afterS5(_KX);  _afterS5(_S6);  _afterS6(_LT);
-      _afterS6(_KX);  _afterS6(_S7);
+      s_beforeS0(s_kx); s_beforeS0(s_s0); s_afterS0(s_lt);
+       s_afterS0(s_kx);  s_afterS0(s_s1); s_afterS1(s_lt);
+       s_afterS1(s_kx);  s_afterS1(s_s2); s_afterS2(s_lt);
+       s_afterS2(s_kx);  s_afterS2(s_s3); s_afterS3(s_lt);
+       s_afterS3(s_kx);  s_afterS3(s_s4); s_afterS4(s_lt);
+       s_afterS4(s_kx);  s_afterS4(s_s5); s_afterS5(s_lt);
+       s_afterS5(s_kx);  s_afterS5(s_s6); s_afterS6(s_lt);
+       s_afterS6(s_kx);  s_afterS6(s_s7);
 
 
       if (i == 4) break;
       if (i == 4) break;
 
 
@@ -511,10 +511,10 @@ static int _enc_block(const unsigned char *in, unsigned char *out, const ulong32
       d = a;
       d = a;
       a = e;
       a = e;
       k += 32;
       k += 32;
-      _beforeS0(_LT);
+      s_beforeS0(s_lt);
    } while (1);
    } while (1);
 
 
-   _afterS7(_KX);
+   s_afterS7(s_kx);
 
 
    STORE32L(d, out + 0);
    STORE32L(d, out + 0);
    STORE32L(e, out + 4);
    STORE32L(e, out + 4);
@@ -524,7 +524,7 @@ static int _enc_block(const unsigned char *in, unsigned char *out, const ulong32
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-static int _dec_block(const unsigned char *in, unsigned char *out, const ulong32 *k)
+static int s_dec_block(const unsigned char *in, unsigned char *out, const ulong32 *k)
 {
 {
    ulong32 a, b, c, d, e;
    ulong32 a, b, c, d, e;
    unsigned int i;
    unsigned int i;
@@ -537,7 +537,7 @@ static int _dec_block(const unsigned char *in, unsigned char *out, const ulong32
    i = 4;
    i = 4;
    k += 96;
    k += 96;
 
 
-   _beforeI7(_KX);
+   s_beforeI7(s_kx);
    goto start;
    goto start;
 
 
    do {
    do {
@@ -545,16 +545,16 @@ static int _dec_block(const unsigned char *in, unsigned char *out, const ulong32
       b = d;
       b = d;
       d = e;
       d = e;
       k -= 32;
       k -= 32;
-      _beforeI7(_ILT);
+      s_beforeI7(s_ilt);
 start:
 start:
-                      _beforeI7(_I7); _afterI7(_KX);
-      _afterI7(_ILT); _afterI7(_I6);  _afterI6(_KX);
-      _afterI6(_ILT); _afterI6(_I5);  _afterI5(_KX);
-      _afterI5(_ILT); _afterI5(_I4);  _afterI4(_KX);
-      _afterI4(_ILT); _afterI4(_I3);  _afterI3(_KX);
-      _afterI3(_ILT); _afterI3(_I2);  _afterI2(_KX);
-      _afterI2(_ILT); _afterI2(_I1);  _afterI1(_KX);
-      _afterI1(_ILT); _afterI1(_I0);  _afterI0(_KX);
+                      s_beforeI7(s_i7); s_afterI7(s_kx);
+      s_afterI7(s_ilt); s_afterI7(s_i6); s_afterI6(s_kx);
+      s_afterI6(s_ilt); s_afterI6(s_i5); s_afterI5(s_kx);
+      s_afterI5(s_ilt); s_afterI5(s_i4); s_afterI4(s_kx);
+      s_afterI4(s_ilt); s_afterI4(s_i3); s_afterI3(s_kx);
+      s_afterI3(s_ilt); s_afterI3(s_i2); s_afterI2(s_kx);
+      s_afterI2(s_ilt); s_afterI2(s_i1); s_afterI1(s_kx);
+      s_afterI1(s_ilt); s_afterI1(s_i0); s_afterI0(s_kx);
    } while (--i != 0);
    } while (--i != 0);
 
 
    STORE32L(a, out + 0);
    STORE32L(a, out + 0);
@@ -575,7 +575,7 @@ int serpent_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
    if (num_rounds != 0 && num_rounds != 32) return CRYPT_INVALID_ROUNDS;
    if (num_rounds != 0 && num_rounds != 32) return CRYPT_INVALID_ROUNDS;
    if (keylen != 16 && keylen != 24 && keylen != 32) return CRYPT_INVALID_KEYSIZE;
    if (keylen != 16 && keylen != 24 && keylen != 32) return CRYPT_INVALID_KEYSIZE;
 
 
-   err = _setup_key(key, keylen, 32, skey->serpent.k);
+   err = s_setup_key(key, keylen, 32, skey->serpent.k);
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
    burn_stack(sizeof(ulong32) * 14 + sizeof(int));
    burn_stack(sizeof(ulong32) * 14 + sizeof(int));
 #endif
 #endif
@@ -584,7 +584,7 @@ int serpent_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
 
 
 int serpent_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int serpent_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err = _enc_block(pt, ct, skey->serpent.k);
+   int err = s_enc_block(pt, ct, skey->serpent.k);
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
    burn_stack(sizeof(ulong32) * 5 + sizeof(int));
    burn_stack(sizeof(ulong32) * 5 + sizeof(int));
 #endif
 #endif
@@ -593,7 +593,7 @@ int serpent_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmet
 
 
 int serpent_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int serpent_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err = _dec_block(ct, pt, skey->serpent.k);
+   int err = s_dec_block(ct, pt, skey->serpent.k);
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
    burn_stack(sizeof(ulong32) * 5 + sizeof(int));
    burn_stack(sizeof(ulong32) * 5 + sizeof(int));
 #endif
 #endif

+ 4 - 4
src/ciphers/skipjack.c

@@ -133,7 +133,7 @@ static unsigned ig_func(unsigned w, int *kp, const unsigned char *key)
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
+static int s_skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #else
 #else
 int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #endif
 #endif
@@ -183,7 +183,7 @@ int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symme
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err = _skipjack_ecb_encrypt(pt, ct, skey);
+   int err = s_skipjack_ecb_encrypt(pt, ct, skey);
    burn_stack(sizeof(unsigned) * 8 + sizeof(int) * 2);
    burn_stack(sizeof(unsigned) * 8 + sizeof(int) * 2);
    return err;
    return err;
 }
 }
@@ -197,7 +197,7 @@ int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symme
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
+static int s_skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #else
 #else
 int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #endif
 #endif
@@ -251,7 +251,7 @@ int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symme
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err = _skipjack_ecb_decrypt(ct, pt, skey);
+   int err = s_skipjack_ecb_decrypt(ct, pt, skey);
    burn_stack(sizeof(unsigned) * 7 + sizeof(int) * 2);
    burn_stack(sizeof(unsigned) * 7 + sizeof(int) * 2);
    return err;
    return err;
 }
 }

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

@@ -58,7 +58,7 @@ static const unsigned char qord[4][5] = {
 
 
 #ifdef LTC_TWOFISH_TABLES
 #ifdef LTC_TWOFISH_TABLES
 
 
-#define __LTC_TWOFISH_TAB_C__
+#define LTC_TWOFISH_TAB_C
 #include "twofish_tab.c"
 #include "twofish_tab.c"
 
 
 #define sbox(i, x) ((ulong32)SBOX[i][(x)&255])
 #define sbox(i, x) ((ulong32)SBOX[i][(x)&255])
@@ -83,7 +83,7 @@ static const unsigned char qbox[2][4][16] = {
 
 
 /* computes S_i[x] */
 /* computes S_i[x] */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static ulong32 _sbox(int i, ulong32 x)
+static ulong32 s_sbox(int i, ulong32 x)
 #else
 #else
 static ulong32 sbox(int i, ulong32 x)
 static ulong32 sbox(int i, ulong32 x)
 #endif
 #endif
@@ -125,7 +125,7 @@ static ulong32 sbox(int i, ulong32 x)
 static ulong32 sbox(int i, ulong32 x)
 static ulong32 sbox(int i, ulong32 x)
 {
 {
    ulong32 y;
    ulong32 y;
-   y = _sbox(i, x);
+   y = s_sbox(i, x);
    burn_stack(sizeof(unsigned char) * 11);
    burn_stack(sizeof(unsigned char) * 11);
    return y;
    return y;
 }
 }
@@ -282,7 +282,7 @@ static void h_func(const unsigned char *in, unsigned char *out, const unsigned c
 #else
 #else
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static ulong32 _g_func(ulong32 x, const symmetric_key *key)
+static ulong32 s_g_func(ulong32 x, const symmetric_key *key)
 #else
 #else
 static ulong32 g_func(ulong32 x, const symmetric_key *key)
 static ulong32 g_func(ulong32 x, const symmetric_key *key)
 #endif
 #endif
@@ -318,7 +318,7 @@ static ulong32 g_func(ulong32 x, const symmetric_key *key)
 static ulong32 g_func(ulong32 x, const symmetric_key *key)
 static ulong32 g_func(ulong32 x, const symmetric_key *key)
 {
 {
     ulong32 y;
     ulong32 y;
-    y = _g_func(x, key);
+    y = s_g_func(x, key);
     burn_stack(sizeof(unsigned char) * 4 + sizeof(ulong32));
     burn_stack(sizeof(unsigned char) * 4 + sizeof(ulong32));
     return y;
     return y;
 }
 }
@@ -335,7 +335,7 @@ static ulong32 g_func(ulong32 x, const symmetric_key *key)
     @return CRYPT_OK if successful
     @return CRYPT_OK if successful
  */
  */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
+static int s_twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #else
 #else
 int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #endif
 #endif
@@ -448,7 +448,7 @@ int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
 int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 {
 {
    int x;
    int x;
-   x = _twofish_setup(key, keylen, num_rounds, skey);
+   x = s_twofish_setup(key, keylen, num_rounds, skey);
    burn_stack(sizeof(int) * 7 + sizeof(unsigned char) * 56 + sizeof(ulong32) * 2);
    burn_stack(sizeof(int) * 7 + sizeof(unsigned char) * 56 + sizeof(ulong32) * 2);
    return x;
    return x;
 }
 }
@@ -462,7 +462,7 @@ int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
+static int s_twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #else
 #else
 int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 #endif
 #endif
@@ -522,7 +522,7 @@ int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmet
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmetric_key *skey)
 {
 {
-   int err = _twofish_ecb_encrypt(pt, ct, skey);
+   int err = s_twofish_ecb_encrypt(pt, ct, skey);
    burn_stack(sizeof(ulong32) * 10 + sizeof(int));
    burn_stack(sizeof(ulong32) * 10 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -536,7 +536,7 @@ int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, const symmet
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
+static int s_twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #else
 #else
 int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 #endif
 #endif
@@ -598,7 +598,7 @@ int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmet
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
 int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, const symmetric_key *skey)
 {
 {
-   int err =_twofish_ecb_decrypt(ct, pt, skey);
+   int err = s_twofish_ecb_decrypt(ct, pt, skey);
    burn_stack(sizeof(ulong32) * 10 + sizeof(int));
    burn_stack(sizeof(ulong32) * 10 + sizeof(int));
    return err;
    return err;
 }
 }

+ 2 - 2
src/ciphers/twofish/twofish_tab.c

@@ -6,7 +6,7 @@
     Twofish tables, Tom St Denis
     Twofish tables, Tom St Denis
  */
  */
 #ifdef LTC_TWOFISH_TABLES
 #ifdef LTC_TWOFISH_TABLES
-#ifdef __LTC_TWOFISH_TAB_C__
+#ifdef LTC_TWOFISH_TAB_C
 
 
 /* pre generated 8x8 tables from the four 4x4s */
 /* pre generated 8x8 tables from the four 4x4s */
 static const unsigned char SBOX[2][256] = {
 static const unsigned char SBOX[2][256] = {
@@ -482,5 +482,5 @@ static const ulong32 rs_tab7[256] = {
 
 
 #endif /* LTC_TWOFISH_ALL_TABLES */
 #endif /* LTC_TWOFISH_ALL_TABLES */
 
 
-#endif /* __LTC_TWOFISH_TAB_C__ */
+#endif /* LTC_TWOFISH_TAB_C */
 #endif
 #endif

+ 2 - 2
src/encauth/gcm/gcm_gf_mult.c

@@ -52,7 +52,7 @@ const unsigned char gcm_shift_table[256*2] = {
 
 
 #ifndef LTC_FAST
 #ifndef LTC_FAST
 /* right shift */
 /* right shift */
-static void _gcm_rightshift(unsigned char *a)
+static void s_gcm_rightshift(unsigned char *a)
 {
 {
    int x;
    int x;
    for (x = 15; x > 0; x--) {
    for (x = 15; x > 0; x--) {
@@ -86,7 +86,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
           }
           }
        }
        }
        z     = V[15] & 0x01;
        z     = V[15] & 0x01;
-       _gcm_rightshift(V);
+       s_gcm_rightshift(V);
        V[0] ^= poly[z];
        V[0] ^= poly[z];
    }
    }
    XMEMCPY(c, Z, 16);
    XMEMCPY(c, Z, 16);

+ 3 - 3
src/encauth/ocb3/ocb3_add_aad.c

@@ -15,7 +15,7 @@
    @param aad_block  [in] AAD data (block_len size)
    @param aad_block  [in] AAD data (block_len size)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-static int _ocb3_int_aad_add_block(ocb3_state *ocb, const unsigned char *aad_block)
+static int s_ocb3_int_aad_add_block(ocb3_state *ocb, const unsigned char *aad_block)
 {
 {
    unsigned char tmp[MAXBLOCKSIZE];
    unsigned char tmp[MAXBLOCKSIZE];
    int err;
    int err;
@@ -59,7 +59,7 @@ int ocb3_add_aad(ocb3_state *ocb, const unsigned char *aad, unsigned long aadlen
      ocb->adata_buffer_bytes += l;
      ocb->adata_buffer_bytes += l;
 
 
      if (ocb->adata_buffer_bytes == ocb->block_len) {
      if (ocb->adata_buffer_bytes == ocb->block_len) {
-       if ((err = _ocb3_int_aad_add_block(ocb, ocb->adata_buffer)) != CRYPT_OK) {
+       if ((err = s_ocb3_int_aad_add_block(ocb, ocb->adata_buffer)) != CRYPT_OK) {
          return err;
          return err;
        }
        }
        ocb->adata_buffer_bytes = 0;
        ocb->adata_buffer_bytes = 0;
@@ -80,7 +80,7 @@ int ocb3_add_aad(ocb3_state *ocb, const unsigned char *aad, unsigned long aadlen
    last_block_len = datalen - full_blocks_len;
    last_block_len = datalen - full_blocks_len;
 
 
    for (x=0; x<full_blocks; x++) {
    for (x=0; x<full_blocks; x++) {
-     if ((err = _ocb3_int_aad_add_block(ocb, data+x*ocb->block_len)) != CRYPT_OK) {
+     if ((err = s_ocb3_int_aad_add_block(ocb, data+x*ocb->block_len)) != CRYPT_OK) {
        return err;
        return err;
      }
      }
    }
    }

+ 2 - 2
src/encauth/ocb3/ocb3_init.c

@@ -9,7 +9,7 @@
 
 
 #ifdef LTC_OCB3_MODE
 #ifdef LTC_OCB3_MODE
 
 
-static void _ocb3_int_calc_offset_zero(ocb3_state *ocb, const unsigned char *nonce, unsigned long noncelen, unsigned long taglen)
+static void s_ocb3_int_calc_offset_zero(ocb3_state *ocb, const unsigned char *nonce, unsigned long noncelen, unsigned long taglen)
 {
 {
    int x, y, bottom;
    int x, y, bottom;
    int idx, shift;
    int idx, shift;
@@ -166,7 +166,7 @@ int ocb3_init(ocb3_state *ocb, int cipher,
    }
    }
 
 
    /* initialize ocb->Offset_current = Offset_0 */
    /* initialize ocb->Offset_current = Offset_0 */
-   _ocb3_int_calc_offset_zero(ocb, nonce, noncelen, taglen);
+   s_ocb3_int_calc_offset_zero(ocb, nonce, noncelen, taglen);
 
 
    /* initialize checksum to all zeros */
    /* initialize checksum to all zeros */
    zeromem(ocb->checksum, ocb->block_len);
    zeromem(ocb->checksum, ocb->block_len);

+ 21 - 21
src/hashes/blake2b.c

@@ -147,26 +147,26 @@ static const unsigned char blake2b_sigma[12][16] =
   { 14, 10,  4,  8,  9, 15, 13,  6,  1, 12,  0,  2, 11,  7,  5,  3 }
   { 14, 10,  4,  8,  9, 15, 13,  6,  1, 12,  0,  2, 11,  7,  5,  3 }
 };
 };
 
 
-static void blake2b_set_lastnode(hash_state *md) { md->blake2b.f[1] = CONST64(0xffffffffffffffff); }
+static void s_blake2b_set_lastnode(hash_state *md) { md->blake2b.f[1] = CONST64(0xffffffffffffffff); }
 
 
 /* Some helper functions, not necessarily useful */
 /* Some helper functions, not necessarily useful */
-static int blake2b_is_lastblock(const hash_state *md) { return md->blake2b.f[0] != 0; }
+static int s_blake2b_is_lastblock(const hash_state *md) { return md->blake2b.f[0] != 0; }
 
 
-static void blake2b_set_lastblock(hash_state *md)
+static void s_blake2b_set_lastblock(hash_state *md)
 {
 {
    if (md->blake2b.last_node) {
    if (md->blake2b.last_node) {
-      blake2b_set_lastnode(md);
+      s_blake2b_set_lastnode(md);
    }
    }
    md->blake2b.f[0] = CONST64(0xffffffffffffffff);
    md->blake2b.f[0] = CONST64(0xffffffffffffffff);
 }
 }
 
 
-static void blake2b_increment_counter(hash_state *md, ulong64 inc)
+static void s_blake2b_increment_counter(hash_state *md, ulong64 inc)
 {
 {
    md->blake2b.t[0] += inc;
    md->blake2b.t[0] += inc;
    if (md->blake2b.t[0] < inc) md->blake2b.t[1]++;
    if (md->blake2b.t[0] < inc) md->blake2b.t[1]++;
 }
 }
 
 
-static void blake2b_init0(hash_state *md)
+static void s_blake2b_init0(hash_state *md)
 {
 {
    unsigned long i;
    unsigned long i;
    XMEMSET(&md->blake2b, 0, sizeof(md->blake2b));
    XMEMSET(&md->blake2b, 0, sizeof(md->blake2b));
@@ -177,11 +177,11 @@ static void blake2b_init0(hash_state *md)
 }
 }
 
 
 /* init xors IV with input parameter block */
 /* init xors IV with input parameter block */
-static int blake2b_init_param(hash_state *md, const unsigned char *P)
+static int s_blake2b_init_param(hash_state *md, const unsigned char *P)
 {
 {
    unsigned long i;
    unsigned long i;
 
 
-   blake2b_init0(md);
+   s_blake2b_init0(md);
 
 
    /* IV XOR ParamBlock */
    /* IV XOR ParamBlock */
    for (i = 0; i < 8; ++i) {
    for (i = 0; i < 8; ++i) {
@@ -228,7 +228,7 @@ int blake2b_init(hash_state *md, unsigned long outlen, const unsigned char *key,
    P[O_FANOUT] = 1;
    P[O_FANOUT] = 1;
    P[O_DEPTH] = 1;
    P[O_DEPTH] = 1;
 
 
-   err = blake2b_init_param(md, P);
+   err = s_blake2b_init_param(md, P);
    if (err != CRYPT_OK) return err;
    if (err != CRYPT_OK) return err;
 
 
    if (key) {
    if (key) {
@@ -299,9 +299,9 @@ int blake2b_512_init(hash_state *md) { return blake2b_init(md, 64, NULL, 0); }
    } while (0)
    } while (0)
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _blake2b_compress(hash_state *md, const unsigned char *buf)
+static int ss_blake2b_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int blake2b_compress(hash_state *md, const unsigned char *buf)
+static int s_blake2b_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
    ulong64 m[16];
    ulong64 m[16];
@@ -348,10 +348,10 @@ static int blake2b_compress(hash_state *md, const unsigned char *buf)
 #undef ROUND
 #undef ROUND
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int blake2b_compress(hash_state *md, const unsigned char *buf)
+static int s_blake2b_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _blake2b_compress(md, buf);
+   err = ss_blake2b_compress(md, buf);
    burn_stack(sizeof(ulong64) * 32 + sizeof(unsigned long));
    burn_stack(sizeof(ulong64) * 32 + sizeof(unsigned long));
    return err;
    return err;
 }
 }
@@ -379,13 +379,13 @@ int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen
       if (inlen > fill) {
       if (inlen > fill) {
          md->blake2b.curlen = 0;
          md->blake2b.curlen = 0;
          XMEMCPY(md->blake2b.buf + (left % sizeof(md->blake2b.buf)), in, fill); /* Fill buffer */
          XMEMCPY(md->blake2b.buf + (left % sizeof(md->blake2b.buf)), in, fill); /* Fill buffer */
-         blake2b_increment_counter(md, BLAKE2B_BLOCKBYTES);
-         blake2b_compress(md, md->blake2b.buf); /* Compress */
+         s_blake2b_increment_counter(md, BLAKE2B_BLOCKBYTES);
+         s_blake2b_compress(md, md->blake2b.buf); /* Compress */
          in += fill;
          in += fill;
          inlen -= fill;
          inlen -= fill;
          while (inlen > BLAKE2B_BLOCKBYTES) {
          while (inlen > BLAKE2B_BLOCKBYTES) {
-            blake2b_increment_counter(md, BLAKE2B_BLOCKBYTES);
-            blake2b_compress(md, in);
+            s_blake2b_increment_counter(md, BLAKE2B_BLOCKBYTES);
+            s_blake2b_compress(md, in);
             in += BLAKE2B_BLOCKBYTES;
             in += BLAKE2B_BLOCKBYTES;
             inlen -= BLAKE2B_BLOCKBYTES;
             inlen -= BLAKE2B_BLOCKBYTES;
          }
          }
@@ -412,14 +412,14 @@ int blake2b_done(hash_state *md, unsigned char *out)
 
 
    /* if(md->blakebs.outlen != outlen) return CRYPT_INVALID_ARG; */
    /* if(md->blakebs.outlen != outlen) return CRYPT_INVALID_ARG; */
 
 
-   if (blake2b_is_lastblock(md)) {
+   if (s_blake2b_is_lastblock(md)) {
       return CRYPT_ERROR;
       return CRYPT_ERROR;
    }
    }
 
 
-   blake2b_increment_counter(md, md->blake2b.curlen);
-   blake2b_set_lastblock(md);
+   s_blake2b_increment_counter(md, md->blake2b.curlen);
+   s_blake2b_set_lastblock(md);
    XMEMSET(md->blake2b.buf + md->blake2b.curlen, 0, BLAKE2B_BLOCKBYTES - md->blake2b.curlen); /* Padding */
    XMEMSET(md->blake2b.buf + md->blake2b.curlen, 0, BLAKE2B_BLOCKBYTES - md->blake2b.curlen); /* Padding */
-   blake2b_compress(md, md->blake2b.buf);
+   s_blake2b_compress(md, md->blake2b.buf);
 
 
    for (i = 0; i < 8; ++i) { /* Output full hash to temp buffer */
    for (i = 0; i < 8; ++i) { /* Output full hash to temp buffer */
       STORE64L(md->blake2b.h[i], buffer + i * 8);
       STORE64L(md->blake2b.h[i], buffer + i * 8);

+ 21 - 21
src/hashes/blake2s.c

@@ -139,26 +139,26 @@ static const unsigned char blake2s_sigma[10][16] = {
     { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
     { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
 };
 };
 
 
-static void blake2s_set_lastnode(hash_state *md) { md->blake2s.f[1] = 0xffffffffUL; }
+static void s_blake2s_set_lastnode(hash_state *md) { md->blake2s.f[1] = 0xffffffffUL; }
 
 
 /* Some helper functions, not necessarily useful */
 /* Some helper functions, not necessarily useful */
-static int blake2s_is_lastblock(const hash_state *md) { return md->blake2s.f[0] != 0; }
+static int s_blake2s_is_lastblock(const hash_state *md) { return md->blake2s.f[0] != 0; }
 
 
-static void blake2s_set_lastblock(hash_state *md)
+static void s_blake2s_set_lastblock(hash_state *md)
 {
 {
    if (md->blake2s.last_node) {
    if (md->blake2s.last_node) {
-      blake2s_set_lastnode(md);
+      s_blake2s_set_lastnode(md);
    }
    }
    md->blake2s.f[0] = 0xffffffffUL;
    md->blake2s.f[0] = 0xffffffffUL;
 }
 }
 
 
-static void blake2s_increment_counter(hash_state *md, const ulong32 inc)
+static void s_blake2s_increment_counter(hash_state *md, const ulong32 inc)
 {
 {
    md->blake2s.t[0] += inc;
    md->blake2s.t[0] += inc;
    if (md->blake2s.t[0] < inc) md->blake2s.t[1]++;
    if (md->blake2s.t[0] < inc) md->blake2s.t[1]++;
 }
 }
 
 
-static int blake2s_init0(hash_state *md)
+static int s_blake2s_init0(hash_state *md)
 {
 {
    int i;
    int i;
    XMEMSET(&md->blake2s, 0, sizeof(struct blake2s_state));
    XMEMSET(&md->blake2s, 0, sizeof(struct blake2s_state));
@@ -171,11 +171,11 @@ static int blake2s_init0(hash_state *md)
 }
 }
 
 
 /* init2 xors IV with input parameter block */
 /* init2 xors IV with input parameter block */
-static int blake2s_init_param(hash_state *md, const unsigned char *P)
+static int s_blake2s_init_param(hash_state *md, const unsigned char *P)
 {
 {
    unsigned long i;
    unsigned long i;
 
 
-   blake2s_init0(md);
+   s_blake2s_init0(md);
 
 
    /* IV XOR ParamBlock */
    /* IV XOR ParamBlock */
    for (i = 0; i < 8; ++i) {
    for (i = 0; i < 8; ++i) {
@@ -222,7 +222,7 @@ int blake2s_init(hash_state *md, unsigned long outlen, const unsigned char *key,
    P[O_FANOUT] = 1;
    P[O_FANOUT] = 1;
    P[O_DEPTH] = 1;
    P[O_DEPTH] = 1;
 
 
-   err = blake2s_init_param(md, P);
+   err = s_blake2s_init_param(md, P);
    if (err != CRYPT_OK) return err;
    if (err != CRYPT_OK) return err;
 
 
    if (key) {
    if (key) {
@@ -291,9 +291,9 @@ int blake2s_256_init(hash_state *md) { return blake2s_init(md, 32, NULL, 0); }
    } while (0)
    } while (0)
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _blake2s_compress(hash_state *md, const unsigned char *buf)
+static int ss_blake2s_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int blake2s_compress(hash_state *md, const unsigned char *buf)
+static int s_blake2s_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
    unsigned long i;
    unsigned long i;
@@ -337,10 +337,10 @@ static int blake2s_compress(hash_state *md, const unsigned char *buf)
 #undef ROUND
 #undef ROUND
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int blake2s_compress(hash_state *md, const unsigned char *buf)
+static int s_blake2s_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _blake2s_compress(md, buf);
+   err = ss_blake2s_compress(md, buf);
    burn_stack(sizeof(ulong32) * (32) + sizeof(unsigned long));
    burn_stack(sizeof(ulong32) * (32) + sizeof(unsigned long));
    return err;
    return err;
 }
 }
@@ -368,13 +368,13 @@ int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen
       if (inlen > fill) {
       if (inlen > fill) {
          md->blake2s.curlen = 0;
          md->blake2s.curlen = 0;
          XMEMCPY(md->blake2s.buf + (left % sizeof(md->blake2s.buf)), in, fill); /* Fill buffer */
          XMEMCPY(md->blake2s.buf + (left % sizeof(md->blake2s.buf)), in, fill); /* Fill buffer */
-         blake2s_increment_counter(md, BLAKE2S_BLOCKBYTES);
-         blake2s_compress(md, md->blake2s.buf); /* Compress */
+         s_blake2s_increment_counter(md, BLAKE2S_BLOCKBYTES);
+         s_blake2s_compress(md, md->blake2s.buf); /* Compress */
          in += fill;
          in += fill;
          inlen -= fill;
          inlen -= fill;
          while (inlen > BLAKE2S_BLOCKBYTES) {
          while (inlen > BLAKE2S_BLOCKBYTES) {
-            blake2s_increment_counter(md, BLAKE2S_BLOCKBYTES);
-            blake2s_compress(md, in);
+            s_blake2s_increment_counter(md, BLAKE2S_BLOCKBYTES);
+            s_blake2s_compress(md, in);
             in += BLAKE2S_BLOCKBYTES;
             in += BLAKE2S_BLOCKBYTES;
             inlen -= BLAKE2S_BLOCKBYTES;
             inlen -= BLAKE2S_BLOCKBYTES;
          }
          }
@@ -401,13 +401,13 @@ int blake2s_done(hash_state *md, unsigned char *out)
 
 
    /* if(md->blake2s.outlen != outlen) return CRYPT_INVALID_ARG; */
    /* if(md->blake2s.outlen != outlen) return CRYPT_INVALID_ARG; */
 
 
-   if (blake2s_is_lastblock(md)) {
+   if (s_blake2s_is_lastblock(md)) {
       return CRYPT_ERROR;
       return CRYPT_ERROR;
    }
    }
-   blake2s_increment_counter(md, md->blake2s.curlen);
-   blake2s_set_lastblock(md);
+   s_blake2s_increment_counter(md, md->blake2s.curlen);
+   s_blake2s_set_lastblock(md);
    XMEMSET(md->blake2s.buf + md->blake2s.curlen, 0, BLAKE2S_BLOCKBYTES - md->blake2s.curlen); /* Padding */
    XMEMSET(md->blake2s.buf + md->blake2s.curlen, 0, BLAKE2S_BLOCKBYTES - md->blake2s.curlen); /* Padding */
-   blake2s_compress(md, md->blake2s.buf);
+   s_blake2s_compress(md, md->blake2s.buf);
 
 
    for (i = 0; i < 8; ++i) { /* Output full hash to temp buffer */
    for (i = 0; i < 8; ++i) { /* Output full hash to temp buffer */
       STORE32L(md->blake2s.h[i], buffer + i * 4);
       STORE32L(md->blake2s.h[i], buffer + i * 4);

+ 6 - 6
src/hashes/chc/chc.c

@@ -121,7 +121,7 @@ int chc_init(hash_state *md)
    T0     <= encrypt T0
    T0     <= encrypt T0
    state  <= state xor T0 xor T1
    state  <= state xor T0 xor T1
 */
 */
-static int chc_compress(hash_state *md, const unsigned char *buf)
+static int s_chc_compress(hash_state *md, const unsigned char *buf)
 {
 {
    unsigned char  T[2][MAXBLOCKSIZE];
    unsigned char  T[2][MAXBLOCKSIZE];
    symmetric_key *key;
    symmetric_key *key;
@@ -154,8 +154,8 @@ static int chc_compress(hash_state *md, const unsigned char *buf)
    @param len  The length of the data (octets)
    @param len  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-static int _chc_process(hash_state * md, const unsigned char *in, unsigned long inlen);
-static HASH_PROCESS(_chc_process, chc_compress, chc, (unsigned long)cipher_blocksize)
+static int ss_chc_process(hash_state * md, const unsigned char *in, unsigned long inlen);
+static HASH_PROCESS(ss_chc_process, s_chc_compress, chc, (unsigned long)cipher_blocksize)
 
 
 /**
 /**
    Process a block of memory though the hash
    Process a block of memory though the hash
@@ -179,7 +179,7 @@ int chc_process(hash_state * md, const unsigned char *in, unsigned long inlen)
       return CRYPT_INVALID_CIPHER;
       return CRYPT_INVALID_CIPHER;
    }
    }
 
 
-   return _chc_process(md, in, inlen);
+   return ss_chc_process(md, in, inlen);
 }
 }
 
 
 /**
 /**
@@ -221,7 +221,7 @@ int chc_done(hash_state *md, unsigned char *out)
         while (md->chc.curlen < (unsigned long)cipher_blocksize) {
         while (md->chc.curlen < (unsigned long)cipher_blocksize) {
             md->chc.buf[md->chc.curlen++] = (unsigned char)0;
             md->chc.buf[md->chc.curlen++] = (unsigned char)0;
         }
         }
-        chc_compress(md, md->chc.buf);
+        s_chc_compress(md, md->chc.buf);
         md->chc.curlen = 0;
         md->chc.curlen = 0;
     }
     }
 
 
@@ -232,7 +232,7 @@ int chc_done(hash_state *md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64L(md->chc.length, md->chc.buf+(cipher_blocksize-8));
     STORE64L(md->chc.length, md->chc.buf+(cipher_blocksize-8));
-    chc_compress(md, md->chc.buf);
+    s_chc_compress(md, md->chc.buf);
 
 
     /* copy output */
     /* copy output */
     XMEMCPY(out, md->chc.state, cipher_blocksize);
     XMEMCPY(out, md->chc.state, cipher_blocksize);

+ 7 - 7
src/hashes/md2.c

@@ -49,7 +49,7 @@ static const unsigned char PI_SUBST[256] = {
 };
 };
 
 
 /* adds 16 bytes to the checksum */
 /* adds 16 bytes to the checksum */
-static void md2_update_chksum(hash_state *md)
+static void s_md2_update_chksum(hash_state *md)
 {
 {
    int j;
    int j;
    unsigned char L;
    unsigned char L;
@@ -63,7 +63,7 @@ static void md2_update_chksum(hash_state *md)
    }
    }
 }
 }
 
 
-static void md2_compress(hash_state *md)
+static void s_md2_compress(hash_state *md)
 {
 {
    int j, k;
    int j, k;
    unsigned char t;
    unsigned char t;
@@ -126,8 +126,8 @@ int md2_process(hash_state *md, const unsigned char *in, unsigned long inlen)
 
 
         /* is 16 bytes full? */
         /* is 16 bytes full? */
         if (md->md2.curlen == 16) {
         if (md->md2.curlen == 16) {
-            md2_compress(md);
-            md2_update_chksum(md);
+            s_md2_compress(md);
+            s_md2_update_chksum(md);
             md->md2.curlen = 0;
             md->md2.curlen = 0;
         }
         }
     }
     }
@@ -159,12 +159,12 @@ int md2_done(hash_state * md, unsigned char *out)
     }
     }
 
 
     /* hash and update */
     /* hash and update */
-    md2_compress(md);
-    md2_update_chksum(md);
+    s_md2_compress(md);
+    s_md2_update_chksum(md);
 
 
     /* hash checksum */
     /* hash checksum */
     XMEMCPY(md->md2.buf, md->md2.chksum, 16);
     XMEMCPY(md->md2.buf, md->md2.chksum, 16);
-    md2_compress(md);
+    s_md2_compress(md);
 
 
     /* output is lower 16 bytes of X */
     /* output is lower 16 bytes of X */
     XMEMCPY(out, md->md2.X, 16);
     XMEMCPY(out, md->md2.X, 16);

+ 7 - 7
src/hashes/md4.c

@@ -65,9 +65,9 @@ const struct ltc_hash_descriptor md4_desc =
   }
   }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _md4_compress(hash_state *md, const unsigned char *buf)
+static int ss_md4_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int  md4_compress(hash_state *md, const unsigned char *buf)
+static int  s_md4_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
     ulong32 x[16], a, b, c, d;
     ulong32 x[16], a, b, c, d;
@@ -149,10 +149,10 @@ static int  md4_compress(hash_state *md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int md4_compress(hash_state *md, const unsigned char *buf)
+static int s_md4_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _md4_compress(md, buf);
+   err = ss_md4_compress(md, buf);
    burn_stack(sizeof(ulong32) * 20 + sizeof(int));
    burn_stack(sizeof(ulong32) * 20 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -182,7 +182,7 @@ int md4_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(md4_process, md4_compress, md4, 64)
+HASH_PROCESS(md4_process, s_md4_compress, md4, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -215,7 +215,7 @@ int md4_done(hash_state * md, unsigned char *out)
         while (md->md4.curlen < 64) {
         while (md->md4.curlen < 64) {
             md->md4.buf[md->md4.curlen++] = (unsigned char)0;
             md->md4.buf[md->md4.curlen++] = (unsigned char)0;
         }
         }
-        md4_compress(md, md->md4.buf);
+        s_md4_compress(md, md->md4.buf);
         md->md4.curlen = 0;
         md->md4.curlen = 0;
     }
     }
 
 
@@ -226,7 +226,7 @@ int md4_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64L(md->md4.length, md->md4.buf+56);
     STORE64L(md->md4.length, md->md4.buf+56);
-    md4_compress(md, md->md4.buf);
+    s_md4_compress(md, md->md4.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 4; i++) {
     for (i = 0; i < 4; i++) {

+ 7 - 7
src/hashes/md5.c

@@ -90,9 +90,9 @@ static const ulong32 Korder[64] = {
 #endif
 #endif
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _md5_compress(hash_state *md, const unsigned char *buf)
+static int ss_md5_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int  md5_compress(hash_state *md, const unsigned char *buf)
+static int  s_md5_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
     ulong32 i, W[16], a, b, c, d;
     ulong32 i, W[16], a, b, c, d;
@@ -208,10 +208,10 @@ static int  md5_compress(hash_state *md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int md5_compress(hash_state *md, const unsigned char *buf)
+static int s_md5_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _md5_compress(md, buf);
+   err = ss_md5_compress(md, buf);
    burn_stack(sizeof(ulong32) * 21);
    burn_stack(sizeof(ulong32) * 21);
    return err;
    return err;
 }
 }
@@ -241,7 +241,7 @@ int md5_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(md5_process, md5_compress, md5, 64)
+HASH_PROCESS(md5_process, s_md5_compress, md5, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -275,7 +275,7 @@ int md5_done(hash_state * md, unsigned char *out)
         while (md->md5.curlen < 64) {
         while (md->md5.curlen < 64) {
             md->md5.buf[md->md5.curlen++] = (unsigned char)0;
             md->md5.buf[md->md5.curlen++] = (unsigned char)0;
         }
         }
-        md5_compress(md, md->md5.buf);
+        s_md5_compress(md, md->md5.buf);
         md->md5.curlen = 0;
         md->md5.curlen = 0;
     }
     }
 
 
@@ -286,7 +286,7 @@ int md5_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64L(md->md5.length, md->md5.buf+56);
     STORE64L(md->md5.length, md->md5.buf+56);
-    md5_compress(md, md->md5.buf);
+    s_md5_compress(md, md->md5.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 4; i++) {
     for (i = 0; i < 4; i++) {

+ 7 - 7
src/hashes/rmd128.c

@@ -73,9 +73,9 @@ const struct ltc_hash_descriptor rmd128_desc =
       (a) = ROLc((a), (s));
       (a) = ROLc((a), (s));
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rmd128_compress(hash_state *md, const unsigned char *buf)
+static int ss_rmd128_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int  rmd128_compress(hash_state *md, const unsigned char *buf)
+static int  s_rmd128_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
    ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,X[16];
    ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,X[16];
@@ -247,10 +247,10 @@ static int  rmd128_compress(hash_state *md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int rmd128_compress(hash_state *md, const unsigned char *buf)
+static int s_rmd128_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _rmd128_compress(md, buf);
+   err = ss_rmd128_compress(md, buf);
    burn_stack(sizeof(ulong32) * 24 + sizeof(int));
    burn_stack(sizeof(ulong32) * 24 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -280,7 +280,7 @@ int rmd128_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(rmd128_process, rmd128_compress, rmd128, 64)
+HASH_PROCESS(rmd128_process, s_rmd128_compress, rmd128, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -314,7 +314,7 @@ int rmd128_done(hash_state * md, unsigned char *out)
         while (md->rmd128.curlen < 64) {
         while (md->rmd128.curlen < 64) {
             md->rmd128.buf[md->rmd128.curlen++] = (unsigned char)0;
             md->rmd128.buf[md->rmd128.curlen++] = (unsigned char)0;
         }
         }
-        rmd128_compress(md, md->rmd128.buf);
+        s_rmd128_compress(md, md->rmd128.buf);
         md->rmd128.curlen = 0;
         md->rmd128.curlen = 0;
     }
     }
 
 
@@ -325,7 +325,7 @@ int rmd128_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64L(md->rmd128.length, md->rmd128.buf+56);
     STORE64L(md->rmd128.length, md->rmd128.buf+56);
-    rmd128_compress(md, md->rmd128.buf);
+    s_rmd128_compress(md, md->rmd128.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 4; i++) {
     for (i = 0; i < 4; i++) {

+ 7 - 7
src/hashes/rmd160.c

@@ -93,9 +93,9 @@ const struct ltc_hash_descriptor rmd160_desc =
 
 
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rmd160_compress(hash_state *md, const unsigned char *buf)
+static int ss_rmd160_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int  rmd160_compress(hash_state *md, const unsigned char *buf)
+static int  s_rmd160_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
    ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,X[16];
    ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,X[16];
@@ -305,10 +305,10 @@ static int  rmd160_compress(hash_state *md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int rmd160_compress(hash_state *md, const unsigned char *buf)
+static int s_rmd160_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _rmd160_compress(md, buf);
+   err = ss_rmd160_compress(md, buf);
    burn_stack(sizeof(ulong32) * 26 + sizeof(int));
    burn_stack(sizeof(ulong32) * 26 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -339,7 +339,7 @@ int rmd160_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(rmd160_process, rmd160_compress, rmd160, 64)
+HASH_PROCESS(rmd160_process, s_rmd160_compress, rmd160, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -373,7 +373,7 @@ int rmd160_done(hash_state * md, unsigned char *out)
         while (md->rmd160.curlen < 64) {
         while (md->rmd160.curlen < 64) {
             md->rmd160.buf[md->rmd160.curlen++] = (unsigned char)0;
             md->rmd160.buf[md->rmd160.curlen++] = (unsigned char)0;
         }
         }
-        rmd160_compress(md, md->rmd160.buf);
+        s_rmd160_compress(md, md->rmd160.buf);
         md->rmd160.curlen = 0;
         md->rmd160.curlen = 0;
     }
     }
 
 
@@ -384,7 +384,7 @@ int rmd160_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64L(md->rmd160.length, md->rmd160.buf+56);
     STORE64L(md->rmd160.length, md->rmd160.buf+56);
-    rmd160_compress(md, md->rmd160.buf);
+    s_rmd160_compress(md, md->rmd160.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 5; i++) {
     for (i = 0; i < 5; i++) {

+ 7 - 7
src/hashes/rmd256.c

@@ -67,9 +67,9 @@ const struct ltc_hash_descriptor rmd256_desc =
       (a) = ROLc((a), (s));
       (a) = ROLc((a), (s));
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rmd256_compress(hash_state *md, const unsigned char *buf)
+static int ss_rmd256_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int  rmd256_compress(hash_state *md, const unsigned char *buf)
+static int  s_rmd256_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
    ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,tmp,X[16];
    ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,tmp,X[16];
@@ -256,10 +256,10 @@ static int  rmd256_compress(hash_state *md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int rmd256_compress(hash_state *md, const unsigned char *buf)
+static int s_rmd256_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _rmd256_compress(md, buf);
+   err = ss_rmd256_compress(md, buf);
    burn_stack(sizeof(ulong32) * 25 + sizeof(int));
    burn_stack(sizeof(ulong32) * 25 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -293,7 +293,7 @@ int rmd256_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(rmd256_process, rmd256_compress, rmd256, 64)
+HASH_PROCESS(rmd256_process, s_rmd256_compress, rmd256, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -327,7 +327,7 @@ int rmd256_done(hash_state * md, unsigned char *out)
         while (md->rmd256.curlen < 64) {
         while (md->rmd256.curlen < 64) {
             md->rmd256.buf[md->rmd256.curlen++] = (unsigned char)0;
             md->rmd256.buf[md->rmd256.curlen++] = (unsigned char)0;
         }
         }
-        rmd256_compress(md, md->rmd256.buf);
+        s_rmd256_compress(md, md->rmd256.buf);
         md->rmd256.curlen = 0;
         md->rmd256.curlen = 0;
     }
     }
 
 
@@ -338,7 +338,7 @@ int rmd256_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64L(md->rmd256.length, md->rmd256.buf+56);
     STORE64L(md->rmd256.length, md->rmd256.buf+56);
-    rmd256_compress(md, md->rmd256.buf);
+    s_rmd256_compress(md, md->rmd256.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 8; i++) {
     for (i = 0; i < 8; i++) {

+ 7 - 7
src/hashes/rmd320.c

@@ -88,9 +88,9 @@ const struct ltc_hash_descriptor rmd320_desc =
 
 
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _rmd320_compress(hash_state *md, const unsigned char *buf)
+static int ss_rmd320_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int  rmd320_compress(hash_state *md, const unsigned char *buf)
+static int  s_rmd320_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
    ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,tmp,X[16];
    ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,tmp,X[16];
@@ -319,10 +319,10 @@ static int  rmd320_compress(hash_state *md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int rmd320_compress(hash_state *md, const unsigned char *buf)
+static int s_rmd320_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _rmd320_compress(md, buf);
+   err = ss_rmd320_compress(md, buf);
    burn_stack(sizeof(ulong32) * 27 + sizeof(int));
    burn_stack(sizeof(ulong32) * 27 + sizeof(int));
    return err;
    return err;
 }
 }
@@ -358,7 +358,7 @@ int rmd320_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(rmd320_process, rmd320_compress, rmd320, 64)
+HASH_PROCESS(rmd320_process, s_rmd320_compress, rmd320, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -392,7 +392,7 @@ int rmd320_done(hash_state * md, unsigned char *out)
         while (md->rmd320.curlen < 64) {
         while (md->rmd320.curlen < 64) {
             md->rmd320.buf[md->rmd320.curlen++] = (unsigned char)0;
             md->rmd320.buf[md->rmd320.curlen++] = (unsigned char)0;
         }
         }
-        rmd320_compress(md, md->rmd320.buf);
+        s_rmd320_compress(md, md->rmd320.buf);
         md->rmd320.curlen = 0;
         md->rmd320.curlen = 0;
     }
     }
 
 
@@ -403,7 +403,7 @@ int rmd320_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64L(md->rmd320.length, md->rmd320.buf+56);
     STORE64L(md->rmd320.length, md->rmd320.buf+56);
-    rmd320_compress(md, md->rmd320.buf);
+    s_rmd320_compress(md, md->rmd320.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 10; i++) {
     for (i = 0; i < 10; i++) {

+ 7 - 7
src/hashes/sha1.c

@@ -34,9 +34,9 @@ const struct ltc_hash_descriptor sha1_desc =
 #define F3(x,y,z)  (x ^ y ^ z)
 #define F3(x,y,z)  (x ^ y ^ z)
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _sha1_compress(hash_state *md, const unsigned char *buf)
+static int ss_sha1_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int  sha1_compress(hash_state *md, const unsigned char *buf)
+static int  s_sha1_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
     ulong32 a,b,c,d,e,W[80],i;
     ulong32 a,b,c,d,e,W[80],i;
@@ -140,10 +140,10 @@ static int  sha1_compress(hash_state *md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int sha1_compress(hash_state *md, const unsigned char *buf)
+static int s_sha1_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _sha1_compress(md, buf);
+   err = ss_sha1_compress(md, buf);
    burn_stack(sizeof(ulong32) * 87);
    burn_stack(sizeof(ulong32) * 87);
    return err;
    return err;
 }
 }
@@ -174,7 +174,7 @@ int sha1_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(sha1_process, sha1_compress, sha1, 64)
+HASH_PROCESS(sha1_process, s_sha1_compress, sha1, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -207,7 +207,7 @@ int sha1_done(hash_state * md, unsigned char *out)
         while (md->sha1.curlen < 64) {
         while (md->sha1.curlen < 64) {
             md->sha1.buf[md->sha1.curlen++] = (unsigned char)0;
             md->sha1.buf[md->sha1.curlen++] = (unsigned char)0;
         }
         }
-        sha1_compress(md, md->sha1.buf);
+        s_sha1_compress(md, md->sha1.buf);
         md->sha1.curlen = 0;
         md->sha1.curlen = 0;
     }
     }
 
 
@@ -218,7 +218,7 @@ int sha1_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64H(md->sha1.length, md->sha1.buf+56);
     STORE64H(md->sha1.length, md->sha1.buf+56);
-    sha1_compress(md, md->sha1.buf);
+    s_sha1_compress(md, md->sha1.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 5; i++) {
     for (i = 0; i < 5; i++) {

+ 7 - 7
src/hashes/sha2/sha256.c

@@ -58,9 +58,9 @@ static const ulong32 K[64] = {
 
 
 /* compress 512-bits */
 /* compress 512-bits */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _sha256_compress(hash_state * md, const unsigned char *buf)
+static int ss_sha256_compress(hash_state * md, const unsigned char *buf)
 #else
 #else
-static int  sha256_compress(hash_state * md, const unsigned char *buf)
+static int s_sha256_compress(hash_state * md, const unsigned char *buf)
 #endif
 #endif
 {
 {
     ulong32 S[8], W[64], t0, t1;
     ulong32 S[8], W[64], t0, t1;
@@ -181,10 +181,10 @@ static int  sha256_compress(hash_state * md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int sha256_compress(hash_state * md, const unsigned char *buf)
+static int s_sha256_compress(hash_state * md, const unsigned char *buf)
 {
 {
     int err;
     int err;
-    err = _sha256_compress(md, buf);
+    err = ss_sha256_compress(md, buf);
     burn_stack(sizeof(ulong32) * 74);
     burn_stack(sizeof(ulong32) * 74);
     return err;
     return err;
 }
 }
@@ -219,7 +219,7 @@ int sha256_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(sha256_process, sha256_compress, sha256, 64)
+HASH_PROCESS(sha256_process,s_sha256_compress, sha256, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -253,7 +253,7 @@ int sha256_done(hash_state * md, unsigned char *out)
         while (md->sha256.curlen < 64) {
         while (md->sha256.curlen < 64) {
             md->sha256.buf[md->sha256.curlen++] = (unsigned char)0;
             md->sha256.buf[md->sha256.curlen++] = (unsigned char)0;
         }
         }
-        sha256_compress(md, md->sha256.buf);
+        s_sha256_compress(md, md->sha256.buf);
         md->sha256.curlen = 0;
         md->sha256.curlen = 0;
     }
     }
 
 
@@ -264,7 +264,7 @@ int sha256_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64H(md->sha256.length, md->sha256.buf+56);
     STORE64H(md->sha256.length, md->sha256.buf+56);
-    sha256_compress(md, md->sha256.buf);
+    s_sha256_compress(md, md->sha256.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 8; i++) {
     for (i = 0; i < 8; i++) {

+ 7 - 7
src/hashes/sha2/sha512.c

@@ -83,9 +83,9 @@ CONST64(0x5fcb6fab3ad6faec), CONST64(0x6c44198c4a475817)
 
 
 /* compress 1024-bits */
 /* compress 1024-bits */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _sha512_compress(hash_state * md, const unsigned char *buf)
+static int ss_sha512_compress(hash_state * md, const unsigned char *buf)
 #else
 #else
-static int  sha512_compress(hash_state * md, const unsigned char *buf)
+static int  s_sha512_compress(hash_state * md, const unsigned char *buf)
 #endif
 #endif
 {
 {
     ulong64 S[8], W[80], t0, t1;
     ulong64 S[8], W[80], t0, t1;
@@ -150,10 +150,10 @@ static int  sha512_compress(hash_state * md, const unsigned char *buf)
 
 
 /* compress 1024-bits */
 /* compress 1024-bits */
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int sha512_compress(hash_state * md, const unsigned char *buf)
+static int s_sha512_compress(hash_state * md, const unsigned char *buf)
 {
 {
     int err;
     int err;
-    err = _sha512_compress(md, buf);
+    err = ss_sha512_compress(md, buf);
     burn_stack(sizeof(ulong64) * 90 + sizeof(int));
     burn_stack(sizeof(ulong64) * 90 + sizeof(int));
     return err;
     return err;
 }
 }
@@ -187,7 +187,7 @@ int sha512_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(sha512_process, sha512_compress, sha512, 128)
+HASH_PROCESS(sha512_process, s_sha512_compress, sha512, 128)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -220,7 +220,7 @@ int sha512_done(hash_state * md, unsigned char *out)
         while (md->sha512.curlen < 128) {
         while (md->sha512.curlen < 128) {
             md->sha512.buf[md->sha512.curlen++] = (unsigned char)0;
             md->sha512.buf[md->sha512.curlen++] = (unsigned char)0;
         }
         }
-        sha512_compress(md, md->sha512.buf);
+        s_sha512_compress(md, md->sha512.buf);
         md->sha512.curlen = 0;
         md->sha512.curlen = 0;
     }
     }
 
 
@@ -234,7 +234,7 @@ int sha512_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64H(md->sha512.length, md->sha512.buf+120);
     STORE64H(md->sha512.length, md->sha512.buf+120);
-    sha512_compress(md, md->sha512.buf);
+    s_sha512_compress(md, md->sha512.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 8; i++) {
     for (i = 0; i < 8; i++) {

+ 15 - 15
src/hashes/sha3.c

@@ -131,7 +131,7 @@ const struct ltc_hash_descriptor keccak_512_desc =
 #define SHA3_KECCAK_SPONGE_WORDS 25 /* 1600 bits > 200 bytes > 25 x ulong64 */
 #define SHA3_KECCAK_SPONGE_WORDS 25 /* 1600 bits > 200 bytes > 25 x ulong64 */
 #define SHA3_KECCAK_ROUNDS 24
 #define SHA3_KECCAK_ROUNDS 24
 
 
-static const ulong64 keccakf_rndc[24] = {
+static const ulong64 s_keccakf_rndc[24] = {
    CONST64(0x0000000000000001), CONST64(0x0000000000008082),
    CONST64(0x0000000000000001), CONST64(0x0000000000008082),
    CONST64(0x800000000000808a), CONST64(0x8000000080008000),
    CONST64(0x800000000000808a), CONST64(0x8000000080008000),
    CONST64(0x000000000000808b), CONST64(0x0000000080000001),
    CONST64(0x000000000000808b), CONST64(0x0000000080000001),
@@ -146,15 +146,15 @@ static const ulong64 keccakf_rndc[24] = {
    CONST64(0x0000000080000001), CONST64(0x8000000080008008)
    CONST64(0x0000000080000001), CONST64(0x8000000080008008)
 };
 };
 
 
-static const unsigned keccakf_rotc[24] = {
+static const unsigned s_keccakf_rotc[24] = {
    1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44
    1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44
 };
 };
 
 
-static const unsigned keccakf_piln[24] = {
+static const unsigned s_keccakf_piln[24] = {
    10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1
    10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1
 };
 };
 
 
-static void keccakf(ulong64 s[25])
+static void s_keccakf(ulong64 s[25])
 {
 {
    int i, j, round;
    int i, j, round;
    ulong64 t, bc[5];
    ulong64 t, bc[5];
@@ -173,9 +173,9 @@ static void keccakf(ulong64 s[25])
       /* Rho Pi */
       /* Rho Pi */
       t = s[1];
       t = s[1];
       for(i = 0; i < 24; i++) {
       for(i = 0; i < 24; i++) {
-         j = keccakf_piln[i];
+         j = s_keccakf_piln[i];
          bc[0] = s[j];
          bc[0] = s[j];
-         s[j] = ROL64(t, keccakf_rotc[i]);
+         s[j] = ROL64(t, s_keccakf_rotc[i]);
          t = bc[0];
          t = bc[0];
       }
       }
       /* Chi */
       /* Chi */
@@ -188,11 +188,11 @@ static void keccakf(ulong64 s[25])
          }
          }
       }
       }
       /* Iota */
       /* Iota */
-      s[0] ^= keccakf_rndc[round];
+      s[0] ^= s_keccakf_rndc[round];
    }
    }
 }
 }
 
 
-static LTC_INLINE int _done(hash_state *md, unsigned char *hash, ulong64 pad)
+static LTC_INLINE int ss_done(hash_state *md, unsigned char *hash, ulong64 pad)
 {
 {
    unsigned i;
    unsigned i;
 
 
@@ -201,7 +201,7 @@ static LTC_INLINE int _done(hash_state *md, unsigned char *hash, ulong64 pad)
 
 
    md->sha3.s[md->sha3.word_index] ^= (md->sha3.saved ^ (pad << (md->sha3.byte_index * 8)));
    md->sha3.s[md->sha3.word_index] ^= (md->sha3.saved ^ (pad << (md->sha3.byte_index * 8)));
    md->sha3.s[SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words - 1] ^= CONST64(0x8000000000000000);
    md->sha3.s[SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words - 1] ^= CONST64(0x8000000000000000);
-   keccakf(md->sha3.s);
+   s_keccakf(md->sha3.s);
 
 
    /* store sha3.s[] as little-endian bytes into sha3.sb */
    /* store sha3.s[] as little-endian bytes into sha3.sb */
    for(i = 0; i < SHA3_KECCAK_SPONGE_WORDS; i++) {
    for(i = 0; i < SHA3_KECCAK_SPONGE_WORDS; i++) {
@@ -283,7 +283,7 @@ int sha3_process(hash_state *md, const unsigned char *in, unsigned long inlen)
       md->sha3.byte_index = 0;
       md->sha3.byte_index = 0;
       md->sha3.saved = 0;
       md->sha3.saved = 0;
       if(++md->sha3.word_index == (SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words)) {
       if(++md->sha3.word_index == (SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words)) {
-         keccakf(md->sha3.s);
+         s_keccakf(md->sha3.s);
          md->sha3.word_index = 0;
          md->sha3.word_index = 0;
       }
       }
    }
    }
@@ -297,7 +297,7 @@ int sha3_process(hash_state *md, const unsigned char *in, unsigned long inlen)
       LOAD64L(t, in);
       LOAD64L(t, in);
       md->sha3.s[md->sha3.word_index] ^= t;
       md->sha3.s[md->sha3.word_index] ^= t;
       if(++md->sha3.word_index == (SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words)) {
       if(++md->sha3.word_index == (SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words)) {
-         keccakf(md->sha3.s);
+         s_keccakf(md->sha3.s);
          md->sha3.word_index = 0;
          md->sha3.word_index = 0;
       }
       }
    }
    }
@@ -312,14 +312,14 @@ int sha3_process(hash_state *md, const unsigned char *in, unsigned long inlen)
 #ifdef LTC_SHA3
 #ifdef LTC_SHA3
 int sha3_done(hash_state *md, unsigned char *out)
 int sha3_done(hash_state *md, unsigned char *out)
 {
 {
-   return _done(md, out, CONST64(0x06));
+   return ss_done(md, out, CONST64(0x06));
 }
 }
 #endif
 #endif
 
 
 #ifdef LTC_KECCAK
 #ifdef LTC_KECCAK
 int keccak_done(hash_state *md, unsigned char *out)
 int keccak_done(hash_state *md, unsigned char *out)
 {
 {
-   return _done(md, out, CONST64(0x01));
+   return ss_done(md, out, CONST64(0x01));
 }
 }
 #endif
 #endif
 
 
@@ -338,7 +338,7 @@ int sha3_shake_done(hash_state *md, unsigned char *out, unsigned long outlen)
       /* shake_xof operation must be done only once */
       /* shake_xof operation must be done only once */
       md->sha3.s[md->sha3.word_index] ^= (md->sha3.saved ^ (CONST64(0x1F) << (md->sha3.byte_index * 8)));
       md->sha3.s[md->sha3.word_index] ^= (md->sha3.saved ^ (CONST64(0x1F) << (md->sha3.byte_index * 8)));
       md->sha3.s[SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words - 1] ^= CONST64(0x8000000000000000);
       md->sha3.s[SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words - 1] ^= CONST64(0x8000000000000000);
-      keccakf(md->sha3.s);
+      s_keccakf(md->sha3.s);
       /* store sha3.s[] as little-endian bytes into sha3.sb */
       /* store sha3.s[] as little-endian bytes into sha3.sb */
       for(i = 0; i < SHA3_KECCAK_SPONGE_WORDS; i++) {
       for(i = 0; i < SHA3_KECCAK_SPONGE_WORDS; i++) {
          STORE64L(md->sha3.s[i], md->sha3.sb + i * 8);
          STORE64L(md->sha3.s[i], md->sha3.sb + i * 8);
@@ -349,7 +349,7 @@ int sha3_shake_done(hash_state *md, unsigned char *out, unsigned long outlen)
 
 
    for (idx = 0; idx < outlen; idx++) {
    for (idx = 0; idx < outlen; idx++) {
       if(md->sha3.byte_index >= (SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words) * 8) {
       if(md->sha3.byte_index >= (SHA3_KECCAK_SPONGE_WORDS - md->sha3.capacity_words) * 8) {
-         keccakf(md->sha3.s);
+         s_keccakf(md->sha3.s);
          /* store sha3.s[] as little-endian bytes into sha3.sb */
          /* store sha3.s[] as little-endian bytes into sha3.sb */
          for(i = 0; i < SHA3_KECCAK_SPONGE_WORDS; i++) {
          for(i = 0; i < SHA3_KECCAK_SPONGE_WORDS; i++) {
             STORE64L(md->sha3.s[i], md->sha3.sb + i * 8);
             STORE64L(md->sha3.s[i], md->sha3.sb + i * 8);

+ 15 - 21
src/hashes/tiger.c

@@ -547,14 +547,8 @@ static const ulong64 table[4*256] = {
     CONST64(0xCD56D9430EA8280E) /* 1020 */, CONST64(0xC12591D7535F5065) /* 1021 */,
     CONST64(0xCD56D9430EA8280E) /* 1020 */, CONST64(0xC12591D7535F5065) /* 1021 */,
     CONST64(0xC83223F1720AEF96) /* 1022 */, CONST64(0xC3A0396F7363A51F) /* 1023 */};
     CONST64(0xC83223F1720AEF96) /* 1022 */, CONST64(0xC3A0396F7363A51F) /* 1023 */};
 
 
-#ifdef _MSC_VER
-   #define INLINE __inline
-#else
-   #define INLINE
-#endif
-
 /* one round of the hash function */
 /* one round of the hash function */
-INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
+LTC_INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
 {
 {
     ulong64 tmp;
     ulong64 tmp;
     tmp = (*c ^= x);
     tmp = (*c ^= x);
@@ -568,7 +562,7 @@ INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, in
 }
 }
 
 
 /* one complete pass */
 /* one complete pass */
-static void pass(ulong64 *a, ulong64 *b, ulong64 *c, const ulong64 *x, int mul)
+static void s_pass(ulong64 *a, ulong64 *b, ulong64 *c, const ulong64 *x, int mul)
 {
 {
    tiger_round(a,b,c,x[0],mul);
    tiger_round(a,b,c,x[0],mul);
    tiger_round(b,c,a,x[1],mul);
    tiger_round(b,c,a,x[1],mul);
@@ -581,7 +575,7 @@ static void pass(ulong64 *a, ulong64 *b, ulong64 *c, const ulong64 *x, int mul)
 }
 }
 
 
 /* The key mixing schedule */
 /* The key mixing schedule */
-static void key_schedule(ulong64 *x)
+static void s_key_schedule(ulong64 *x)
 {
 {
     x[0] -= x[7] ^ CONST64(0xA5A5A5A5A5A5A5A5);
     x[0] -= x[7] ^ CONST64(0xA5A5A5A5A5A5A5A5);
     x[1] ^= x[0];
     x[1] ^= x[0];
@@ -602,9 +596,9 @@ static void key_schedule(ulong64 *x)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _tiger_compress(hash_state *md, const unsigned char *buf)
+static int ss_tiger_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int  tiger_compress(hash_state *md, const unsigned char *buf)
+static int  s_tiger_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
     ulong64 a, b, c, x[8];
     ulong64 a, b, c, x[8];
@@ -618,11 +612,11 @@ static int  tiger_compress(hash_state *md, const unsigned char *buf)
     b = md->tiger.state[1];
     b = md->tiger.state[1];
     c = md->tiger.state[2];
     c = md->tiger.state[2];
 
 
-    pass(&a,&b,&c,x,5);
-    key_schedule(x);
-    pass(&c,&a,&b,x,7);
-    key_schedule(x);
-    pass(&b,&c,&a,x,9);
+    s_pass(&a,&b,&c,x,5);
+    s_key_schedule(x);
+    s_pass(&c,&a,&b,x,7);
+    s_key_schedule(x);
+    s_pass(&b,&c,&a,x,9);
 
 
     /* store state */
     /* store state */
     md->tiger.state[0] = a ^ md->tiger.state[0];
     md->tiger.state[0] = a ^ md->tiger.state[0];
@@ -633,10 +627,10 @@ static int  tiger_compress(hash_state *md, const unsigned char *buf)
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int tiger_compress(hash_state *md, const unsigned char *buf)
+static int s_tiger_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _tiger_compress(md, buf);
+   err = ss_tiger_compress(md, buf);
    burn_stack(sizeof(ulong64) * 11 + sizeof(unsigned long));
    burn_stack(sizeof(ulong64) * 11 + sizeof(unsigned long));
    return err;
    return err;
 }
 }
@@ -665,7 +659,7 @@ int tiger_init(hash_state *md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(tiger_process, tiger_compress, tiger, 64)
+HASH_PROCESS(tiger_process, s_tiger_compress, tiger, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -695,7 +689,7 @@ int tiger_done(hash_state * md, unsigned char *out)
         while (md->tiger.curlen < 64) {
         while (md->tiger.curlen < 64) {
             md->tiger.buf[md->tiger.curlen++] = (unsigned char)0;
             md->tiger.buf[md->tiger.curlen++] = (unsigned char)0;
         }
         }
-        tiger_compress(md, md->tiger.buf);
+        s_tiger_compress(md, md->tiger.buf);
         md->tiger.curlen = 0;
         md->tiger.curlen = 0;
     }
     }
 
 
@@ -706,7 +700,7 @@ int tiger_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64L(md->tiger.length, md->tiger.buf+56);
     STORE64L(md->tiger.length, md->tiger.buf+56);
-    tiger_compress(md, md->tiger.buf);
+    s_tiger_compress(md, md->tiger.buf);
 
 
     /* copy output */
     /* copy output */
     STORE64L(md->tiger.state[0], &out[0]);
     STORE64L(md->tiger.state[0], &out[0]);

+ 8 - 8
src/hashes/whirl/whirl.c

@@ -29,7 +29,7 @@ const struct ltc_hash_descriptor whirlpool_desc =
 };
 };
 
 
 /* the sboxes */
 /* the sboxes */
-#define __LTC_WHIRLTAB_C__
+#define LTC_WHIRLTAB_C
 #include "whirltab.c"
 #include "whirltab.c"
 
 
 /* get a_{i,j} */
 /* get a_{i,j} */
@@ -47,9 +47,9 @@ const struct ltc_hash_descriptor whirlpool_desc =
     SB7(GB(a, i-7, 0)))
     SB7(GB(a, i-7, 0)))
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int _whirlpool_compress(hash_state *md, const unsigned char *buf)
+static int ss_whirlpool_compress(hash_state *md, const unsigned char *buf)
 #else
 #else
-static int whirlpool_compress(hash_state *md, const unsigned char *buf)
+static int s_whirlpool_compress(hash_state *md, const unsigned char *buf)
 #endif
 #endif
 {
 {
    ulong64 K[2][8], T[3][8];
    ulong64 K[2][8], T[3][8];
@@ -103,10 +103,10 @@ static int whirlpool_compress(hash_state *md, const unsigned char *buf)
 
 
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK
-static int whirlpool_compress(hash_state *md, const unsigned char *buf)
+static int s_whirlpool_compress(hash_state *md, const unsigned char *buf)
 {
 {
    int err;
    int err;
-   err = _whirlpool_compress(md, buf);
+   err = ss_whirlpool_compress(md, buf);
    burn_stack((5 * 8 * sizeof(ulong64)) + (2 * sizeof(int)));
    burn_stack((5 * 8 * sizeof(ulong64)) + (2 * sizeof(int)));
    return err;
    return err;
 }
 }
@@ -132,7 +132,7 @@ int whirlpool_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @param inlen  The length of the data (octets)
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-HASH_PROCESS(whirlpool_process, whirlpool_compress, whirlpool, 64)
+HASH_PROCESS(whirlpool_process, s_whirlpool_compress, whirlpool, 64)
 
 
 /**
 /**
    Terminate the hash to get the digest
    Terminate the hash to get the digest
@@ -165,7 +165,7 @@ int whirlpool_done(hash_state * md, unsigned char *out)
         while (md->whirlpool.curlen < 64) {
         while (md->whirlpool.curlen < 64) {
             md->whirlpool.buf[md->whirlpool.curlen++] = (unsigned char)0;
             md->whirlpool.buf[md->whirlpool.curlen++] = (unsigned char)0;
         }
         }
-        whirlpool_compress(md, md->whirlpool.buf);
+        s_whirlpool_compress(md, md->whirlpool.buf);
         md->whirlpool.curlen = 0;
         md->whirlpool.curlen = 0;
     }
     }
 
 
@@ -176,7 +176,7 @@ int whirlpool_done(hash_state * md, unsigned char *out)
 
 
     /* store length */
     /* store length */
     STORE64H(md->whirlpool.length, md->whirlpool.buf+56);
     STORE64H(md->whirlpool.length, md->whirlpool.buf+56);
-    whirlpool_compress(md, md->whirlpool.buf);
+    s_whirlpool_compress(md, md->whirlpool.buf);
 
 
     /* copy output */
     /* copy output */
     for (i = 0; i < 8; i++) {
     for (i = 0; i < 8; i++) {

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

@@ -6,7 +6,7 @@
    LTC_WHIRLPOOL tables, Tom St Denis
    LTC_WHIRLPOOL tables, Tom St Denis
 */
 */
 
 
-#ifdef __LTC_WHIRLTAB_C__
+#ifdef LTC_WHIRLTAB_C
 
 
 static const ulong64 sbox0[] = {
 static const ulong64 sbox0[] = {
 CONST64(0x18186018c07830d8), CONST64(0x23238c2305af4626), CONST64(0xc6c63fc67ef991b8), CONST64(0xe8e887e8136fcdfb),
 CONST64(0x18186018c07830d8), CONST64(0x23238c2305af4626), CONST64(0xc6c63fc67ef991b8), CONST64(0xe8e887e8136fcdfb),
@@ -583,4 +583,4 @@ CONST64(0xca2dbf07ad5a8333),
 CONST64(0x6302aa71c81949d9),
 CONST64(0x6302aa71c81949d9),
 };
 };
 
 
-#endif /* __LTC_WHIRLTAB_C__ */
+#endif /* LTC_WHIRLTAB_C */

+ 26 - 26
src/headers/tomcrypt_macros.h

@@ -54,8 +54,8 @@ do { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \
 #ifdef LTC_HAVE_BSWAP_BUILTIN
 #ifdef LTC_HAVE_BSWAP_BUILTIN
 
 
 #define STORE32H(x, y)                          \
 #define STORE32H(x, y)                          \
-do { ulong32 __t = __builtin_bswap32 ((x));     \
-      XMEMCPY ((y), &__t, 4); } while(0)
+do { ulong32 ttt = __builtin_bswap32 ((x));     \
+      XMEMCPY ((y), &ttt, 4); } while(0)
 
 
 #define LOAD32H(x, y)                           \
 #define LOAD32H(x, y)                           \
 do { XMEMCPY (&(x), (y), 4);                    \
 do { XMEMCPY (&(x), (y), 4);                    \
@@ -93,8 +93,8 @@ asm __volatile__ (             \
 #ifdef LTC_HAVE_BSWAP_BUILTIN
 #ifdef LTC_HAVE_BSWAP_BUILTIN
 
 
 #define STORE64H(x, y)                          \
 #define STORE64H(x, y)                          \
-do { ulong64 __t = __builtin_bswap64 ((x));     \
-      XMEMCPY ((y), &__t, 8); } while(0)
+do { ulong64 ttt = __builtin_bswap64 ((x));     \
+      XMEMCPY ((y), &ttt, 8); } while(0)
 
 
 #define LOAD64H(x, y)                           \
 #define LOAD64H(x, y)                           \
 do { XMEMCPY (&(x), (y), 8);                    \
 do { XMEMCPY (&(x), (y), 8);                    \
@@ -135,7 +135,7 @@ do { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \
 #ifdef ENDIAN_32BITWORD
 #ifdef ENDIAN_32BITWORD
 
 
 #define STORE32L(x, y)        \
 #define STORE32L(x, y)        \
-  do { ulong32  __t = (x); XMEMCPY(y, &__t, 4); } while(0)
+  do { ulong32  ttt = (x); XMEMCPY(y, &ttt, 4); } while(0)
 
 
 #define LOAD32L(x, y)         \
 #define LOAD32L(x, y)         \
   do { XMEMCPY(&(x), y, 4); } while(0)
   do { XMEMCPY(&(x), y, 4); } while(0)
@@ -155,13 +155,13 @@ do { x = (((ulong64)((y)[0] & 255))<<56)|(((ulong64)((y)[1] & 255))<<48) | \
 #else /* 64-bit words then  */
 #else /* 64-bit words then  */
 
 
 #define STORE32L(x, y)        \
 #define STORE32L(x, y)        \
-  do { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } while(0)
+  do { ulong32 ttt = (x); XMEMCPY(y, &ttt, 4); } while(0)
 
 
 #define LOAD32L(x, y)         \
 #define LOAD32L(x, y)         \
   do { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; } while(0)
   do { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; } while(0)
 
 
 #define STORE64L(x, y)        \
 #define STORE64L(x, y)        \
-  do { ulong64 __t = (x); XMEMCPY(y, &__t, 8); } while(0)
+  do { ulong64 ttt = (x); XMEMCPY(y, &ttt, 8); } while(0)
 
 
 #define LOAD64L(x, y)         \
 #define LOAD64L(x, y)         \
   do { XMEMCPY(&(x), y, 8); } while(0)
   do { XMEMCPY(&(x), y, 8); } while(0)
@@ -195,7 +195,7 @@ do { x = (((ulong64)((y)[7] & 255))<<56)|(((ulong64)((y)[6] & 255))<<48) | \
 #ifdef ENDIAN_32BITWORD
 #ifdef ENDIAN_32BITWORD
 
 
 #define STORE32H(x, y)        \
 #define STORE32H(x, y)        \
-  do { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } while(0)
+  do { ulong32 ttt = (x); XMEMCPY(y, &ttt, 4); } while(0)
 
 
 #define LOAD32H(x, y)         \
 #define LOAD32H(x, y)         \
   do { XMEMCPY(&(x), y, 4); } while(0)
   do { XMEMCPY(&(x), y, 4); } while(0)
@@ -215,13 +215,13 @@ do { x = (((ulong64)((y)[7] & 255))<<56)|(((ulong64)((y)[6] & 255))<<48) | \
 #else /* 64-bit words then  */
 #else /* 64-bit words then  */
 
 
 #define STORE32H(x, y)        \
 #define STORE32H(x, y)        \
-  do { ulong32 __t = (x); XMEMCPY(y, &__t, 4); } while(0)
+  do { ulong32 ttt = (x); XMEMCPY(y, &ttt, 4); } while(0)
 
 
 #define LOAD32H(x, y)         \
 #define LOAD32H(x, y)         \
   do { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; } while(0)
   do { XMEMCPY(&(x), y, 4); x &= 0xFFFFFFFF; } while(0)
 
 
 #define STORE64H(x, y)        \
 #define STORE64H(x, y)        \
-  do { ulong64 __t = (x); XMEMCPY(y, &__t, 8); } while(0)
+  do { ulong64 ttt = (x); XMEMCPY(y, &ttt, 8); } while(0)
 
 
 #define LOAD64H(x, y)         \
 #define LOAD64H(x, y)         \
   do { XMEMCPY(&(x), y, 8); } while(0)
   do { XMEMCPY(&(x), y, 8); } while(0)
@@ -275,20 +275,20 @@ static inline ulong32 ROR(ulong32 word, int i)
 #ifndef LTC_NO_ROLC
 #ifndef LTC_NO_ROLC
 
 
 #define ROLc(word,i) ({ \
 #define ROLc(word,i) ({ \
-   ulong32 __ROLc_tmp = (word); \
+   ulong32 ROLc_tmp = (word); \
    __asm__ ("roll %2, %0" : \
    __asm__ ("roll %2, %0" : \
-            "=r" (__ROLc_tmp) : \
-            "0" (__ROLc_tmp), \
+            "=r" (ROLc_tmp) : \
+            "0" (ROLc_tmp), \
             "I" (i)); \
             "I" (i)); \
-            __ROLc_tmp; \
+            ROLc_tmp; \
    })
    })
 #define RORc(word,i) ({ \
 #define RORc(word,i) ({ \
-   ulong32 __RORc_tmp = (word); \
+   ulong32 RORc_tmp = (word); \
    __asm__ ("rorl %2, %0" : \
    __asm__ ("rorl %2, %0" : \
-            "=r" (__RORc_tmp) : \
-            "0" (__RORc_tmp), \
+            "=r" (RORc_tmp) : \
+            "0" (RORc_tmp), \
             "I" (i)); \
             "I" (i)); \
-            __RORc_tmp; \
+            RORc_tmp; \
    })
    })
 
 
 #else
 #else
@@ -393,20 +393,20 @@ static inline ulong64 ROR64(ulong64 word, int i)
 #ifndef LTC_NO_ROLC
 #ifndef LTC_NO_ROLC
 
 
 #define ROL64c(word,i) ({ \
 #define ROL64c(word,i) ({ \
-   ulong64 __ROL64c_tmp = word; \
+   ulong64 ROL64c_tmp = word; \
    __asm__ ("rolq %2, %0" : \
    __asm__ ("rolq %2, %0" : \
-            "=r" (__ROL64c_tmp) : \
-            "0" (__ROL64c_tmp), \
+            "=r" (ROL64c_tmp) : \
+            "0" (ROL64c_tmp), \
             "J" (i)); \
             "J" (i)); \
-            __ROL64c_tmp; \
+            ROL64c_tmp; \
    })
    })
 #define ROR64c(word,i) ({ \
 #define ROR64c(word,i) ({ \
-   ulong64 __ROR64c_tmp = word; \
+   ulong64 ROR64c_tmp = word; \
    __asm__ ("rorq %2, %0" : \
    __asm__ ("rorq %2, %0" : \
-            "=r" (__ROR64c_tmp) : \
-            "0" (__ROR64c_tmp), \
+            "=r" (ROR64c_tmp) : \
+            "0" (ROR64c_tmp), \
             "J" (i)); \
             "J" (i)); \
-            __ROR64c_tmp; \
+            ROR64c_tmp; \
    })
    })
 
 
 #else /* LTC_NO_ROLC */
 #else /* LTC_NO_ROLC */

+ 13 - 13
src/headers/tomcrypt_pk.h

@@ -55,20 +55,20 @@ int rsa_exptmod(const unsigned char *in,   unsigned long inlen,
 void rsa_free(rsa_key *key);
 void rsa_free(rsa_key *key);
 
 
 /* These use PKCS #1 v2.0 padding */
 /* These use PKCS #1 v2.0 padding */
-#define rsa_encrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, _key) \
-  rsa_encrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, LTC_PKCS_1_OAEP, _key)
+#define rsa_encrypt_key(in, inlen, out, outlen, lparam, lparamlen, prng, prng_idx, hash_idx, key) \
+  rsa_encrypt_key_ex(in, inlen, out, outlen, lparam, lparamlen, prng, prng_idx, hash_idx, LTC_PKCS_1_OAEP, key)
 
 
-#define rsa_decrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, _stat, _key) \
-  rsa_decrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, LTC_PKCS_1_OAEP, _stat, _key)
+#define rsa_decrypt_key(in, inlen, out, outlen, lparam, lparamlen, hash_idx, stat, key) \
+  rsa_decrypt_key_ex(in, inlen, out, outlen, lparam, lparamlen, hash_idx, LTC_PKCS_1_OAEP, stat, key)
 
 
-#define rsa_sign_hash(_in, _inlen, _out, _outlen, _prng, _prng_idx, _hash_idx, _saltlen, _key) \
-  rsa_sign_hash_ex(_in, _inlen, _out, _outlen, LTC_PKCS_1_PSS, _prng, _prng_idx, _hash_idx, _saltlen, _key)
+#define rsa_sign_hash(in, inlen, out, outlen, prng, prng_idx, hash_idx, saltlen, key) \
+  rsa_sign_hash_ex(in, inlen, out, outlen, LTC_PKCS_1_PSS, prng, prng_idx, hash_idx, saltlen, key)
 
 
-#define rsa_verify_hash(_sig, _siglen, _hash, _hashlen, _hash_idx, _saltlen, _stat, _key) \
-  rsa_verify_hash_ex(_sig, _siglen, _hash, _hashlen, LTC_PKCS_1_PSS, _hash_idx, _saltlen, _stat, _key)
+#define rsa_verify_hash(sig, siglen, hash, hashlen, hash_idx, saltlen, stat, key) \
+  rsa_verify_hash_ex(sig, siglen, hash, hashlen, LTC_PKCS_1_PSS, hash_idx, saltlen, stat, key)
 
 
-#define rsa_sign_saltlen_get_max(_hash_idx, _key) \
-  rsa_sign_saltlen_get_max_ex(LTC_PKCS_1_PSS, _hash_idx, _key)
+#define rsa_sign_saltlen_get_max(hash_idx, key) \
+  rsa_sign_saltlen_get_max_ex(LTC_PKCS_1_PSS, hash_idx, key)
 
 
 /* These can be switched between PKCS #1 v2.x and PKCS #1 v1.5 paddings */
 /* These can be switched between PKCS #1 v2.x and PKCS #1 v1.5 paddings */
 int rsa_encrypt_key_ex(const unsigned char *in,       unsigned long  inlen,
 int rsa_encrypt_key_ex(const unsigned char *in,       unsigned long  inlen,
@@ -540,7 +540,7 @@ typedef struct ltc_asn1_list_ {
       LTC_MACRO_list[LTC_MACRO_temp].tag = 0;        \
       LTC_MACRO_list[LTC_MACRO_temp].tag = 0;        \
    } while (0)
    } while (0)
 
 
-#define __LTC_SET_ASN1_IDENTIFIER(list, index, Class, Pc, Tag)      \
+#define LTC_SET_ASN1_IDENTIFIER(list, index, Class, Pc, Tag)      \
    do {                                                           \
    do {                                                           \
       int LTC_MACRO_temp            = (index);                    \
       int LTC_MACRO_temp            = (index);                    \
       ltc_asn1_list *LTC_MACRO_list = (list);                     \
       ltc_asn1_list *LTC_MACRO_list = (list);                     \
@@ -554,14 +554,14 @@ typedef struct ltc_asn1_list_ {
    do {                                                           \
    do {                                                           \
       int LTC_MACRO_temp##__LINE__ = (index);                     \
       int LTC_MACRO_temp##__LINE__ = (index);                     \
       LTC_SET_ASN1(list, LTC_MACRO_temp##__LINE__, LTC_ASN1_CUSTOM_TYPE, Data, 1);   \
       LTC_SET_ASN1(list, LTC_MACRO_temp##__LINE__, LTC_ASN1_CUSTOM_TYPE, Data, 1);   \
-      __LTC_SET_ASN1_IDENTIFIER(list, LTC_MACRO_temp##__LINE__, Class, LTC_ASN1_PC_CONSTRUCTED, Tag);       \
+      LTC_SET_ASN1_IDENTIFIER(list, LTC_MACRO_temp##__LINE__, Class, LTC_ASN1_PC_CONSTRUCTED, Tag);       \
    } while (0)
    } while (0)
 
 
 #define LTC_SET_ASN1_CUSTOM_PRIMITIVE(list, index, Class, Tag, Type, Data, Size)    \
 #define LTC_SET_ASN1_CUSTOM_PRIMITIVE(list, index, Class, Tag, Type, Data, Size)    \
    do {                                                           \
    do {                                                           \
       int LTC_MACRO_temp##__LINE__ = (index);                     \
       int LTC_MACRO_temp##__LINE__ = (index);                     \
       LTC_SET_ASN1(list, LTC_MACRO_temp##__LINE__, LTC_ASN1_CUSTOM_TYPE, Data, Size);   \
       LTC_SET_ASN1(list, LTC_MACRO_temp##__LINE__, LTC_ASN1_CUSTOM_TYPE, Data, Size);   \
-      __LTC_SET_ASN1_IDENTIFIER(list, LTC_MACRO_temp##__LINE__, Class, LTC_ASN1_PC_PRIMITIVE, Tag);       \
+      LTC_SET_ASN1_IDENTIFIER(list, LTC_MACRO_temp##__LINE__, Class, LTC_ASN1_PC_PRIMITIVE, Tag);       \
       list[LTC_MACRO_temp##__LINE__].used = (int)(Type);       \
       list[LTC_MACRO_temp##__LINE__].used = (int)(Type);       \
    } while (0)
    } while (0)
 
 

+ 1 - 1
src/headers/tomcrypt_private.h

@@ -417,7 +417,7 @@ int pkcs12_kdf(               int   hash_id,
 
 
 /* tomcrypt_prng.h */
 /* tomcrypt_prng.h */
 
 
-#define _LTC_PRNG_EXPORT(which) \
+#define LTC_PRNG_EXPORT(which) \
 int which ## _export(unsigned char *out, unsigned long *outlen, prng_state *prng)      \
 int which ## _export(unsigned char *out, unsigned long *outlen, prng_state *prng)      \
 {                                                                                      \
 {                                                                                      \
    unsigned long len = which ## _desc.export_size;                                     \
    unsigned long len = which ## _desc.export_size;                                     \

+ 5 - 5
src/mac/pelican/pelican.c

@@ -9,7 +9,7 @@
 
 
 #ifdef LTC_PELICAN
 #ifdef LTC_PELICAN
 
 
-#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"
@@ -45,7 +45,7 @@ int pelican_init(pelican_state *pelmac, const unsigned char *key, unsigned long
     return CRYPT_OK;
     return CRYPT_OK;
 }
 }
 
 
-static void _four_rounds(pelican_state *pelmac)
+static void s_four_rounds(pelican_state *pelmac)
 {
 {
     ulong32 s0, s1, s2, s3, t0, t1, t2, t3;
     ulong32 s0, s1, s2, s3, t0, t1, t2, t3;
     int r;
     int r;
@@ -108,7 +108,7 @@ int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned lon
          for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
          for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
             *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pelmac->state + x)) ^= *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)in + x));
             *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pelmac->state + x)) ^= *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)in + x));
          }
          }
-         _four_rounds(pelmac);
+         s_four_rounds(pelmac);
          in    += 16;
          in    += 16;
          inlen -= 16;
          inlen -= 16;
       }
       }
@@ -118,7 +118,7 @@ int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned lon
    while (inlen--) {
    while (inlen--) {
        pelmac->state[pelmac->buflen++] ^= *in++;
        pelmac->state[pelmac->buflen++] ^= *in++;
        if (pelmac->buflen == 16) {
        if (pelmac->buflen == 16) {
-          _four_rounds(pelmac);
+          s_four_rounds(pelmac);
           pelmac->buflen = 0;
           pelmac->buflen = 0;
        }
        }
    }
    }
@@ -142,7 +142,7 @@ int pelican_done(pelican_state *pelmac, unsigned char *out)
    }
    }
 
 
    if  (pelmac->buflen == 16) {
    if  (pelmac->buflen == 16) {
-       _four_rounds(pelmac);
+       s_four_rounds(pelmac);
        pelmac->buflen = 0;
        pelmac->buflen = 0;
    }
    }
    pelmac->state[pelmac->buflen++] ^= 0x80;
    pelmac->state[pelmac->buflen++] ^= 0x80;

+ 4 - 4
src/mac/poly1305/poly1305.c

@@ -11,7 +11,7 @@
 #ifdef LTC_POLY1305
 #ifdef LTC_POLY1305
 
 
 /* internal only */
 /* internal only */
-static void _poly1305_block(poly1305_state *st, const unsigned char *in, unsigned long inlen)
+static void s_poly1305_block(poly1305_state *st, const unsigned char *in, unsigned long inlen)
 {
 {
    const unsigned long hibit = (st->final) ? 0 : (1UL << 24); /* 1 << 128 */
    const unsigned long hibit = (st->final) ? 0 : (1UL << 24); /* 1 << 128 */
    ulong32 r0,r1,r2,r3,r4;
    ulong32 r0,r1,r2,r3,r4;
@@ -135,14 +135,14 @@ int poly1305_process(poly1305_state *st, const unsigned char *in, unsigned long
       in += want;
       in += want;
       st->leftover += want;
       st->leftover += want;
       if (st->leftover < 16) return CRYPT_OK;
       if (st->leftover < 16) return CRYPT_OK;
-      _poly1305_block(st, st->buffer, 16);
+      s_poly1305_block(st, st->buffer, 16);
       st->leftover = 0;
       st->leftover = 0;
    }
    }
 
 
    /* process full blocks */
    /* process full blocks */
    if (inlen >= 16) {
    if (inlen >= 16) {
       unsigned long want = (inlen & ~(16 - 1));
       unsigned long want = (inlen & ~(16 - 1));
-      _poly1305_block(st, in, want);
+      s_poly1305_block(st, in, want);
       in += want;
       in += want;
       inlen -= want;
       inlen -= want;
    }
    }
@@ -180,7 +180,7 @@ int poly1305_done(poly1305_state *st, unsigned char *mac, unsigned long *maclen)
       st->buffer[i++] = 1;
       st->buffer[i++] = 1;
       for (; i < 16; i++) st->buffer[i] = 0;
       for (; i < 16; i++) st->buffer[i] = 0;
       st->final = 1;
       st->final = 1;
-      _poly1305_block(st, st->buffer, 16);
+      s_poly1305_block(st, st->buffer, 16);
    }
    }
 
 
    /* fully carry h */
    /* fully carry h */

+ 28 - 28
src/math/fp/ltc_ecc_fp_mulmod.c

@@ -566,7 +566,7 @@ static const struct {
 };
 };
 
 
 /* find a hole and free as required, return -1 if no hole found */
 /* find a hole and free as required, return -1 if no hole found */
-static int _find_hole(void)
+static int s_find_hole(void)
 {
 {
    unsigned x;
    unsigned x;
    int      y, z;
    int      y, z;
@@ -602,7 +602,7 @@ static int _find_hole(void)
 }
 }
 
 
 /* determine if a base is already in the cache and if so, where */
 /* determine if a base is already in the cache and if so, where */
-static int _find_base(ecc_point *g)
+static int s_find_base(ecc_point *g)
 {
 {
    int x;
    int x;
    for (x = 0; x < FP_ENTRIES; x++) {
    for (x = 0; x < FP_ENTRIES; x++) {
@@ -620,7 +620,7 @@ static int _find_base(ecc_point *g)
 }
 }
 
 
 /* add a new base to the cache */
 /* add a new base to the cache */
-static int _add_entry(int idx, ecc_point *g)
+static int s_add_entry(int idx, ecc_point *g)
 {
 {
    unsigned x, y;
    unsigned x, y;
 
 
@@ -662,7 +662,7 @@ static int _add_entry(int idx, ecc_point *g)
  * The algorithm builds patterns in increasing bit order by first making all
  * The algorithm builds patterns in increasing bit order by first making all
  * single bit input patterns, then all two bit input patterns and so on
  * single bit input patterns, then all two bit input patterns and so on
  */
  */
-static int _build_lut(int idx, void *a, void *modulus, void *mp, void *mu)
+static int s_build_lut(int idx, void *a, void *modulus, void *mp, void *mu)
 {
 {
    unsigned x, y, err, bitlen, lut_gap;
    unsigned x, y, err, bitlen, lut_gap;
    void    *tmp;
    void    *tmp;
@@ -769,7 +769,7 @@ DONE:
 }
 }
 
 
 /* perform a fixed point ECC mulmod */
 /* perform a fixed point ECC mulmod */
-static int _accel_fp_mul(int idx, void *k, ecc_point *R, void *a, void *modulus, void *mp, int map)
+static int s_accel_fp_mul(int idx, void *k, ecc_point *R, void *a, void *modulus, void *mp, int map)
 {
 {
    unsigned char kb[128];
    unsigned char kb[128];
    int      x;
    int      x;
@@ -892,7 +892,7 @@ static int _accel_fp_mul(int idx, void *k, ecc_point *R, void *a, void *modulus,
 
 
 #ifdef LTC_ECC_SHAMIR
 #ifdef LTC_ECC_SHAMIR
 /* perform a fixed point ECC mulmod */
 /* perform a fixed point ECC mulmod */
-static int _accel_fp_mul2add(int idx1, int idx2,
+static int ss_accel_fp_mul2add(int idx1, int idx2,
                             void *kA, void *kB,
                             void *kA, void *kB,
                             ecc_point *R, void *a, void *modulus, void *mp)
                             ecc_point *R, void *a, void *modulus, void *mp)
 {
 {
@@ -1115,13 +1115,13 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
    mu = NULL;
    mu = NULL;
    LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
    LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
       /* find point */
       /* find point */
-      idx1 = _find_base(A);
+      idx1 = s_find_base(A);
 
 
       /* no entry? */
       /* no entry? */
       if (idx1 == -1) {
       if (idx1 == -1) {
          /* find hole and add it */
          /* find hole and add it */
-         if ((idx1 = _find_hole()) >= 0) {
-            if ((err = _add_entry(idx1, A)) != CRYPT_OK) {
+         if ((idx1 = s_find_hole()) >= 0) {
+            if ((err = s_add_entry(idx1, A)) != CRYPT_OK) {
                goto LBL_ERR;
                goto LBL_ERR;
             }
             }
          }
          }
@@ -1132,13 +1132,13 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
       }
       }
 
 
       /* find point */
       /* find point */
-      idx2 = _find_base(B);
+      idx2 = s_find_base(B);
 
 
       /* no entry? */
       /* no entry? */
       if (idx2 == -1) {
       if (idx2 == -1) {
          /* find hole and add it */
          /* find hole and add it */
-         if ((idx2 = _find_hole()) >= 0) {
-            if ((err = _add_entry(idx2, B)) != CRYPT_OK) {
+         if ((idx2 = s_find_hole()) >= 0) {
+            if ((err = s_add_entry(idx2, B)) != CRYPT_OK) {
                goto LBL_ERR;
                goto LBL_ERR;
             }
             }
          }
          }
@@ -1162,7 +1162,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
          }
          }
 
 
          /* build the LUT */
          /* build the LUT */
-         if ((err = _build_lut(idx1, a, modulus, mp, mu)) != CRYPT_OK) {
+         if ((err = s_build_lut(idx1, a, modulus, mp, mu)) != CRYPT_OK) {
              goto LBL_ERR;;
              goto LBL_ERR;;
          }
          }
       }
       }
@@ -1183,7 +1183,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
          }
          }
 
 
          /* build the LUT */
          /* build the LUT */
-         if ((err = _build_lut(idx2, a, modulus, mp, mu)) != CRYPT_OK) {
+         if ((err = s_build_lut(idx2, a, modulus, mp, mu)) != CRYPT_OK) {
              goto LBL_ERR;;
              goto LBL_ERR;;
          }
          }
       }
       }
@@ -1194,7 +1194,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA,
             /* compute mp */
             /* compute mp */
             if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; }
             if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; }
          }
          }
-         err = _accel_fp_mul2add(idx1, idx2, kA, kB, C, a, modulus, mp);
+         err = ss_accel_fp_mul2add(idx1, idx2, kA, kB, C, a, modulus, mp);
       } else {
       } else {
          err = ltc_ecc_mul2add(A, kA, B, kB, C, a, modulus);
          err = ltc_ecc_mul2add(A, kA, B, kB, C, a, modulus);
       }
       }
@@ -1228,15 +1228,15 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulu
    mu = NULL;
    mu = NULL;
    LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
    LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
       /* find point */
       /* find point */
-      idx = _find_base(G);
+      idx = s_find_base(G);
 
 
       /* no entry? */
       /* no entry? */
       if (idx == -1) {
       if (idx == -1) {
          /* find hole and add it */
          /* find hole and add it */
-         idx = _find_hole();
+         idx = s_find_hole();
 
 
          if (idx >= 0) {
          if (idx >= 0) {
-            if ((err = _add_entry(idx, G)) != CRYPT_OK) {
+            if ((err = s_add_entry(idx, G)) != CRYPT_OK) {
                goto LBL_ERR;
                goto LBL_ERR;
             }
             }
          }
          }
@@ -1261,7 +1261,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulu
          }
          }
 
 
          /* build the LUT */
          /* build the LUT */
-         if ((err = _build_lut(idx, a, modulus, mp, mu)) != CRYPT_OK) {
+         if ((err = s_build_lut(idx, a, modulus, mp, mu)) != CRYPT_OK) {
              goto LBL_ERR;;
              goto LBL_ERR;;
          }
          }
       }
       }
@@ -1271,7 +1271,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulu
             /* compute mp */
             /* compute mp */
             if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; }
             if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; }
          }
          }
-         err = _accel_fp_mul(idx, k, R, a, modulus, mp, map);
+         err = s_accel_fp_mul(idx, k, R, a, modulus, mp, map);
       } else {
       } else {
          err = ltc_ecc_mulmod(k, G, R, a, modulus, map);
          err = ltc_ecc_mulmod(k, G, R, a, modulus, map);
       }
       }
@@ -1287,7 +1287,7 @@ LBL_ERR:
 }
 }
 
 
 /* helper function for freeing the cache ... must be called with the cache mutex locked */
 /* helper function for freeing the cache ... must be called with the cache mutex locked */
-static void _ltc_ecc_fp_free_cache(void)
+static void s_ltc_ecc_fp_free_cache(void)
 {
 {
    unsigned x, y;
    unsigned x, y;
    for (x = 0; x < FP_ENTRIES; x++) {
    for (x = 0; x < FP_ENTRIES; x++) {
@@ -1312,7 +1312,7 @@ static void _ltc_ecc_fp_free_cache(void)
 void ltc_ecc_fp_free(void)
 void ltc_ecc_fp_free(void)
 {
 {
    LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
    LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
-   _ltc_ecc_fp_free_cache();
+   s_ltc_ecc_fp_free_cache();
    LTC_MUTEX_UNLOCK(&ltc_ecc_fp_lock);
    LTC_MUTEX_UNLOCK(&ltc_ecc_fp_lock);
 }
 }
 
 
@@ -1331,7 +1331,7 @@ ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock)
    void *mu = NULL;
    void *mu = NULL;
 
 
    LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
    LTC_MUTEX_LOCK(&ltc_ecc_fp_lock);
-   if ((idx = _find_base(g)) >= 0) {
+   if ((idx = s_find_base(g)) >= 0) {
       /* it is already in the cache ... just check that the LUT is initialized */
       /* it is already in the cache ... just check that the LUT is initialized */
       if(fp_cache[idx].lru_count >= 2) {
       if(fp_cache[idx].lru_count >= 2) {
          LTC_MUTEX_UNLOCK(&ltc_ecc_fp_lock);
          LTC_MUTEX_UNLOCK(&ltc_ecc_fp_lock);
@@ -1339,11 +1339,11 @@ ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock)
       }
       }
    }
    }
 
 
-   if(idx == -1 && (idx = _find_hole()) == -1) {
+   if(idx == -1 && (idx = s_find_hole()) == -1) {
       err = CRYPT_BUFFER_OVERFLOW;
       err = CRYPT_BUFFER_OVERFLOW;
       goto LBL_ERR;
       goto LBL_ERR;
    }
    }
-   if ((err = _add_entry(idx, g)) != CRYPT_OK) {
+   if ((err = s_add_entry(idx, g)) != CRYPT_OK) {
       goto LBL_ERR;
       goto LBL_ERR;
    }
    }
    /* compute mp */
    /* compute mp */
@@ -1360,7 +1360,7 @@ ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock)
    }
    }
 
 
    /* build the LUT */
    /* build the LUT */
-   if ((err = _build_lut(idx, a, modulus, mp, mu)) != CRYPT_OK) {
+   if ((err = s_build_lut(idx, a, modulus, mp, mu)) != CRYPT_OK) {
        goto LBL_ERR;
        goto LBL_ERR;
    }
    }
    fp_cache[idx].lru_count = 2;
    fp_cache[idx].lru_count = 2;
@@ -1498,7 +1498,7 @@ int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen)
    /*
    /*
     * start with an empty cache
     * start with an empty cache
     */
     */
-   _ltc_ecc_fp_free_cache();
+   s_ltc_ecc_fp_free_cache();
 
 
    /*
    /*
     * decode the input packet: It consists of a sequence with a few
     * decode the input packet: It consists of a sequence with a few
@@ -1568,7 +1568,7 @@ int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen)
 ERR_OUT:
 ERR_OUT:
    if(asn1_list)
    if(asn1_list)
       XFREE(asn1_list);
       XFREE(asn1_list);
-   _ltc_ecc_fp_free_cache();
+   s_ltc_ecc_fp_free_cache();
    LTC_MUTEX_UNLOCK(&ltc_ecc_fp_lock);
    LTC_MUTEX_UNLOCK(&ltc_ecc_fp_lock);
    return err;
    return err;
 }
 }

+ 9 - 9
src/misc/adler32.c

@@ -10,7 +10,7 @@
 */
 */
 #ifdef LTC_ADLER32
 #ifdef LTC_ADLER32
 
 
-static const unsigned long _adler32_base = 65521;
+static const unsigned long s_adler32_base = 65521;
 
 
 void adler32_init(adler32_state *ctx)
 void adler32_init(adler32_state *ctx)
 {
 {
@@ -35,10 +35,10 @@ void adler32_update(adler32_state *ctx, const unsigned char *input, unsigned lon
          length--;
          length--;
       } while (length % 8 != 0);
       } while (length % 8 != 0);
 
 
-      if (s1 >= _adler32_base) {
-         s1 -= _adler32_base;
+      if (s1 >= s_adler32_base) {
+         s1 -= s_adler32_base;
       }
       }
-      s2 %= _adler32_base;
+      s2 %= s_adler32_base;
    }
    }
 
 
    while (length > 0) {
    while (length > 0) {
@@ -62,14 +62,14 @@ void adler32_update(adler32_state *ctx, const unsigned char *input, unsigned lon
       length -= 8;
       length -= 8;
       input += 8;
       input += 8;
 
 
-      if (s1 >= _adler32_base) {
-         s1 -= _adler32_base;
+      if (s1 >= s_adler32_base) {
+         s1 -= s_adler32_base;
       }
       }
-      s2 %= _adler32_base;
+      s2 %= s_adler32_base;
    }
    }
 
 
-   LTC_ARGCHKVD(s1 < _adler32_base);
-   LTC_ARGCHKVD(s2 < _adler32_base);
+   LTC_ARGCHKVD(s1 < s_adler32_base);
+   LTC_ARGCHKVD(s2 < s_adler32_base);
 
 
    ctx->s[0] = (unsigned short)s1;
    ctx->s[0] = (unsigned short)s1;
    ctx->s[1] = (unsigned short)s2;
    ctx->s[1] = (unsigned short)s2;

+ 7 - 7
src/misc/base64/base64_decode.c

@@ -75,7 +75,7 @@ enum {
    relaxed = 2
    relaxed = 2
 };
 };
 
 
-static int _base64_decode_internal(const char *in,  unsigned long inlen,
+static int s_base64_decode_internal(const char *in,  unsigned long inlen,
                                  unsigned char *out, unsigned long *outlen,
                                  unsigned char *out, unsigned long *outlen,
                            const unsigned char *map, int mode)
                            const unsigned char *map, int mode)
 {
 {
@@ -149,7 +149,7 @@ static int _base64_decode_internal(const char *in,  unsigned long inlen,
 int base64_decode(const char *in,  unsigned long inlen,
 int base64_decode(const char *in,  unsigned long inlen,
                         unsigned char *out, unsigned long *outlen)
                         unsigned char *out, unsigned long *outlen)
 {
 {
-    return _base64_decode_internal(in, inlen, out, outlen, map_base64, insane);
+    return s_base64_decode_internal(in, inlen, out, outlen, map_base64, insane);
 }
 }
 
 
 /**
 /**
@@ -163,7 +163,7 @@ int base64_decode(const char *in,  unsigned long inlen,
 int base64_strict_decode(const char *in,  unsigned long inlen,
 int base64_strict_decode(const char *in,  unsigned long inlen,
                         unsigned char *out, unsigned long *outlen)
                         unsigned char *out, unsigned long *outlen)
 {
 {
-   return _base64_decode_internal(in, inlen, out, outlen, map_base64, strict);
+   return s_base64_decode_internal(in, inlen, out, outlen, map_base64, strict);
 }
 }
 
 
 /**
 /**
@@ -177,7 +177,7 @@ int base64_strict_decode(const char *in,  unsigned long inlen,
 int base64_sane_decode(const char *in,  unsigned long inlen,
 int base64_sane_decode(const char *in,  unsigned long inlen,
                         unsigned char *out, unsigned long *outlen)
                         unsigned char *out, unsigned long *outlen)
 {
 {
-   return _base64_decode_internal(in, inlen, out, outlen, map_base64, relaxed);
+   return s_base64_decode_internal(in, inlen, out, outlen, map_base64, relaxed);
 }
 }
 #endif /* LTC_BASE64 */
 #endif /* LTC_BASE64 */
 
 
@@ -193,7 +193,7 @@ int base64_sane_decode(const char *in,  unsigned long inlen,
 int base64url_decode(const char *in,  unsigned long inlen,
 int base64url_decode(const char *in,  unsigned long inlen,
                            unsigned char *out, unsigned long *outlen)
                            unsigned char *out, unsigned long *outlen)
 {
 {
-    return _base64_decode_internal(in, inlen, out, outlen, map_base64url, insane);
+    return s_base64_decode_internal(in, inlen, out, outlen, map_base64url, insane);
 }
 }
 
 
 /**
 /**
@@ -207,7 +207,7 @@ int base64url_decode(const char *in,  unsigned long inlen,
 int base64url_strict_decode(const char *in,  unsigned long inlen,
 int base64url_strict_decode(const char *in,  unsigned long inlen,
                            unsigned char *out, unsigned long *outlen)
                            unsigned char *out, unsigned long *outlen)
 {
 {
-    return _base64_decode_internal(in, inlen, out, outlen, map_base64url, strict);
+    return s_base64_decode_internal(in, inlen, out, outlen, map_base64url, strict);
 }
 }
 
 
 /**
 /**
@@ -221,7 +221,7 @@ int base64url_strict_decode(const char *in,  unsigned long inlen,
 int base64url_sane_decode(const char *in,  unsigned long inlen,
 int base64url_sane_decode(const char *in,  unsigned long inlen,
                            unsigned char *out, unsigned long *outlen)
                            unsigned char *out, unsigned long *outlen)
 {
 {
-    return _base64_decode_internal(in, inlen, out, outlen, map_base64url, relaxed);
+    return s_base64_decode_internal(in, inlen, out, outlen, map_base64url, relaxed);
 }
 }
 #endif /* LTC_BASE64_URL */
 #endif /* LTC_BASE64_URL */
 
 

+ 4 - 4
src/misc/base64/base64_encode.c

@@ -21,7 +21,7 @@ static const char * const codes_base64url =
 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
 #endif /* LTC_BASE64_URL */
 #endif /* LTC_BASE64_URL */
 
 
-static int _base64_encode_internal(const unsigned char *in,  unsigned long inlen,
+static int s_base64_encode_internal(const unsigned char *in,  unsigned long inlen,
                                  char *out, unsigned long *outlen,
                                  char *out, unsigned long *outlen,
                                  const char *codes, int pad)
                                  const char *codes, int pad)
 {
 {
@@ -83,7 +83,7 @@ static int _base64_encode_internal(const unsigned char *in,  unsigned long inlen
 int base64_encode(const unsigned char *in,  unsigned long inlen,
 int base64_encode(const unsigned char *in,  unsigned long inlen,
                                  char *out, unsigned long *outlen)
                                  char *out, unsigned long *outlen)
 {
 {
-    return _base64_encode_internal(in, inlen, out, outlen, codes_base64, 1);
+    return s_base64_encode_internal(in, inlen, out, outlen, codes_base64, 1);
 }
 }
 #endif /* LTC_BASE64 */
 #endif /* LTC_BASE64 */
 
 
@@ -100,13 +100,13 @@ int base64_encode(const unsigned char *in,  unsigned long inlen,
 int base64url_encode(const unsigned char *in,  unsigned long inlen,
 int base64url_encode(const unsigned char *in,  unsigned long inlen,
                                     char *out, unsigned long *outlen)
                                     char *out, unsigned long *outlen)
 {
 {
-    return _base64_encode_internal(in, inlen, out, outlen, codes_base64url, 0);
+    return s_base64_encode_internal(in, inlen, out, outlen, codes_base64url, 0);
 }
 }
 
 
 int base64url_strict_encode(const unsigned char *in,  unsigned long inlen,
 int base64url_strict_encode(const unsigned char *in,  unsigned long inlen,
                                            char *out, unsigned long *outlen)
                                            char *out, unsigned long *outlen)
 {
 {
-    return _base64_encode_internal(in, inlen, out, outlen, codes_base64url, 1);
+    return s_base64_encode_internal(in, inlen, out, outlen, codes_base64url, 1);
 }
 }
 #endif /* LTC_BASE64_URL */
 #endif /* LTC_BASE64_URL */
 
 

+ 5 - 5
src/misc/bcrypt/bcrypt.c

@@ -11,7 +11,7 @@
 #define BCRYPT_WORDS 8
 #define BCRYPT_WORDS 8
 #define BCRYPT_HASHSIZE (BCRYPT_WORDS * 4)
 #define BCRYPT_HASHSIZE (BCRYPT_WORDS * 4)
 
 
-static int _bcrypt_hash(const unsigned char *pt,
+static int s_bcrypt_hash(const unsigned char *pt,
                         const unsigned char *pass, unsigned long passlen,
                         const unsigned char *pass, unsigned long passlen,
                         const unsigned char *salt, unsigned long saltlen,
                         const unsigned char *salt, unsigned long saltlen,
                               unsigned char *out,  unsigned long *outlen)
                               unsigned char *out,  unsigned long *outlen)
@@ -52,12 +52,12 @@ static int _bcrypt_hash(const unsigned char *pt,
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-static int _bcrypt_pbkdf_hash(const unsigned char *pass, unsigned long passlen,
+static int s_bcrypt_pbkdf_hash(const unsigned char *pass, unsigned long passlen,
                          const unsigned char *salt, unsigned long saltlen,
                          const unsigned char *salt, unsigned long saltlen,
                                unsigned char *out,  unsigned long *outlen)
                                unsigned char *out,  unsigned long *outlen)
 {
 {
    const unsigned char pt[] = "OxychromaticBlowfishSwatDynamite";
    const unsigned char pt[] = "OxychromaticBlowfishSwatDynamite";
-   return _bcrypt_hash(pt, pass, passlen, salt, saltlen, out, outlen);
+   return s_bcrypt_hash(pt, pass, passlen, salt, saltlen, out, outlen);
 }
 }
 
 
 /**
 /**
@@ -143,7 +143,7 @@ int bcrypt_pbkdf_openbsd(const          void *secret, unsigned long secret_len,
           goto LBL_ERR;
           goto LBL_ERR;
        }
        }
        y = MAXBLOCKSIZE;
        y = MAXBLOCKSIZE;
-       if ((err = _bcrypt_pbkdf_hash(hashed_pass, hashed_pass_len, buf[0], x, buf[1], &y)) != CRYPT_OK) {
+       if ((err = s_bcrypt_pbkdf_hash(hashed_pass, hashed_pass_len, buf[0], x, buf[1], &y)) != CRYPT_OK) {
           goto LBL_ERR;
           goto LBL_ERR;
        }
        }
        XMEMCPY(buf[2], buf[1], y);
        XMEMCPY(buf[2], buf[1], y);
@@ -155,7 +155,7 @@ int bcrypt_pbkdf_openbsd(const          void *secret, unsigned long secret_len,
              goto LBL_ERR;
              goto LBL_ERR;
           }
           }
           y = MAXBLOCKSIZE;
           y = MAXBLOCKSIZE;
-          if ((err = _bcrypt_pbkdf_hash(hashed_pass, hashed_pass_len, buf[0], x, buf[1], &y)) != CRYPT_OK) {
+          if ((err = s_bcrypt_pbkdf_hash(hashed_pass, hashed_pass_len, buf[0], x, buf[1], &y)) != CRYPT_OK) {
              goto LBL_ERR;
              goto LBL_ERR;
           }
           }
           for (x = 0; x < y; x++) {
           for (x = 0; x < y; x++) {

+ 3 - 3
src/misc/compare_testvector.c

@@ -9,7 +9,7 @@
 */
 */
 
 
 #if defined(LTC_TEST) && defined(LTC_TEST_DBG)
 #if defined(LTC_TEST) && defined(LTC_TEST_DBG)
-static void _print_hex(const char* what, const void* v, const unsigned long l)
+static void s_print_hex(const char* what, const void* v, const unsigned long l)
 {
 {
   const unsigned char* p = v;
   const unsigned char* p = v;
   unsigned long x, y = 0, z;
   unsigned long x, y = 0, z;
@@ -65,8 +65,8 @@ int compare_testvector(const void* is, const unsigned long is_len, const void* s
 #if defined(LTC_TEST) && defined(LTC_TEST_DBG)
 #if defined(LTC_TEST) && defined(LTC_TEST_DBG)
    if (res != 0) {
    if (res != 0) {
       fprintf(stderr, "Testvector #%i of %s failed:\n", which, what);
       fprintf(stderr, "Testvector #%i of %s failed:\n", which, what);
-      _print_hex("SHOULD", should, should_len);
-      _print_hex("IS    ", is, is_len);
+      s_print_hex("SHOULD", should, should_len);
+      s_print_hex("IS    ", is, is_len);
 #if LTC_TEST_DBG > 1
 #if LTC_TEST_DBG > 1
    } else {
    } else {
       fprintf(stderr, "Testvector #%i of %s passed!\n", which, what);
       fprintf(stderr, "Testvector #%i of %s passed!\n", which, what);

+ 3 - 3
src/misc/crc32.c

@@ -10,7 +10,7 @@
 */
 */
 #ifdef LTC_CRC32
 #ifdef LTC_CRC32
 
 
-static const ulong32 _CRC32_NEGL = 0xffffffffUL;
+static const ulong32 CRC32_NEGL = 0xffffffffUL;
 
 
 #if defined(ENDIAN_LITTLE)
 #if defined(ENDIAN_LITTLE)
 #define CRC32_INDEX(c) (c & 0xff)
 #define CRC32_INDEX(c) (c & 0xff)
@@ -137,7 +137,7 @@ static const ulong32 crc32_m_tab[] =
 void crc32_init(crc32_state *ctx)
 void crc32_init(crc32_state *ctx)
 {
 {
    LTC_ARGCHKVD(ctx != NULL);
    LTC_ARGCHKVD(ctx != NULL);
-   ctx->crc = _CRC32_NEGL;
+   ctx->crc = CRC32_NEGL;
 }
 }
 
 
 void crc32_update(crc32_state *ctx, const unsigned char *input, unsigned long length)
 void crc32_update(crc32_state *ctx, const unsigned char *input, unsigned long length)
@@ -164,7 +164,7 @@ void crc32_finish(const crc32_state *ctx, void *hash, unsigned long size)
 
 
    h = hash;
    h = hash;
    crc = ctx->crc;
    crc = ctx->crc;
-   crc ^= _CRC32_NEGL;
+   crc ^= CRC32_NEGL;
 
 
    if (size > 4) size = 4;
    if (size > 4) size = 4;
    for (i = 0; i < size; i++) {
    for (i = 0; i < size; i++) {

+ 95 - 95
src/misc/crypt/crypt_constants.c

@@ -17,54 +17,54 @@ typedef struct {
     const int value;
     const int value;
 } crypt_constant;
 } crypt_constant;
 
 
-#define _C_STRINGIFY(s) { #s, s }
-
-static const crypt_constant _crypt_constants[] = {
-
-    _C_STRINGIFY(CRYPT_OK),
-    _C_STRINGIFY(CRYPT_ERROR),
-    _C_STRINGIFY(CRYPT_NOP),
-    _C_STRINGIFY(CRYPT_INVALID_KEYSIZE),
-    _C_STRINGIFY(CRYPT_INVALID_ROUNDS),
-    _C_STRINGIFY(CRYPT_FAIL_TESTVECTOR),
-    _C_STRINGIFY(CRYPT_BUFFER_OVERFLOW),
-    _C_STRINGIFY(CRYPT_INVALID_PACKET),
-    _C_STRINGIFY(CRYPT_INVALID_PRNGSIZE),
-    _C_STRINGIFY(CRYPT_ERROR_READPRNG),
-    _C_STRINGIFY(CRYPT_INVALID_CIPHER),
-    _C_STRINGIFY(CRYPT_INVALID_HASH),
-    _C_STRINGIFY(CRYPT_INVALID_PRNG),
-    _C_STRINGIFY(CRYPT_MEM),
-    _C_STRINGIFY(CRYPT_PK_TYPE_MISMATCH),
-    _C_STRINGIFY(CRYPT_PK_NOT_PRIVATE),
-    _C_STRINGIFY(CRYPT_INVALID_ARG),
-    _C_STRINGIFY(CRYPT_FILE_NOTFOUND),
-    _C_STRINGIFY(CRYPT_PK_INVALID_TYPE),
-    _C_STRINGIFY(CRYPT_OVERFLOW),
-    _C_STRINGIFY(CRYPT_PK_ASN1_ERROR),
-    _C_STRINGIFY(CRYPT_INPUT_TOO_LONG),
-    _C_STRINGIFY(CRYPT_PK_INVALID_SIZE),
-    _C_STRINGIFY(CRYPT_INVALID_PRIME_SIZE),
-    _C_STRINGIFY(CRYPT_PK_INVALID_PADDING),
-    _C_STRINGIFY(CRYPT_HASH_OVERFLOW),
-
-    _C_STRINGIFY(PK_PUBLIC),
-    _C_STRINGIFY(PK_PRIVATE),
-
-    _C_STRINGIFY(LTC_ENCRYPT),
-    _C_STRINGIFY(LTC_DECRYPT),
+#define C_STRINGIFY(s) { #s, s }
+
+static const crypt_constant s_crypt_constants[] = {
+
+    C_STRINGIFY(CRYPT_OK),
+    C_STRINGIFY(CRYPT_ERROR),
+    C_STRINGIFY(CRYPT_NOP),
+    C_STRINGIFY(CRYPT_INVALID_KEYSIZE),
+    C_STRINGIFY(CRYPT_INVALID_ROUNDS),
+    C_STRINGIFY(CRYPT_FAIL_TESTVECTOR),
+    C_STRINGIFY(CRYPT_BUFFER_OVERFLOW),
+    C_STRINGIFY(CRYPT_INVALID_PACKET),
+    C_STRINGIFY(CRYPT_INVALID_PRNGSIZE),
+    C_STRINGIFY(CRYPT_ERROR_READPRNG),
+    C_STRINGIFY(CRYPT_INVALID_CIPHER),
+    C_STRINGIFY(CRYPT_INVALID_HASH),
+    C_STRINGIFY(CRYPT_INVALID_PRNG),
+    C_STRINGIFY(CRYPT_MEM),
+    C_STRINGIFY(CRYPT_PK_TYPE_MISMATCH),
+    C_STRINGIFY(CRYPT_PK_NOT_PRIVATE),
+    C_STRINGIFY(CRYPT_INVALID_ARG),
+    C_STRINGIFY(CRYPT_FILE_NOTFOUND),
+    C_STRINGIFY(CRYPT_PK_INVALID_TYPE),
+    C_STRINGIFY(CRYPT_OVERFLOW),
+    C_STRINGIFY(CRYPT_PK_ASN1_ERROR),
+    C_STRINGIFY(CRYPT_INPUT_TOO_LONG),
+    C_STRINGIFY(CRYPT_PK_INVALID_SIZE),
+    C_STRINGIFY(CRYPT_INVALID_PRIME_SIZE),
+    C_STRINGIFY(CRYPT_PK_INVALID_PADDING),
+    C_STRINGIFY(CRYPT_HASH_OVERFLOW),
+
+    C_STRINGIFY(PK_PUBLIC),
+    C_STRINGIFY(PK_PRIVATE),
+
+    C_STRINGIFY(LTC_ENCRYPT),
+    C_STRINGIFY(LTC_DECRYPT),
 
 
 #ifdef LTC_PKCS_1
 #ifdef LTC_PKCS_1
     {"LTC_PKCS_1", 1},
     {"LTC_PKCS_1", 1},
     /* Block types */
     /* Block types */
-    _C_STRINGIFY(LTC_PKCS_1_EMSA),
-    _C_STRINGIFY(LTC_PKCS_1_EME),
+    C_STRINGIFY(LTC_PKCS_1_EMSA),
+    C_STRINGIFY(LTC_PKCS_1_EME),
 
 
     /* Padding types */
     /* Padding types */
-    _C_STRINGIFY(LTC_PKCS_1_V1_5),
-    _C_STRINGIFY(LTC_PKCS_1_OAEP),
-    _C_STRINGIFY(LTC_PKCS_1_PSS),
-    _C_STRINGIFY(LTC_PKCS_1_V1_5_NA1),
+    C_STRINGIFY(LTC_PKCS_1_V1_5),
+    C_STRINGIFY(LTC_PKCS_1_OAEP),
+    C_STRINGIFY(LTC_PKCS_1_PSS),
+    C_STRINGIFY(LTC_PKCS_1_V1_5_NA1),
 #else
 #else
     {"LTC_PKCS_1", 0},
     {"LTC_PKCS_1", 0},
 #endif
 #endif
@@ -72,14 +72,14 @@ static const crypt_constant _crypt_constants[] = {
 #ifdef LTC_PADDING
 #ifdef LTC_PADDING
     {"LTC_PADDING", 1},
     {"LTC_PADDING", 1},
 
 
-    _C_STRINGIFY(LTC_PAD_PKCS7),
+    C_STRINGIFY(LTC_PAD_PKCS7),
 #ifdef LTC_RNG_GET_BYTES
 #ifdef LTC_RNG_GET_BYTES
-    _C_STRINGIFY(LTC_PAD_ISO_10126),
+    C_STRINGIFY(LTC_PAD_ISO_10126),
 #endif
 #endif
-    _C_STRINGIFY(LTC_PAD_ANSI_X923),
-    _C_STRINGIFY(LTC_PAD_ONE_AND_ZERO),
-    _C_STRINGIFY(LTC_PAD_ZERO),
-    _C_STRINGIFY(LTC_PAD_ZERO_ALWAYS),
+    C_STRINGIFY(LTC_PAD_ANSI_X923),
+    C_STRINGIFY(LTC_PAD_ONE_AND_ZERO),
+    C_STRINGIFY(LTC_PAD_ZERO),
+    C_STRINGIFY(LTC_PAD_ZERO_ALWAYS),
 #else
 #else
     {"LTC_PADDING", 0},
     {"LTC_PADDING", 0},
 #endif
 #endif
@@ -92,76 +92,76 @@ static const crypt_constant _crypt_constants[] = {
 
 
 #ifdef LTC_MECC
 #ifdef LTC_MECC
     {"LTC_MECC", 1},
     {"LTC_MECC", 1},
-    _C_STRINGIFY(ECC_BUF_SIZE),
-    _C_STRINGIFY(ECC_MAXSIZE),
+    C_STRINGIFY(ECC_BUF_SIZE),
+    C_STRINGIFY(ECC_MAXSIZE),
 #else
 #else
     {"LTC_MECC", 0},
     {"LTC_MECC", 0},
 #endif
 #endif
 
 
 #ifdef LTC_MDSA
 #ifdef LTC_MDSA
     {"LTC_MDSA", 1},
     {"LTC_MDSA", 1},
-    _C_STRINGIFY(LTC_MDSA_DELTA),
-    _C_STRINGIFY(LTC_MDSA_MAX_GROUP),
+    C_STRINGIFY(LTC_MDSA_DELTA),
+    C_STRINGIFY(LTC_MDSA_MAX_GROUP),
 #else
 #else
     {"LTC_MDSA", 0},
     {"LTC_MDSA", 0},
 #endif
 #endif
 
 
 #ifdef LTC_MILLER_RABIN_REPS
 #ifdef LTC_MILLER_RABIN_REPS
-    _C_STRINGIFY(LTC_MILLER_RABIN_REPS),
+    C_STRINGIFY(LTC_MILLER_RABIN_REPS),
 #endif
 #endif
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 /* DER handling */
 /* DER handling */
     {"LTC_DER", 1},
     {"LTC_DER", 1},
-    _C_STRINGIFY(LTC_ASN1_EOL),
-    _C_STRINGIFY(LTC_ASN1_BOOLEAN),
-    _C_STRINGIFY(LTC_ASN1_INTEGER),
-    _C_STRINGIFY(LTC_ASN1_SHORT_INTEGER),
-    _C_STRINGIFY(LTC_ASN1_BIT_STRING),
-    _C_STRINGIFY(LTC_ASN1_OCTET_STRING),
-    _C_STRINGIFY(LTC_ASN1_NULL),
-    _C_STRINGIFY(LTC_ASN1_OBJECT_IDENTIFIER),
-    _C_STRINGIFY(LTC_ASN1_IA5_STRING),
-    _C_STRINGIFY(LTC_ASN1_PRINTABLE_STRING),
-    _C_STRINGIFY(LTC_ASN1_UTF8_STRING),
-    _C_STRINGIFY(LTC_ASN1_UTCTIME),
-    _C_STRINGIFY(LTC_ASN1_CHOICE),
-    _C_STRINGIFY(LTC_ASN1_SEQUENCE),
-    _C_STRINGIFY(LTC_ASN1_SET),
-    _C_STRINGIFY(LTC_ASN1_SETOF),
-    _C_STRINGIFY(LTC_ASN1_RAW_BIT_STRING),
-    _C_STRINGIFY(LTC_ASN1_TELETEX_STRING),
-    _C_STRINGIFY(LTC_ASN1_GENERALIZEDTIME),
-    _C_STRINGIFY(LTC_ASN1_CUSTOM_TYPE),
-    _C_STRINGIFY(LTC_DER_MAX_RECURSION),
+    C_STRINGIFY(LTC_ASN1_EOL),
+    C_STRINGIFY(LTC_ASN1_BOOLEAN),
+    C_STRINGIFY(LTC_ASN1_INTEGER),
+    C_STRINGIFY(LTC_ASN1_SHORT_INTEGER),
+    C_STRINGIFY(LTC_ASN1_BIT_STRING),
+    C_STRINGIFY(LTC_ASN1_OCTET_STRING),
+    C_STRINGIFY(LTC_ASN1_NULL),
+    C_STRINGIFY(LTC_ASN1_OBJECT_IDENTIFIER),
+    C_STRINGIFY(LTC_ASN1_IA5_STRING),
+    C_STRINGIFY(LTC_ASN1_PRINTABLE_STRING),
+    C_STRINGIFY(LTC_ASN1_UTF8_STRING),
+    C_STRINGIFY(LTC_ASN1_UTCTIME),
+    C_STRINGIFY(LTC_ASN1_CHOICE),
+    C_STRINGIFY(LTC_ASN1_SEQUENCE),
+    C_STRINGIFY(LTC_ASN1_SET),
+    C_STRINGIFY(LTC_ASN1_SETOF),
+    C_STRINGIFY(LTC_ASN1_RAW_BIT_STRING),
+    C_STRINGIFY(LTC_ASN1_TELETEX_STRING),
+    C_STRINGIFY(LTC_ASN1_GENERALIZEDTIME),
+    C_STRINGIFY(LTC_ASN1_CUSTOM_TYPE),
+    C_STRINGIFY(LTC_DER_MAX_RECURSION),
 #else
 #else
     {"LTC_DER", 0},
     {"LTC_DER", 0},
 #endif
 #endif
 
 
 #ifdef LTC_CTR_MODE
 #ifdef LTC_CTR_MODE
     {"LTC_CTR_MODE", 1},
     {"LTC_CTR_MODE", 1},
-    _C_STRINGIFY(CTR_COUNTER_LITTLE_ENDIAN),
-    _C_STRINGIFY(CTR_COUNTER_BIG_ENDIAN),
-    _C_STRINGIFY(LTC_CTR_RFC3686),
+    C_STRINGIFY(CTR_COUNTER_LITTLE_ENDIAN),
+    C_STRINGIFY(CTR_COUNTER_BIG_ENDIAN),
+    C_STRINGIFY(LTC_CTR_RFC3686),
 #else
 #else
     {"LTC_CTR_MODE", 0},
     {"LTC_CTR_MODE", 0},
 #endif
 #endif
 #ifdef LTC_GCM_MODE
 #ifdef LTC_GCM_MODE
-    _C_STRINGIFY(LTC_GCM_MODE_IV),
-    _C_STRINGIFY(LTC_GCM_MODE_AAD),
-    _C_STRINGIFY(LTC_GCM_MODE_TEXT),
+    C_STRINGIFY(LTC_GCM_MODE_IV),
+    C_STRINGIFY(LTC_GCM_MODE_AAD),
+    C_STRINGIFY(LTC_GCM_MODE_TEXT),
 #endif
 #endif
 
 
-    _C_STRINGIFY(LTC_MP_LT),
-    _C_STRINGIFY(LTC_MP_EQ),
-    _C_STRINGIFY(LTC_MP_GT),
+    C_STRINGIFY(LTC_MP_LT),
+    C_STRINGIFY(LTC_MP_EQ),
+    C_STRINGIFY(LTC_MP_GT),
 
 
-    _C_STRINGIFY(LTC_MP_NO),
-    _C_STRINGIFY(LTC_MP_YES),
+    C_STRINGIFY(LTC_MP_NO),
+    C_STRINGIFY(LTC_MP_YES),
 
 
-    _C_STRINGIFY(MAXBLOCKSIZE),
-    _C_STRINGIFY(TAB_SIZE),
-    _C_STRINGIFY(ARGTYPE),
+    C_STRINGIFY(MAXBLOCKSIZE),
+    C_STRINGIFY(TAB_SIZE),
+    C_STRINGIFY(ARGTYPE),
 
 
 #ifdef LTM_DESC
 #ifdef LTM_DESC
     {"LTM_DESC", 1},
     {"LTM_DESC", 1},
@@ -229,10 +229,10 @@ static const crypt_constant _crypt_constants[] = {
  */
  */
 int crypt_get_constant(const char* namein, int *valueout) {
 int crypt_get_constant(const char* namein, int *valueout) {
     int i;
     int i;
-    int _crypt_constants_len = sizeof(_crypt_constants) / sizeof(_crypt_constants[0]);
-    for (i=0; i<_crypt_constants_len; i++) {
-        if (XSTRCMP(_crypt_constants[i].name, namein) == 0) {
-            *valueout = _crypt_constants[i].value;
+    int count = sizeof(s_crypt_constants) / sizeof(s_crypt_constants[0]);
+    for (i=0; i<count; i++) {
+        if (XSTRCMP(s_crypt_constants[i].name, namein) == 0) {
+            *valueout = s_crypt_constants[i].value;
             return 0;
             return 0;
         }
         }
     }
     }
@@ -254,11 +254,11 @@ int crypt_list_all_constants(char *names_list, unsigned int *names_list_size) {
     unsigned int total_len = 0;
     unsigned int total_len = 0;
     char *ptr;
     char *ptr;
     int number_len;
     int number_len;
-    int count = sizeof(_crypt_constants) / sizeof(_crypt_constants[0]);
+    int count = sizeof(s_crypt_constants) / sizeof(s_crypt_constants[0]);
 
 
     /* calculate amount of memory required for the list */
     /* calculate amount of memory required for the list */
     for (i=0; i<count; i++) {
     for (i=0; i<count; i++) {
-        number_len = snprintf(NULL, 0, "%s,%d\n", _crypt_constants[i].name, _crypt_constants[i].value);
+        number_len = snprintf(NULL, 0, "%s,%d\n", s_crypt_constants[i].name, s_crypt_constants[i].value);
         if (number_len < 0) {
         if (number_len < 0) {
           return -1;
           return -1;
         }
         }
@@ -274,7 +274,7 @@ int crypt_list_all_constants(char *names_list, unsigned int *names_list_size) {
         /* build the names list */
         /* build the names list */
         ptr = names_list;
         ptr = names_list;
         for (i=0; i<count; i++) {
         for (i=0; i<count; i++) {
-            number_len = snprintf(ptr, total_len, "%s,%d\n", _crypt_constants[i].name, _crypt_constants[i].value);
+            number_len = snprintf(ptr, total_len, "%s,%d\n", s_crypt_constants[i].name, s_crypt_constants[i].value);
             if (number_len < 0) return -1;
             if (number_len < 0) return -1;
             if ((unsigned int)number_len > total_len) return -1;
             if ((unsigned int)number_len > total_len) return -1;
             total_len -= number_len;
             total_len -= number_len;

+ 98 - 98
src/misc/crypt/crypt_sizes.c

@@ -17,270 +17,270 @@ typedef struct {
     const unsigned int size;
     const unsigned int size;
 } crypt_size;
 } crypt_size;
 
 
-#define _SZ_STRINGIFY_S(s) { #s, sizeof(struct s) }
-#define _SZ_STRINGIFY_T(s) { #s, sizeof(s) }
+#define SZ_STRINGIFY_S(s) { #s, sizeof(struct s) }
+#define SZ_STRINGIFY_T(s) { #s, sizeof(s) }
 
 
-static const crypt_size _crypt_sizes[] = {
+static const crypt_size s_crypt_sizes[] = {
     /* hash state sizes */
     /* hash state sizes */
-    _SZ_STRINGIFY_S(ltc_hash_descriptor),
-    _SZ_STRINGIFY_T(hash_state),
+    SZ_STRINGIFY_S(ltc_hash_descriptor),
+    SZ_STRINGIFY_T(hash_state),
 #ifdef LTC_CHC_HASH
 #ifdef LTC_CHC_HASH
-    _SZ_STRINGIFY_S(chc_state),
+    SZ_STRINGIFY_S(chc_state),
 #endif
 #endif
 #ifdef LTC_WHIRLPOOL
 #ifdef LTC_WHIRLPOOL
-    _SZ_STRINGIFY_S(whirlpool_state),
+    SZ_STRINGIFY_S(whirlpool_state),
 #endif
 #endif
 #ifdef LTC_SHA3
 #ifdef LTC_SHA3
-    _SZ_STRINGIFY_S(sha3_state),
+    SZ_STRINGIFY_S(sha3_state),
 #endif
 #endif
 #ifdef LTC_SHA512
 #ifdef LTC_SHA512
-    _SZ_STRINGIFY_S(sha512_state),
+    SZ_STRINGIFY_S(sha512_state),
 #endif
 #endif
 #ifdef LTC_SHA256
 #ifdef LTC_SHA256
-    _SZ_STRINGIFY_S(sha256_state),
+    SZ_STRINGIFY_S(sha256_state),
 #endif
 #endif
 #ifdef LTC_SHA1
 #ifdef LTC_SHA1
-    _SZ_STRINGIFY_S(sha1_state),
+    SZ_STRINGIFY_S(sha1_state),
 #endif
 #endif
 #ifdef LTC_MD5
 #ifdef LTC_MD5
-    _SZ_STRINGIFY_S(md5_state),
+    SZ_STRINGIFY_S(md5_state),
 #endif
 #endif
 #ifdef LTC_MD4
 #ifdef LTC_MD4
-    _SZ_STRINGIFY_S(md4_state),
+    SZ_STRINGIFY_S(md4_state),
 #endif
 #endif
 #ifdef LTC_MD2
 #ifdef LTC_MD2
-    _SZ_STRINGIFY_S(md2_state),
+    SZ_STRINGIFY_S(md2_state),
 #endif
 #endif
 #ifdef LTC_TIGER
 #ifdef LTC_TIGER
-    _SZ_STRINGIFY_S(tiger_state),
+    SZ_STRINGIFY_S(tiger_state),
 #endif
 #endif
 #ifdef LTC_RIPEMD128
 #ifdef LTC_RIPEMD128
-    _SZ_STRINGIFY_S(rmd128_state),
+    SZ_STRINGIFY_S(rmd128_state),
 #endif
 #endif
 #ifdef LTC_RIPEMD160
 #ifdef LTC_RIPEMD160
-    _SZ_STRINGIFY_S(rmd160_state),
+    SZ_STRINGIFY_S(rmd160_state),
 #endif
 #endif
 #ifdef LTC_RIPEMD256
 #ifdef LTC_RIPEMD256
-    _SZ_STRINGIFY_S(rmd256_state),
+    SZ_STRINGIFY_S(rmd256_state),
 #endif
 #endif
 #ifdef LTC_RIPEMD320
 #ifdef LTC_RIPEMD320
-    _SZ_STRINGIFY_S(rmd320_state),
+    SZ_STRINGIFY_S(rmd320_state),
 #endif
 #endif
 #ifdef LTC_BLAKE2S
 #ifdef LTC_BLAKE2S
-    _SZ_STRINGIFY_S(blake2s_state),
+    SZ_STRINGIFY_S(blake2s_state),
 #endif
 #endif
 #ifdef LTC_BLAKE2B
 #ifdef LTC_BLAKE2B
-    _SZ_STRINGIFY_S(blake2b_state),
+    SZ_STRINGIFY_S(blake2b_state),
 #endif
 #endif
 
 
     /* block cipher key sizes */
     /* block cipher key sizes */
-    _SZ_STRINGIFY_S(ltc_cipher_descriptor),
-    _SZ_STRINGIFY_T(symmetric_key),
+    SZ_STRINGIFY_S(ltc_cipher_descriptor),
+    SZ_STRINGIFY_T(symmetric_key),
 #ifdef LTC_ANUBIS
 #ifdef LTC_ANUBIS
-    _SZ_STRINGIFY_S(anubis_key),
+    SZ_STRINGIFY_S(anubis_key),
 #endif
 #endif
 #ifdef LTC_CAMELLIA
 #ifdef LTC_CAMELLIA
-    _SZ_STRINGIFY_S(camellia_key),
+    SZ_STRINGIFY_S(camellia_key),
 #endif
 #endif
 #ifdef LTC_BLOWFISH
 #ifdef LTC_BLOWFISH
-    _SZ_STRINGIFY_S(blowfish_key),
+    SZ_STRINGIFY_S(blowfish_key),
 #endif
 #endif
 #ifdef LTC_CAST5
 #ifdef LTC_CAST5
-    _SZ_STRINGIFY_S(cast5_key),
+    SZ_STRINGIFY_S(cast5_key),
 #endif
 #endif
 #ifdef LTC_DES
 #ifdef LTC_DES
-    _SZ_STRINGIFY_S(des_key),
-    _SZ_STRINGIFY_S(des3_key),
+    SZ_STRINGIFY_S(des_key),
+    SZ_STRINGIFY_S(des3_key),
 #endif
 #endif
 #ifdef LTC_IDEA
 #ifdef LTC_IDEA
-    _SZ_STRINGIFY_S(idea_key),
+    SZ_STRINGIFY_S(idea_key),
 #endif
 #endif
 #ifdef LTC_KASUMI
 #ifdef LTC_KASUMI
-    _SZ_STRINGIFY_S(kasumi_key),
+    SZ_STRINGIFY_S(kasumi_key),
 #endif
 #endif
 #ifdef LTC_KHAZAD
 #ifdef LTC_KHAZAD
-    _SZ_STRINGIFY_S(khazad_key),
+    SZ_STRINGIFY_S(khazad_key),
 #endif
 #endif
 #ifdef LTC_KSEED
 #ifdef LTC_KSEED
-    _SZ_STRINGIFY_S(kseed_key),
+    SZ_STRINGIFY_S(kseed_key),
 #endif
 #endif
 #ifdef LTC_MULTI2
 #ifdef LTC_MULTI2
-    _SZ_STRINGIFY_S(multi2_key),
+    SZ_STRINGIFY_S(multi2_key),
 #endif
 #endif
 #ifdef LTC_NOEKEON
 #ifdef LTC_NOEKEON
-    _SZ_STRINGIFY_S(noekeon_key),
+    SZ_STRINGIFY_S(noekeon_key),
 #endif
 #endif
 #ifdef LTC_RC2
 #ifdef LTC_RC2
-    _SZ_STRINGIFY_S(rc2_key),
+    SZ_STRINGIFY_S(rc2_key),
 #endif
 #endif
 #ifdef LTC_RC5
 #ifdef LTC_RC5
-    _SZ_STRINGIFY_S(rc5_key),
+    SZ_STRINGIFY_S(rc5_key),
 #endif
 #endif
 #ifdef LTC_RC6
 #ifdef LTC_RC6
-    _SZ_STRINGIFY_S(rc6_key),
+    SZ_STRINGIFY_S(rc6_key),
 #endif
 #endif
 #ifdef LTC_SERPENT
 #ifdef LTC_SERPENT
-    _SZ_STRINGIFY_S(serpent_key),
+    SZ_STRINGIFY_S(serpent_key),
 #endif
 #endif
 #ifdef LTC_SKIPJACK
 #ifdef LTC_SKIPJACK
-    _SZ_STRINGIFY_S(skipjack_key),
+    SZ_STRINGIFY_S(skipjack_key),
 #endif
 #endif
 #ifdef LTC_XTEA
 #ifdef LTC_XTEA
-    _SZ_STRINGIFY_S(xtea_key),
+    SZ_STRINGIFY_S(xtea_key),
 #endif
 #endif
 #ifdef LTC_RIJNDAEL
 #ifdef LTC_RIJNDAEL
-    _SZ_STRINGIFY_S(rijndael_key),
+    SZ_STRINGIFY_S(rijndael_key),
 #endif
 #endif
 #ifdef LTC_SAFER
 #ifdef LTC_SAFER
-    _SZ_STRINGIFY_S(safer_key),
+    SZ_STRINGIFY_S(safer_key),
 #endif
 #endif
 #ifdef LTC_SAFERP
 #ifdef LTC_SAFERP
-    _SZ_STRINGIFY_S(saferp_key),
+    SZ_STRINGIFY_S(saferp_key),
 #endif
 #endif
 #ifdef LTC_TWOFISH
 #ifdef LTC_TWOFISH
-    _SZ_STRINGIFY_S(twofish_key),
+    SZ_STRINGIFY_S(twofish_key),
 #endif
 #endif
 
 
     /* mode sizes */
     /* mode sizes */
 #ifdef LTC_ECB_MODE
 #ifdef LTC_ECB_MODE
-    _SZ_STRINGIFY_T(symmetric_ECB),
+    SZ_STRINGIFY_T(symmetric_ECB),
 #endif
 #endif
 #ifdef LTC_CFB_MODE
 #ifdef LTC_CFB_MODE
-    _SZ_STRINGIFY_T(symmetric_CFB),
+    SZ_STRINGIFY_T(symmetric_CFB),
 #endif
 #endif
 #ifdef LTC_OFB_MODE
 #ifdef LTC_OFB_MODE
-    _SZ_STRINGIFY_T(symmetric_OFB),
+    SZ_STRINGIFY_T(symmetric_OFB),
 #endif
 #endif
 #ifdef LTC_CBC_MODE
 #ifdef LTC_CBC_MODE
-    _SZ_STRINGIFY_T(symmetric_CBC),
+    SZ_STRINGIFY_T(symmetric_CBC),
 #endif
 #endif
 #ifdef LTC_CTR_MODE
 #ifdef LTC_CTR_MODE
-    _SZ_STRINGIFY_T(symmetric_CTR),
+    SZ_STRINGIFY_T(symmetric_CTR),
 #endif
 #endif
 #ifdef LTC_LRW_MODE
 #ifdef LTC_LRW_MODE
-    _SZ_STRINGIFY_T(symmetric_LRW),
+    SZ_STRINGIFY_T(symmetric_LRW),
 #endif
 #endif
 #ifdef LTC_F8_MODE
 #ifdef LTC_F8_MODE
-    _SZ_STRINGIFY_T(symmetric_F8),
+    SZ_STRINGIFY_T(symmetric_F8),
 #endif
 #endif
 #ifdef LTC_XTS_MODE
 #ifdef LTC_XTS_MODE
-    _SZ_STRINGIFY_T(symmetric_xts),
+    SZ_STRINGIFY_T(symmetric_xts),
 #endif
 #endif
 
 
     /* stream cipher sizes */
     /* stream cipher sizes */
 #ifdef LTC_CHACHA
 #ifdef LTC_CHACHA
-    _SZ_STRINGIFY_T(chacha_state),
+    SZ_STRINGIFY_T(chacha_state),
 #endif
 #endif
 #ifdef LTC_SALSA20
 #ifdef LTC_SALSA20
-    _SZ_STRINGIFY_T(salsa20_state),
+    SZ_STRINGIFY_T(salsa20_state),
 #endif
 #endif
 #ifdef LTC_SOSEMANUK
 #ifdef LTC_SOSEMANUK
-    _SZ_STRINGIFY_T(sosemanuk_state),
+    SZ_STRINGIFY_T(sosemanuk_state),
 #endif
 #endif
 #ifdef LTC_RABBIT
 #ifdef LTC_RABBIT
-    _SZ_STRINGIFY_T(rabbit_state),
+    SZ_STRINGIFY_T(rabbit_state),
 #endif
 #endif
 #ifdef LTC_RC4_STREAM
 #ifdef LTC_RC4_STREAM
-    _SZ_STRINGIFY_T(rc4_state),
+    SZ_STRINGIFY_T(rc4_state),
 #endif
 #endif
 #ifdef LTC_SOBER128_STREAM
 #ifdef LTC_SOBER128_STREAM
-    _SZ_STRINGIFY_T(sober128_state),
+    SZ_STRINGIFY_T(sober128_state),
 #endif
 #endif
 
 
     /* MAC sizes            -- no states for ccm, lrw */
     /* MAC sizes            -- no states for ccm, lrw */
 #ifdef LTC_HMAC
 #ifdef LTC_HMAC
-    _SZ_STRINGIFY_T(hmac_state),
+    SZ_STRINGIFY_T(hmac_state),
 #endif
 #endif
 #ifdef LTC_OMAC
 #ifdef LTC_OMAC
-    _SZ_STRINGIFY_T(omac_state),
+    SZ_STRINGIFY_T(omac_state),
 #endif
 #endif
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC
-    _SZ_STRINGIFY_T(pmac_state),
+    SZ_STRINGIFY_T(pmac_state),
 #endif
 #endif
 #ifdef LTC_POLY1305
 #ifdef LTC_POLY1305
-    _SZ_STRINGIFY_T(poly1305_state),
+    SZ_STRINGIFY_T(poly1305_state),
 #endif
 #endif
 #ifdef LTC_EAX_MODE
 #ifdef LTC_EAX_MODE
-    _SZ_STRINGIFY_T(eax_state),
+    SZ_STRINGIFY_T(eax_state),
 #endif
 #endif
 #ifdef LTC_OCB_MODE
 #ifdef LTC_OCB_MODE
-    _SZ_STRINGIFY_T(ocb_state),
+    SZ_STRINGIFY_T(ocb_state),
 #endif
 #endif
 #ifdef LTC_OCB3_MODE
 #ifdef LTC_OCB3_MODE
-    _SZ_STRINGIFY_T(ocb3_state),
+    SZ_STRINGIFY_T(ocb3_state),
 #endif
 #endif
 #ifdef LTC_CCM_MODE
 #ifdef LTC_CCM_MODE
-    _SZ_STRINGIFY_T(ccm_state),
+    SZ_STRINGIFY_T(ccm_state),
 #endif
 #endif
 #ifdef LTC_GCM_MODE
 #ifdef LTC_GCM_MODE
-    _SZ_STRINGIFY_T(gcm_state),
+    SZ_STRINGIFY_T(gcm_state),
 #endif
 #endif
 #ifdef LTC_PELICAN
 #ifdef LTC_PELICAN
-    _SZ_STRINGIFY_T(pelican_state),
+    SZ_STRINGIFY_T(pelican_state),
 #endif
 #endif
 #ifdef LTC_XCBC
 #ifdef LTC_XCBC
-    _SZ_STRINGIFY_T(xcbc_state),
+    SZ_STRINGIFY_T(xcbc_state),
 #endif
 #endif
 #ifdef LTC_F9_MODE
 #ifdef LTC_F9_MODE
-    _SZ_STRINGIFY_T(f9_state),
+    SZ_STRINGIFY_T(f9_state),
 #endif
 #endif
 #ifdef LTC_CHACHA20POLY1305_MODE
 #ifdef LTC_CHACHA20POLY1305_MODE
-    _SZ_STRINGIFY_T(chacha20poly1305_state),
+    SZ_STRINGIFY_T(chacha20poly1305_state),
 #endif
 #endif
 
 
     /* asymmetric keys */
     /* asymmetric keys */
 #ifdef LTC_MRSA
 #ifdef LTC_MRSA
-    _SZ_STRINGIFY_T(rsa_key),
+    SZ_STRINGIFY_T(rsa_key),
 #endif
 #endif
 #ifdef LTC_MDSA
 #ifdef LTC_MDSA
-    _SZ_STRINGIFY_T(dsa_key),
+    SZ_STRINGIFY_T(dsa_key),
 #endif
 #endif
 #ifdef LTC_MDH
 #ifdef LTC_MDH
-    _SZ_STRINGIFY_T(dh_key),
+    SZ_STRINGIFY_T(dh_key),
 #endif
 #endif
 #ifdef LTC_MECC
 #ifdef LTC_MECC
-    _SZ_STRINGIFY_T(ltc_ecc_curve),
-    _SZ_STRINGIFY_T(ecc_point),
-    _SZ_STRINGIFY_T(ecc_key),
+    SZ_STRINGIFY_T(ltc_ecc_curve),
+    SZ_STRINGIFY_T(ecc_point),
+    SZ_STRINGIFY_T(ecc_key),
 #endif
 #endif
 
 
     /* DER handling */
     /* DER handling */
 #ifdef LTC_DER
 #ifdef LTC_DER
-    _SZ_STRINGIFY_T(ltc_asn1_list),  /* a list entry */
-    _SZ_STRINGIFY_T(ltc_utctime),
-    _SZ_STRINGIFY_T(ltc_generalizedtime),
+    SZ_STRINGIFY_T(ltc_asn1_list),  /* a list entry */
+    SZ_STRINGIFY_T(ltc_utctime),
+    SZ_STRINGIFY_T(ltc_generalizedtime),
 #endif
 #endif
 
 
     /* prng state sizes */
     /* prng state sizes */
-    _SZ_STRINGIFY_S(ltc_prng_descriptor),
-    _SZ_STRINGIFY_T(prng_state),
+    SZ_STRINGIFY_S(ltc_prng_descriptor),
+    SZ_STRINGIFY_T(prng_state),
 #ifdef LTC_FORTUNA
 #ifdef LTC_FORTUNA
-    _SZ_STRINGIFY_S(fortuna_prng),
+    SZ_STRINGIFY_S(fortuna_prng),
 #endif
 #endif
 #ifdef LTC_CHACHA20_PRNG
 #ifdef LTC_CHACHA20_PRNG
-    _SZ_STRINGIFY_S(chacha20_prng),
+    SZ_STRINGIFY_S(chacha20_prng),
 #endif
 #endif
 #ifdef LTC_RC4
 #ifdef LTC_RC4
-    _SZ_STRINGIFY_S(rc4_prng),
+    SZ_STRINGIFY_S(rc4_prng),
 #endif
 #endif
 #ifdef LTC_SOBER128
 #ifdef LTC_SOBER128
-    _SZ_STRINGIFY_S(sober128_prng),
+    SZ_STRINGIFY_S(sober128_prng),
 #endif
 #endif
 #ifdef LTC_YARROW
 #ifdef LTC_YARROW
-    _SZ_STRINGIFY_S(yarrow_prng),
+    SZ_STRINGIFY_S(yarrow_prng),
 #endif
 #endif
     /* sprng has no state as it uses other potentially available sources */
     /* sprng has no state as it uses other potentially available sources */
     /* like /dev/random.  See Developers Guide for more info. */
     /* like /dev/random.  See Developers Guide for more info. */
 
 
 #ifdef LTC_ADLER32
 #ifdef LTC_ADLER32
-    _SZ_STRINGIFY_T(adler32_state),
+    SZ_STRINGIFY_T(adler32_state),
 #endif
 #endif
 #ifdef LTC_CRC32
 #ifdef LTC_CRC32
-    _SZ_STRINGIFY_T(crc32_state),
+    SZ_STRINGIFY_T(crc32_state),
 #endif
 #endif
 
 
-    _SZ_STRINGIFY_T(ltc_mp_digit),
-    _SZ_STRINGIFY_T(ltc_math_descriptor)
+    SZ_STRINGIFY_T(ltc_mp_digit),
+    SZ_STRINGIFY_T(ltc_math_descriptor)
 
 
 };
 };
 
 
@@ -290,10 +290,10 @@ static const crypt_size _crypt_sizes[] = {
  */
  */
 int crypt_get_size(const char* namein, unsigned int *sizeout) {
 int crypt_get_size(const char* namein, unsigned int *sizeout) {
     int i;
     int i;
-    int count = sizeof(_crypt_sizes) / sizeof(_crypt_sizes[0]);
+    int count = sizeof(s_crypt_sizes) / sizeof(s_crypt_sizes[0]);
     for (i=0; i<count; i++) {
     for (i=0; i<count; i++) {
-        if (XSTRCMP(_crypt_sizes[i].name, namein) == 0) {
-            *sizeout = _crypt_sizes[i].size;
+        if (XSTRCMP(s_crypt_sizes[i].name, namein) == 0) {
+            *sizeout = s_crypt_sizes[i].size;
             return 0;
             return 0;
         }
         }
     }
     }
@@ -315,11 +315,11 @@ int crypt_list_all_sizes(char *names_list, unsigned int *names_list_size) {
     unsigned int total_len = 0;
     unsigned int total_len = 0;
     char *ptr;
     char *ptr;
     int number_len;
     int number_len;
-    int count = sizeof(_crypt_sizes) / sizeof(_crypt_sizes[0]);
+    int count = sizeof(s_crypt_sizes) / sizeof(s_crypt_sizes[0]);
 
 
     /* calculate amount of memory required for the list */
     /* calculate amount of memory required for the list */
     for (i=0; i<count; i++) {
     for (i=0; i<count; i++) {
-        number_len = snprintf(NULL, 0, "%s,%u\n", _crypt_sizes[i].name, _crypt_sizes[i].size);
+        number_len = snprintf(NULL, 0, "%s,%u\n", s_crypt_sizes[i].name, s_crypt_sizes[i].size);
         if (number_len < 0) {
         if (number_len < 0) {
           return -1;
           return -1;
         }
         }
@@ -336,7 +336,7 @@ int crypt_list_all_sizes(char *names_list, unsigned int *names_list_size) {
         /* build the names list */
         /* build the names list */
         ptr = names_list;
         ptr = names_list;
         for (i=0; i<count; i++) {
         for (i=0; i<count; i++) {
-            number_len = snprintf(ptr, total_len, "%s,%u\n", _crypt_sizes[i].name, _crypt_sizes[i].size);
+            number_len = snprintf(ptr, total_len, "%s,%u\n", s_crypt_sizes[i].name, s_crypt_sizes[i].size);
             if (number_len < 0) return -1;
             if (number_len < 0) return -1;
             if ((unsigned int)number_len > total_len) return -1;
             if ((unsigned int)number_len > total_len) return -1;
             total_len -= number_len;
             total_len -= number_len;

+ 2 - 2
src/misc/padding/padding_pad.c

@@ -11,7 +11,7 @@
    @param mode       Mask of (LTC_PAD_xxx | block_length)
    @param mode       Mask of (LTC_PAD_xxx | block_length)
    @return CRYPT_OK on success
    @return CRYPT_OK on success
 */
 */
-static int _padding_padded_length(unsigned long *length, unsigned long mode)
+static int s_padding_padded_length(unsigned long *length, unsigned long mode)
 {
 {
    enum padding_type padding;
    enum padding_type padding;
    unsigned char pad, block_length, r, t;
    unsigned char pad, block_length, r, t;
@@ -87,7 +87,7 @@ int padding_pad(unsigned char *data, unsigned long length, unsigned long* padded
    LTC_ARGCHK(padded_length != NULL);
    LTC_ARGCHK(padded_length != NULL);
 
 
    l = length;
    l = length;
-   if ((err = _padding_padded_length(&l, mode)) != CRYPT_OK) {
+   if ((err = s_padding_padded_length(&l, mode)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
 
 

+ 23 - 23
src/misc/pbes/pbes1.c

@@ -4,7 +4,7 @@
 
 
 #ifdef LTC_PBES
 #ifdef LTC_PBES
 
 
-static int _pkcs_5_alg1_wrap(const unsigned char *password, unsigned long password_len,
+static int s_pkcs_5_alg1_wrap(const unsigned char *password, unsigned long password_len,
                               const unsigned char *salt,     unsigned long salt_len,
                               const unsigned char *salt,     unsigned long salt_len,
                               int iteration_count,  int hash_idx,
                               int iteration_count,  int hash_idx,
                               unsigned char *out,   unsigned long *outlen)
                               unsigned char *out,   unsigned long *outlen)
@@ -13,7 +13,7 @@ static int _pkcs_5_alg1_wrap(const unsigned char *password, unsigned long passwo
    return pkcs_5_alg1(password, password_len, salt, iteration_count, hash_idx, out, outlen);
    return pkcs_5_alg1(password, password_len, salt, iteration_count, hash_idx, out, outlen);
 }
 }
 
 
-static int _pkcs_12_wrap(const unsigned char *password, unsigned long password_len,
+static int s_pkcs_12_wrap(const unsigned char *password, unsigned long password_len,
                               const unsigned char *salt,     unsigned long salt_len,
                               const unsigned char *salt,     unsigned long salt_len,
                               int iteration_count,  int hash_idx,
                               int iteration_count,  int hash_idx,
                               unsigned char *out,   unsigned long *outlen)
                               unsigned char *out,   unsigned long *outlen)
@@ -40,14 +40,14 @@ LBL_ERROR:
    return err;
    return err;
 }
 }
 
 
-static const pbes_properties _pbes1_types[] = {
-   { _pkcs_5_alg1_wrap, "md2",   "des",   8, 8 },
-   { _pkcs_5_alg1_wrap, "md2",   "rc2",   8, 8 },
-   { _pkcs_5_alg1_wrap, "md5",   "des",   8, 8 },
-   { _pkcs_5_alg1_wrap, "md5",   "rc2",   8, 8 },
-   { _pkcs_5_alg1_wrap, "sha1",  "des",   8, 8 },
-   { _pkcs_5_alg1_wrap, "sha1",  "rc2",   8, 8 },
-   { _pkcs_12_wrap,     "sha1",  "3des", 24, 8 },
+static const pbes_properties s_pbes1_types[] = {
+   { s_pkcs_5_alg1_wrap, "md2",   "des",   8, 8 },
+   { s_pkcs_5_alg1_wrap, "md2",   "rc2",   8, 8 },
+   { s_pkcs_5_alg1_wrap, "md5",   "des",   8, 8 },
+   { s_pkcs_5_alg1_wrap, "md5",   "rc2",   8, 8 },
+   { s_pkcs_5_alg1_wrap, "sha1",  "des",   8, 8 },
+   { s_pkcs_5_alg1_wrap, "sha1",  "rc2",   8, 8 },
+   { s_pkcs_12_wrap,     "sha1",  "3des", 24, 8 },
 };
 };
 
 
 typedef struct {
 typedef struct {
@@ -55,23 +55,23 @@ typedef struct {
    const char *oid;
    const char *oid;
 } oid_to_pbes;
 } oid_to_pbes;
 
 
-static const oid_to_pbes _pbes1_list[] = {
-   { &_pbes1_types[0], "1.2.840.113549.1.5.1"    },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.1    pbeWithMD2AndDES-CBC */
-   { &_pbes1_types[1], "1.2.840.113549.1.5.4"    },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.4    pbeWithMD2AndRC2-CBC */
-   { &_pbes1_types[2], "1.2.840.113549.1.5.3"    },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.3    pbeWithMD5AndDES-CBC */
-   { &_pbes1_types[3], "1.2.840.113549.1.5.6"    },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.6    pbeWithMD5AndRC2-CBC */
-   { &_pbes1_types[4], "1.2.840.113549.1.5.10"   },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.10   pbeWithSHA1AndDES-CBC */
-   { &_pbes1_types[5], "1.2.840.113549.1.5.11"   },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.11   pbeWithSHA1AndRC2-CBC */
-   { &_pbes1_types[6], "1.2.840.113549.1.12.1.3" },  /* http://www.oid-info.com/get/1.2.840.113549.1.12.1.3 pbeWithSHAAnd3-KeyTripleDES-CBC */
+static const oid_to_pbes s_pbes1_list[] = {
+   { &s_pbes1_types[0], "1.2.840.113549.1.5.1"    },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.1    pbeWithMD2AndDES-CBC */
+   { &s_pbes1_types[1], "1.2.840.113549.1.5.4"    },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.4    pbeWithMD2AndRC2-CBC */
+   { &s_pbes1_types[2], "1.2.840.113549.1.5.3"    },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.3    pbeWithMD5AndDES-CBC */
+   { &s_pbes1_types[3], "1.2.840.113549.1.5.6"    },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.6    pbeWithMD5AndRC2-CBC */
+   { &s_pbes1_types[4], "1.2.840.113549.1.5.10"   },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.10   pbeWithSHA1AndDES-CBC */
+   { &s_pbes1_types[5], "1.2.840.113549.1.5.11"   },  /* http://www.oid-info.com/get/1.2.840.113549.1.5.11   pbeWithSHA1AndRC2-CBC */
+   { &s_pbes1_types[6], "1.2.840.113549.1.12.1.3" },  /* http://www.oid-info.com/get/1.2.840.113549.1.12.1.3 pbeWithSHAAnd3-KeyTripleDES-CBC */
    { 0 },
    { 0 },
 };
 };
 
 
-static int _pbes1_from_oid(const ltc_asn1_list *oid, pbes_properties *res)
+static int s_pbes1_from_oid(const ltc_asn1_list *oid, pbes_properties *res)
 {
 {
    unsigned int i;
    unsigned int i;
-   for (i = 0; _pbes1_list[i].data != NULL; ++i) {
-      if (pk_oid_cmp_with_asn1(_pbes1_list[i].oid, oid) == CRYPT_OK) {
-         if (res != NULL) *res = *_pbes1_list[i].data;
+   for (i = 0; s_pbes1_list[i].data != NULL; ++i) {
+      if (pk_oid_cmp_with_asn1(s_pbes1_list[i].oid, oid) == CRYPT_OK) {
+         if (res != NULL) *res = *s_pbes1_list[i].data;
          return CRYPT_OK;
          return CRYPT_OK;
       }
       }
    }
    }
@@ -92,7 +92,7 @@ int pbes1_extract(const ltc_asn1_list *s, pbes_arg *res)
    LTC_ARGCHK(s   != NULL);
    LTC_ARGCHK(s   != NULL);
    LTC_ARGCHK(res != NULL);
    LTC_ARGCHK(res != NULL);
 
 
-   if ((err = _pbes1_from_oid(s, &res->type)) != CRYPT_OK) return err;
+   if ((err = s_pbes1_from_oid(s, &res->type)) != CRYPT_OK) return err;
 
 
    if (!LTC_ASN1_IS_TYPE(s->next, LTC_ASN1_SEQUENCE) ||
    if (!LTC_ASN1_IS_TYPE(s->next, LTC_ASN1_SEQUENCE) ||
        !LTC_ASN1_IS_TYPE(s->next->child, LTC_ASN1_OCTET_STRING) ||
        !LTC_ASN1_IS_TYPE(s->next->child, LTC_ASN1_OCTET_STRING) ||

+ 21 - 21
src/misc/pbes/pbes2.c

@@ -4,15 +4,15 @@
 
 
 #ifdef LTC_PBES
 #ifdef LTC_PBES
 
 
-static const char * const _oid_pbes2 =  "1.2.840.113549.1.5.13";
-static const char * const _oid_pbkdf2 = "1.2.840.113549.1.5.12";
+static const char * const s_oid_pbes2 =  "1.2.840.113549.1.5.13";
+static const char * const s_oid_pbkdf2 = "1.2.840.113549.1.5.12";
 
 
 typedef struct {
 typedef struct {
    const char *oid;
    const char *oid;
    const char *id;
    const char *id;
 } oid_id_st;
 } oid_id_st;
 
 
-static const oid_id_st _hmac_oid_names[] = {
+static const oid_id_st s_hmac_oid_names[] = {
    { "1.2.840.113549.2.7",  "sha1" },
    { "1.2.840.113549.2.7",  "sha1" },
    { "1.2.840.113549.2.8",  "sha224" },
    { "1.2.840.113549.2.8",  "sha224" },
    { "1.2.840.113549.2.9",  "sha256" },
    { "1.2.840.113549.2.9",  "sha256" },
@@ -22,7 +22,7 @@ static const oid_id_st _hmac_oid_names[] = {
    { "1.2.840.113549.2.13", "sha512-256" },
    { "1.2.840.113549.2.13", "sha512-256" },
 };
 };
 
 
-static const pbes_properties _pbes2_default_types[] = {
+static const pbes_properties s_pbes2_default_types[] = {
    { pkcs_5_alg2, "sha1",   "des",   8, 0 },
    { pkcs_5_alg2, "sha1",   "des",   8, 0 },
    { pkcs_5_alg2, "sha1",   "rc2",   4, 0 },
    { pkcs_5_alg2, "sha1",   "rc2",   4, 0 },
    { pkcs_5_alg2, "sha1",   "3des", 24, 0 },
    { pkcs_5_alg2, "sha1",   "3des", 24, 0 },
@@ -36,29 +36,29 @@ typedef struct {
    const char* oid;
    const char* oid;
 } oid_to_pbes;
 } oid_to_pbes;
 
 
-static const oid_to_pbes _pbes2_list[] = {
-   { &_pbes2_default_types[0], "1.3.14.3.2.7"            },  /* http://www.oid-info.com/get/1.3.14.3.2.7            desCBC */
-   { &_pbes2_default_types[1], "1.2.840.113549.3.2"      },  /* http://www.oid-info.com/get/1.2.840.113549.3.2      rc2CBC */
-   { &_pbes2_default_types[2], "1.2.840.113549.3.7"      },  /* http://www.oid-info.com/get/1.2.840.113549.3.7      des-EDE3-CBC */
-   { &_pbes2_default_types[3], "2.16.840.1.101.3.4.1.2"  },  /* http://www.oid-info.com/get/2.16.840.1.101.3.4.1.2  aes128-CBC */
-   { &_pbes2_default_types[4], "2.16.840.1.101.3.4.1.22" },  /* http://www.oid-info.com/get/2.16.840.1.101.3.4.1.22 aes192-CBC */
-   { &_pbes2_default_types[5], "2.16.840.1.101.3.4.1.42" },  /* http://www.oid-info.com/get/2.16.840.1.101.3.4.1.42 aes256-CBC */
+static const oid_to_pbes s_pbes2_list[] = {
+   { &s_pbes2_default_types[0], "1.3.14.3.2.7"            },  /* http://www.oid-info.com/get/1.3.14.3.2.7            desCBC */
+   { &s_pbes2_default_types[1], "1.2.840.113549.3.2"      },  /* http://www.oid-info.com/get/1.2.840.113549.3.2      rc2CBC */
+   { &s_pbes2_default_types[2], "1.2.840.113549.3.7"      },  /* http://www.oid-info.com/get/1.2.840.113549.3.7      des-EDE3-CBC */
+   { &s_pbes2_default_types[3], "2.16.840.1.101.3.4.1.2"  },  /* http://www.oid-info.com/get/2.16.840.1.101.3.4.1.2  aes128-CBC */
+   { &s_pbes2_default_types[4], "2.16.840.1.101.3.4.1.22" },  /* http://www.oid-info.com/get/2.16.840.1.101.3.4.1.22 aes192-CBC */
+   { &s_pbes2_default_types[5], "2.16.840.1.101.3.4.1.42" },  /* http://www.oid-info.com/get/2.16.840.1.101.3.4.1.42 aes256-CBC */
 };
 };
 
 
-static int _pbes2_from_oid(const ltc_asn1_list *cipher_oid, const ltc_asn1_list *hmac_oid, pbes_properties *res)
+static int s_pbes2_from_oid(const ltc_asn1_list *cipher_oid, const ltc_asn1_list *hmac_oid, pbes_properties *res)
 {
 {
    unsigned int i;
    unsigned int i;
-   for (i = 0; i < sizeof(_pbes2_list)/sizeof(_pbes2_list[0]); ++i) {
-      if (pk_oid_cmp_with_asn1(_pbes2_list[i].oid, cipher_oid) == CRYPT_OK) {
-         *res = *_pbes2_list[i].data;
+   for (i = 0; i < sizeof(s_pbes2_list)/sizeof(s_pbes2_list[0]); ++i) {
+      if (pk_oid_cmp_with_asn1(s_pbes2_list[i].oid, cipher_oid) == CRYPT_OK) {
+         *res = *s_pbes2_list[i].data;
          break;
          break;
       }
       }
    }
    }
    if (res->c == NULL) return CRYPT_INVALID_CIPHER;
    if (res->c == NULL) return CRYPT_INVALID_CIPHER;
    if (hmac_oid != NULL) {
    if (hmac_oid != NULL) {
-      for (i = 0; i < sizeof(_hmac_oid_names)/sizeof(_hmac_oid_names[0]); ++i) {
-         if (pk_oid_cmp_with_asn1(_hmac_oid_names[i].oid, hmac_oid) == CRYPT_OK) {
-            res->h = _hmac_oid_names[i].id;
+      for (i = 0; i < sizeof(s_hmac_oid_names)/sizeof(s_hmac_oid_names[0]); ++i) {
+         if (pk_oid_cmp_with_asn1(s_hmac_oid_names[i].oid, hmac_oid) == CRYPT_OK) {
+            res->h = s_hmac_oid_names[i].id;
             return CRYPT_OK;
             return CRYPT_OK;
          }
          }
       }
       }
@@ -84,7 +84,7 @@ int pbes2_extract(const ltc_asn1_list *s, pbes_arg *res)
    LTC_ARGCHK(s   != NULL);
    LTC_ARGCHK(s   != NULL);
    LTC_ARGCHK(res != NULL);
    LTC_ARGCHK(res != NULL);
 
 
-   if ((err = pk_oid_cmp_with_asn1(_oid_pbes2, s)) != CRYPT_OK) return err;
+   if ((err = pk_oid_cmp_with_asn1(s_oid_pbes2, s)) != CRYPT_OK) return err;
 
 
    if (!LTC_ASN1_IS_TYPE(s->next, LTC_ASN1_SEQUENCE) ||
    if (!LTC_ASN1_IS_TYPE(s->next, LTC_ASN1_SEQUENCE) ||
        !LTC_ASN1_IS_TYPE(s->next->child, LTC_ASN1_SEQUENCE) ||
        !LTC_ASN1_IS_TYPE(s->next->child, LTC_ASN1_SEQUENCE) ||
@@ -115,7 +115,7 @@ int pbes2_extract(const ltc_asn1_list *s, pbes_arg *res)
    lkdf = s->next->child->child;
    lkdf = s->next->child->child;
    lenc = s->next->child->next->child;
    lenc = s->next->child->next->child;
 
 
-   if ((err = pk_oid_cmp_with_asn1(_oid_pbkdf2, lkdf)) != CRYPT_OK) return err;
+   if ((err = pk_oid_cmp_with_asn1(s_oid_pbkdf2, lkdf)) != CRYPT_OK) return err;
 
 
    if (!LTC_ASN1_IS_TYPE(lkdf->next, LTC_ASN1_SEQUENCE) ||
    if (!LTC_ASN1_IS_TYPE(lkdf->next, LTC_ASN1_SEQUENCE) ||
        !LTC_ASN1_IS_TYPE(lkdf->next->child, LTC_ASN1_OCTET_STRING) ||
        !LTC_ASN1_IS_TYPE(lkdf->next->child, LTC_ASN1_OCTET_STRING) ||
@@ -140,7 +140,7 @@ int pbes2_extract(const ltc_asn1_list *s, pbes_arg *res)
        LTC_ASN1_IS_TYPE(loptseq->child, LTC_ASN1_OBJECT_IDENTIFIER)) {
        LTC_ASN1_IS_TYPE(loptseq->child, LTC_ASN1_OBJECT_IDENTIFIER)) {
       lhmac = loptseq->child;
       lhmac = loptseq->child;
    }
    }
-   if ((err = _pbes2_from_oid(lenc, lhmac, &res->type)) != CRYPT_OK) return err;
+   if ((err = s_pbes2_from_oid(lenc, lhmac, &res->type)) != CRYPT_OK) return err;
 
 
    if (LTC_ASN1_IS_TYPE(lenc->next, LTC_ASN1_OCTET_STRING)) {
    if (LTC_ASN1_IS_TYPE(lenc->next, LTC_ASN1_OCTET_STRING)) {
       /* 'NON-RC2'-CBC */
       /* 'NON-RC2'-CBC */

+ 3 - 3
src/misc/pkcs5/pkcs_5_1.c

@@ -29,7 +29,7 @@
    @param openssl_compat   [in] Whether or not to grow the key to the buffer size ala OpenSSL
    @param openssl_compat   [in] Whether or not to grow the key to the buffer size ala OpenSSL
    @return CRYPT_OK if successful
    @return CRYPT_OK if successful
 */
 */
-static int _pkcs_5_alg1_common(const unsigned char *password,
+static int s_pkcs_5_alg1_common(const unsigned char *password,
                        unsigned long password_len,
                        unsigned long password_len,
                        const unsigned char *salt,
                        const unsigned char *salt,
                        int iteration_count,  int hash_idx,
                        int iteration_count,  int hash_idx,
@@ -150,7 +150,7 @@ int pkcs_5_alg1(const unsigned char *password, unsigned long password_len,
                 int iteration_count,  int hash_idx,
                 int iteration_count,  int hash_idx,
                 unsigned char *out,   unsigned long *outlen)
                 unsigned char *out,   unsigned long *outlen)
 {
 {
-   return _pkcs_5_alg1_common(password, password_len, salt, iteration_count,
+   return s_pkcs_5_alg1_common(password, password_len, salt, iteration_count,
                              hash_idx, out, outlen, 0);
                              hash_idx, out, outlen, 0);
 }
 }
 
 
@@ -174,7 +174,7 @@ int pkcs_5_alg1_openssl(const unsigned char *password,
                         int iteration_count,  int hash_idx,
                         int iteration_count,  int hash_idx,
                         unsigned char *out,   unsigned long *outlen)
                         unsigned char *out,   unsigned long *outlen)
 {
 {
-   return _pkcs_5_alg1_common(password, password_len, salt, iteration_count,
+   return s_pkcs_5_alg1_common(password, password_len, salt, iteration_count,
                              hash_idx, out, outlen, 1);
                              hash_idx, out, outlen, 1);
 }
 }
 
 

+ 3 - 3
src/modes/ctr/ctr_encrypt.c

@@ -18,7 +18,7 @@
   @param ctr    CTR state
   @param ctr    CTR state
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-static int _ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CTR *ctr)
+static int s_ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CTR *ctr)
 {
 {
    int x, err;
    int x, err;
 
 
@@ -105,7 +105,7 @@ int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
    if ((cipher_descriptor[ctr->cipher].accel_ctr_encrypt != NULL) && (len >= (unsigned long)ctr->blocklen)) {
    if ((cipher_descriptor[ctr->cipher].accel_ctr_encrypt != NULL) && (len >= (unsigned long)ctr->blocklen)) {
      if (ctr->padlen < ctr->blocklen) {
      if (ctr->padlen < ctr->blocklen) {
        fr = ctr->blocklen - ctr->padlen;
        fr = ctr->blocklen - ctr->padlen;
-       if ((err = _ctr_encrypt(pt, ct, fr, ctr)) != CRYPT_OK) {
+       if ((err = s_ctr_encrypt(pt, ct, fr, ctr)) != CRYPT_OK) {
           return err;
           return err;
        }
        }
        pt += fr;
        pt += fr;
@@ -123,7 +123,7 @@ int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
      }
      }
    }
    }
 
 
-   return _ctr_encrypt(pt, ct, len, ctr);
+   return s_ctr_encrypt(pt, ct, len, ctr);
 }
 }
 
 
 #endif
 #endif

+ 4 - 4
src/modes/xts/xts_decrypt.c

@@ -8,7 +8,7 @@
 
 
 #ifdef LTC_XTS_MODE
 #ifdef LTC_XTS_MODE
 
 
-static int _tweak_uncrypt(const unsigned char *C, unsigned char *P, unsigned char *T, const symmetric_xts *xts)
+static int s_tweak_uncrypt(const unsigned char *C, unsigned char *P, unsigned char *T, const symmetric_xts *xts)
 {
 {
    unsigned long x;
    unsigned long x;
    int err;
    int err;
@@ -102,7 +102,7 @@ int xts_decrypt(const unsigned char *ct, unsigned long ptlen, unsigned char *pt,
       }
       }
 
 
       for (i = 0; i < lim; i++) {
       for (i = 0; i < lim; i++) {
-         if ((err = _tweak_uncrypt(ct, pt, T, xts)) != CRYPT_OK) {
+         if ((err = s_tweak_uncrypt(ct, pt, T, xts)) != CRYPT_OK) {
             return err;
             return err;
          }
          }
          ct += 16;
          ct += 16;
@@ -116,7 +116,7 @@ int xts_decrypt(const unsigned char *ct, unsigned long ptlen, unsigned char *pt,
       xts_mult_x(CC);
       xts_mult_x(CC);
 
 
       /* PP = tweak decrypt block m-1 */
       /* PP = tweak decrypt block m-1 */
-      if ((err = _tweak_uncrypt(ct, PP, CC, xts)) != CRYPT_OK) {
+      if ((err = s_tweak_uncrypt(ct, PP, CC, xts)) != CRYPT_OK) {
          return err;
          return err;
       }
       }
 
 
@@ -130,7 +130,7 @@ int xts_decrypt(const unsigned char *ct, unsigned long ptlen, unsigned char *pt,
       }
       }
 
 
       /* Pm-1 = Tweak uncrypt CC */
       /* Pm-1 = Tweak uncrypt CC */
-      if ((err = _tweak_uncrypt(CC, pt, T, xts)) != CRYPT_OK) {
+      if ((err = s_tweak_uncrypt(CC, pt, T, xts)) != CRYPT_OK) {
          return err;
          return err;
       }
       }
    }
    }

+ 4 - 4
src/modes/xts/xts_encrypt.c

@@ -8,7 +8,7 @@
 
 
 #ifdef LTC_XTS_MODE
 #ifdef LTC_XTS_MODE
 
 
-static int _tweak_crypt(const unsigned char *P, unsigned char *C, unsigned char *T, const symmetric_xts *xts)
+static int s_tweak_crypt(const unsigned char *P, unsigned char *C, unsigned char *T, const symmetric_xts *xts)
 {
 {
    unsigned long x;
    unsigned long x;
    int err;
    int err;
@@ -105,7 +105,7 @@ int xts_encrypt(const unsigned char *pt, unsigned long ptlen, unsigned char *ct,
       }
       }
 
 
       for (i = 0; i < lim; i++) {
       for (i = 0; i < lim; i++) {
-         if ((err = _tweak_crypt(pt, ct, T, xts)) != CRYPT_OK) {
+         if ((err = s_tweak_crypt(pt, ct, T, xts)) != CRYPT_OK) {
             return err;
             return err;
          }
          }
          ct += 16;
          ct += 16;
@@ -116,7 +116,7 @@ int xts_encrypt(const unsigned char *pt, unsigned long ptlen, unsigned char *ct,
    /* if ptlen not divide 16 then */
    /* if ptlen not divide 16 then */
    if (mo > 0) {
    if (mo > 0) {
       /* CC = tweak encrypt block m-1 */
       /* CC = tweak encrypt block m-1 */
-      if ((err = _tweak_crypt(pt, CC, T, xts)) != CRYPT_OK) {
+      if ((err = s_tweak_crypt(pt, CC, T, xts)) != CRYPT_OK) {
          return err;
          return err;
       }
       }
 
 
@@ -131,7 +131,7 @@ int xts_encrypt(const unsigned char *pt, unsigned long ptlen, unsigned char *ct,
       }
       }
 
 
       /* Cm-1 = Tweak encrypt PP */
       /* Cm-1 = Tweak encrypt PP */
-      if ((err = _tweak_crypt(PP, ct, T, xts)) != CRYPT_OK) {
+      if ((err = s_tweak_crypt(PP, ct, T, xts)) != CRYPT_OK) {
          return err;
          return err;
       }
       }
    }
    }

+ 4 - 4
src/modes/xts/xts_test.c

@@ -5,7 +5,7 @@
 #ifdef LTC_XTS_MODE
 #ifdef LTC_XTS_MODE
 
 
 #ifndef LTC_NO_TEST
 #ifndef LTC_NO_TEST
-static int _xts_test_accel_xts_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long blocks,
+static int s_xts_test_accel_xts_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long blocks,
                                        unsigned char *tweak, const symmetric_key *skey1, const symmetric_key *skey2)
                                        unsigned char *tweak, const symmetric_key *skey1, const symmetric_key *skey2)
 {
 {
    int ret;
    int ret;
@@ -32,7 +32,7 @@ static int _xts_test_accel_xts_encrypt(const unsigned char *pt, unsigned char *c
    return ret;
    return ret;
 }
 }
 
 
-static int _xts_test_accel_xts_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long blocks,
+static int s_xts_test_accel_xts_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long blocks,
                                        unsigned char *tweak, const symmetric_key *skey1, const symmetric_key *skey2)
                                        unsigned char *tweak, const symmetric_key *skey1, const symmetric_key *skey2)
 {
 {
    int ret;
    int ret;
@@ -208,10 +208,10 @@ int xts_test(void)
       cipher_descriptor[idx].accel_xts_encrypt = NULL;
       cipher_descriptor[idx].accel_xts_encrypt = NULL;
       cipher_descriptor[idx].accel_xts_decrypt = NULL;
       cipher_descriptor[idx].accel_xts_decrypt = NULL;
       if (k & 0x1) {
       if (k & 0x1) {
-         cipher_descriptor[idx].accel_xts_encrypt = _xts_test_accel_xts_encrypt;
+         cipher_descriptor[idx].accel_xts_encrypt = s_xts_test_accel_xts_encrypt;
       }
       }
       if (k & 0x2) {
       if (k & 0x2) {
-         cipher_descriptor[idx].accel_xts_decrypt = _xts_test_accel_xts_decrypt;
+         cipher_descriptor[idx].accel_xts_decrypt = s_xts_test_accel_xts_decrypt;
       }
       }
       for (j = 0; j < 2; j++) {
       for (j = 0; j < 2; j++) {
          for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
          for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {

+ 4 - 4
src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c

@@ -10,7 +10,7 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 
 
-static int _char_to_int(unsigned char x)
+static int s_char_to_int(unsigned char x)
 {
 {
    switch (x)  {
    switch (x)  {
       case '0': return 0;
       case '0': return 0;
@@ -28,13 +28,13 @@ static int _char_to_int(unsigned char x)
 }
 }
 
 
 #define DECODE_V(y, max) do {\
 #define DECODE_V(y, max) do {\
-   y  = _char_to_int(buf[x])*10 + _char_to_int(buf[x+1]); \
+   y  = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \
    if (y >= max) return CRYPT_INVALID_PACKET;           \
    if (y >= max) return CRYPT_INVALID_PACKET;           \
    x += 2; \
    x += 2; \
 } while(0)
 } while(0)
 
 
 #define DECODE_V4(y, max) do {\
 #define DECODE_V4(y, max) do {\
-   y  = _char_to_int(buf[x])*1000 + _char_to_int(buf[x+1])*100 + _char_to_int(buf[x+2])*10 + _char_to_int(buf[x+3]); \
+   y  = s_char_to_int(buf[x])*1000 + s_char_to_int(buf[x+1])*100 + s_char_to_int(buf[x+2])*10 + s_char_to_int(buf[x+3]); \
    if (y >= max) return CRYPT_INVALID_PACKET; \
    if (y >= max) return CRYPT_INVALID_PACKET; \
    x += 4; \
    x += 4; \
 } while(0)
 } while(0)
@@ -113,7 +113,7 @@ YYYYMMDDhhmmss.fs-hh'mm'
           unsigned fs = out->fs;
           unsigned fs = out->fs;
           if (x >= sizeof(buf)) return CRYPT_INVALID_PACKET;
           if (x >= sizeof(buf)) return CRYPT_INVALID_PACKET;
           out->fs *= 10;
           out->fs *= 10;
-          out->fs += _char_to_int(buf[x]);
+          out->fs += s_char_to_int(buf[x]);
           if (fs > out->fs) return CRYPT_OVERFLOW;
           if (fs > out->fs) return CRYPT_OVERFLOW;
           x++;
           x++;
        }
        }

+ 6 - 6
src/pk/asn1/der/sequence/der_decode_sequence_flexi.c

@@ -9,7 +9,7 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 
 
-static int _new_element(ltc_asn1_list **l)
+static int s_new_element(ltc_asn1_list **l)
 {
 {
    /* alloc new link */
    /* alloc new link */
    if (*l == NULL) {
    if (*l == NULL) {
@@ -36,7 +36,7 @@ static int _new_element(ltc_asn1_list **l)
    @param depth   The depth/level of decoding recursion we've already reached
    @param depth   The depth/level of decoding recursion we've already reached
    @return CRYPT_OK on success.
    @return CRYPT_OK on success.
 */
 */
-static int _der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out, unsigned long depth)
+static int s_der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out, unsigned long depth)
 {
 {
    ltc_asn1_list *l;
    ltc_asn1_list *l;
    unsigned long err, identifier, len, totlen, data_offset, id_len, len_len;
    unsigned long err, identifier, len, totlen, data_offset, id_len, len_len;
@@ -51,7 +51,7 @@ static int _der_decode_sequence_flexi(const unsigned char *in, unsigned long *in
 
 
    if (*inlen == 0) {
    if (*inlen == 0) {
       /* alloc new link */
       /* alloc new link */
-      if ((err = _new_element(&l)) != CRYPT_OK) {
+      if ((err = s_new_element(&l)) != CRYPT_OK) {
          goto error;
          goto error;
       }
       }
    }
    }
@@ -59,7 +59,7 @@ static int _der_decode_sequence_flexi(const unsigned char *in, unsigned long *in
    /* scan the input and and get lengths and what not */
    /* scan the input and and get lengths and what not */
    while (*inlen) {
    while (*inlen) {
       /* alloc new link */
       /* alloc new link */
-      if ((err = _new_element(&l)) != CRYPT_OK) {
+      if ((err = s_new_element(&l)) != CRYPT_OK) {
          goto error;
          goto error;
       }
       }
 
 
@@ -447,7 +447,7 @@ static int _der_decode_sequence_flexi(const unsigned char *in, unsigned long *in
              len_len = len;
              len_len = len;
 
 
              /* Sequence elements go as child */
              /* Sequence elements go as child */
-             if ((err = _der_decode_sequence_flexi(in, &len, &(l->child), depth+1)) != CRYPT_OK) {
+             if ((err = s_der_decode_sequence_flexi(in, &len, &(l->child), depth+1)) != CRYPT_OK) {
                 goto error;
                 goto error;
              }
              }
              if (len_len != len) {
              if (len_len != len) {
@@ -534,7 +534,7 @@ error:
 */
 */
 int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out)
 int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out)
 {
 {
-   return _der_decode_sequence_flexi(in, inlen, out, 0);
+   return s_der_decode_sequence_flexi(in, inlen, out, 0);
 }
 }
 
 
 #endif
 #endif

+ 3 - 3
src/pk/asn1/der/sequence/der_decode_sequence_multi.c

@@ -20,7 +20,7 @@
   @param flags    c.f. enum ltc_der_seq
   @param flags    c.f. enum ltc_der_seq
   @return CRYPT_OK on success
   @return CRYPT_OK on success
 */
 */
-static int _der_decode_sequence_va(const unsigned char *in, unsigned long inlen, va_list a1, va_list a2, unsigned int flags)
+static int s_der_decode_sequence_va(const unsigned char *in, unsigned long inlen, va_list a1, va_list a2, unsigned int flags)
 {
 {
    int           err;
    int           err;
    ltc_asn1_type type;
    ltc_asn1_type type;
@@ -142,7 +142,7 @@ int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...)
    va_start(a1, inlen);
    va_start(a1, inlen);
    va_start(a2, inlen);
    va_start(a2, inlen);
 
 
-   err = _der_decode_sequence_va(in, inlen, a1, a2, LTC_DER_SEQ_SEQUENCE | LTC_DER_SEQ_RELAXED);
+   err = s_der_decode_sequence_va(in, inlen, a1, a2, LTC_DER_SEQ_SEQUENCE | LTC_DER_SEQ_RELAXED);
 
 
    va_end(a2);
    va_end(a2);
    va_end(a1);
    va_end(a1);
@@ -168,7 +168,7 @@ int der_decode_sequence_multi_ex(const unsigned char *in, unsigned long inlen, u
    va_start(a1, flags);
    va_start(a1, flags);
    va_start(a2, flags);
    va_start(a2, flags);
 
 
-   err = _der_decode_sequence_va(in, inlen, a1, a2, flags);
+   err = s_der_decode_sequence_va(in, inlen, a1, a2, flags);
 
 
    va_end(a2);
    va_end(a2);
    va_end(a1);
    va_end(a1);

+ 4 - 4
src/pk/asn1/der/set/der_encode_set.c

@@ -10,18 +10,18 @@
 #ifdef LTC_DER
 #ifdef LTC_DER
 
 
 /* LTC define to ASN.1 TAG */
 /* LTC define to ASN.1 TAG */
-static int _ltc_to_asn1(ltc_asn1_type v)
+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];
 }
 }
 
 
 
 
-static int _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;
    int            r;
    int            r;
 
 
-   r = _ltc_to_asn1(A->type) - _ltc_to_asn1(B->type);
+   r = s_ltc_to_asn1(A->type) - s_ltc_to_asn1(B->type);
 
 
    /* for QSORT the order is UNDEFINED if they are "equal" which means it is NOT DETERMINISTIC.  So we force it to be :-) */
    /* for QSORT the order is UNDEFINED if they are "equal" which means it is NOT DETERMINISTIC.  So we force it to be :-) */
    if (r == 0) {
    if (r == 0) {
@@ -59,7 +59,7 @@ int der_encode_set(const ltc_asn1_list *list, unsigned long inlen,
    }
    }
 
 
    /* sort it by the "type" field */
    /* sort it by the "type" field */
-   XQSORT(copy, inlen, sizeof(*copy), &_qsort_helper);
+   XQSORT(copy, inlen, sizeof(*copy), &s_qsort_helper);
 
 
    /* call der_encode_sequence_ex() */
    /* call der_encode_sequence_ex() */
    err = der_encode_sequence_ex(copy, inlen, out, outlen, LTC_ASN1_SET);
    err = der_encode_sequence_ex(copy, inlen, out, outlen, LTC_ASN1_SET);

+ 2 - 2
src/pk/asn1/der/set/der_encode_setof.c

@@ -14,7 +14,7 @@ struct edge {
    unsigned long  size;
    unsigned long  size;
 };
 };
 
 
-static int _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;
    int            r;
    int            r;
@@ -126,7 +126,7 @@ int der_encode_setof(const ltc_asn1_list *list, unsigned long inlen,
    }
    }
 
 
    /* sort based on contents (using edges) */
    /* sort based on contents (using edges) */
-   XQSORT(edges, inlen, sizeof(*edges), &_qsort_helper);
+   XQSORT(edges, inlen, sizeof(*edges), &s_qsort_helper);
 
 
    /* copy static header */
    /* copy static header */
    XMEMCPY(out, buf, hdrlen);
    XMEMCPY(out, buf, hdrlen);

+ 2 - 2
src/pk/asn1/der/utctime/der_decode_utctime.c

@@ -9,7 +9,7 @@
 
 
 #ifdef LTC_DER
 #ifdef LTC_DER
 
 
-static int _char_to_int(unsigned char x)
+static int s_char_to_int(unsigned char x)
 {
 {
    switch (x)  {
    switch (x)  {
       case '0': return 0;
       case '0': return 0;
@@ -27,7 +27,7 @@ static int _char_to_int(unsigned char x)
 }
 }
 
 
 #define DECODE_V(y, max) \
 #define DECODE_V(y, max) \
-   y  = _char_to_int(buf[x])*10 + _char_to_int(buf[x+1]); \
+   y  = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \
    if (y >= max) return CRYPT_INVALID_PACKET;           \
    if (y >= max) return CRYPT_INVALID_PACKET;           \
    x += 2;
    x += 2;
 
 

+ 2 - 2
src/pk/dh/dh_generate_key.c

@@ -5,7 +5,7 @@
 
 
 #ifdef LTC_MDH
 #ifdef LTC_MDH
 
 
-static int _dh_groupsize_to_keysize(int groupsize)
+static int s_dh_groupsize_to_keysize(int groupsize)
 {
 {
    /* The strength estimates from https://tools.ietf.org/html/rfc3526#section-8
    /* The strength estimates from https://tools.ietf.org/html/rfc3526#section-8
     * We use "Estimate 2" to get an appropriate private key (exponent) size.
     * We use "Estimate 2" to get an appropriate private key (exponent) size.
@@ -48,7 +48,7 @@ int dh_generate_key(prng_state *prng, int wprng, dh_key *key)
       return err;
       return err;
    }
    }
 
 
-   keysize = _dh_groupsize_to_keysize(mp_unsigned_bin_size(key->prime));
+   keysize = s_dh_groupsize_to_keysize(mp_unsigned_bin_size(key->prime));
    if (keysize == 0) {
    if (keysize == 0) {
       err = CRYPT_INVALID_KEYSIZE;
       err = CRYPT_INVALID_KEYSIZE;
       goto freemp;
       goto freemp;

+ 2 - 2
src/pk/dsa/dsa_generate_pqg.c

@@ -20,7 +20,7 @@
   @param g             [out] bignum where generated 'g' is stored (must be initialized by caller)
   @param g             [out] bignum where generated 'g' is stored (must be initialized by caller)
   @return CRYPT_OK if successful, upon error this function will free all allocated memory
   @return CRYPT_OK if successful, upon error this function will free all allocated memory
 */
 */
-static int _dsa_make_params(prng_state *prng, int wprng, int group_size, int modulus_size, void *p, void *q, void *g)
+static int s_dsa_make_params(prng_state *prng, int wprng, int group_size, int modulus_size, void *p, void *q, void *g)
 {
 {
   unsigned long L, N, n, outbytes, seedbytes, counter, j, i;
   unsigned long L, N, n, outbytes, seedbytes, counter, j, i;
   int err, res, mr_tests_q, mr_tests_p, found_p, found_q, hash;
   int err, res, mr_tests_q, mr_tests_p, found_p, found_q, hash;
@@ -217,7 +217,7 @@ int dsa_generate_pqg(prng_state *prng, int wprng, int group_size, int modulus_si
       return err;
       return err;
    }
    }
    /* generate params */
    /* generate params */
-   err = _dsa_make_params(prng, wprng, group_size, modulus_size, key->p, key->q, key->g);
+   err = s_dsa_make_params(prng, wprng, group_size, modulus_size, key->p, key->q, key->g);
    if (err != CRYPT_OK) {
    if (err != CRYPT_OK) {
       goto cleanup;
       goto cleanup;
    }
    }

+ 4 - 4
src/pk/ec25519/tweetnacl.c

@@ -14,11 +14,11 @@ typedef long64 i64;
 typedef i64 gf[16];
 typedef i64 gf[16];
 
 
 static const u8
 static const u8
-  _9[32] = {9};
+  nine[32] = {9};
 static const gf
 static const gf
   gf0,
   gf0,
   gf1 = {1},
   gf1 = {1},
-  _121665 = {0xDB41,1},
+  gf121665 = {0xDB41,1},
   D = {0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203},
   D = {0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203},
   D2 = {0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406},
   D2 = {0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406},
   X = {0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169},
   X = {0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169},
@@ -195,7 +195,7 @@ int tweetnacl_crypto_scalarmult(u8 *q,const u8 *n,const u8 *p)
     Z(a,a,c);
     Z(a,a,c);
     S(b,a);
     S(b,a);
     Z(c,d,f);
     Z(c,d,f);
-    M(a,c,_121665);
+    M(a,c,gf121665);
     A(a,a,d);
     A(a,a,d);
     M(c,c,a);
     M(c,c,a);
     M(a,d,f);
     M(a,d,f);
@@ -218,7 +218,7 @@ int tweetnacl_crypto_scalarmult(u8 *q,const u8 *n,const u8 *p)
 
 
 int tweetnacl_crypto_scalarmult_base(u8 *q,const u8 *n)
 int tweetnacl_crypto_scalarmult_base(u8 *q,const u8 *n)
 {
 {
-  return tweetnacl_crypto_scalarmult(q,n,_9);
+  return tweetnacl_crypto_scalarmult(q,n,nine);
 }
 }
 
 
 static int tweetnacl_crypto_hash(u8 *out,const u8 *m,u64 n)
 static int tweetnacl_crypto_hash(u8 *out,const u8 *m,u64 n)

+ 8 - 8
src/pk/ecc/ecc_find_curve.c

@@ -8,7 +8,7 @@
 static const struct {
 static const struct {
    const char *OID;
    const char *OID;
    const char *names[6];
    const char *names[6];
-} _curve_names[] = {
+} s_curve_names[] = {
 #ifdef LTC_ECC_SECP112R1
 #ifdef LTC_ECC_SECP112R1
    {
    {
       "1.3.132.0.6", { "SECP112R1", "ECC-112", NULL }
       "1.3.132.0.6", { "SECP112R1", "ECC-112", NULL }
@@ -185,7 +185,7 @@ static const struct {
 };
 };
 
 
 /* case-insensitive match + ignore '-', '_', ' ' */
 /* case-insensitive match + ignore '-', '_', ' ' */
-static int _name_match(const char *left, const char *right)
+static int s_name_match(const char *left, const char *right)
 {
 {
    char lc_r, lc_l;
    char lc_r, lc_l;
 
 
@@ -216,13 +216,13 @@ int ecc_find_curve(const char *name_or_oid, const ltc_ecc_curve **cu)
 
 
    *cu = NULL;
    *cu = NULL;
 
 
-   for (i = 0; _curve_names[i].OID != NULL && !OID; i++) {
-      if (XSTRCMP(_curve_names[i].OID, name_or_oid) == 0) {
-         OID = _curve_names[i].OID;
+   for (i = 0; s_curve_names[i].OID != NULL && !OID; i++) {
+      if (XSTRCMP(s_curve_names[i].OID, name_or_oid) == 0) {
+         OID = s_curve_names[i].OID;
       }
       }
-      for (j = 0; _curve_names[i].names[j] != NULL && !OID; j++) {
-         if (_name_match(_curve_names[i].names[j], name_or_oid)) {
-            OID = _curve_names[i].OID;
+      for (j = 0; s_curve_names[i].names[j] != NULL && !OID; j++) {
+         if (s_name_match(s_curve_names[i].names[j], name_or_oid)) {
+            OID = s_curve_names[i].OID;
          }
          }
       }
       }
    }
    }

+ 4 - 4
src/pk/ecc/ecc_import_openssl.c

@@ -5,7 +5,7 @@
 
 
 #ifdef LTC_MECC
 #ifdef LTC_MECC
 
 
-static int _ecc_import_private_with_oid(const unsigned char *in, unsigned long inlen, ecc_key *key)
+static int s_ecc_import_private_with_oid(const unsigned char *in, unsigned long inlen, ecc_key *key)
 {
 {
    ltc_asn1_list seq_priv[4], custom[2];
    ltc_asn1_list seq_priv[4], custom[2];
    unsigned char bin_xy[2*ECC_MAXSIZE+2], bin_k[ECC_MAXSIZE];
    unsigned char bin_xy[2*ECC_MAXSIZE+2], bin_k[ECC_MAXSIZE];
@@ -39,7 +39,7 @@ error:
    return err;
    return err;
 }
 }
 
 
-static int _ecc_import_private_with_curve(const unsigned char *in, unsigned long inlen, ecc_key *key)
+static int s_ecc_import_private_with_curve(const unsigned char *in, unsigned long inlen, ecc_key *key)
 {
 {
    void *prime, *order, *a, *b, *gx, *gy;
    void *prime, *order, *a, *b, *gx, *gy;
    ltc_asn1_list seq_fieldid[2], seq_curve[3], seq_ecparams[6], seq_priv[4], custom[2];
    ltc_asn1_list seq_fieldid[2], seq_curve[3], seq_ecparams[6], seq_priv[4], custom[2];
@@ -107,11 +107,11 @@ int ecc_import_openssl(const unsigned char *in, unsigned long inlen, ecc_key *ke
       goto success;
       goto success;
    }
    }
 
 
-   if ((err = _ecc_import_private_with_oid(in, inlen, key)) == CRYPT_OK) {
+   if ((err = s_ecc_import_private_with_oid(in, inlen, key)) == CRYPT_OK) {
       goto success;
       goto success;
    }
    }
 
 
-   err = _ecc_import_private_with_curve(in, inlen, key);
+   err = s_ecc_import_private_with_curve(in, inlen, key);
 
 
 success:
 success:
    return err;
    return err;

+ 4 - 4
src/pk/ecc/ecc_import_pkcs8.c

@@ -17,7 +17,7 @@ typedef struct {
       list[LTC_SDFC_temp##__LINE__].pp = P;    \
       list[LTC_SDFC_temp##__LINE__].pp = P;    \
    } while (0)
    } while (0)
 
 
-static int _der_flexi_sequence_cmp(const ltc_asn1_list *flexi, der_flexi_check *check)
+static int s_der_flexi_sequence_cmp(const ltc_asn1_list *flexi, der_flexi_check *check)
 {
 {
    const ltc_asn1_list *cur;
    const ltc_asn1_list *cur;
    if (flexi->type != LTC_ASN1_SEQUENCE) {
    if (flexi->type != LTC_ASN1_SEQUENCE) {
@@ -35,7 +35,7 @@ static int _der_flexi_sequence_cmp(const ltc_asn1_list *flexi, der_flexi_check *
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-/* NOTE: _der_decode_pkcs8_flexi & related stuff can be shared with rsa_import_pkcs8() */
+/* NOTE: s_der_decode_pkcs8_flexi & related stuff can be shared with rsa_import_pkcs8() */
 
 
 int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen,
 int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen,
                      const void *pwd, unsigned long pwdlen,
                      const void *pwd, unsigned long pwdlen,
@@ -73,7 +73,7 @@ int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen,
       LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_OCTET_STRING, &priv_key);
       LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_OCTET_STRING, &priv_key);
       LTC_SET_DER_FLEXI_CHECK(flexi_should, n, LTC_ASN1_EOL, NULL);
       LTC_SET_DER_FLEXI_CHECK(flexi_should, n, LTC_ASN1_EOL, NULL);
 
 
-      if (((err = _der_flexi_sequence_cmp(l, flexi_should)) == CRYPT_OK) &&
+      if (((err = s_der_flexi_sequence_cmp(l, flexi_should)) == CRYPT_OK) &&
             (pk_oid_cmp_with_asn1(pka_ec_oid, seq->child) == CRYPT_OK)) {
             (pk_oid_cmp_with_asn1(pka_ec_oid, seq->child) == CRYPT_OK)) {
          ltc_asn1_list *version, *field, *point, *point_g, *order, *p_cofactor;
          ltc_asn1_list *version, *field, *point, *point_g, *order, *p_cofactor;
 
 
@@ -102,7 +102,7 @@ int ecc_import_pkcs8(const unsigned char *in, unsigned long inlen,
             if ((err = ecc_find_curve(OID, &curve)) != CRYPT_OK)                          { goto LBL_DONE; }
             if ((err = ecc_find_curve(OID, &curve)) != CRYPT_OK)                          { goto LBL_DONE; }
             if ((err = ecc_set_curve(curve, key)) != CRYPT_OK)                            { goto LBL_DONE; }
             if ((err = ecc_set_curve(curve, key)) != CRYPT_OK)                            { goto LBL_DONE; }
          }
          }
-         else if ((err = _der_flexi_sequence_cmp(seq->child->next, flexi_should)) == CRYPT_OK) {
+         else if ((err = s_der_flexi_sequence_cmp(seq->child->next, flexi_should)) == CRYPT_OK) {
             /* CASE 2: explicit curve parameters (AKA long variant):
             /* CASE 2: explicit curve parameters (AKA long variant):
              *   0:d=0  hl=3 l= 227 cons: SEQUENCE
              *   0:d=0  hl=3 l= 227 cons: SEQUENCE
              *   3:d=1  hl=2 l=   1 prim:   INTEGER              :00
              *   3:d=1  hl=2 l=   1 prim:   INTEGER              :00

+ 4 - 4
src/pk/ecc/ecc_import_x509.c

@@ -4,7 +4,7 @@
 
 
 #ifdef LTC_MECC
 #ifdef LTC_MECC
 
 
-static int _ecc_import_x509_with_oid(const unsigned char *in, unsigned long inlen, ecc_key *key)
+static int s_ecc_import_x509_with_oid(const unsigned char *in, unsigned long inlen, ecc_key *key)
 {
 {
    unsigned char bin_xy[2*ECC_MAXSIZE+2];
    unsigned char bin_xy[2*ECC_MAXSIZE+2];
    unsigned long curveoid[16];
    unsigned long curveoid[16];
@@ -30,7 +30,7 @@ error:
    return err;
    return err;
 }
 }
 
 
-static int _ecc_import_x509_with_curve(const unsigned char *in, unsigned long inlen, ecc_key *key)
+static int s_ecc_import_x509_with_curve(const unsigned char *in, unsigned long inlen, ecc_key *key)
 {
 {
    void *prime, *order, *a, *b, *gx, *gy;
    void *prime, *order, *a, *b, *gx, *gy;
    ltc_asn1_list seq_fieldid[2], seq_curve[3], seq_ecparams[6];
    ltc_asn1_list seq_fieldid[2], seq_curve[3], seq_ecparams[6];
@@ -87,11 +87,11 @@ int ecc_import_subject_public_key_info(const unsigned char *in, unsigned long in
 {
 {
    int err;
    int err;
 
 
-   if ((err = _ecc_import_x509_with_oid(in, inlen, key)) == CRYPT_OK) {
+   if ((err = s_ecc_import_x509_with_oid(in, inlen, key)) == CRYPT_OK) {
       goto success;
       goto success;
    }
    }
 
 
-   err = _ecc_import_x509_with_curve(in, inlen, key);
+   err = s_ecc_import_x509_with_curve(in, inlen, key);
 
 
 success:
 success:
    return err;
    return err;

+ 10 - 10
src/pk/ecc/ecc_set_curve_internal.c

@@ -5,14 +5,14 @@
 
 
 #ifdef LTC_MECC
 #ifdef LTC_MECC
 
 
-static int _ecc_cmp_hex_bn(const char *left_hex, void *right_bn, void *tmp_bn)
+static int s_ecc_cmp_hex_bn(const char *left_hex, void *right_bn, void *tmp_bn)
 {
 {
    if (mp_read_radix(tmp_bn, left_hex, 16) != CRYPT_OK) return 0;
    if (mp_read_radix(tmp_bn, left_hex, 16) != CRYPT_OK) return 0;
    if (mp_cmp(tmp_bn, right_bn) != LTC_MP_EQ)           return 0;
    if (mp_cmp(tmp_bn, right_bn) != LTC_MP_EQ)           return 0;
    return 1;
    return 1;
 }
 }
 
 
-static void _ecc_oid_lookup(ecc_key *key)
+static void s_ecc_oid_lookup(ecc_key *key)
 {
 {
    void *bn;
    void *bn;
    const ltc_ecc_curve *curve;
    const ltc_ecc_curve *curve;
@@ -20,12 +20,12 @@ static void _ecc_oid_lookup(ecc_key *key)
    key->dp.oidlen = 0;
    key->dp.oidlen = 0;
    if (mp_init(&bn) != CRYPT_OK) return;
    if (mp_init(&bn) != CRYPT_OK) return;
    for (curve = ltc_ecc_curves; curve->prime != NULL; curve++) {
    for (curve = ltc_ecc_curves; curve->prime != NULL; curve++) {
-      if (_ecc_cmp_hex_bn(curve->prime, key->dp.prime,  bn) != 1) continue;
-      if (_ecc_cmp_hex_bn(curve->order, key->dp.order,  bn) != 1) continue;
-      if (_ecc_cmp_hex_bn(curve->A,     key->dp.A,      bn) != 1) continue;
-      if (_ecc_cmp_hex_bn(curve->B,     key->dp.B,      bn) != 1) continue;
-      if (_ecc_cmp_hex_bn(curve->Gx,    key->dp.base.x, bn) != 1) continue;
-      if (_ecc_cmp_hex_bn(curve->Gy,    key->dp.base.y, bn) != 1) continue;
+      if (s_ecc_cmp_hex_bn(curve->prime, key->dp.prime,  bn) != 1) continue;
+      if (s_ecc_cmp_hex_bn(curve->order, key->dp.order,  bn) != 1) continue;
+      if (s_ecc_cmp_hex_bn(curve->A,     key->dp.A,      bn) != 1) continue;
+      if (s_ecc_cmp_hex_bn(curve->B,     key->dp.B,      bn) != 1) continue;
+      if (s_ecc_cmp_hex_bn(curve->Gx,    key->dp.base.x, bn) != 1) continue;
+      if (s_ecc_cmp_hex_bn(curve->Gy,    key->dp.base.y, bn) != 1) continue;
       if (key->dp.cofactor != curve->cofactor)                    continue;
       if (key->dp.cofactor != curve->cofactor)                    continue;
       break; /* found */
       break; /* found */
    }
    }
@@ -66,7 +66,7 @@ int ecc_copy_curve(const ecc_key *srckey, ecc_key *key)
      for (i = 0; i < key->dp.oidlen; i++) key->dp.oid[i] = srckey->dp.oid[i];
      for (i = 0; i < key->dp.oidlen; i++) key->dp.oid[i] = srckey->dp.oid[i];
    }
    }
    else {
    else {
-     _ecc_oid_lookup(key); /* try to find OID in ltc_ecc_curves */
+     s_ecc_oid_lookup(key); /* try to find OID in ltc_ecc_curves */
    }
    }
    /* success */
    /* success */
    return CRYPT_OK;
    return CRYPT_OK;
@@ -107,7 +107,7 @@ int ecc_set_curve_from_mpis(void *a, void *b, void *prime, void *order, void *gx
    key->dp.cofactor = cofactor;
    key->dp.cofactor = cofactor;
    key->dp.size = mp_unsigned_bin_size(prime);
    key->dp.size = mp_unsigned_bin_size(prime);
    /* try to find OID in ltc_ecc_curves */
    /* try to find OID in ltc_ecc_curves */
-   _ecc_oid_lookup(key);
+   s_ecc_oid_lookup(key);
    /* success */
    /* success */
    return CRYPT_OK;
    return CRYPT_OK;
 
 

+ 2 - 2
src/pk/ed25519/ed25519_import_x509.c

@@ -9,7 +9,7 @@
 
 
 #ifdef LTC_CURVE25519
 #ifdef LTC_CURVE25519
 
 
-static int _ed25519_decode(const unsigned char *in, unsigned long inlen, curve25519_key *key)
+static int s_ed25519_decode(const unsigned char *in, unsigned long inlen, curve25519_key *key)
 {
 {
    if (inlen != sizeof(key->pub)) return CRYPT_PK_INVALID_SIZE;
    if (inlen != sizeof(key->pub)) return CRYPT_PK_INVALID_SIZE;
    XMEMCPY(key->pub, in, sizeof(key->pub));
    XMEMCPY(key->pub, in, sizeof(key->pub));
@@ -33,7 +33,7 @@ int ed25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519
    if ((err = x509_decode_public_key_from_certificate(in, inlen,
    if ((err = x509_decode_public_key_from_certificate(in, inlen,
                                                       PKA_ED25519,
                                                       PKA_ED25519,
                                                       LTC_ASN1_EOL, NULL, NULL,
                                                       LTC_ASN1_EOL, NULL, NULL,
-                                                      (public_key_decode_cb)_ed25519_decode, key)) != CRYPT_OK) {
+                                                      (public_key_decode_cb)s_ed25519_decode, key)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
    key->type = PK_PUBLIC;
    key->type = PK_PUBLIC;

+ 2 - 2
src/pk/rsa/rsa_import_x509.c

@@ -9,7 +9,7 @@
 
 
 #ifdef LTC_MRSA
 #ifdef LTC_MRSA
 
 
-static int _rsa_decode(const unsigned char *in, unsigned long inlen, rsa_key *key)
+static int s_rsa_decode(const unsigned char *in, unsigned long inlen, rsa_key *key)
 {
 {
    /* now it should be SEQUENCE { INTEGER, INTEGER } */
    /* now it should be SEQUENCE { INTEGER, INTEGER } */
    return der_decode_sequence_multi(in, inlen,
    return der_decode_sequence_multi(in, inlen,
@@ -41,7 +41,7 @@ int rsa_import_x509(const unsigned char *in, unsigned long inlen, rsa_key *key)
    if ((err = x509_decode_public_key_from_certificate(in, inlen,
    if ((err = x509_decode_public_key_from_certificate(in, inlen,
                                                       PKA_RSA, LTC_ASN1_NULL,
                                                       PKA_RSA, LTC_ASN1_NULL,
                                                       NULL, NULL,
                                                       NULL, NULL,
-                                                      (public_key_decode_cb)_rsa_decode, key)) != CRYPT_OK) {
+                                                      (public_key_decode_cb)s_rsa_decode, key)) != CRYPT_OK) {
       rsa_free(key);
       rsa_free(key);
    } else {
    } else {
       key->type = PK_PUBLIC;
       key->type = PK_PUBLIC;

+ 2 - 2
src/pk/rsa/rsa_key.c

@@ -11,7 +11,7 @@
 #ifdef LTC_MRSA
 #ifdef LTC_MRSA
 #include <stdarg.h>
 #include <stdarg.h>
 
 
-static void _mpi_shrink_multi(void **a, ...)
+static void s_mpi_shrink_multi(void **a, ...)
 {
 {
    void **cur;
    void **cur;
    unsigned n;
    unsigned n;
@@ -76,7 +76,7 @@ out:
 void rsa_shrink_key(rsa_key *key)
 void rsa_shrink_key(rsa_key *key)
 {
 {
    LTC_ARGCHKVD(key != NULL);
    LTC_ARGCHKVD(key != NULL);
-   _mpi_shrink_multi(&key->e, &key->d, &key->N, &key->dQ, &key->dP, &key->qP, &key->p, &key->q, NULL);
+   s_mpi_shrink_multi(&key->e, &key->d, &key->N, &key->dQ, &key->dP, &key->qP, &key->p, &key->q, NULL);
 }
 }
 
 
 /**
 /**

+ 2 - 2
src/pk/x25519/x25519_import_x509.c

@@ -9,7 +9,7 @@
 
 
 #ifdef LTC_CURVE25519
 #ifdef LTC_CURVE25519
 
 
-static int _x25519_decode(const unsigned char *in, unsigned long inlen, curve25519_key *key)
+static int s_x25519_decode(const unsigned char *in, unsigned long inlen, curve25519_key *key)
 {
 {
    if (inlen != sizeof(key->pub)) return CRYPT_PK_INVALID_SIZE;
    if (inlen != sizeof(key->pub)) return CRYPT_PK_INVALID_SIZE;
    XMEMCPY(key->pub, in, sizeof(key->pub));
    XMEMCPY(key->pub, in, sizeof(key->pub));
@@ -33,7 +33,7 @@ int x25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_
    if ((err = x509_decode_public_key_from_certificate(in, inlen,
    if ((err = x509_decode_public_key_from_certificate(in, inlen,
                                                       PKA_X25519,
                                                       PKA_X25519,
                                                       LTC_ASN1_EOL, NULL, NULL,
                                                       LTC_ASN1_EOL, NULL, NULL,
-                                                      (public_key_decode_cb)_x25519_decode, key)) != CRYPT_OK) {
+                                                      (public_key_decode_cb)s_x25519_decode, key)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
    key->type = PK_PUBLIC;
    key->type = PK_PUBLIC;

+ 1 - 1
src/prngs/chacha20.c

@@ -144,7 +144,7 @@ int chacha20_prng_done(prng_state *prng)
   @param prng      The PRNG to export
   @param prng      The PRNG to export
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-_LTC_PRNG_EXPORT(chacha20_prng)
+LTC_PRNG_EXPORT(chacha20_prng)
 
 
 /**
 /**
   Import a PRNG state
   Import a PRNG state

+ 17 - 17
src/prngs/fortuna.c

@@ -53,7 +53,7 @@ const struct ltc_prng_descriptor fortuna_desc = {
 };
 };
 
 
 /* update the IV */
 /* update the IV */
-static void _fortuna_update_iv(prng_state *prng)
+static void s_fortuna_update_iv(prng_state *prng)
 {
 {
    int            x;
    int            x;
    unsigned char *IV;
    unsigned char *IV;
@@ -67,7 +67,7 @@ static void _fortuna_update_iv(prng_state *prng)
 
 
 #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED
 #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED
 /* get the current time in 100ms steps */
 /* get the current time in 100ms steps */
-static ulong64 _fortuna_current_time(void)
+static ulong64 s_fortuna_current_time(void)
 {
 {
    ulong64 cur_time;
    ulong64 cur_time;
 #if defined(_WIN32)
 #if defined(_WIN32)
@@ -93,7 +93,7 @@ static ulong64 _fortuna_current_time(void)
 #endif
 #endif
 
 
 /* reseed the PRNG */
 /* reseed the PRNG */
-static int _fortuna_reseed(prng_state *prng)
+static int s_fortuna_reseed(prng_state *prng)
 {
 {
    unsigned char tmp[MAXBLOCKSIZE];
    unsigned char tmp[MAXBLOCKSIZE];
    hash_state    md;
    hash_state    md;
@@ -101,7 +101,7 @@ static int _fortuna_reseed(prng_state *prng)
    int           err, x;
    int           err, x;
 
 
 #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED
 #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED
-   ulong64 now = _fortuna_current_time();
+   ulong64 now = s_fortuna_current_time();
    if (now == prng->u.fortuna.wd) {
    if (now == prng->u.fortuna.wd) {
       return CRYPT_OK;
       return CRYPT_OK;
    }
    }
@@ -149,7 +149,7 @@ static int _fortuna_reseed(prng_state *prng)
    if ((err = rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey)) != CRYPT_OK) {
    if ((err = rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey)) != CRYPT_OK) {
       return err;
       return err;
    }
    }
-   _fortuna_update_iv(prng);
+   s_fortuna_update_iv(prng);
 
 
    /* reset/update internals */
    /* reset/update internals */
    prng->u.fortuna.pool0_len = 0;
    prng->u.fortuna.pool0_len = 0;
@@ -198,7 +198,7 @@ int fortuna_update_seed(const unsigned char *in, unsigned long inlen, prng_state
    if ((err = sha256_done(&md, prng->u.fortuna.K)) != CRYPT_OK) {
    if ((err = sha256_done(&md, prng->u.fortuna.K)) != CRYPT_OK) {
       goto LBL_UNLOCK;
       goto LBL_UNLOCK;
    }
    }
-   _fortuna_update_iv(prng);
+   s_fortuna_update_iv(prng);
 
 
 LBL_UNLOCK:
 LBL_UNLOCK:
    LTC_MUTEX_UNLOCK(&prng->lock);
    LTC_MUTEX_UNLOCK(&prng->lock);
@@ -249,7 +249,7 @@ int fortuna_start(prng_state *prng)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-static int _fortuna_add(unsigned long source, unsigned long pool, const unsigned char *in, unsigned long inlen, prng_state *prng)
+static int s_fortuna_add(unsigned long source, unsigned long pool, const unsigned char *in, unsigned long inlen, prng_state *prng)
 {
 {
    unsigned char tmp[2];
    unsigned char tmp[2];
    int err;
    int err;
@@ -296,7 +296,7 @@ int fortuna_add_random_event(unsigned long source, unsigned long pool, const uns
 
 
    LTC_MUTEX_LOCK(&prng->lock);
    LTC_MUTEX_LOCK(&prng->lock);
 
 
-   err = _fortuna_add(source, pool, in, inlen, prng);
+   err = s_fortuna_add(source, pool, in, inlen, prng);
 
 
    LTC_MUTEX_UNLOCK(&prng->lock);
    LTC_MUTEX_UNLOCK(&prng->lock);
 
 
@@ -320,7 +320,7 @@ int fortuna_add_entropy(const unsigned char *in, unsigned long inlen, prng_state
 
 
    LTC_MUTEX_LOCK(&prng->lock);
    LTC_MUTEX_LOCK(&prng->lock);
 
 
-   err = _fortuna_add(0, prng->u.fortuna.pool_idx, in, inlen, prng);
+   err = s_fortuna_add(0, prng->u.fortuna.pool_idx, in, inlen, prng);
 
 
    if (err == CRYPT_OK) {
    if (err == CRYPT_OK) {
       ++(prng->u.fortuna.pool_idx);
       ++(prng->u.fortuna.pool_idx);
@@ -346,11 +346,11 @@ int fortuna_ready(prng_state *prng)
    /* make sure the reseed doesn't fail because
    /* make sure the reseed doesn't fail because
     * of the chosen rate limit */
     * of the chosen rate limit */
 #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED
 #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED
-   prng->u.fortuna.wd = _fortuna_current_time() - 1;
+   prng->u.fortuna.wd = s_fortuna_current_time() - 1;
 #else
 #else
    prng->u.fortuna.wd = LTC_FORTUNA_WD;
    prng->u.fortuna.wd = LTC_FORTUNA_WD;
 #endif
 #endif
-   err = _fortuna_reseed(prng);
+   err = s_fortuna_reseed(prng);
    prng->ready = (err == CRYPT_OK) ? 1 : 0;
    prng->ready = (err == CRYPT_OK) ? 1 : 0;
 
 
    LTC_MUTEX_UNLOCK(&prng->lock);
    LTC_MUTEX_UNLOCK(&prng->lock);
@@ -379,7 +379,7 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state
 
 
    /* do we have to reseed? */
    /* do we have to reseed? */
    if (prng->u.fortuna.pool0_len >= 64) {
    if (prng->u.fortuna.pool0_len >= 64) {
-      if (_fortuna_reseed(prng) != CRYPT_OK) {
+      if (s_fortuna_reseed(prng) != CRYPT_OK) {
          goto LBL_UNLOCK;
          goto LBL_UNLOCK;
       }
       }
    }
    }
@@ -398,22 +398,22 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state
       rijndael_ecb_encrypt(prng->u.fortuna.IV, out, &prng->u.fortuna.skey);
       rijndael_ecb_encrypt(prng->u.fortuna.IV, out, &prng->u.fortuna.skey);
       out += 16;
       out += 16;
       outlen -= 16;
       outlen -= 16;
-      _fortuna_update_iv(prng);
+      s_fortuna_update_iv(prng);
    }
    }
 
 
    /* left over bytes? */
    /* left over bytes? */
    if (outlen > 0) {
    if (outlen > 0) {
       rijndael_ecb_encrypt(prng->u.fortuna.IV, tmp, &prng->u.fortuna.skey);
       rijndael_ecb_encrypt(prng->u.fortuna.IV, tmp, &prng->u.fortuna.skey);
       XMEMCPY(out, tmp, outlen);
       XMEMCPY(out, tmp, outlen);
-      _fortuna_update_iv(prng);
+      s_fortuna_update_iv(prng);
    }
    }
 
 
    /* generate new key */
    /* generate new key */
    rijndael_ecb_encrypt(prng->u.fortuna.IV, prng->u.fortuna.K   , &prng->u.fortuna.skey);
    rijndael_ecb_encrypt(prng->u.fortuna.IV, prng->u.fortuna.K   , &prng->u.fortuna.skey);
-   _fortuna_update_iv(prng);
+   s_fortuna_update_iv(prng);
 
 
    rijndael_ecb_encrypt(prng->u.fortuna.IV, prng->u.fortuna.K+16, &prng->u.fortuna.skey);
    rijndael_ecb_encrypt(prng->u.fortuna.IV, prng->u.fortuna.K+16, &prng->u.fortuna.skey);
-   _fortuna_update_iv(prng);
+   s_fortuna_update_iv(prng);
 
 
    if (rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey) != CRYPT_OK) {
    if (rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey) != CRYPT_OK) {
       tlen = 0;
       tlen = 0;
@@ -467,7 +467,7 @@ LBL_UNLOCK:
   @param prng      The PRNG to export
   @param prng      The PRNG to export
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-_LTC_PRNG_EXPORT(fortuna)
+LTC_PRNG_EXPORT(fortuna)
 
 
 /**
 /**
   Import a PRNG state
   Import a PRNG state

+ 1 - 1
src/prngs/rc4.c

@@ -147,7 +147,7 @@ int rc4_done(prng_state *prng)
   @param prng      The PRNG to export
   @param prng      The PRNG to export
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-_LTC_PRNG_EXPORT(rc4)
+LTC_PRNG_EXPORT(rc4)
 
 
 /**
 /**
   Import a PRNG state
   Import a PRNG state

+ 6 - 6
src/prngs/rng_get_bytes.c

@@ -10,7 +10,7 @@
 
 
 #if defined(LTC_DEVRANDOM) && !defined(_WIN32)
 #if defined(LTC_DEVRANDOM) && !defined(_WIN32)
 /* on *NIX read /dev/random */
 /* on *NIX read /dev/random */
-static unsigned long _rng_nix(unsigned char *buf, unsigned long len,
+static unsigned long s_rng_nix(unsigned char *buf, unsigned long len,
                              void (*callback)(void))
                              void (*callback)(void))
 {
 {
 #ifdef LTC_NO_FILE
 #ifdef LTC_NO_FILE
@@ -53,7 +53,7 @@ static unsigned long _rng_nix(unsigned char *buf, unsigned long len,
 
 
 #define ANSI_RNG
 #define ANSI_RNG
 
 
-static unsigned long _rng_ansic(unsigned char *buf, unsigned long len,
+static unsigned long s_rng_ansic(unsigned char *buf, unsigned long len,
                                void (*callback)(void))
                                void (*callback)(void))
 {
 {
    clock_t t1;
    clock_t t1;
@@ -94,7 +94,7 @@ static unsigned long _rng_ansic(unsigned char *buf, unsigned long len,
 #include <windows.h>
 #include <windows.h>
 #include <wincrypt.h>
 #include <wincrypt.h>
 
 
-static unsigned long _rng_win32(unsigned char *buf, unsigned long len,
+static unsigned long s_rng_win32(unsigned char *buf, unsigned long len,
                                void (*callback)(void))
                                void (*callback)(void))
 {
 {
    HCRYPTPROV hProv = 0;
    HCRYPTPROV hProv = 0;
@@ -140,12 +140,12 @@ unsigned long rng_get_bytes(unsigned char *out, unsigned long outlen,
 #endif
 #endif
 
 
 #if defined(_WIN32) || defined(_WIN32_WCE)
 #if defined(_WIN32) || defined(_WIN32_WCE)
-   x = _rng_win32(out, outlen, callback); if (x != 0) { return x; }
+   x = s_rng_win32(out, outlen, callback); if (x != 0) { return x; }
 #elif defined(LTC_DEVRANDOM)
 #elif defined(LTC_DEVRANDOM)
-   x = _rng_nix(out, outlen, callback);   if (x != 0) { return x; }
+   x = s_rng_nix(out, outlen, callback);   if (x != 0) { return x; }
 #endif
 #endif
 #ifdef ANSI_RNG
 #ifdef ANSI_RNG
-   x = _rng_ansic(out, outlen, callback); if (x != 0) { return x; }
+   x = s_rng_ansic(out, outlen, callback); if (x != 0) { return x; }
 #endif
 #endif
    return 0;
    return 0;
 }
 }

+ 1 - 1
src/prngs/sober128.c

@@ -146,7 +146,7 @@ int sober128_done(prng_state *prng)
   @param prng      The PRNG to export
   @param prng      The PRNG to export
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-_LTC_PRNG_EXPORT(sober128)
+LTC_PRNG_EXPORT(sober128)
 
 
 /**
 /**
   Import a PRNG state
   Import a PRNG state

+ 1 - 1
src/prngs/yarrow.c

@@ -267,7 +267,7 @@ int yarrow_done(prng_state *prng)
   @param prng      The PRNG to export
   @param prng      The PRNG to export
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-_LTC_PRNG_EXPORT(yarrow)
+LTC_PRNG_EXPORT(yarrow)
 
 
 /**
 /**
   Import a PRNG state
   Import a PRNG state

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

@@ -16,7 +16,7 @@
   x[a] += x[b]; x[d] = ROL(x[d] ^ x[a],  8); \
   x[a] += x[b]; x[d] = ROL(x[d] ^ x[a],  8); \
   x[c] += x[d]; x[b] = ROL(x[b] ^ x[c],  7);
   x[c] += x[d]; x[b] = ROL(x[b] ^ x[c],  7);
 
 
-static void _chacha_block(unsigned char *output, const ulong32 *input, int rounds)
+static void s_chacha_block(unsigned char *output, const ulong32 *input, int rounds)
 {
 {
    ulong32 x[16];
    ulong32 x[16];
    int i;
    int i;
@@ -66,7 +66,7 @@ int chacha_crypt(chacha_state *st, const unsigned char *in, unsigned long inlen,
       in  += j;
       in  += j;
    }
    }
    for (;;) {
    for (;;) {
-     _chacha_block(buf, st->input, st->rounds);
+     s_chacha_block(buf, st->input, st->rounds);
      if (st->ivlen == 8) {
      if (st->ivlen == 8) {
        /* IV-64bit, increment 64bit counter */
        /* IV-64bit, increment 64bit counter */
        if (0 == ++st->input[12] && 0 == ++st->input[13]) return CRYPT_OVERFLOW;
        if (0 == ++st->input[12] && 0 == ++st->input[13]) return CRYPT_OVERFLOW;

+ 11 - 11
src/stream/rabbit/rabbit.c

@@ -61,15 +61,15 @@
 #ifdef LTC_RABBIT
 #ifdef LTC_RABBIT
 
 
 /* local/private prototypes  (NB: rabbit_ctx and rabbit_state are different)  */
 /* local/private prototypes  (NB: rabbit_ctx and rabbit_state are different)  */
-static LTC_INLINE ulong32 _rabbit_g_func(ulong32 x);
-static LTC_INLINE void _rabbit_next_state(rabbit_ctx *p_instance);
-static LTC_INLINE void _rabbit_gen_1_block(rabbit_state* st, unsigned char *out);
+static LTC_INLINE ulong32 ss_rabbit_g_func(ulong32 x);
+static LTC_INLINE void ss_rabbit_next_state(rabbit_ctx *p_instance);
+static LTC_INLINE void ss_rabbit_gen_1_block(rabbit_state* st, unsigned char *out);
 
 
 /* -------------------------------------------------------------------------- */
 /* -------------------------------------------------------------------------- */
 
 
 /* Square a 32-bit unsigned integer to obtain the 64-bit result and return */
 /* Square a 32-bit unsigned integer to obtain the 64-bit result and return */
 /* the upper 32 bits XOR the lower 32 bits */
 /* the upper 32 bits XOR the lower 32 bits */
-static LTC_INLINE ulong32 _rabbit_g_func(ulong32 x)
+static LTC_INLINE ulong32 ss_rabbit_g_func(ulong32 x)
 {
 {
    ulong32 a, b, h, l;
    ulong32 a, b, h, l;
 
 
@@ -88,7 +88,7 @@ static LTC_INLINE ulong32 _rabbit_g_func(ulong32 x)
 /* -------------------------------------------------------------------------- */
 /* -------------------------------------------------------------------------- */
 
 
 /* Calculate the next internal state */
 /* Calculate the next internal state */
-static LTC_INLINE void _rabbit_next_state(rabbit_ctx *p_instance)
+static LTC_INLINE void ss_rabbit_next_state(rabbit_ctx *p_instance)
 {
 {
    ulong32 g[8], c_old[8], i;
    ulong32 g[8], c_old[8], i;
 
 
@@ -110,7 +110,7 @@ static LTC_INLINE void _rabbit_next_state(rabbit_ctx *p_instance)
 
 
    /* Calculate the g-values */
    /* Calculate the g-values */
    for (i=0;i<8;i++) {
    for (i=0;i<8;i++) {
-      g[i] = _rabbit_g_func((ulong32)(p_instance->x[i] + p_instance->c[i]));
+      g[i] = ss_rabbit_g_func((ulong32)(p_instance->x[i] + p_instance->c[i]));
    }
    }
 
 
    /* Calculate new state values */
    /* Calculate new state values */
@@ -126,12 +126,12 @@ static LTC_INLINE void _rabbit_next_state(rabbit_ctx *p_instance)
 
 
 /* ------------------------------------------------------------------------- */
 /* ------------------------------------------------------------------------- */
 
 
-static LTC_INLINE void _rabbit_gen_1_block(rabbit_state* st, unsigned char *out)
+static LTC_INLINE void ss_rabbit_gen_1_block(rabbit_state* st, unsigned char *out)
 {
 {
     ulong32 *ptr;
     ulong32 *ptr;
 
 
     /* Iterate the work context once */
     /* Iterate the work context once */
-    _rabbit_next_state(&(st->work_ctx));
+    ss_rabbit_next_state(&(st->work_ctx));
 
 
     /* Generate 16 bytes of pseudo-random data */
     /* Generate 16 bytes of pseudo-random data */
     ptr = (ulong32*)&(st->work_ctx.x);
     ptr = (ulong32*)&(st->work_ctx.x);
@@ -195,7 +195,7 @@ int rabbit_setup(rabbit_state* st, const unsigned char *key, unsigned long keyle
 
 
    /* Iterate the master context four times */
    /* Iterate the master context four times */
    for (i=0; i<4; i++) {
    for (i=0; i<4; i++) {
-      _rabbit_next_state(&(st->master_ctx));
+      ss_rabbit_next_state(&(st->master_ctx));
    }
    }
 
 
    /* Modify the counters */
    /* Modify the counters */
@@ -255,7 +255,7 @@ int rabbit_setiv(rabbit_state* st, const unsigned char *iv, unsigned long ivlen)
 
 
    /* Iterate the work context four times */
    /* Iterate the work context four times */
    for (i=0; i<4; i++) {
    for (i=0; i<4; i++) {
-      _rabbit_next_state(&(st->work_ctx));
+      ss_rabbit_next_state(&(st->work_ctx));
    }
    }
 
 
    /* reset keystream buffer and unused count */
    /* reset keystream buffer and unused count */
@@ -289,7 +289,7 @@ int rabbit_crypt(rabbit_state* st, const unsigned char *in, unsigned long inlen,
    }
    }
    for (;;) {
    for (;;) {
      /* gen a block for buf */
      /* gen a block for buf */
-     _rabbit_gen_1_block(st, buf);
+     ss_rabbit_gen_1_block(st, buf);
      if (inlen <= 16) {
      if (inlen <= 16) {
        /* XOR and send to out */
        /* XOR and send to out */
        for (i = 0; i < inlen; ++i) out[i] = in[i] ^ buf[i];
        for (i = 0; i < inlen; ++i) out[i] = in[i] ^ buf[i];

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

@@ -17,7 +17,7 @@
     x[d] ^= (ROL((x[c] + x[b]), 13)); \
     x[d] ^= (ROL((x[c] + x[b]), 13)); \
     x[a] ^= (ROL((x[d] + x[c]), 18));
     x[a] ^= (ROL((x[d] + x[c]), 18));
 
 
-static void _salsa20_block(unsigned char *output, const ulong32 *input, int rounds)
+static void s_salsa20_block(unsigned char *output, const ulong32 *input, int rounds)
 {
 {
    ulong32 x[16];
    ulong32 x[16];
    int i;
    int i;
@@ -67,7 +67,7 @@ int salsa20_crypt(salsa20_state *st, const unsigned char *in, unsigned long inle
       in  += j;
       in  += j;
    }
    }
    for (;;) {
    for (;;) {
-     _salsa20_block(buf, st->input, st->rounds);
+     s_salsa20_block(buf, st->input, st->rounds);
      /* Salsa20: 64-bit IV, increment 64-bit counter */
      /* Salsa20: 64-bit IV, increment 64-bit counter */
      if (0 == ++st->input[8] && 0 == ++st->input[9]) return CRYPT_OVERFLOW;
      if (0 == ++st->input[8] && 0 == ++st->input[9]) return CRYPT_OVERFLOW;
      if (inlen <= 64) {
      if (inlen <= 64) {

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

@@ -21,7 +21,7 @@ static const char * const constants = "expand 32-byte k";
     x[a] ^= (ROL((x[d] + x[c]), 18));
     x[a] ^= (ROL((x[d] + x[c]), 18));
 
 
 /* use modified salsa20 doubleround (no final addition as in salsa20) */
 /* use modified salsa20 doubleround (no final addition as in salsa20) */
-static void _xsalsa20_doubleround(ulong32 *x, int rounds)
+static void s_xsalsa20_doubleround(ulong32 *x, int rounds)
 {
 {
    int i;
    int i;
 
 
@@ -87,7 +87,7 @@ int xsalsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long ke
    LOAD32L(x[ 9], nonce + 12);
    LOAD32L(x[ 9], nonce + 12);
 
 
    /* use modified salsa20 doubleround (no final addition) */
    /* use modified salsa20 doubleround (no final addition) */
-   _xsalsa20_doubleround(x, rounds);
+   s_xsalsa20_doubleround(x, rounds);
 
 
    /* extract the subkey */
    /* extract the subkey */
    for (i = 0; i < 8; ++i) {
    for (i = 0; i < 8; ++i) {

+ 2 - 2
src/stream/salsa20/xsalsa20_test.c

@@ -13,7 +13,7 @@
 #ifdef LTC_XSALSA20
 #ifdef LTC_XSALSA20
 
 
 #if defined(LTC_SHA256) && defined(LTC_TEST)
 #if defined(LTC_SHA256) && defined(LTC_TEST)
-static int _sha256(unsigned char *hash, const unsigned char *data, const int datalen) {
+static int s_sha256(unsigned char *hash, const unsigned char *data, const int datalen) {
    hash_state md;
    hash_state md;
    sha256_init(&md);
    sha256_init(&md);
    sha256_process(&md, data, datalen);
    sha256_process(&md, data, datalen);
@@ -77,7 +77,7 @@ int xsalsa20_test(void)
        if ((err = xsalsa20_setup(&st, key, 32, nonce, 24, rounds))   != CRYPT_OK)  return err;
        if ((err = xsalsa20_setup(&st, key, 32, nonce, 24, rounds))   != CRYPT_OK)  return err;
        if ((err = salsa20_keystream(&st, keystream, keystreamlen))   != CRYPT_OK)  return err;
        if ((err = salsa20_keystream(&st, keystream, keystreamlen))   != CRYPT_OK)  return err;
        if ((err = salsa20_done(&st))                                 != CRYPT_OK)  return err;
        if ((err = salsa20_done(&st))                                 != CRYPT_OK)  return err;
-       if ((err = _sha256(hash, keystream, keystreamlen))            != CRYPT_OK)  return err;
+       if ((err = s_sha256(hash, keystream, keystreamlen))            != CRYPT_OK)  return err;
        if (compare_testvector(hash, sizeof(hash), expecthash, sizeof(expecthash),   "XSALSA20-TV3", 1))  return CRYPT_FAIL_TESTVECTOR;
        if (compare_testvector(hash, sizeof(hash), expecthash, sizeof(expecthash),   "XSALSA20-TV3", 1))  return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif

+ 1 - 1
src/stream/sober128/sober128_stream.c

@@ -10,7 +10,7 @@
 
 
 #ifdef LTC_SOBER128
 #ifdef LTC_SOBER128
 
 
-#define __LTC_SOBER128TAB_C__
+#define LTC_SOBER128TAB_C
 #include "sober128tab.c"
 #include "sober128tab.c"
 
 
 /* don't change these... */
 /* don't change these... */

+ 2 - 2
src/stream/sober128/sober128tab.c

@@ -6,7 +6,7 @@
    SOBER-128 Tables
    SOBER-128 Tables
 */
 */
 
 
-#ifdef __LTC_SOBER128TAB_C__
+#ifdef LTC_SOBER128TAB_C
 
 
 /* $ID$ */
 /* $ID$ */
 /* @(#)TuringMultab.h   1.3 (QUALCOMM) 02/09/03 */
 /* @(#)TuringMultab.h   1.3 (QUALCOMM) 02/09/03 */
@@ -163,4 +163,4 @@ static const ulong32 Sbox[256] = {
     0xf9e6053f, 0xa4b0d300, 0xd499cbcc, 0xb95e3d40,
     0xf9e6053f, 0xa4b0d300, 0xd499cbcc, 0xb95e3d40,
 };
 };
 
 
-#endif /* __LTC_SOBER128TAB_C__ */
+#endif /* LTC_SOBER128TAB_C */

+ 6 - 6
src/stream/sosemanuk/sosemanuk.c

@@ -579,7 +579,7 @@ static const ulong32 mul_ia[] = {
  * Compute the next block of bits of output stream. This is equivalent
  * Compute the next block of bits of output stream. This is equivalent
  * to one full rotation of the shift register.
  * to one full rotation of the shift register.
  */
  */
-static LTC_INLINE void _sosemanuk_internal(sosemanuk_state *st)
+static LTC_INLINE void s_sosemanuk_internal(sosemanuk_state *st)
 {
 {
     /*
     /*
      * MUL_A(x) computes alpha * x (in F_{2^32}).
      * MUL_A(x) computes alpha * x (in F_{2^32}).
@@ -717,7 +717,7 @@ static LTC_INLINE void _sosemanuk_internal(sosemanuk_state *st)
  * or in2[] is not allowed. Total overlap (out == in1 and/or out == in2)
  * or in2[] is not allowed. Total overlap (out == in1 and/or out == in2)
  * is allowed.
  * is allowed.
  */
  */
-static LTC_INLINE void _xorbuf(const unsigned char *in1, const unsigned char *in2,
+static LTC_INLINE void s_xorbuf(const unsigned char *in1, const unsigned char *in2,
     unsigned char *out, unsigned long datalen)
     unsigned char *out, unsigned long datalen)
 {
 {
     while (datalen -- > 0) {
     while (datalen -- > 0) {
@@ -750,21 +750,21 @@ int sosemanuk_crypt(sosemanuk_state *st,
         if (rlen > inlen) {
         if (rlen > inlen) {
             rlen = inlen;
             rlen = inlen;
         }
         }
-        _xorbuf(st->buf + st->ptr, in, out, rlen);
+        s_xorbuf(st->buf + st->ptr, in, out, rlen);
         in += rlen;
         in += rlen;
         out += rlen;
         out += rlen;
         inlen -= rlen;
         inlen -= rlen;
         st->ptr += rlen;
         st->ptr += rlen;
     }
     }
     while (inlen > 0) {
     while (inlen > 0) {
-        _sosemanuk_internal(st);
+        s_sosemanuk_internal(st);
         if (inlen >= sizeof(st->buf)) {
         if (inlen >= sizeof(st->buf)) {
-            _xorbuf(st->buf, in, out, sizeof(st->buf));
+            s_xorbuf(st->buf, in, out, sizeof(st->buf));
             in += sizeof(st->buf);
             in += sizeof(st->buf);
             out += sizeof(st->buf);
             out += sizeof(st->buf);
             inlen -= sizeof(st->buf);
             inlen -= sizeof(st->buf);
         } else {
         } else {
-            _xorbuf(st->buf, in, out, inlen);
+            s_xorbuf(st->buf, in, out, inlen);
             st->ptr = inlen;
             st->ptr = inlen;
             inlen = 0;
             inlen = 0;
         }
         }

+ 57 - 59
tests/der_test.c

@@ -15,7 +15,7 @@ int der_test(void)
 #define LTC_DER_TESTS_PRINT_FLEXI
 #define LTC_DER_TESTS_PRINT_FLEXI
 #endif
 #endif
 
 
-static const char _der_tests_stinky_root_cert[] =
+static const char s_der_tests_stinky_root_cert[] =
    "MIIFETCCA/mgAwIBAgIQbv53JNmv518t5lkCHE272jANBgkqhkiG9w0BAQUFADCB"
    "MIIFETCCA/mgAwIBAgIQbv53JNmv518t5lkCHE272jANBgkqhkiG9w0BAQUFADCB"
    "lTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug"
    "lTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug"
    "Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho"
    "Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho"
@@ -44,7 +44,7 @@ static const char _der_tests_stinky_root_cert[] =
    "JeXwdFaRjbamiz3Irl+u7x/mhxdza6RvgBYylXRFMudANpeGsV7gDXlnfzpFDKHQ"
    "JeXwdFaRjbamiz3Irl+u7x/mhxdza6RvgBYylXRFMudANpeGsV7gDXlnfzpFDKHQ"
    "niVwB7P5sbPFIlmIc+4/xRItkLIRjCVXaepgN9KYu3VOgiSDI6wXiTwP44/LUXQM"
    "niVwB7P5sbPFIlmIc+4/xRItkLIRjCVXaepgN9KYu3VOgiSDI6wXiTwP44/LUXQM"
    "hetwa7s=";
    "hetwa7s=";
-const char _der_tests_cacert_root_cert[] =
+const char ltc_der_tests_cacert_root_cert[] =
    "MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290"
    "MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290"
    "IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB"
    "IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB"
    "IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA"
    "IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA"
@@ -84,7 +84,7 @@ const char _der_tests_cacert_root_cert[] =
    "GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk"
    "GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk"
    "zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW"
    "zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW"
    "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD";
    "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD";
-const unsigned long _der_tests_cacert_root_cert_size = sizeof(_der_tests_cacert_root_cert);
+const unsigned long ltc_der_tests_cacert_root_cert_size = sizeof(ltc_der_tests_cacert_root_cert);
 
 
 /*
 /*
 SEQUENCE(3 elem)
 SEQUENCE(3 elem)
@@ -203,35 +203,33 @@ SEQUENCE(3 elem)
     BIT STRING(4096 bit)
     BIT STRING(4096 bit)
  */
  */
 
 
-#define __ASN1_FMTSTRING_FMT "line: %d, type=%d, size=%lu, data=%p, self=%p, next=%p, prev=%p, parent=%p, child=%p"
-#define __ASN1_FMTSTRING_VAL(l)  __LINE__, (l)->type, (l)->size, (l)->data, (l), (l)->next, (l)->prev, (l)->parent, (l)->child
+#define ASN1_FMTSTRING_FMT "line: %d, type=%d, size=%lu, data=%p, self=%p, next=%p, prev=%p, parent=%p, child=%p"
+#define ASN1_FMTSTRING_VAL(l)  __LINE__, (l)->type, (l)->size, (l)->data, (l), (l)->next, (l)->prev, (l)->parent, (l)->child
 
 
-#define __ASN1_ERR(l) fprintf(stderr, __ASN1_FMTSTRING_FMT "\n", __ASN1_FMTSTRING_VAL(l)); \
+#define ASN1_ERR(l) fprintf(stderr, ASN1_FMTSTRING_FMT "\n", ASN1_FMTSTRING_VAL(l)); \
     exit(EXIT_FAILURE)
     exit(EXIT_FAILURE)
 
 
-#define __CHECK_ASN1_HAS(l, w) do { if ((l)->w == NULL) { \
-    __ASN1_ERR(l);\
+#define CHECK_ASN1_HAS(l, w) do { if ((l)->w == NULL) { \
+    ASN1_ERR(l);\
 } } while(0)
 } } while(0)
 
 
-#define __CHECK_ASN1_HAS_NO(l, w) do { if ((l)->w != NULL) { \
-    __ASN1_ERR(l);\
+#define CHECK_ASN1_HAS_NO(l, w) do { if ((l)->w != NULL) { \
+    ASN1_ERR(l);\
 } } while(0)
 } } while(0)
 
 
-
-
 #define CHECK_ASN1_TYPE(l, t) do { if ((l)->type != (t)) { \
 #define CHECK_ASN1_TYPE(l, t) do { if ((l)->type != (t)) { \
-    __ASN1_ERR(l);\
+    ASN1_ERR(l);\
 } } while(0)
 } } while(0)
 
 
-#define CHECK_ASN1_HAS_CHILD(l) __CHECK_ASN1_HAS(l, child)
-#define CHECK_ASN1_HAS_NO_CHILD(l) __CHECK_ASN1_HAS_NO(l, child)
-#define CHECK_ASN1_HAS_NEXT(l) __CHECK_ASN1_HAS(l, next)
-#define CHECK_ASN1_HAS_NO_NEXT(l) __CHECK_ASN1_HAS_NO(l, next)
-#define CHECK_ASN1_HAS_DATA(l) __CHECK_ASN1_HAS(l, data)
-#define CHECK_ASN1_HAS_NO_DATA(l) __CHECK_ASN1_HAS_NO(l, data)
+#define CHECK_ASN1_HAS_CHILD(l) CHECK_ASN1_HAS(l, child)
+#define CHECK_ASN1_HAS_NO_CHILD(l) CHECK_ASN1_HAS_NO(l, child)
+#define CHECK_ASN1_HAS_NEXT(l) CHECK_ASN1_HAS(l, next)
+#define CHECK_ASN1_HAS_NO_NEXT(l) CHECK_ASN1_HAS_NO(l, next)
+#define CHECK_ASN1_HAS_DATA(l) CHECK_ASN1_HAS(l, data)
+#define CHECK_ASN1_HAS_NO_DATA(l) CHECK_ASN1_HAS_NO(l, data)
 
 
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
-static void _der_tests_print_flexi(ltc_asn1_list* l, unsigned int level)
+static void s_der_tests_print_flexi(ltc_asn1_list* l, unsigned int level)
 {
 {
   char buf[1024];
   char buf[1024];
   const char* name = NULL;
   const char* name = NULL;
@@ -243,7 +241,7 @@ static void _der_tests_print_flexi(ltc_asn1_list* l, unsigned int level)
     {
     {
   case LTC_ASN1_EOL:
   case LTC_ASN1_EOL:
     name = "EOL";
     name = "EOL";
-    snprintf(buf, sizeof(buf),__ASN1_FMTSTRING_FMT "\n", __ASN1_FMTSTRING_VAL(l));
+    snprintf(buf, sizeof(buf),__ASN1_FMTSTRING_FMT "\n", ASN1_FMTSTRING_VAL(l));
     text = buf;
     text = buf;
     break;
     break;
   case LTC_ASN1_BOOLEAN:
   case LTC_ASN1_BOOLEAN:
@@ -397,32 +395,32 @@ static void _der_tests_print_flexi(ltc_asn1_list* l, unsigned int level)
      fprintf(stderr, "WTF type=%i\n", l->type);
      fprintf(stderr, "WTF type=%i\n", l->type);
 
 
   if (ostring) {
   if (ostring) {
-      _der_tests_print_flexi(ostring, level + 1);
+      s_der_tests_print_flexi(ostring, level + 1);
       der_free_sequence_flexi(ostring);
       der_free_sequence_flexi(ostring);
   }
   }
 
 
   if (l->child)
   if (l->child)
-    _der_tests_print_flexi(l->child, level + 1);
+    s_der_tests_print_flexi(l->child, level + 1);
 
 
   if (l->next)
   if (l->next)
-    _der_tests_print_flexi(l->next, level);
+    s_der_tests_print_flexi(l->next, level);
 }
 }
 #endif
 #endif
 
 
 static void der_cacert_test(void)
 static void der_cacert_test(void)
 {
 {
-  unsigned char buf[sizeof(_der_tests_cacert_root_cert)];
+  unsigned char buf[sizeof(ltc_der_tests_cacert_root_cert)];
   unsigned long len1 = sizeof(buf), len2;
   unsigned long len1 = sizeof(buf), len2;
 
 
   ltc_asn1_list *decoded_list, *l, *l1, *l2;
   ltc_asn1_list *decoded_list, *l, *l1, *l2;
 
 
-  DO(base64_decode(_der_tests_stinky_root_cert, sizeof(_der_tests_stinky_root_cert), buf, &len1));
+  DO(base64_decode(s_der_tests_stinky_root_cert, sizeof(s_der_tests_stinky_root_cert), buf, &len1));
   len2 = len1;
   len2 = len1;
   DO(der_decode_sequence_flexi(buf, &len2, &decoded_list));
   DO(der_decode_sequence_flexi(buf, &len2, &decoded_list));
   der_free_sequence_flexi(decoded_list);
   der_free_sequence_flexi(decoded_list);
 
 
   len1 = sizeof(buf);
   len1 = sizeof(buf);
-  DO(base64_decode(_der_tests_cacert_root_cert, sizeof(_der_tests_cacert_root_cert), buf, &len1));
+  DO(base64_decode(ltc_der_tests_cacert_root_cert, sizeof(ltc_der_tests_cacert_root_cert), buf, &len1));
   len2 = len1;
   len2 = len1;
   DO(der_decode_sequence_flexi(buf, &len2, &decoded_list));
   DO(der_decode_sequence_flexi(buf, &len2, &decoded_list));
   CHECK_ASN1_TYPE(decoded_list, LTC_ASN1_SEQUENCE);
   CHECK_ASN1_TYPE(decoded_list, LTC_ASN1_SEQUENCE);
@@ -435,7 +433,7 @@ static void der_cacert_test(void)
 
 
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
   printf("\n\n--- test print start ---\n\n");
   printf("\n\n--- test print start ---\n\n");
-  _der_tests_print_flexi(decoded_list, 0);
+  s_der_tests_print_flexi(decoded_list, 0);
   printf("\n\n--- test print end ---\n\n");
   printf("\n\n--- test print end ---\n\n");
 #endif
 #endif
 
 
@@ -667,7 +665,7 @@ static void der_set_test(void)
 
 
 */
 */
 
 
-static void _der_oid_test(void)
+static void s_der_oid_test(void)
 {
 {
    static const unsigned char oid_x690_8_19_5_example[] = { 0x06, 0x03, 0x88, 0x37, 0x03 };
    static const unsigned char oid_x690_8_19_5_example[] = { 0x06, 0x03, 0x88, 0x37, 0x03 };
    unsigned long len, oid[3];
    unsigned long len, oid[3];
@@ -1127,13 +1125,13 @@ static int der_choice_n_custom_test(void)
   return 0;
   return 0;
 }
 }
 
 
-static void _der_decode_print(const void* p, unsigned long* plen)
+static void s_der_decode_print(const void* p, unsigned long* plen)
 {
 {
    ltc_asn1_list *list;
    ltc_asn1_list *list;
    DO(der_decode_sequence_flexi(p, plen, &list));
    DO(der_decode_sequence_flexi(p, plen, &list));
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
    fprintf(stderr, "\n\n");
    fprintf(stderr, "\n\n");
-   _der_tests_print_flexi(list, 0);
+   s_der_tests_print_flexi(list, 0);
    fprintf(stderr, "\n\n");
    fprintf(stderr, "\n\n");
 #endif
 #endif
    der_sequence_free(list);
    der_sequence_free(list);
@@ -1183,7 +1181,7 @@ static void der_custom_test(void)
    DO(der_length_custom_type(custom, &len, NULL));
    DO(der_length_custom_type(custom, &len, NULL));
    len = sizeof(buf);
    len = sizeof(buf);
    DO(der_encode_custom_type(custom, buf, &len));
    DO(der_encode_custom_type(custom, buf, &len));
-   _der_decode_print(buf, &len);
+   s_der_decode_print(buf, &len);
 
 
    boolean = 0x0;
    boolean = 0x0;
    DO(der_decode_custom_type(buf, len, custom));
    DO(der_decode_custom_type(buf, len, custom));
@@ -1191,7 +1189,7 @@ static void der_custom_test(void)
    DO(der_length_sequence(custom, 1, &len));
    DO(der_length_sequence(custom, 1, &len));
    len = sizeof(buf);
    len = sizeof(buf);
    DO(der_encode_sequence(custom, 1, buf, &len));
    DO(der_encode_sequence(custom, 1, buf, &len));
-   _der_decode_print(buf, &len);
+   s_der_decode_print(buf, &len);
 
 
    boolean = 0x0;
    boolean = 0x0;
    DO(der_decode_sequence(buf, len, custom, 1));
    DO(der_decode_sequence(buf, len, custom, 1));
@@ -1200,29 +1198,29 @@ static void der_custom_test(void)
    DO(der_length_custom_type(bool_ean, &len, NULL));
    DO(der_length_custom_type(bool_ean, &len, NULL));
    len = sizeof(buf);
    len = sizeof(buf);
    DO(der_encode_custom_type(bool_ean, buf, &len));
    DO(der_encode_custom_type(bool_ean, buf, &len));
-   _der_decode_print(buf, &len);
+   s_der_decode_print(buf, &len);
 
 
    LTC_SET_ASN1_CUSTOM_PRIMITIVE(bool_ean, 0, LTC_ASN1_CL_CONTEXT_SPECIFIC, 0x8000, LTC_ASN1_BOOLEAN, &boolean, 1);
    LTC_SET_ASN1_CUSTOM_PRIMITIVE(bool_ean, 0, LTC_ASN1_CL_CONTEXT_SPECIFIC, 0x8000, LTC_ASN1_BOOLEAN, &boolean, 1);
    DO(der_decode_custom_type(buf, len, bool_ean));
    DO(der_decode_custom_type(buf, len, bool_ean));
 
 
    len = sizeof(buf1);
    len = sizeof(buf1);
-   _der_decode_print(buf1, &len);
+   s_der_decode_print(buf1, &len);
 
 
    len = sizeof(buf2);
    len = sizeof(buf2);
-   _der_decode_print(buf2, &len);
+   s_der_decode_print(buf2, &len);
 
 
    len = sizeof(eckey_privc_der);
    len = sizeof(eckey_privc_der);
-   _der_decode_print(eckey_privc_der, &len);
+   s_der_decode_print(eckey_privc_der, &len);
 
 
    len = sizeof(eckey_privs_der);
    len = sizeof(eckey_privs_der);
-   _der_decode_print(eckey_privs_der, &len);
+   s_der_decode_print(eckey_privs_der, &len);
 }
 }
 
 
-typedef int (*_der_Xcode)(const void*, unsigned long, void*, unsigned long*);
+typedef int (*s_der_Xcode)(const void*, unsigned long, void*, unsigned long*);
 
 
 typedef struct {
 typedef struct {
-   _der_Xcode encode;
-   _der_Xcode decode;
+   s_der_Xcode encode;
+   s_der_Xcode decode;
    const void* in;
    const void* in;
    size_t in_sz;
    size_t in_sz;
    size_t factor;
    size_t factor;
@@ -1260,8 +1258,8 @@ static void der_Xcode_run(const der_Xcode_t* x)
 #endif
 #endif
 
 
 #define DER_XCODE_X(n, b, x) {  \
 #define DER_XCODE_X(n, b, x) {  \
-      (_der_Xcode)der_encode_ ## n,    \
-      (_der_Xcode)der_decode_ ## n,    \
+      (s_der_Xcode)der_encode_ ## n,    \
+      (s_der_Xcode)der_decode_ ## n,    \
       b,                   \
       b,                   \
       sizeof(b),           \
       sizeof(b),           \
       x,                   \
       x,                   \
@@ -1307,7 +1305,7 @@ static void der_Xcode_test(void)
    DO(der_decode_sequence_flexi(teletex_neg_int, &i, &list));
    DO(der_decode_sequence_flexi(teletex_neg_int, &i, &list));
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
    fprintf(stderr, "\n\n");
    fprintf(stderr, "\n\n");
-   _der_tests_print_flexi(list, 0);
+   s_der_tests_print_flexi(list, 0);
    fprintf(stderr, "\n\n");
    fprintf(stderr, "\n\n");
 #endif
 #endif
    if (list->child == NULL || list->child->next == NULL)
    if (list->child == NULL || list->child->next == NULL)
@@ -1327,13 +1325,13 @@ static void der_Xcode_test(void)
 }
 }
 
 
 #ifdef LTC_TEST_READDIR
 #ifdef LTC_TEST_READDIR
-static int _der_decode_sequence_flexi(const void *in, unsigned long inlen, void* ctx)
+static int s_der_decode_sequence_flexi(const void *in, unsigned long inlen, void* ctx)
 {
 {
    ltc_asn1_list** list = ctx;
    ltc_asn1_list** list = ctx;
    if (der_decode_sequence_flexi(in, &inlen, list) == CRYPT_OK) {
    if (der_decode_sequence_flexi(in, &inlen, list) == CRYPT_OK) {
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
 #ifdef LTC_DER_TESTS_PRINT_FLEXI
       fprintf(stderr, "\n\n");
       fprintf(stderr, "\n\n");
-      _der_tests_print_flexi(*list, 0);
+      s_der_tests_print_flexi(*list, 0);
       fprintf(stderr, "\n\n");
       fprintf(stderr, "\n\n");
 #endif
 #endif
       der_sequence_free(*list);
       der_sequence_free(*list);
@@ -1343,16 +1341,16 @@ static int _der_decode_sequence_flexi(const void *in, unsigned long inlen, void*
 #endif
 #endif
 
 
 
 
-static void _der_regression_test(void)
+static void s_der_regression_test(void)
 {
 {
-   static const unsigned char _broken_sequence[] = {
+   static const unsigned char s_broken_sequence[] = {
      0x30,0x41,0x02,0x84,0x7f,0xff,0xff,0xff,0x1e,0x41,0xb4,0x79,0xad,0x57,0x69,
      0x30,0x41,0x02,0x84,0x7f,0xff,0xff,0xff,0x1e,0x41,0xb4,0x79,0xad,0x57,0x69,
      0x05,0xb9,0x60,0xfe,0x14,0xea,0xdb,0x91,0xb0,0xcc,0xf3,0x48,0x43,0xda,0xb9,
      0x05,0xb9,0x60,0xfe,0x14,0xea,0xdb,0x91,0xb0,0xcc,0xf3,0x48,0x43,0xda,0xb9,
      0x16,0x17,0x3b,0xb8,0xc9,0xcd,0x02,0x1d,0x00,0xad,0xe6,0x59,0x88,0xd2,0x37,
      0x16,0x17,0x3b,0xb8,0xc9,0xcd,0x02,0x1d,0x00,0xad,0xe6,0x59,0x88,0xd2,0x37,
      0xd3,0x0f,0x9e,0xf4,0x1d,0xd4,0x24,0xa4,0xe1,0xc8,0xf1,0x69,0x67,0xcf,0x33,
      0xd3,0x0f,0x9e,0xf4,0x1d,0xd4,0x24,0xa4,0xe1,0xc8,0xf1,0x69,0x67,0xcf,0x33,
      0x65,0x81,0x3f,0xe8,0x78,0x62,0x36
      0x65,0x81,0x3f,0xe8,0x78,0x62,0x36
    };
    };
-   static const unsigned char _addtl_bytes[] = {
+   static const unsigned char s_addtl_bytes[] = {
      0x30,0x45,0x02,0x21,0x00,0xb7,0xba,0xba,0xe9,0x33,0x2b,0x54,0xb8,0xa3,0xa0,0x5b,0x70,0x04,0x57,
      0x30,0x45,0x02,0x21,0x00,0xb7,0xba,0xba,0xe9,0x33,0x2b,0x54,0xb8,0xa3,0xa0,0x5b,0x70,0x04,0x57,
      0x98,0x21,0xa8,0x87,0xa1,0xb2,0x14,0x65,0xf7,0xdb,0x8a,0x3d,0x49,0x1b,0x39,0xfd,0x2c,0x3f,0x02,
      0x98,0x21,0xa8,0x87,0xa1,0xb2,0x14,0x65,0xf7,0xdb,0x8a,0x3d,0x49,0x1b,0x39,0xfd,0x2c,0x3f,0x02,
      0x20,0x74,0x72,0x91,0xdd,0x2f,0x3f,0x44,0xaf,0x7a,0xce,0x68,0xea,0x33,0x43,0x1d,0x6f,0x94,0xe4,
      0x20,0x74,0x72,0x91,0xdd,0x2f,0x3f,0x44,0xaf,0x7a,0xce,0x68,0xea,0x33,0x43,0x1d,0x6f,0x94,0xe4,
@@ -1370,17 +1368,17 @@ static void _der_regression_test(void)
    mp_init_multi(&x, &y, NULL);
    mp_init_multi(&x, &y, NULL);
    LTC_SET_ASN1(seq, 0, LTC_ASN1_INTEGER, x, 1UL);
    LTC_SET_ASN1(seq, 0, LTC_ASN1_INTEGER, x, 1UL);
    LTC_SET_ASN1(seq, 1, LTC_ASN1_INTEGER, y, 1UL);
    LTC_SET_ASN1(seq, 1, LTC_ASN1_INTEGER, y, 1UL);
-   SHOULD_FAIL(der_decode_sequence(_broken_sequence, sizeof(_broken_sequence), seq, 2));
+   SHOULD_FAIL(der_decode_sequence(s_broken_sequence, sizeof(s_broken_sequence), seq, 2));
    mp_cleanup_multi(&y, &x, NULL);
    mp_cleanup_multi(&y, &x, NULL);
-   len = sizeof(_broken_sequence);
+   len = sizeof(s_broken_sequence);
 
 
    mp_init_multi(&x, &y, NULL);
    mp_init_multi(&x, &y, NULL);
    LTC_SET_ASN1(seq, 0, LTC_ASN1_INTEGER, x, 1UL);
    LTC_SET_ASN1(seq, 0, LTC_ASN1_INTEGER, x, 1UL);
    LTC_SET_ASN1(seq, 1, LTC_ASN1_INTEGER, y, 1UL);
    LTC_SET_ASN1(seq, 1, LTC_ASN1_INTEGER, y, 1UL);
-   SHOULD_FAIL_WITH(der_decode_sequence(_addtl_bytes, sizeof(_addtl_bytes), seq, 2), CRYPT_INPUT_TOO_LONG);
+   SHOULD_FAIL_WITH(der_decode_sequence(s_addtl_bytes, sizeof(s_addtl_bytes), seq, 2), CRYPT_INPUT_TOO_LONG);
    mp_cleanup_multi(&y, &x, NULL);
    mp_cleanup_multi(&y, &x, NULL);
-   len = sizeof(_addtl_bytes);
-   _der_decode_print(_addtl_bytes, &len);
+   len = sizeof(s_addtl_bytes);
+   s_der_decode_print(s_addtl_bytes, &len);
 
 
    len = sizeof(issue_507);
    len = sizeof(issue_507);
    SHOULD_FAIL(der_decode_sequence_flexi(issue_507, &len, &l));
    SHOULD_FAIL(der_decode_sequence_flexi(issue_507, &len, &l));
@@ -1552,7 +1550,7 @@ static void der_toolong_test(void)
    if (failed) exit(EXIT_FAILURE);
    if (failed) exit(EXIT_FAILURE);
 }
 }
 
 
-static void _der_recursion_limit(void)
+static void s_der_recursion_limit(void)
 {
 {
    unsigned int n, m;
    unsigned int n, m;
    unsigned long integer = 123, s;
    unsigned long integer = 123, s;
@@ -1614,23 +1612,23 @@ int der_test(void)
 
 
    if (ltc_mp.name == NULL) return CRYPT_NOP;
    if (ltc_mp.name == NULL) return CRYPT_NOP;
 
 
-   _der_recursion_limit();
+   s_der_recursion_limit();
 
 
    der_Xcode_test();
    der_Xcode_test();
 
 
 #ifdef LTC_TEST_READDIR
 #ifdef LTC_TEST_READDIR
-   DO(test_process_dir("tests/asn1", &list, _der_decode_sequence_flexi, NULL, "DER ASN.1 special cases"));
+   DO(test_process_dir("tests/asn1", &list, s_der_decode_sequence_flexi, NULL, "DER ASN.1 special cases"));
 #endif
 #endif
 
 
    der_custom_test();
    der_custom_test();
 
 
-   _der_regression_test();
+   s_der_regression_test();
 
 
    der_toolong_test();
    der_toolong_test();
 
 
    der_cacert_test();
    der_cacert_test();
 
 
-   _der_oid_test();
+   s_der_oid_test();
 
 
    y = 0xffffff00;
    y = 0xffffff00;
 #if ULONG_MAX == ULLONG_MAX
 #if ULONG_MAX == ULLONG_MAX

Some files were not shown because too many files changed in this diff