Upgrade libtomcrypt
This commit is contained in:
@@ -55,12 +55,12 @@ int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned l
|
||||
|
||||
/* determine which polys to use */
|
||||
pmac->block_len = cipher_descriptor[cipher].block_length;
|
||||
for (poly = 0; poly < (int)(sizeof(polys)/sizeof(polys[0])); poly++) {
|
||||
for (poly = 0; poly < (int)LTC_ARRAY_SIZE(polys); poly++) {
|
||||
if (polys[poly].len == pmac->block_len) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (poly >= (int)(sizeof(polys)/sizeof(polys[0]))) {
|
||||
if (poly >= (int)LTC_ARRAY_SIZE(polys)) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
if (polys[poly].len != pmac->block_len) {
|
||||
@@ -75,7 +75,7 @@ int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned l
|
||||
|
||||
|
||||
/* schedule the key */
|
||||
if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &pmac->key)) != CRYPT_OK) {
|
||||
if ((err = ecb_start(cipher, key, keylen, 0, &pmac->key)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned l
|
||||
|
||||
/* find L = E[0] */
|
||||
zeromem(L, pmac->block_len);
|
||||
if ((err = cipher_descriptor[cipher].ecb_encrypt(L, L, &pmac->key)) != CRYPT_OK) {
|
||||
if ((err = ecb_encrypt_block(L, L, &pmac->key)) != CRYPT_OK) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,6 @@ int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned l
|
||||
|
||||
/* zero buffer, counters, etc... */
|
||||
pmac->block_index = 1;
|
||||
pmac->cipher_idx = cipher;
|
||||
pmac->buflen = 0;
|
||||
zeromem(pmac->block, sizeof(pmac->block));
|
||||
zeromem(pmac->Li, sizeof(pmac->Li));
|
||||
|
||||
Reference in New Issue
Block a user