lint fixes discussed in #199
@@ -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,
@@ -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;
@@ -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;
@@ -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) {
@@ -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 */
@@ -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;
@@ -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;