diff --git a/src/encauth/gcm/gcm_test.c b/src/encauth/gcm/gcm_test.c index 013402d..5f68b30 100644 --- a/src/encauth/gcm/gcm_test.c +++ b/src/encauth/gcm/gcm_test.c @@ -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++) { diff --git a/src/encauth/ocb3/ocb3_decrypt.c b/src/encauth/ocb3/ocb3_decrypt.c index 1824bc3..4973bd2 100644 --- a/src/encauth/ocb3/ocb3_decrypt.c +++ b/src/encauth/ocb3/ocb3_decrypt.c @@ -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; diff --git a/src/encauth/ocb3/ocb3_encrypt.c b/src/encauth/ocb3/ocb3_encrypt.c index 3349554..337b025 100644 --- a/src/encauth/ocb3/ocb3_encrypt.c +++ b/src/encauth/ocb3/ocb3_encrypt.c @@ -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; diff --git a/src/encauth/ocb3/ocb3_test.c b/src/encauth/ocb3/ocb3_test.c index bd30144..a3e5062 100644 --- a/src/encauth/ocb3/ocb3_test.c +++ b/src/encauth/ocb3/ocb3_test.c @@ -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 */ diff --git a/src/pk/ecc/ltc_ecc_map.c b/src/pk/ecc/ltc_ecc_map.c index 0cc699c..c745f29 100644 --- a/src/pk/ecc/ltc_ecc_map.c +++ b/src/pk/ecc/ltc_ecc_map.c @@ -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 */