removed IAR compiler warnings
This commit is contained in:
parent
e960ff887c
commit
59f9c00f98
@ -42,14 +42,6 @@ const struct ltc_cipher_descriptor twofish_desc =
|
|||||||
#define MDS_POLY 0x169
|
#define MDS_POLY 0x169
|
||||||
#define RS_POLY 0x14D
|
#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 */
|
/* The 4x8 RS Linear Transform */
|
||||||
static const unsigned char RS[4][8] = {
|
static const unsigned char RS[4][8] = {
|
||||||
{ 0x01, 0xA4, 0x55, 0x87, 0x5A, 0x58, 0xDB, 0x9E },
|
{ 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 }
|
{ 0XA4, 0X55, 0X87, 0X5A, 0X58, 0XDB, 0X9E, 0X03 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef LTC_TWOFISH_SMALL
|
||||||
/* sbox usage orderings */
|
/* sbox usage orderings */
|
||||||
static const unsigned char qord[4][5] = {
|
static const unsigned char qord[4][5] = {
|
||||||
{ 1, 1, 0, 0, 1 },
|
{ 1, 1, 0, 0, 1 },
|
||||||
@ -65,6 +58,7 @@ static const unsigned char qord[4][5] = {
|
|||||||
{ 0, 0, 0, 1, 1 },
|
{ 0, 0, 0, 1, 1 },
|
||||||
{ 1, 0, 1, 1, 0 }
|
{ 1, 0, 1, 1, 0 }
|
||||||
};
|
};
|
||||||
|
#endif /* LTC_TWOFISH_SMALL */
|
||||||
|
|
||||||
#ifdef LTC_TWOFISH_TABLES
|
#ifdef LTC_TWOFISH_TABLES
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
int der_decode_sequence_ex(const unsigned char *in, unsigned long inlen,
|
int der_decode_sequence_ex(const unsigned char *in, unsigned long inlen,
|
||||||
ltc_asn1_list *list, unsigned long outlen, int ordered)
|
ltc_asn1_list *list, unsigned long outlen, int ordered)
|
||||||
{
|
{
|
||||||
int err, type;
|
int err, type, i;
|
||||||
unsigned long size, x, y, z, i, blksize;
|
unsigned long size, x, y, z, blksize;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
LTC_ARGCHK(in != NULL);
|
LTC_ARGCHK(in != NULL);
|
||||||
|
@ -28,7 +28,7 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
|||||||
unsigned long *outlen)
|
unsigned long *outlen)
|
||||||
{
|
{
|
||||||
int err, type;
|
int err, type;
|
||||||
unsigned long size, x, y, z, i;
|
unsigned long size, x, y, i;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
LTC_ARGCHK(list != NULL);
|
LTC_ARGCHK(list != NULL);
|
||||||
@ -137,7 +137,6 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* calc header size */
|
/* calc header size */
|
||||||
z = y;
|
|
||||||
if (y < 128) {
|
if (y < 128) {
|
||||||
y += 2;
|
y += 2;
|
||||||
} else if (y < 256) {
|
} else if (y < 256) {
|
||||||
|
@ -40,9 +40,9 @@ int ltc_ecc_mul2add(ecc_point *A, void *kA,
|
|||||||
void *modulus)
|
void *modulus)
|
||||||
{
|
{
|
||||||
ecc_point *precomp[16];
|
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;
|
unsigned char *tA, *tB;
|
||||||
int err, first;
|
int err, first, x;
|
||||||
void *mp, *mu;
|
void *mp, *mu;
|
||||||
|
|
||||||
/* argchks */
|
/* argchks */
|
||||||
|
@ -226,7 +226,6 @@ int fortuna_ready(prng_state *prng)
|
|||||||
unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state *prng)
|
unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state *prng)
|
||||||
{
|
{
|
||||||
unsigned char tmp[16];
|
unsigned char tmp[16];
|
||||||
int err;
|
|
||||||
unsigned long tlen;
|
unsigned long tlen;
|
||||||
|
|
||||||
LTC_ARGCHK(out != NULL);
|
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? */
|
/* do we have to reseed? */
|
||||||
if (++prng->fortuna.wd == LTC_FORTUNA_WD || prng->fortuna.pool0_len >= 64) {
|
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);
|
LTC_MUTEX_UNLOCK(&prng->fortuna.prng_lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -262,9 +261,13 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* generate new key */
|
/* 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 , &prng->fortuna.skey);
|
||||||
rijndael_ecb_encrypt(prng->fortuna.IV, prng->fortuna.K+16, &prng->fortuna.skey); fortuna_update_iv(prng);
|
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+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);
|
LTC_MUTEX_UNLOCK(&prng->fortuna.prng_lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user