From 59f9c00f9855ed3ad693db096fa8429f28bd783d Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Wed, 2 Jun 2010 15:26:47 +0200 Subject: [PATCH] removed IAR compiler warnings --- src/ciphers/twofish/twofish.c | 10 ++-------- src/pk/asn1/der/sequence/der_decode_sequence_ex.c | 4 ++-- src/pk/asn1/der/sequence/der_length_sequence.c | 3 +-- src/pk/ecc/ltc_ecc_mul2add.c | 4 ++-- src/prngs/fortuna.c | 13 ++++++++----- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/ciphers/twofish/twofish.c b/src/ciphers/twofish/twofish.c index e96bf67..65a8c2b 100644 --- a/src/ciphers/twofish/twofish.c +++ b/src/ciphers/twofish/twofish.c @@ -42,14 +42,6 @@ const struct ltc_cipher_descriptor twofish_desc = #define MDS_POLY 0x169 #define RS_POLY 0x14D -/* The 4x4 MDS Linear Transform */ -static const unsigned char MDS[4][4] = { - { 0x01, 0xEF, 0x5B, 0x5B }, - { 0x5B, 0xEF, 0xEF, 0x01 }, - { 0xEF, 0x5B, 0x01, 0xEF }, - { 0xEF, 0x01, 0xEF, 0x5B } -}; - /* The 4x8 RS Linear Transform */ static const unsigned char RS[4][8] = { { 0x01, 0xA4, 0x55, 0x87, 0x5A, 0x58, 0xDB, 0x9E }, @@ -58,6 +50,7 @@ static const unsigned char RS[4][8] = { { 0XA4, 0X55, 0X87, 0X5A, 0X58, 0XDB, 0X9E, 0X03 } }; +#ifdef LTC_TWOFISH_SMALL /* sbox usage orderings */ static const unsigned char qord[4][5] = { { 1, 1, 0, 0, 1 }, @@ -65,6 +58,7 @@ static const unsigned char qord[4][5] = { { 0, 0, 0, 1, 1 }, { 1, 0, 1, 1, 0 } }; +#endif /* LTC_TWOFISH_SMALL */ #ifdef LTC_TWOFISH_TABLES diff --git a/src/pk/asn1/der/sequence/der_decode_sequence_ex.c b/src/pk/asn1/der/sequence/der_decode_sequence_ex.c index 5042b18..b5f8da5 100644 --- a/src/pk/asn1/der/sequence/der_decode_sequence_ex.c +++ b/src/pk/asn1/der/sequence/der_decode_sequence_ex.c @@ -31,8 +31,8 @@ int der_decode_sequence_ex(const unsigned char *in, unsigned long inlen, ltc_asn1_list *list, unsigned long outlen, int ordered) { - int err, type; - unsigned long size, x, y, z, i, blksize; + int err, type, i; + unsigned long size, x, y, z, blksize; void *data; LTC_ARGCHK(in != NULL); diff --git a/src/pk/asn1/der/sequence/der_length_sequence.c b/src/pk/asn1/der/sequence/der_length_sequence.c index 7221f99..bd7b938 100644 --- a/src/pk/asn1/der/sequence/der_length_sequence.c +++ b/src/pk/asn1/der/sequence/der_length_sequence.c @@ -28,7 +28,7 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen, unsigned long *outlen) { int err, type; - unsigned long size, x, y, z, i; + unsigned long size, x, y, i; void *data; LTC_ARGCHK(list != NULL); @@ -137,7 +137,6 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen, } /* calc header size */ - z = y; if (y < 128) { y += 2; } else if (y < 256) { diff --git a/src/pk/ecc/ltc_ecc_mul2add.c b/src/pk/ecc/ltc_ecc_mul2add.c index a6d1aab..e5174a4 100644 --- a/src/pk/ecc/ltc_ecc_mul2add.c +++ b/src/pk/ecc/ltc_ecc_mul2add.c @@ -40,9 +40,9 @@ int ltc_ecc_mul2add(ecc_point *A, void *kA, void *modulus) { ecc_point *precomp[16]; - unsigned bitbufA, bitbufB, lenA, lenB, len, x, y, nA, nB, nibble; + unsigned bitbufA, bitbufB, lenA, lenB, len, y, nA, nB, nibble; unsigned char *tA, *tB; - int err, first; + int err, first, x; void *mp, *mu; /* argchks */ diff --git a/src/prngs/fortuna.c b/src/prngs/fortuna.c index d262a0b..51a1c7d 100644 --- a/src/prngs/fortuna.c +++ b/src/prngs/fortuna.c @@ -226,7 +226,6 @@ int fortuna_ready(prng_state *prng) unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state *prng) { unsigned char tmp[16]; - int err; unsigned long tlen; LTC_ARGCHK(out != NULL); @@ -236,7 +235,7 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state /* do we have to reseed? */ if (++prng->fortuna.wd == LTC_FORTUNA_WD || prng->fortuna.pool0_len >= 64) { - if ((err = fortuna_reseed(prng)) != CRYPT_OK) { + if (fortuna_reseed(prng) != CRYPT_OK) { LTC_MUTEX_UNLOCK(&prng->fortuna.prng_lock); return 0; } @@ -262,9 +261,13 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state } /* generate new key */ - rijndael_ecb_encrypt(prng->fortuna.IV, prng->fortuna.K , &prng->fortuna.skey); fortuna_update_iv(prng); - rijndael_ecb_encrypt(prng->fortuna.IV, prng->fortuna.K+16, &prng->fortuna.skey); fortuna_update_iv(prng); - if ((err = rijndael_setup(prng->fortuna.K, 32, 0, &prng->fortuna.skey)) != CRYPT_OK) { + rijndael_ecb_encrypt(prng->fortuna.IV, prng->fortuna.K , &prng->fortuna.skey); + fortuna_update_iv(prng); + + rijndael_ecb_encrypt(prng->fortuna.IV, prng->fortuna.K+16, &prng->fortuna.skey); + fortuna_update_iv(prng); + + if (rijndael_setup(prng->fortuna.K, 32, 0, &prng->fortuna.skey) != CRYPT_OK) { LTC_MUTEX_UNLOCK(&prng->fortuna.prng_lock); return 0; }