Upgrade libtomcrypt

This commit is contained in:
2025-10-24 19:33:21 +03:00
parent d770dd8df3
commit acc69bb8ad
157 changed files with 922 additions and 761 deletions

View File

@@ -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));