]> www.average.org Git - pam_pcsc_cr.git/commitdiff
consistent use of 'const'
authorEugene Crosser <crosser@average.org>
Sat, 7 Dec 2013 10:16:00 +0000 (14:16 +0400)
committerEugene Crosser <crosser@average.org>
Sat, 7 Dec 2013 10:16:00 +0000 (14:16 +0400)
crypto.c
crypto_if.h
gnu_crypto.c
ossl_crypto.c
tom_crypto.c

index 88670ee87eac98f3e8dd39b881acaac16ebad050..cb996e870f71cf011bd41b4b159528bb5f35f825 100644 (file)
--- a/crypto.c
+++ b/crypto.c
@@ -42,7 +42,7 @@ static struct crypto_interface *ifs[] = {
 #ifdef HAVE_GCRYPT
        &gnu_crypto_if,
 #endif
-       (void*)0,
+       (struct crypto_interface *)0,
 };
 #define MAX_IF (sizeof(ifs)/sizeof(struct crypto_interface *)-2)
 
index f569596ff354c46c9ae25ef463b6a9893b4ce2c2..e2c7579794fc707a383b19b917c9ab8430acb001 100644 (file)
@@ -26,14 +26,16 @@ freely, subject to the following restrictions:
 
 struct crypto_interface {
        const char *(*init)(void);
-       unsigned long (*encrypt)(void *key, int keylen, void *iv,
-                               void *pt, void *ct, int tlen);
-       unsigned long (*decrypt)(void *key, int keylen, void *iv,
-                               void *ct, void *pt, int tlen);
-       unsigned long (*hash)(void *pt, int tlen, void *tag, int *taglen);
-       unsigned long (*hmac)(void *key, int keylen,
-                               void *pt, int tlen, void *tag, int *taglen);
-       const char *(*errstr)(unsigned long err);
+       unsigned long (*encrypt)(const void *key, const int keylen, void *iv,
+                               const void *pt, void *ct, const int tlen);
+       unsigned long (*decrypt)(const void *key, const int keylen, void *iv,
+                               const void *ct, void *pt, const int tlen);
+       unsigned long (*hash)(const void *pt, const int tlen,
+                               void *tag, int *taglen);
+       unsigned long (*hmac)(const void *key, const int keylen,
+                               const void *pt, const int tlen,
+                               void *tag, int *taglen);
+       const char *(*errstr)(const unsigned long err);
 };
 
 #endif
index 1b6092b661dcb1a672b7e8301b2eb48991d39665..5c8621d7f2f55b7aa22b0dc366b3d01f5280e207 100644 (file)
@@ -36,8 +36,8 @@ static const char *gnu_init(void)
        return "gcrypt";
 }
 
-static unsigned long gnu_encrypt(void *key, int keylen, void *iv,
-                       void *pt, void *ct, int tlen)
+static unsigned long gnu_encrypt(const void *key, const int keylen, void *iv,
+                       const void *pt, void *ct, const int tlen)
 {
        gcry_error_t err;
        gcry_cipher_hd_t hd;
@@ -56,8 +56,8 @@ static unsigned long gnu_encrypt(void *key, int keylen, void *iv,
        return 0UL;
 }
 
-static unsigned long gnu_decrypt(void *key, int keylen, void *iv,
-                       void *ct, void *pt, int tlen)
+static unsigned long gnu_decrypt(const void *key, const int keylen, void *iv,
+                       const void *ct, void *pt, const int tlen)
 {
        gcry_error_t err;
        gcry_cipher_hd_t hd;
@@ -76,7 +76,8 @@ static unsigned long gnu_decrypt(void *key, int keylen, void *iv,
        return 0UL;
 }
 
-static unsigned long gnu_hash(void *pt, int tlen, void *tag, int *taglen)
+static unsigned long gnu_hash(const void *pt, const int tlen,
+                       void *tag, int *taglen)
 {
        gcry_error_t err;
        gcry_md_hd_t hd;
@@ -94,7 +95,8 @@ static unsigned long gnu_hash(void *pt, int tlen, void *tag, int *taglen)
        return 0UL;
 }
 
-static unsigned long gnu_hmac(void *key, int keylen, void *pt, int tlen,
+static unsigned long gnu_hmac(const void *key, const int keylen,
+                       const void *pt, const int tlen,
                        void *tag, int *taglen)
 {
        gcry_error_t err;
@@ -116,7 +118,7 @@ static unsigned long gnu_hmac(void *key, int keylen, void *pt, int tlen,
        return 0UL;
 }
 
-static const char *gnu_errstr(unsigned long err)
+static const char *gnu_errstr(const unsigned long err)
 {
        return gcry_strerror((gcry_error_t)err);
 }
index 837fac0e553f5ecaf512711d6a954abacaa2a8d7..e0e10bce4e3a7b59a98a4819a383d4cc2489b640 100644 (file)
@@ -37,8 +37,8 @@ static const char *ossl_init(void)
        return "openssl";
 }
 
-static unsigned long ossl_encrypt(void *key, int keylen, void *iv,
-                       void *pt, void *ct, int tlen)
+static unsigned long ossl_encrypt(const void *key, const int keylen, void *iv,
+                       const void *pt, void *ct, const int tlen)
 {
        AES_KEY akey;
 
@@ -48,8 +48,8 @@ static unsigned long ossl_encrypt(void *key, int keylen, void *iv,
        return 0UL;
 }
 
-static unsigned long ossl_decrypt(void *key, int keylen, void *iv,
-                       void *ct, void *pt, int tlen)
+static unsigned long ossl_decrypt(const void *key, const int keylen, void *iv,
+                       const void *ct, void *pt, const int tlen)
 {
        AES_KEY akey;
 
@@ -59,7 +59,8 @@ static unsigned long ossl_decrypt(void *key, int keylen, void *iv,
        return 0UL;
 }
 
-static unsigned long ossl_hash(void *pt, int tlen, void *tag, int *taglen)
+static unsigned long ossl_hash(const void *pt, const int tlen,
+                       void *tag, int *taglen)
 {
        SHA_CTX sctx;
 
@@ -70,7 +71,8 @@ static unsigned long ossl_hash(void *pt, int tlen, void *tag, int *taglen)
        return 0UL;
 }
 
-static unsigned long ossl_hmac(void *key, int keylen, void *pt, int tlen,
+static unsigned long ossl_hmac(const void *key, int const keylen,
+                       const void *pt, const int tlen,
                        void *tag, int *taglen)
 {
 #if 1
@@ -91,7 +93,7 @@ static unsigned long ossl_hmac(void *key, int keylen, void *pt, int tlen,
        return 0UL;
 }
 
-static const char *ossl_errstr(unsigned long err)
+static const char *ossl_errstr(const unsigned long err)
 {
        return ERR_error_string(err, NULL);
 }
index 7d49f5ddf5bb34abc0119e46e42fc5ddf48e2a4c..b5bed3e06d0fe5da41293903ded63b15f281c8dc 100644 (file)
@@ -34,8 +34,8 @@ static const char *tom_init(void)
        return "tomcrypt";
 }
 
-static unsigned long tom_encrypt(void *key, int keylen, void *iv,
-                       void *pt, void *ct, int tlen)
+static unsigned long tom_encrypt(const void *key, const int keylen, void *iv,
+                       const void *pt, void *ct, const int tlen)
 {
        symmetric_CBC cbc;
        int index, err;
@@ -49,8 +49,8 @@ static unsigned long tom_encrypt(void *key, int keylen, void *iv,
        return err;
 }
 
-static unsigned long tom_decrypt(void *key, int keylen, void *iv,
-                       void *ct, void *pt, int tlen)
+static unsigned long tom_decrypt(const void *key, const int keylen, void *iv,
+                       const void *ct, void *pt, const int tlen)
 {
        symmetric_CBC cbc;
        int index, err;
@@ -64,7 +64,8 @@ static unsigned long tom_decrypt(void *key, int keylen, void *iv,
        return err;
 }
 
-static unsigned long tom_hash(void *pt, int tlen, void *tag, int *taglen)
+static unsigned long tom_hash(const void *pt, const int tlen,
+                       void *tag, int *taglen)
 {
        int index, rc;
        unsigned long ltaglen = *taglen;
@@ -76,8 +77,9 @@ static unsigned long tom_hash(void *pt, int tlen, void *tag, int *taglen)
        return rc;
 }
 
-static unsigned long tom_hmac(void *key, int keylen,
-                       void *pt, int tlen, void *tag, int *taglen)
+static unsigned long tom_hmac(const void *key, const int keylen,
+                       const void *pt, const int tlen,
+                       void *tag, int *taglen)
 {
        int index, rc;
        unsigned long ltaglen = *taglen;
@@ -89,7 +91,7 @@ static unsigned long tom_hmac(void *key, int keylen,
        return rc;
 }
 
-static const char *tom_errstr(unsigned long err)
+static const char *tom_errstr(const unsigned long err)
 {
        return error_to_string((int)err);
 }