Pārlūkot izejas kodu

Merge pull request #201 from libtom/pr/lint-20170429

lint fixes discussed in #199
karel-m 8 gadi atpakaļ
vecāks
revīzija
91c0071b6b

+ 1 - 2
src/encauth/gcm/gcm_memory.c

@@ -52,8 +52,7 @@ int gcm_memory(      int           cipher,
     }
 
     if (cipher_descriptor[cipher].accel_gcm_memory != NULL) {
-       return
-         cipher_descriptor[cipher].accel_gcm_memory
+       return cipher_descriptor[cipher].accel_gcm_memory
                                           (key,   keylen,
                                            IV,    IVlen,
                                            adata, adatalen,

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

@@ -54,7 +54,7 @@ int ocb3_add_aad(ocb3_state *ocb, const unsigned char *aad, unsigned long aadlen
      datalen = aadlen;
    }
 
-   if (datalen <= 0) return CRYPT_OK;
+   if (datalen == 0) return CRYPT_OK;
 
    full_blocks = datalen/ocb->block_len;
    full_blocks_len = full_blocks * ocb->block_len;

+ 1 - 1
src/headers/tomcrypt_cipher.h

@@ -962,7 +962,7 @@ int chacha_test(void);
 #ifdef LTC_RC4_STREAM
 
 typedef struct {
-   int x, y;
+   unsigned int x, y;
    unsigned char buf[256];
 } rc4_state;
 

+ 2 - 1
src/pk/dsa/dsa_decrypt_key.c

@@ -92,7 +92,8 @@ int dsa_decrypt_key(const unsigned char *in,  unsigned long  inlen,
       goto LBL_ERR;
    }
 
-   y = MIN(mp_unsigned_bin_size(key->p) + 1, MAXBLOCKSIZE);
+   y = mp_unsigned_bin_size(key->p) + 1;
+   y = MIN(y, MAXBLOCKSIZE);
    if ((err = hash_memory(hash, expt, x, expt, &y)) != CRYPT_OK) {
       goto LBL_ERR;
    }

+ 1 - 1
src/pk/dsa/dsa_verify_hash.c

@@ -102,7 +102,7 @@ int dsa_verify_hash(const unsigned char *sig, unsigned long siglen,
    void   *r, *s;
 
    if ((err = mp_init_multi(&r, &s, NULL)) != CRYPT_OK) {
-      return CRYPT_MEM;
+      return err;
    }
 
    /* decode the sequence */

+ 0 - 1
src/pk/pkcs1/pkcs_1_oaep_decode.c

@@ -160,7 +160,6 @@ int pkcs_1_oaep_decode(const unsigned char *msg,    unsigned long msglen,
       /* copy message */
       *outlen = modulus_len - hLen - 1 - x;
       XMEMCPY(out, DB + x, modulus_len - hLen - 1 - x);
-      x += modulus_len - hLen - 1;
 
       /* valid packet */
       *res = 1;

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

@@ -27,7 +27,7 @@
 int rsa_import_x509(const unsigned char *in, unsigned long inlen, rsa_key *key)
 {
    int           err;
-   unsigned char *tmpbuf=NULL;
+   unsigned char *tmpbuf;
    unsigned long tmpbuf_len, tmp_inlen;
    ltc_asn1_list *decoded_list = NULL, *l;