Upgrade libtomcrypt
This commit is contained in:
@@ -33,7 +33,7 @@ int f9_done(f9_state *f9, unsigned char *out, unsigned long *outlen)
|
||||
|
||||
if (f9->buflen != 0) {
|
||||
/* encrypt */
|
||||
cipher_descriptor[f9->cipher].ecb_encrypt(f9->IV, f9->IV, &f9->key);
|
||||
ecb_encrypt_block(f9->IV, f9->IV, &f9->key);
|
||||
f9->buflen = 0;
|
||||
for (x = 0; x < f9->blocksize; x++) {
|
||||
f9->ACC[x] ^= f9->IV[x];
|
||||
@@ -41,13 +41,13 @@ int f9_done(f9_state *f9, unsigned char *out, unsigned long *outlen)
|
||||
}
|
||||
|
||||
/* schedule modified key */
|
||||
if ((err = cipher_descriptor[f9->cipher].setup(f9->akey, f9->keylen, 0, &f9->key)) != CRYPT_OK) {
|
||||
if ((err = ecb_start(f9->cipher, f9->akey, f9->keylen, 0, &f9->key)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* encrypt the ACC */
|
||||
cipher_descriptor[f9->cipher].ecb_encrypt(f9->ACC, f9->ACC, &f9->key);
|
||||
cipher_descriptor[f9->cipher].done(&f9->key);
|
||||
ecb_encrypt_block(f9->ACC, f9->ACC, &f9->key);
|
||||
ecb_done(&f9->key);
|
||||
|
||||
/* extract tag */
|
||||
for (x = 0; x < f9->blocksize && (unsigned long)x < *outlen; x++) {
|
||||
|
||||
@@ -38,7 +38,7 @@ int f9_init(f9_state *f9, int cipher, const unsigned char *key, unsigned long ke
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &f9->key)) != CRYPT_OK) {
|
||||
if ((err = ecb_start(cipher, key, keylen, 0, &f9->key)) != CRYPT_OK) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ int f9_process(f9_state *f9, const unsigned char *in, unsigned long inlen)
|
||||
for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) {
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&(f9->IV[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(in[x])));
|
||||
}
|
||||
cipher_descriptor[f9->cipher].ecb_encrypt(f9->IV, f9->IV, &f9->key);
|
||||
ecb_encrypt_block(f9->IV, f9->IV, &f9->key);
|
||||
for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) {
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&(f9->ACC[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(f9->IV[x])));
|
||||
}
|
||||
@@ -50,7 +50,7 @@ int f9_process(f9_state *f9, const unsigned char *in, unsigned long inlen)
|
||||
|
||||
while (inlen) {
|
||||
if (f9->buflen == f9->blocksize) {
|
||||
cipher_descriptor[f9->cipher].ecb_encrypt(f9->IV, f9->IV, &f9->key);
|
||||
ecb_encrypt_block(f9->IV, f9->IV, &f9->key);
|
||||
for (x = 0; x < f9->blocksize; x++) {
|
||||
f9->ACC[x] ^= f9->IV[x];
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ int f9_test(void)
|
||||
return CRYPT_NOP;
|
||||
}
|
||||
|
||||
for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) {
|
||||
for (x = 0; x < (int)LTC_ARRAY_SIZE(tests); x++) {
|
||||
taglen = 4;
|
||||
if ((err = f9_memory(idx, tests[x].K, 16, tests[x].M, tests[x].msglen, T, &taglen)) != CRYPT_OK) {
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user