فهرست منبع

Added missing 'const' qualifier to many functions' parameters

Miroslav Mareš 7 سال پیش
والد
کامیت
228d29d1e7

+ 1 - 1
src/ciphers/camellia.c

@@ -193,7 +193,7 @@ static ulong64 F(ulong64 x)
    return ((ulong64)U) | (((ulong64)D) << CONST64(32));
 }
 
-static void rot_128(unsigned char *in, unsigned count, unsigned char *out)
+static void rot_128(const unsigned char *in, unsigned count, unsigned char *out)
 {
    unsigned x, w, b;
 

+ 1 - 1
src/ciphers/idea.c

@@ -104,7 +104,7 @@ static int _setup_key(const unsigned char *key, symmetric_key *skey)
    return CRYPT_OK;
 }
 
-static int _process_block(const unsigned char *in, unsigned char *out, ushort16 *m_key)
+static int _process_block(const unsigned char *in, unsigned char *out, const ushort16 *m_key)
 {
    int i;
    ushort16 x0, x1, x2, x3, t0, t1;

+ 1 - 1
src/ciphers/kseed.c

@@ -236,7 +236,7 @@ int kseed_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_
    return CRYPT_OK;
 }
 
-static void rounds(ulong32 *P, ulong32 *K)
+static void rounds(ulong32 *P, const ulong32 *K)
 {
    ulong32 T, T2;
    int     i;

+ 4 - 4
src/ciphers/multi2.c

@@ -20,7 +20,7 @@ static void pi1(ulong32 *p)
    p[1] ^= p[0];
 }
 
-static void pi2(ulong32 *p, ulong32 *k)
+static void pi2(ulong32 *p, const ulong32 *k)
 {
    ulong32 t;
    t = (p[1] + k[0]) & 0xFFFFFFFFUL;
@@ -29,7 +29,7 @@ static void pi2(ulong32 *p, ulong32 *k)
    p[0] ^= t;
 }
 
-static void pi3(ulong32 *p, ulong32 *k)
+static void pi3(ulong32 *p, const ulong32 *k)
 {
    ulong32 t;
    t = p[0] + k[1];
@@ -41,7 +41,7 @@ static void pi3(ulong32 *p, ulong32 *k)
    p[1] ^= t;
 }
 
-static void pi4(ulong32 *p, ulong32 *k)
+static void pi4(ulong32 *p, const ulong32 *k)
 {
    ulong32 t;
    t = (p[1] + k[3])  & 0xFFFFFFFFUL;
@@ -49,7 +49,7 @@ static void pi4(ulong32 *p, ulong32 *k)
    p[0] ^= t;
 }
 
-static void setup(ulong32 *dk, ulong32 *k, ulong32 *uk)
+static void setup(const ulong32 *dk, ulong32 *k, ulong32 *uk)
 {
    int n, t;
    ulong32 p[2];

+ 2 - 2
src/ciphers/serpent.c

@@ -488,7 +488,7 @@ static int _setup_key(const unsigned char *key, int keylen, int rounds, ulong32
    return CRYPT_OK;
 }
 
-static int _enc_block(const unsigned char *in, unsigned char *out, ulong32 *k)
+static int _enc_block(const unsigned char *in, unsigned char *out, const ulong32 *k)
 {
    ulong32 a, b, c, d, e;
    unsigned int i = 1;
@@ -530,7 +530,7 @@ static int _enc_block(const unsigned char *in, unsigned char *out, ulong32 *k)
    return CRYPT_OK;
 }
 
-static int _dec_block(const unsigned char *in, unsigned char *out, ulong32 *k)
+static int _dec_block(const unsigned char *in, unsigned char *out, const ulong32 *k)
 {
    ulong32 a, b, c, d, e;
    unsigned int i;

+ 2 - 2
src/ciphers/skipjack.c

@@ -107,7 +107,7 @@ int skipjack_setup(const unsigned char *key, int keylen, int num_rounds, symmetr
    w2  = tmp ^ w3 ^ x;                            \
    w3  = w4; w4 = w1; w1 = tmp;
 
-static unsigned g_func(unsigned w, int *kp, unsigned char *key)
+static unsigned g_func(unsigned w, int *kp, const unsigned char *key)
 {
    unsigned char g1,g2;
 
@@ -119,7 +119,7 @@ static unsigned g_func(unsigned w, int *kp, unsigned char *key)
    return ((unsigned)g1<<8)|(unsigned)g2;
 }
 
-static unsigned ig_func(unsigned w, int *kp, unsigned char *key)
+static unsigned ig_func(unsigned w, int *kp, const unsigned char *key)
 {
    unsigned char g1,g2;
 

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

@@ -237,7 +237,7 @@ static void rs_mult(const unsigned char *in, unsigned char *out)
 #endif
 
 /* computes h(x) */
-static void h_func(const unsigned char *in, unsigned char *out, unsigned char *M, int k, int offset)
+static void h_func(const unsigned char *in, unsigned char *out, const unsigned char *M, int k, int offset)
 {
   int x;
   unsigned char y[4];

+ 1 - 1
src/hashes/md4.c

@@ -73,7 +73,7 @@ const struct ltc_hash_descriptor md4_desc =
 #ifdef LTC_CLEAN_STACK
 static int _md4_compress(hash_state *md, unsigned char *buf)
 #else
-static int  md4_compress(hash_state *md, unsigned char *buf)
+static int  md4_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
     ulong32 x[16], a, b, c, d;

+ 1 - 1
src/hashes/md5.c

@@ -98,7 +98,7 @@ static const ulong32 Korder[64] = {
 #ifdef LTC_CLEAN_STACK
 static int _md5_compress(hash_state *md, unsigned char *buf)
 #else
-static int  md5_compress(hash_state *md, unsigned char *buf)
+static int  md5_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
     ulong32 i, W[16], a, b, c, d;

+ 1 - 1
src/hashes/rmd128.c

@@ -81,7 +81,7 @@ const struct ltc_hash_descriptor rmd128_desc =
 #ifdef LTC_CLEAN_STACK
 static int _rmd128_compress(hash_state *md, unsigned char *buf)
 #else
-static int  rmd128_compress(hash_state *md, unsigned char *buf)
+static int  rmd128_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,X[16];

+ 1 - 1
src/hashes/rmd160.c

@@ -101,7 +101,7 @@ const struct ltc_hash_descriptor rmd160_desc =
 #ifdef LTC_CLEAN_STACK
 static int _rmd160_compress(hash_state *md, unsigned char *buf)
 #else
-static int  rmd160_compress(hash_state *md, unsigned char *buf)
+static int  rmd160_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,X[16];

+ 1 - 1
src/hashes/rmd256.c

@@ -75,7 +75,7 @@ const struct ltc_hash_descriptor rmd256_desc =
 #ifdef LTC_CLEAN_STACK
 static int _rmd256_compress(hash_state *md, unsigned char *buf)
 #else
-static int  rmd256_compress(hash_state *md, unsigned char *buf)
+static int  rmd256_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    ulong32 aa,bb,cc,dd,aaa,bbb,ccc,ddd,tmp,X[16];

+ 1 - 1
src/hashes/rmd320.c

@@ -96,7 +96,7 @@ const struct ltc_hash_descriptor rmd320_desc =
 #ifdef LTC_CLEAN_STACK
 static int _rmd320_compress(hash_state *md, unsigned char *buf)
 #else
-static int  rmd320_compress(hash_state *md, unsigned char *buf)
+static int  rmd320_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    ulong32 aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,tmp,X[16];

+ 1 - 1
src/hashes/sha1.c

@@ -42,7 +42,7 @@ const struct ltc_hash_descriptor sha1_desc =
 #ifdef LTC_CLEAN_STACK
 static int _sha1_compress(hash_state *md, unsigned char *buf)
 #else
-static int  sha1_compress(hash_state *md, unsigned char *buf)
+static int  sha1_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
     ulong32 a,b,c,d,e,W[80],i;

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

@@ -66,7 +66,7 @@ static const ulong32 K[64] = {
 #ifdef LTC_CLEAN_STACK
 static int _sha256_compress(hash_state * md, unsigned char *buf)
 #else
-static int  sha256_compress(hash_state * md, unsigned char *buf)
+static int  sha256_compress(hash_state * md, const unsigned char *buf)
 #endif
 {
     ulong32 S[8], W[64], t0, t1;

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

@@ -91,7 +91,7 @@ CONST64(0x5fcb6fab3ad6faec), CONST64(0x6c44198c4a475817)
 #ifdef LTC_CLEAN_STACK
 static int _sha512_compress(hash_state * md, unsigned char *buf)
 #else
-static int  sha512_compress(hash_state * md, unsigned char *buf)
+static int  sha512_compress(hash_state * md, const unsigned char *buf)
 #endif
 {
     ulong64 S[8], W[80], t0, t1;

+ 1 - 1
src/hashes/sha3.c

@@ -364,7 +364,7 @@ int sha3_shake_done(hash_state *md, unsigned char *out, unsigned long outlen)
    return CRYPT_OK;
 }
 
-int sha3_shake_memory(int num, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
+int sha3_shake_memory(int num, const unsigned char *in, unsigned long inlen, unsigned char *out, const unsigned long *outlen)
 {
    hash_state md;
    int err;

+ 2 - 2
src/hashes/tiger.c

@@ -608,9 +608,9 @@ static void key_schedule(ulong64 *x)
 }
 
 #ifdef LTC_CLEAN_STACK
-static int _tiger_compress(hash_state *md, unsigned char *buf)
+static int _tiger_compress(hash_state *md, const unsigned char *buf)
 #else
-static int  tiger_compress(hash_state *md, unsigned char *buf)
+static int  tiger_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
     ulong64 a, b, c, x[8];

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

@@ -53,9 +53,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, unsigned char *buf)
+static int _whirlpool_compress(hash_state *md, const unsigned char *buf)
 #else
-static int whirlpool_compress(hash_state *md, unsigned char *buf)
+static int whirlpool_compress(hash_state *md, const unsigned char *buf)
 #endif
 {
    ulong64 K[2][8], T[3][8];

+ 1 - 1
src/headers/tomcrypt_hash.h

@@ -288,7 +288,7 @@ int sha3_shake_init(hash_state *md, int num);
 #define sha3_shake_process(a,b,c) sha3_process(a,b,c)
 int sha3_shake_done(hash_state *md, unsigned char *out, unsigned long outlen);
 int sha3_shake_test(void);
-int sha3_shake_memory(int num, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen);
+int sha3_shake_memory(int num, const unsigned char *in, unsigned long inlen, unsigned char *out, const unsigned long *outlen);
 #endif
 
 #ifdef LTC_KECCAK

+ 18 - 18
src/headers/tomcrypt_pk.h

@@ -67,7 +67,7 @@ typedef struct Rsa_key {
 
 int rsa_make_key(prng_state *prng, int wprng, int size, long e, rsa_key *key);
 
-int rsa_get_size(rsa_key *key);
+int rsa_get_size(const rsa_key *key);
 
 int rsa_exptmod(const unsigned char *in,   unsigned long inlen,
                       unsigned char *out,  unsigned long *outlen, int which,
@@ -119,7 +119,7 @@ int rsa_verify_hash_ex(const unsigned char *sig,      unsigned long siglen,
 int rsa_sign_saltlen_get_max_ex(int padding, int hash_idx, rsa_key *key);
 
 /* PKCS #1 import/export */
-int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key);
+int rsa_export(unsigned char *out, unsigned long *outlen, int type, const rsa_key *key);
 int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key);
 
 int rsa_import_x509(const unsigned char *in, unsigned long inlen, rsa_key *key);
@@ -205,9 +205,9 @@ typedef struct {
     void *prime;
 } dh_key;
 
-int dh_get_groupsize(dh_key *key);
+int dh_get_groupsize(const dh_key *key);
 
-int dh_export(unsigned char *out, unsigned long *outlen, int type, dh_key *key);
+int dh_export(unsigned char *out, unsigned long *outlen, int type, const dh_key *key);
 int dh_import(const unsigned char *in, unsigned long inlen, dh_key *key);
 
 int dh_set_pg(const unsigned char *p, unsigned long plen,
@@ -219,12 +219,12 @@ int dh_set_pg_groupsize(int groupsize, dh_key *key);
 int dh_set_key(const unsigned char *in, unsigned long inlen, int type, dh_key *key);
 int dh_generate_key(prng_state *prng, int wprng, dh_key *key);
 
-int dh_shared_secret(dh_key        *private_key, dh_key        *public_key,
+int dh_shared_secret(const dh_key  *private_key, const dh_key  *public_key,
                      unsigned char *out,         unsigned long *outlen);
 
 void dh_free(dh_key *key);
 
-int dh_export_key(void *out, unsigned long *outlen, int type, dh_key *key);
+int dh_export_key(void *out, unsigned long *outlen, int type, const dh_key *key);
 
 #ifdef LTC_SOURCE
 typedef struct {
@@ -235,7 +235,7 @@ typedef struct {
 extern const ltc_dh_set_type ltc_dh_sets[];
 
 /* internal helper functions */
-int dh_check_pubkey(dh_key *key);
+int dh_check_pubkey(const dh_key *key);
 #endif
 
 #endif /* LTC_MDH */
@@ -603,8 +603,8 @@ extern const char*          der_asn1_tag_to_string_map[];
 extern const unsigned long  der_asn1_tag_to_string_map_sz;
 
 /* SEQUENCE */
-int der_encode_sequence_ex(ltc_asn1_list *list, unsigned long inlen,
-                           unsigned char *out,  unsigned long *outlen, int type_of);
+int der_encode_sequence_ex(const ltc_asn1_list *list, unsigned long inlen,
+                           unsigned char *out,        unsigned long *outlen, int type_of);
 
 #define der_encode_sequence(list, inlen, out, outlen) der_encode_sequence_ex(list, inlen, out, outlen, LTC_ASN1_SEQUENCE)
 
@@ -635,7 +635,7 @@ int der_decode_sequence_ex(const unsigned char *in, unsigned long  inlen,
 #define der_decode_sequence(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, LTC_DER_SEQ_SEQUENCE | LTC_DER_SEQ_RELAXED)
 #define der_decode_sequence_strict(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, LTC_DER_SEQ_SEQUENCE | LTC_DER_SEQ_STRICT)
 
-int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
+int der_length_sequence(const ltc_asn1_list *list, unsigned long inlen,
                         unsigned long *outlen);
 
 
@@ -664,7 +664,7 @@ int der_encode_asn1_length(unsigned long len, unsigned char* out, unsigned long*
 int der_decode_asn1_length(const unsigned char* len, unsigned long* lenlen, unsigned long* outlen);
 int der_length_asn1_length(unsigned long len, unsigned long *outlen);
 
-int der_length_sequence_ex(ltc_asn1_list *list, unsigned long inlen,
+int der_length_sequence_ex(const ltc_asn1_list *list, unsigned long inlen,
                            unsigned long *outlen, unsigned long *payloadlen);
 
 extern const ltc_asn1_type  der_asn1_tag_to_type_map[];
@@ -677,11 +677,11 @@ extern const unsigned long der_asn1_type_to_identifier_map_sz;
 /* SET */
 #define der_decode_set(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, LTC_DER_SEQ_SET)
 #define der_length_set der_length_sequence
-int der_encode_set(ltc_asn1_list *list, unsigned long inlen,
-                   unsigned char *out,  unsigned long *outlen);
+int der_encode_set(const ltc_asn1_list *list, unsigned long inlen,
+                   unsigned char *out,        unsigned long *outlen);
 
-int der_encode_setof(ltc_asn1_list *list, unsigned long inlen,
-                     unsigned char *out,  unsigned long *outlen);
+int der_encode_setof(const ltc_asn1_list *list, unsigned long inlen,
+                     unsigned char *out,        unsigned long *outlen);
 
 /* VA list handy helpers with triplets of <type, size, data> */
 int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...);
@@ -736,7 +736,7 @@ int der_encode_object_identifier(unsigned long *words, unsigned long  nwords,
                                  unsigned char *out,   unsigned long *outlen);
 int der_decode_object_identifier(const unsigned char *in,    unsigned long  inlen,
                                        unsigned long *words, unsigned long *outlen);
-int der_length_object_identifier(unsigned long *words, unsigned long nwords, unsigned long *outlen);
+int der_length_object_identifier(const unsigned long *words, unsigned long nwords, unsigned long *outlen);
 unsigned long der_object_identifier_bits(unsigned long x);
 
 /* IA5 STRING */
@@ -821,7 +821,7 @@ int der_encode_utctime(ltc_utctime *utctime,
 int der_decode_utctime(const unsigned char *in, unsigned long *inlen,
                              ltc_utctime   *out);
 
-int der_length_utctime(ltc_utctime *utctime, unsigned long *outlen);
+int der_length_utctime(const ltc_utctime *utctime, unsigned long *outlen);
 
 /* GeneralizedTime */
 typedef struct {
@@ -843,7 +843,7 @@ int der_encode_generalizedtime(ltc_generalizedtime *gtime,
 int der_decode_generalizedtime(const unsigned char *in, unsigned long *inlen,
                                ltc_generalizedtime *out);
 
-int der_length_generalizedtime(ltc_generalizedtime *gtime, unsigned long *outlen);
+int der_length_generalizedtime(const ltc_generalizedtime *gtime, unsigned long *outlen);
 
 #ifdef LTC_SOURCE
 /* internal helper functions */

+ 1 - 1
src/pk/asn1/der/generalizedtime/der_length_generalizedtime.c

@@ -22,7 +22,7 @@
   @param outlen [out] The length of the DER encoding
   @return CRYPT_OK if successful
 */
-int der_length_generalizedtime(ltc_generalizedtime *gtime, unsigned long *outlen)
+int der_length_generalizedtime(const ltc_generalizedtime *gtime, unsigned long *outlen)
 {
    LTC_ARGCHK(outlen  != NULL);
    LTC_ARGCHK(gtime != NULL);

+ 1 - 1
src/pk/asn1/der/object_identifier/der_length_object_identifier.c

@@ -35,7 +35,7 @@ unsigned long der_object_identifier_bits(unsigned long x)
   @param outlen   [out] The length of the DER encoding for the given string
   @return CRYPT_OK if successful
 */
-int der_length_object_identifier(unsigned long *words, unsigned long nwords, unsigned long *outlen)
+int der_length_object_identifier(const unsigned long *words, unsigned long nwords, unsigned long *outlen)
 {
    unsigned long y, z, t, wordbuf;
 

+ 2 - 2
src/pk/asn1/der/sequence/der_encode_sequence_ex.c

@@ -25,8 +25,8 @@
    @param type_of   LTC_ASN1_SEQUENCE or LTC_ASN1_SET/LTC_ASN1_SETOF
    @return CRYPT_OK on success
 */
-int der_encode_sequence_ex(ltc_asn1_list *list, unsigned long inlen,
-                           unsigned char *out,  unsigned long *outlen, int type_of)
+int der_encode_sequence_ex(const ltc_asn1_list *list, unsigned long inlen,
+                           unsigned char *out,        unsigned long *outlen, int type_of)
 {
    int           err;
    ltc_asn1_type type;

+ 2 - 2
src/pk/asn1/der/sequence/der_length_sequence.c

@@ -22,13 +22,13 @@
    @param outlen [out] The length required in octets to store it
    @return CRYPT_OK on success
 */
-int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
+int der_length_sequence(const ltc_asn1_list *list, unsigned long inlen,
                         unsigned long *outlen)
 {
    return der_length_sequence_ex(list, inlen, outlen, NULL);
 }
 
-int der_length_sequence_ex(ltc_asn1_list *list, unsigned long inlen,
+int der_length_sequence_ex(const ltc_asn1_list *list, unsigned long inlen,
                            unsigned long *outlen, unsigned long *payloadlen)
 {
    int           err;

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

@@ -46,8 +46,8 @@ static int _qsort_helper(const void *a, const void *b)
    @param outlen    [in/out] The size of the output
    @return CRYPT_OK on success
 */
-int der_encode_set(ltc_asn1_list *list, unsigned long inlen,
-                   unsigned char *out,  unsigned long *outlen)
+int der_encode_set(const ltc_asn1_list *list, unsigned long inlen,
+                   unsigned char *out,        unsigned long *outlen)
 {
    ltc_asn1_list  *copy;
    unsigned long   x;

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

@@ -56,8 +56,8 @@ static int _qsort_helper(const void *a, const void *b)
    @param outlen    [in/out] The size of the output
    @return CRYPT_OK on success
 */
-int der_encode_setof(ltc_asn1_list *list, unsigned long inlen,
-                     unsigned char *out,  unsigned long *outlen)
+int der_encode_setof(const ltc_asn1_list *list, unsigned long inlen,
+                     unsigned char *out,        unsigned long *outlen)
 {
    unsigned long  x, y, z;
    ptrdiff_t hdrlen;

+ 1 - 1
src/pk/asn1/der/utctime/der_length_utctime.c

@@ -21,7 +21,7 @@
   @param outlen [out] The length of the DER encoding
   @return CRYPT_OK if successful
 */
-int der_length_utctime(ltc_utctime *utctime, unsigned long *outlen)
+int der_length_utctime(const ltc_utctime *utctime, unsigned long *outlen)
 {
    LTC_ARGCHK(outlen  != NULL);
    LTC_ARGCHK(utctime != NULL);

+ 1 - 1
src/pk/dh/dh.c

@@ -224,7 +224,7 @@ const ltc_dh_set_type ltc_dh_sets[] = {
   @param key   The DH key to get the size of
   @return The group size in octets (0 on error)
  */
-int dh_get_groupsize(dh_key *key)
+int dh_get_groupsize(const dh_key *key)
 {
    if (key == NULL) return 0;
    return mp_unsigned_bin_size(key->prime);

+ 1 - 1
src/pk/dh/dh_check_pubkey.c

@@ -16,7 +16,7 @@
   @param key    The key you wish to test
   @return CRYPT_OK if successful
 */
-int dh_check_pubkey(dh_key *key)
+int dh_check_pubkey(const dh_key *key)
 {
    void *p_minus1;
    ltc_mp_digit digit;

+ 1 - 1
src/pk/dh/dh_export.c

@@ -19,7 +19,7 @@
   @param key    The key you wish to export
   @return CRYPT_OK if successful
 */
-int dh_export(unsigned char *out, unsigned long *outlen, int type, dh_key *key)
+int dh_export(unsigned char *out, unsigned long *outlen, int type, const dh_key *key)
 {
    unsigned char flags[1];
    int err;

+ 1 - 1
src/pk/dh/dh_export_key.c

@@ -19,7 +19,7 @@
   @param key    The key you wish to export
   @return CRYPT_OK if successful
 */
-int dh_export_key(void *out, unsigned long *outlen, int type, dh_key *key)
+int dh_export_key(void *out, unsigned long *outlen, int type, const dh_key *key)
 {
    unsigned long len;
    void *k;

+ 1 - 1
src/pk/dh/dh_shared_secret.c

@@ -19,7 +19,7 @@
    @param outlen          [in/out] The max size and resulting size of the shared data.
    @return CRYPT_OK if successful
 */
-int dh_shared_secret(dh_key *private_key, dh_key *public_key,
+int dh_shared_secret(const dh_key *private_key, const dh_key *public_key,
                      unsigned char *out, unsigned long *outlen)
 {
    void *tmp;

+ 1 - 1
src/pk/rsa/rsa_export.c

@@ -23,7 +23,7 @@
     @param key       The RSA key to export
     @return CRYPT_OK if successful
 */
-int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key)
+int rsa_export(unsigned char *out, unsigned long *outlen, int type, const rsa_key *key)
 {
    unsigned long zero=0;
    int err;

+ 1 - 1
src/pk/rsa/rsa_get_size.c

@@ -20,7 +20,7 @@
   @param key      The RSA key
   @return The size in bytes of the RSA key or INT_MAX on error.
 */
-int rsa_get_size(rsa_key *key)
+int rsa_get_size(const rsa_key *key)
 {
   int ret = INT_MAX;
   LTC_ARGCHK(key != NULL);

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

@@ -28,7 +28,7 @@
 
 #define B(x,i) ((unsigned char)(((x) >> (8*i)) & 0xFF))
 
-static ulong32 BYTE2WORD(unsigned char *b)
+static ulong32 BYTE2WORD(const unsigned char *b)
 {
    ulong32 t;
    LOAD32L(t, b);