Browse Source

also prefix static hash functions by `s_`

Steffen Jaeckel 5 years ago
parent
commit
3447eaff53

+ 1 - 2
helper.pl

@@ -61,11 +61,10 @@ sub check_source {
       push @{$troubles->{sizeof_no_brackets}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bsizeof\s*[^\(]/;
       if ($file =~ m|src/.*\.c$| &&
           $file !~ m|src/ciphers/.*\.c$| &&
-          $file !~ m|src/hashes/.*\.c$| &&
           $file !~ m|src/math/.+_desc.c$| &&
           $file !~ m|src/pk/ec25519/tweetnacl.c$| &&
           $file !~ m|src/stream/sober128/sober128_stream.c$| &&
-          $l =~ /^static(\s+[a-zA-Z0-9_]+)+\s+([^s][a-zA-Z0-9_]+)\s*\(/) {
+          $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/) {

+ 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 }
 };
 
-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 */
-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) {
-      blake2b_set_lastnode(md);
+      s_blake2b_set_lastnode(md);
    }
    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;
    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;
    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 */
-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;
 
-   blake2b_init0(md);
+   s_blake2b_init0(md);
 
    /* IV XOR ParamBlock */
    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_DEPTH] = 1;
 
-   err = blake2b_init_param(md, P);
+   err = s_blake2b_init_param(md, P);
    if (err != CRYPT_OK) return err;
 
    if (key) {
@@ -299,9 +299,9 @@ int blake2b_512_init(hash_state *md) { return blake2b_init(md, 64, NULL, 0); }
    } while (0)
 
 #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
-static int blake2b_compress(hash_state *md, const unsigned char *buf)
+static int s_blake2b_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    ulong64 m[16];
@@ -348,10 +348,10 @@ static int blake2b_compress(hash_state *md, const unsigned char *buf)
 #undef ROUND
 
 #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;
-   err = _blake2b_compress(md, buf);
+   err = ss_blake2b_compress(md, buf);
    burn_stack(sizeof(ulong64) * 32 + sizeof(unsigned long));
    return err;
 }
@@ -379,13 +379,13 @@ int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen
       if (inlen > fill) {
          md->blake2b.curlen = 0;
          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;
          inlen -= fill;
          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;
             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 (blake2b_is_lastblock(md)) {
+   if (s_blake2b_is_lastblock(md)) {
       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 */
-   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 */
       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 },
 };
 
-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 */
-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) {
-      blake2s_set_lastnode(md);
+      s_blake2s_set_lastnode(md);
    }
    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;
    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;
    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 */
-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;
 
-   blake2s_init0(md);
+   s_blake2s_init0(md);
 
    /* IV XOR ParamBlock */
    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_DEPTH] = 1;
 
-   err = blake2s_init_param(md, P);
+   err = s_blake2s_init_param(md, P);
    if (err != CRYPT_OK) return err;
 
    if (key) {
@@ -291,9 +291,9 @@ int blake2s_256_init(hash_state *md) { return blake2s_init(md, 32, NULL, 0); }
    } while (0)
 
 #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
-static int blake2s_compress(hash_state *md, const unsigned char *buf)
+static int s_blake2s_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    unsigned long i;
@@ -337,10 +337,10 @@ static int blake2s_compress(hash_state *md, const unsigned char *buf)
 #undef ROUND
 
 #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;
-   err = _blake2s_compress(md, buf);
+   err = ss_blake2s_compress(md, buf);
    burn_stack(sizeof(ulong32) * (32) + sizeof(unsigned long));
    return err;
 }
@@ -368,13 +368,13 @@ int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen
       if (inlen > fill) {
          md->blake2s.curlen = 0;
          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;
          inlen -= fill;
          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;
             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 (blake2s_is_lastblock(md)) {
+   if (s_blake2s_is_lastblock(md)) {
       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 */
-   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 */
       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
    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];
    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)
    @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
@@ -179,7 +179,7 @@ int chc_process(hash_state * md, const unsigned char *in, unsigned long inlen)
       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) {
             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;
     }
 
@@ -232,7 +232,7 @@ int chc_done(hash_state *md, unsigned char *out)
 
     /* store length */
     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 */
     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 */
-static void md2_update_chksum(hash_state *md)
+static void s_md2_update_chksum(hash_state *md)
 {
    int j;
    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;
    unsigned char t;
@@ -126,8 +126,8 @@ int md2_process(hash_state *md, const unsigned char *in, unsigned long inlen)
 
         /* is 16 bytes full? */
         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;
         }
     }
@@ -159,12 +159,12 @@ int md2_done(hash_state * md, unsigned char *out)
     }
 
     /* hash and update */
-    md2_compress(md);
-    md2_update_chksum(md);
+    s_md2_compress(md);
+    s_md2_update_chksum(md);
 
     /* hash checksum */
     XMEMCPY(md->md2.buf, md->md2.chksum, 16);
-    md2_compress(md);
+    s_md2_compress(md);
 
     /* output is lower 16 bytes of X */
     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
-static int _md4_compress(hash_state *md, const unsigned char *buf)
+static int ss_md4_compress(hash_state *md, const unsigned char *buf)
 #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
 {
     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
-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;
-   err = _md4_compress(md, buf);
+   err = ss_md4_compress(md, buf);
    burn_stack(sizeof(ulong32) * 20 + sizeof(int));
    return err;
 }
@@ -182,7 +182,7 @@ int md4_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -215,7 +215,7 @@ int md4_done(hash_state * md, unsigned char *out)
         while (md->md4.curlen < 64) {
             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;
     }
 
@@ -226,7 +226,7 @@ int md4_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64L(md->md4.length, md->md4.buf+56);
-    md4_compress(md, md->md4.buf);
+    s_md4_compress(md, md->md4.buf);
 
     /* copy output */
     for (i = 0; i < 4; i++) {

+ 7 - 7
src/hashes/md5.c

@@ -90,9 +90,9 @@ static const ulong32 Korder[64] = {
 #endif
 
 #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
-static int  md5_compress(hash_state *md, const unsigned char *buf)
+static int  s_md5_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
     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
-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;
-   err = _md5_compress(md, buf);
+   err = ss_md5_compress(md, buf);
    burn_stack(sizeof(ulong32) * 21);
    return err;
 }
@@ -241,7 +241,7 @@ int md5_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -275,7 +275,7 @@ int md5_done(hash_state * md, unsigned char *out)
         while (md->md5.curlen < 64) {
             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;
     }
 
@@ -286,7 +286,7 @@ int md5_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64L(md->md5.length, md->md5.buf+56);
-    md5_compress(md, md->md5.buf);
+    s_md5_compress(md, md->md5.buf);
 
     /* copy output */
     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));
 
 #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
-static int  rmd128_compress(hash_state *md, const unsigned char *buf)
+static int  s_rmd128_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    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
-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;
-   err = _rmd128_compress(md, buf);
+   err = ss_rmd128_compress(md, buf);
    burn_stack(sizeof(ulong32) * 24 + sizeof(int));
    return err;
 }
@@ -280,7 +280,7 @@ int rmd128_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -314,7 +314,7 @@ int rmd128_done(hash_state * md, unsigned char *out)
         while (md->rmd128.curlen < 64) {
             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;
     }
 
@@ -325,7 +325,7 @@ int rmd128_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64L(md->rmd128.length, md->rmd128.buf+56);
-    rmd128_compress(md, md->rmd128.buf);
+    s_rmd128_compress(md, md->rmd128.buf);
 
     /* copy output */
     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
-static int _rmd160_compress(hash_state *md, const unsigned char *buf)
+static int ss_rmd160_compress(hash_state *md, const unsigned char *buf)
 #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
 {
    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
-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;
-   err = _rmd160_compress(md, buf);
+   err = ss_rmd160_compress(md, buf);
    burn_stack(sizeof(ulong32) * 26 + sizeof(int));
    return err;
 }
@@ -339,7 +339,7 @@ int rmd160_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -373,7 +373,7 @@ int rmd160_done(hash_state * md, unsigned char *out)
         while (md->rmd160.curlen < 64) {
             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;
     }
 
@@ -384,7 +384,7 @@ int rmd160_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64L(md->rmd160.length, md->rmd160.buf+56);
-    rmd160_compress(md, md->rmd160.buf);
+    s_rmd160_compress(md, md->rmd160.buf);
 
     /* copy output */
     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));
 
 #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
-static int  rmd256_compress(hash_state *md, const unsigned char *buf)
+static int  s_rmd256_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    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
-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;
-   err = _rmd256_compress(md, buf);
+   err = ss_rmd256_compress(md, buf);
    burn_stack(sizeof(ulong32) * 25 + sizeof(int));
    return err;
 }
@@ -293,7 +293,7 @@ int rmd256_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -327,7 +327,7 @@ int rmd256_done(hash_state * md, unsigned char *out)
         while (md->rmd256.curlen < 64) {
             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;
     }
 
@@ -338,7 +338,7 @@ int rmd256_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64L(md->rmd256.length, md->rmd256.buf+56);
-    rmd256_compress(md, md->rmd256.buf);
+    s_rmd256_compress(md, md->rmd256.buf);
 
     /* copy output */
     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
-static int _rmd320_compress(hash_state *md, const unsigned char *buf)
+static int ss_rmd320_compress(hash_state *md, const unsigned char *buf)
 #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
 {
    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
-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;
-   err = _rmd320_compress(md, buf);
+   err = ss_rmd320_compress(md, buf);
    burn_stack(sizeof(ulong32) * 27 + sizeof(int));
    return err;
 }
@@ -358,7 +358,7 @@ int rmd320_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -392,7 +392,7 @@ int rmd320_done(hash_state * md, unsigned char *out)
         while (md->rmd320.curlen < 64) {
             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;
     }
 
@@ -403,7 +403,7 @@ int rmd320_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64L(md->rmd320.length, md->rmd320.buf+56);
-    rmd320_compress(md, md->rmd320.buf);
+    s_rmd320_compress(md, md->rmd320.buf);
 
     /* copy output */
     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)
 
 #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
-static int  sha1_compress(hash_state *md, const unsigned char *buf)
+static int  s_sha1_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
     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
-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;
-   err = _sha1_compress(md, buf);
+   err = ss_sha1_compress(md, buf);
    burn_stack(sizeof(ulong32) * 87);
    return err;
 }
@@ -174,7 +174,7 @@ int sha1_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -207,7 +207,7 @@ int sha1_done(hash_state * md, unsigned char *out)
         while (md->sha1.curlen < 64) {
             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;
     }
 
@@ -218,7 +218,7 @@ int sha1_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64H(md->sha1.length, md->sha1.buf+56);
-    sha1_compress(md, md->sha1.buf);
+    s_sha1_compress(md, md->sha1.buf);
 
     /* copy output */
     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 */
 #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
-static int  sha256_compress(hash_state * md, const unsigned char *buf)
+static int s_sha256_compress(hash_state * md, const unsigned char *buf)
 #endif
 {
     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
-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;
-    err = _sha256_compress(md, buf);
+    err = ss_sha256_compress(md, buf);
     burn_stack(sizeof(ulong32) * 74);
     return err;
 }
@@ -219,7 +219,7 @@ int sha256_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -253,7 +253,7 @@ int sha256_done(hash_state * md, unsigned char *out)
         while (md->sha256.curlen < 64) {
             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;
     }
 
@@ -264,7 +264,7 @@ int sha256_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64H(md->sha256.length, md->sha256.buf+56);
-    sha256_compress(md, md->sha256.buf);
+    s_sha256_compress(md, md->sha256.buf);
 
     /* copy output */
     for (i = 0; i < 8; i++) {

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

@@ -83,9 +83,9 @@ CONST64(0x5fcb6fab3ad6faec), CONST64(0x6c44198c4a475817)
 
 /* compress 1024-bits */
 #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
-static int  sha512_compress(hash_state * md, const unsigned char *buf)
+static int  s_sha512_compress(hash_state * md, const unsigned char *buf)
 #endif
 {
     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 */
 #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;
-    err = _sha512_compress(md, buf);
+    err = ss_sha512_compress(md, buf);
     burn_stack(sizeof(ulong64) * 90 + sizeof(int));
     return err;
 }
@@ -187,7 +187,7 @@ int sha512_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -220,7 +220,7 @@ int sha512_done(hash_state * md, unsigned char *out)
         while (md->sha512.curlen < 128) {
             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;
     }
 
@@ -234,7 +234,7 @@ int sha512_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64H(md->sha512.length, md->sha512.buf+120);
-    sha512_compress(md, md->sha512.buf);
+    s_sha512_compress(md, md->sha512.buf);
 
     /* copy output */
     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_ROUNDS 24
 
-static const ulong64 keccakf_rndc[24] = {
+static const ulong64 s_keccakf_rndc[24] = {
    CONST64(0x0000000000000001), CONST64(0x0000000000008082),
    CONST64(0x800000000000808a), CONST64(0x8000000080008000),
    CONST64(0x000000000000808b), CONST64(0x0000000080000001),
@@ -146,15 +146,15 @@ static const ulong64 keccakf_rndc[24] = {
    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
 };
 
-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
 };
 
-static void keccakf(ulong64 s[25])
+static void s_keccakf(ulong64 s[25])
 {
    int i, j, round;
    ulong64 t, bc[5];
@@ -173,9 +173,9 @@ static void keccakf(ulong64 s[25])
       /* Rho Pi */
       t = s[1];
       for(i = 0; i < 24; i++) {
-         j = keccakf_piln[i];
+         j = s_keccakf_piln[i];
          bc[0] = s[j];
-         s[j] = ROL64(t, keccakf_rotc[i]);
+         s[j] = ROL64(t, s_keccakf_rotc[i]);
          t = bc[0];
       }
       /* Chi */
@@ -188,11 +188,11 @@ static void keccakf(ulong64 s[25])
          }
       }
       /* 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;
 
@@ -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[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 */
    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.saved = 0;
       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;
       }
    }
@@ -297,7 +297,7 @@ int sha3_process(hash_state *md, const unsigned char *in, unsigned long inlen)
       LOAD64L(t, in);
       md->sha3.s[md->sha3.word_index] ^= t;
       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;
       }
    }
@@ -312,14 +312,14 @@ int sha3_process(hash_state *md, const unsigned char *in, unsigned long inlen)
 #ifdef LTC_SHA3
 int sha3_done(hash_state *md, unsigned char *out)
 {
-   return _done(md, out, CONST64(0x06));
+   return ss_done(md, out, CONST64(0x06));
 }
 #endif
 
 #ifdef LTC_KECCAK
 int keccak_done(hash_state *md, unsigned char *out)
 {
-   return _done(md, out, CONST64(0x01));
+   return ss_done(md, out, CONST64(0x01));
 }
 #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 */
       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);
-      keccakf(md->sha3.s);
+      s_keccakf(md->sha3.s);
       /* store sha3.s[] as little-endian bytes into sha3.sb */
       for(i = 0; i < SHA3_KECCAK_SPONGE_WORDS; i++) {
          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++) {
       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 */
          for(i = 0; i < SHA3_KECCAK_SPONGE_WORDS; i++) {
             STORE64L(md->sha3.s[i], md->sha3.sb + i * 8);

+ 14 - 14
src/hashes/tiger.c

@@ -562,7 +562,7 @@ LTC_INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x
 }
 
 /* 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(b,c,a,x[1],mul);
@@ -575,7 +575,7 @@ static void pass(ulong64 *a, ulong64 *b, ulong64 *c, const ulong64 *x, int mul)
 }
 
 /* The key mixing schedule */
-static void key_schedule(ulong64 *x)
+static void s_key_schedule(ulong64 *x)
 {
     x[0] -= x[7] ^ CONST64(0xA5A5A5A5A5A5A5A5);
     x[1] ^= x[0];
@@ -596,9 +596,9 @@ static void key_schedule(ulong64 *x)
 }
 
 #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
-static int  tiger_compress(hash_state *md, const unsigned char *buf)
+static int  s_tiger_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
     ulong64 a, b, c, x[8];
@@ -612,11 +612,11 @@ static int  tiger_compress(hash_state *md, const unsigned char *buf)
     b = md->tiger.state[1];
     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 */
     md->tiger.state[0] = a ^ md->tiger.state[0];
@@ -627,10 +627,10 @@ static int  tiger_compress(hash_state *md, const unsigned char *buf)
 }
 
 #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;
-   err = _tiger_compress(md, buf);
+   err = ss_tiger_compress(md, buf);
    burn_stack(sizeof(ulong64) * 11 + sizeof(unsigned long));
    return err;
 }
@@ -659,7 +659,7 @@ int tiger_init(hash_state *md)
    @param inlen  The length of the data (octets)
    @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
@@ -689,7 +689,7 @@ int tiger_done(hash_state * md, unsigned char *out)
         while (md->tiger.curlen < 64) {
             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;
     }
 
@@ -700,7 +700,7 @@ int tiger_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64L(md->tiger.length, md->tiger.buf+56);
-    tiger_compress(md, md->tiger.buf);
+    s_tiger_compress(md, md->tiger.buf);
 
     /* copy output */
     STORE64L(md->tiger.state[0], &out[0]);

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

@@ -47,9 +47,9 @@ const struct ltc_hash_descriptor whirlpool_desc =
     SB7(GB(a, i-7, 0)))
 
 #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
-static int whirlpool_compress(hash_state *md, const unsigned char *buf)
+static int s_whirlpool_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    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
-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;
-   err = _whirlpool_compress(md, buf);
+   err = ss_whirlpool_compress(md, buf);
    burn_stack((5 * 8 * sizeof(ulong64)) + (2 * sizeof(int)));
    return err;
 }
@@ -132,7 +132,7 @@ int whirlpool_init(hash_state * md)
    @param inlen  The length of the data (octets)
    @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
@@ -165,7 +165,7 @@ int whirlpool_done(hash_state * md, unsigned char *out)
         while (md->whirlpool.curlen < 64) {
             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;
     }
 
@@ -176,7 +176,7 @@ int whirlpool_done(hash_state * md, unsigned char *out)
 
     /* store length */
     STORE64H(md->whirlpool.length, md->whirlpool.buf+56);
-    whirlpool_compress(md, md->whirlpool.buf);
+    s_whirlpool_compress(md, md->whirlpool.buf);
 
     /* copy output */
     for (i = 0; i < 8; i++) {