Merge pull request #266 from libtom/pr/fix-lint-issues

Fix lint issues
This commit is contained in:
karel-m 2017-08-13 18:16:55 +02:00 committed by GitHub
commit 385bae81a1
5 changed files with 9 additions and 13 deletions

View File

@ -342,7 +342,6 @@ int gcm_test(void)
if ((err = gcm_add_iv(&gcm, tests[0].IV, tests[0].IVlen)) != CRYPT_OK) return err;
/* intentionally skip gcm_add_aad + gcm_process */
if ((err = gcm_done(&gcm, T[0], &y)) != CRYPT_OK) return err;
if (compare_testvector(out[0], 0, tests[0].C, tests[0].ptlen, "GCM CT-special", 0)) return CRYPT_FAIL_TESTVECTOR;
if (compare_testvector(T[0], y, tests[0].T, 16, "GCM Encrypt Tag-special", 0)) return CRYPT_FAIL_TESTVECTOR;
for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) {

View File

@ -30,11 +30,9 @@ int ocb3_decrypt(ocb3_state *ocb, const unsigned char *ct, unsigned long ctlen,
unsigned char *pt_b, *ct_b;
LTC_ARGCHK(ocb != NULL);
if (ct == NULL) LTC_ARGCHK(ctlen == 0);
if (ctlen != 0) {
LTC_ARGCHK(ct != NULL);
LTC_ARGCHK(pt != NULL);
}
if (ctlen == 0) return CRYPT_OK; /* no data, nothing to do */
LTC_ARGCHK(ct != NULL);
LTC_ARGCHK(pt != NULL);
if ((err = cipher_is_valid(ocb->cipher)) != CRYPT_OK) {
return err;

View File

@ -30,11 +30,9 @@ int ocb3_encrypt(ocb3_state *ocb, const unsigned char *pt, unsigned long ptlen,
unsigned char *pt_b, *ct_b;
LTC_ARGCHK(ocb != NULL);
if (pt == NULL) LTC_ARGCHK(ptlen == 0);
if (ptlen != 0) {
LTC_ARGCHK(pt != NULL);
LTC_ARGCHK(ct != NULL);
}
if (ptlen == 0) return CRYPT_OK; /* no data, nothing to do */
LTC_ARGCHK(pt != NULL);
LTC_ARGCHK(ct != NULL);
if ((err = cipher_is_valid(ocb->cipher)) != CRYPT_OK) {
return err;

View File

@ -204,7 +204,8 @@ int ocb3_test(void)
int err, x, idx, res;
unsigned long len;
unsigned char outct[MAXBLOCKSIZE], outtag[MAXBLOCKSIZE];
unsigned char outct[MAXBLOCKSIZE] = { 0 };
unsigned char outtag[MAXBLOCKSIZE] = { 0 };
ocb3_state ocb;
/* AES can be under rijndael or aes... try to find it */

View File

@ -38,7 +38,7 @@ int ltc_ecc_map(ecc_point *P, void *modulus, void *mp)
LTC_ARGCHK(mp != NULL);
if ((err = mp_init_multi(&t1, &t2, NULL)) != CRYPT_OK) {
return CRYPT_MEM;
return err;
}
/* first map z back to normal */