Upgrade libtomcrypt
This commit is contained in:
parent
d770dd8df3
commit
acc69bb8ad
157 changed files with 922 additions and 761 deletions
|
|
@ -17,7 +17,6 @@
|
|||
*/
|
||||
int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen)
|
||||
{
|
||||
int err;
|
||||
#ifdef LTC_FAST
|
||||
int x;
|
||||
#endif
|
||||
|
|
@ -25,13 +24,7 @@ int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen)
|
|||
LTC_ARGCHK(xcbc != NULL);
|
||||
LTC_ARGCHK(in != NULL);
|
||||
|
||||
/* check structure */
|
||||
if ((err = cipher_is_valid(xcbc->cipher)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((xcbc->blocksize > cipher_descriptor[xcbc->cipher].block_length) || (xcbc->blocksize < 0) ||
|
||||
(xcbc->buflen > xcbc->blocksize) || (xcbc->buflen < 0)) {
|
||||
if ((xcbc->blocksize < 0) || (xcbc->buflen > xcbc->blocksize) || (xcbc->buflen < 0)) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +34,7 @@ int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen)
|
|||
for (x = 0; x < xcbc->blocksize; x += sizeof(LTC_FAST_TYPE)) {
|
||||
*(LTC_FAST_TYPE_PTR_CAST(&(xcbc->IV[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(in[x])));
|
||||
}
|
||||
cipher_descriptor[xcbc->cipher].ecb_encrypt(xcbc->IV, xcbc->IV, &xcbc->key);
|
||||
ecb_encrypt_block(xcbc->IV, xcbc->IV, &xcbc->key);
|
||||
in += xcbc->blocksize;
|
||||
inlen -= xcbc->blocksize;
|
||||
}
|
||||
|
|
@ -50,7 +43,7 @@ int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen)
|
|||
|
||||
while (inlen) {
|
||||
if (xcbc->buflen == xcbc->blocksize) {
|
||||
cipher_descriptor[xcbc->cipher].ecb_encrypt(xcbc->IV, xcbc->IV, &xcbc->key);
|
||||
ecb_encrypt_block(xcbc->IV, xcbc->IV, &xcbc->key);
|
||||
xcbc->buflen = 0;
|
||||
}
|
||||
xcbc->IV[xcbc->buflen++] ^= *in++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue