Merge pull request #143 from libtom/fix/85-part2

Fix/85 part2
This commit is contained in:
karel-m 2017-02-24 19:04:46 +01:00 committed by GitHub
commit f60e045034
7 changed files with 13 additions and 13 deletions

View File

@ -38,7 +38,7 @@ int ccm_add_aad(ccm_state *ccm,
if (ccm->x == 16) {
/* full block so let's encrypt it */
if ((err = cipher_descriptor[ccm->cipher].ecb_encrypt(ccm->PAD, ccm->PAD, &ccm->K)) != CRYPT_OK) {
return CRYPT_ERROR;
return err;
}
ccm->x = 0;
}
@ -49,7 +49,7 @@ int ccm_add_aad(ccm_state *ccm,
if (ccm->aadlen == ccm->current_aadlen) {
if (ccm->x != 0) {
if ((err = cipher_descriptor[ccm->cipher].ecb_encrypt(ccm->PAD, ccm->PAD, &ccm->K)) != CRYPT_OK) {
return CRYPT_ERROR;
return err;
}
}
ccm->x = 0;

View File

@ -45,14 +45,14 @@ const struct ltc_hash_descriptor whirlpool_desc =
/* shortcut macro to perform three functions at once */
#define theta_pi_gamma(a, i) \
SB0(GB(a, i-0, 7)) ^ \
(SB0(GB(a, i-0, 7)) ^ \
SB1(GB(a, i-1, 6)) ^ \
SB2(GB(a, i-2, 5)) ^ \
SB3(GB(a, i-3, 4)) ^ \
SB4(GB(a, i-4, 3)) ^ \
SB5(GB(a, i-5, 2)) ^ \
SB6(GB(a, i-6, 1)) ^ \
SB7(GB(a, i-7, 0))
SB7(GB(a, i-7, 0)))
#ifdef LTC_CLEAN_STACK
static int _whirlpool_compress(hash_state *md, unsigned char *buf)

View File

@ -267,7 +267,7 @@ static inline ulong32 ROR(ulong32 word, int i)
#ifndef LTC_NO_ROLC
#define ROLc(word,i) ({ \
ulong32 __ROLc_tmp = word; \
ulong32 __ROLc_tmp = (word); \
__asm__ ("roll %2, %0" : \
"=r" (__ROLc_tmp) : \
"0" (__ROLc_tmp), \
@ -275,7 +275,7 @@ static inline ulong32 ROR(ulong32 word, int i)
__ROLc_tmp; \
})
#define RORc(word,i) ({ \
ulong32 __RORc_tmp = word; \
ulong32 __RORc_tmp = (word); \
__asm__ ("rorl %2, %0" : \
"=r" (__RORc_tmp) : \
"0" (__RORc_tmp), \

View File

@ -126,8 +126,8 @@ static int compare(void *a, void *b)
case MP_LT: return LTC_MP_LT;
case MP_EQ: return LTC_MP_EQ;
case MP_GT: return LTC_MP_GT;
default: return 0;
}
return 0;
}
static int compare_d(void *a, unsigned long b)
@ -139,8 +139,8 @@ static int compare_d(void *a, unsigned long b)
case MP_LT: return LTC_MP_LT;
case MP_EQ: return LTC_MP_EQ;
case MP_GT: return LTC_MP_GT;
default: return 0;
}
return 0;
}
static int count_bits(void *a)

View File

@ -94,8 +94,8 @@ int xts_decrypt(const unsigned char *ct, unsigned long ptlen, unsigned char *pt,
if (cipher_descriptor[xts->cipher].accel_xts_decrypt && lim > 0) {
/* use accelerated decryption for whole blocks */
if ((err = cipher_descriptor[xts->cipher].accel_xts_decrypt(ct, pt, lim, tweak, &xts->key1, &xts->key2) !=
CRYPT_OK)) {
if ((err = cipher_descriptor[xts->cipher].accel_xts_decrypt(ct, pt, lim, tweak, &xts->key1, &xts->key2)) !=
CRYPT_OK) {
return err;
}
ct += lim * 16;

View File

@ -96,8 +96,8 @@ int xts_encrypt(const unsigned char *pt, unsigned long ptlen, unsigned char *ct,
if (cipher_descriptor[xts->cipher].accel_xts_encrypt && lim > 0) {
/* use accelerated encryption for whole blocks */
if ((err = cipher_descriptor[xts->cipher].accel_xts_encrypt(pt, ct, lim, tweak, &xts->key1, &xts->key2) !=
CRYPT_OK)) {
if ((err = cipher_descriptor[xts->cipher].accel_xts_encrypt(pt, ct, lim, tweak, &xts->key1, &xts->key2)) !=
CRYPT_OK) {
return err;
}
ct += lim * 16;

View File

@ -107,7 +107,7 @@ int ecc_import_ex(const unsigned char *in, unsigned long inlen, ecc_key *key, co
}
/* find out what type of key it is */
if ((err = der_decode_sequence_multi(in, inlen,
if ((err = der_decode_sequence_multi(in, inlen,
LTC_ASN1_BIT_STRING, 1UL, &flags,
LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
goto done;