Browse Source

prefix static functions with `s_`

Steffen Jaeckel 5 years ago
parent
commit
4fd7b5002d
44 changed files with 197 additions and 197 deletions
  1. 2 2
      helper.pl
  2. 2 2
      src/encauth/gcm/gcm_gf_mult.c
  3. 3 3
      src/encauth/ocb3/ocb3_add_aad.c
  4. 2 2
      src/encauth/ocb3/ocb3_init.c
  5. 4 4
      src/mac/pelican/pelican.c
  6. 4 4
      src/mac/poly1305/poly1305.c
  7. 28 28
      src/math/fp/ltc_ecc_fp_mulmod.c
  8. 7 7
      src/misc/base64/base64_decode.c
  9. 4 4
      src/misc/base64/base64_encode.c
  10. 5 5
      src/misc/bcrypt/bcrypt.c
  11. 3 3
      src/misc/compare_testvector.c
  12. 2 2
      src/misc/padding/padding_pad.c
  13. 11 11
      src/misc/pbes/pbes1.c
  14. 2 2
      src/misc/pbes/pbes2.c
  15. 3 3
      src/misc/pkcs5/pkcs_5_1.c
  16. 3 3
      src/modes/ctr/ctr_encrypt.c
  17. 4 4
      src/modes/xts/xts_decrypt.c
  18. 4 4
      src/modes/xts/xts_encrypt.c
  19. 4 4
      src/modes/xts/xts_test.c
  20. 4 4
      src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c
  21. 3 3
      src/pk/asn1/der/sequence/der_decode_sequence_flexi.c
  22. 3 3
      src/pk/asn1/der/sequence/der_decode_sequence_multi.c
  23. 4 4
      src/pk/asn1/der/set/der_encode_set.c
  24. 2 2
      src/pk/asn1/der/set/der_encode_setof.c
  25. 2 2
      src/pk/asn1/der/utctime/der_decode_utctime.c
  26. 2 2
      src/pk/dh/dh_generate_key.c
  27. 2 2
      src/pk/dsa/dsa_generate_pqg.c
  28. 2 2
      src/pk/ecc/ecc_find_curve.c
  29. 4 4
      src/pk/ecc/ecc_import_openssl.c
  30. 3 3
      src/pk/ecc/ecc_import_pkcs8.c
  31. 4 4
      src/pk/ecc/ecc_import_x509.c
  32. 10 10
      src/pk/ecc/ecc_set_curve_internal.c
  33. 2 2
      src/pk/ed25519/ed25519_import_x509.c
  34. 2 2
      src/pk/rsa/rsa_import_x509.c
  35. 2 2
      src/pk/rsa/rsa_key.c
  36. 2 2
      src/pk/x25519/x25519_import_x509.c
  37. 16 16
      src/prngs/fortuna.c
  38. 6 6
      src/prngs/rng_get_bytes.c
  39. 2 2
      src/stream/chacha/chacha_crypt.c
  40. 11 11
      src/stream/rabbit/rabbit.c
  41. 2 2
      src/stream/salsa20/salsa20_crypt.c
  42. 2 2
      src/stream/salsa20/xsalsa20_setup.c
  43. 2 2
      src/stream/salsa20/xsalsa20_test.c
  44. 6 6
      src/stream/sosemanuk/sosemanuk.c

+ 2 - 2
helper.pl

@@ -65,8 +65,8 @@ sub check_source {
           $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/) {
       if ($file =~ m|src/.*\.[ch]$| && $l =~ /^\s*#\s*define\s+(_[A-Z_][a-zA-Z0-9_]*)\b/) {
         my $n = $1;
         my $n = $1;

+ 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);

+ 4 - 4
src/mac/pelican/pelican.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;
 }
 }

+ 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);

+ 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;
    }
    }
 
 

+ 11 - 11
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)
@@ -41,13 +41,13 @@ LBL_ERROR:
 }
 }
 
 
 static const pbes_properties _pbes1_types[] = {
 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 },
+   { 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 {
@@ -66,7 +66,7 @@ static const oid_to_pbes _pbes1_list[] = {
    { 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) {
    for (i = 0; _pbes1_list[i].data != NULL; ++i) {
@@ -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) ||

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

@@ -45,7 +45,7 @@ static const oid_to_pbes _pbes2_list[] = {
    { &_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 */
    { &_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) {
    for (i = 0; i < sizeof(_pbes2_list)/sizeof(_pbes2_list[0]); ++i) {
@@ -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++;
        }
        }

+ 3 - 3
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) {
@@ -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;
       }
       }
 
 

+ 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;
    }
    }

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

@@ -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;
 
 
@@ -221,7 +221,7 @@ int ecc_find_curve(const char *name_or_oid, const ltc_ecc_curve **cu)
          OID = _curve_names[i].OID;
          OID = _curve_names[i].OID;
       }
       }
       for (j = 0; _curve_names[i].names[j] != NULL && !OID; j++) {
       for (j = 0; _curve_names[i].names[j] != NULL && !OID; j++) {
-         if (_name_match(_curve_names[i].names[j], name_or_oid)) {
+         if (s_name_match(_curve_names[i].names[j], name_or_oid)) {
             OID = _curve_names[i].OID;
             OID = _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;

+ 3 - 3
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) {
@@ -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;

+ 16 - 16
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;

+ 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;
 }
 }

+ 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

+ 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;
         }
         }