Mercurial > dropbear
comparison libtomcrypt/src/mac/xcbc/xcbc_process.c @ 1511:5916af64acd4 fuzz
merge from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 17 Feb 2018 19:29:51 +0800 |
parents | 6dba84798cd5 |
children |
comparison
equal
deleted
inserted
replaced
1457:32f990cc96b1 | 1511:5916af64acd4 |
---|---|
3 * LibTomCrypt is a library that provides various cryptographic | 3 * LibTomCrypt is a library that provides various cryptographic |
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | |
9 * Tom St Denis, [email protected], http://libtom.org | |
10 */ | 8 */ |
11 #include "tomcrypt.h" | 9 #include "tomcrypt.h" |
12 | 10 |
13 /** | 11 /** |
14 @file xcbc_process.c | 12 @file xcbc_process.c |
45 | 43 |
46 #ifdef LTC_FAST | 44 #ifdef LTC_FAST |
47 if (xcbc->buflen == 0) { | 45 if (xcbc->buflen == 0) { |
48 while (inlen > (unsigned long)xcbc->blocksize) { | 46 while (inlen > (unsigned long)xcbc->blocksize) { |
49 for (x = 0; x < xcbc->blocksize; x += sizeof(LTC_FAST_TYPE)) { | 47 for (x = 0; x < xcbc->blocksize; x += sizeof(LTC_FAST_TYPE)) { |
50 *((LTC_FAST_TYPE*)&(xcbc->IV[x])) ^= *((LTC_FAST_TYPE*)&(in[x])); | 48 *(LTC_FAST_TYPE_PTR_CAST(&(xcbc->IV[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(in[x]))); |
51 } | 49 } |
52 cipher_descriptor[xcbc->cipher].ecb_encrypt(xcbc->IV, xcbc->IV, &xcbc->key); | 50 cipher_descriptor[xcbc->cipher].ecb_encrypt(xcbc->IV, xcbc->IV, &xcbc->key); |
53 in += xcbc->blocksize; | 51 in += xcbc->blocksize; |
54 inlen -= xcbc->blocksize; | 52 inlen -= xcbc->blocksize; |
55 } | 53 } |
56 } | 54 } |
57 #endif | 55 #endif |
58 | 56 |
59 while (inlen) { | 57 while (inlen) { |
60 if (xcbc->buflen == xcbc->blocksize) { | 58 if (xcbc->buflen == xcbc->blocksize) { |
61 cipher_descriptor[xcbc->cipher].ecb_encrypt(xcbc->IV, xcbc->IV, &xcbc->key); | 59 cipher_descriptor[xcbc->cipher].ecb_encrypt(xcbc->IV, xcbc->IV, &xcbc->key); |
62 xcbc->buflen = 0; | 60 xcbc->buflen = 0; |
63 } | 61 } |
64 xcbc->IV[xcbc->buflen++] ^= *in++; | 62 xcbc->IV[xcbc->buflen++] ^= *in++; |
65 --inlen; | 63 --inlen; |
66 } | 64 } |
67 return CRYPT_OK; | 65 return CRYPT_OK; |
68 } | 66 } |
69 | 67 |
70 #endif | 68 #endif |
71 | 69 |
72 /* $Source$ */ | 70 /* ref: $Format:%D$ */ |
73 /* $Revision$ */ | 71 /* git commit: $Format:%H$ */ |
74 /* $Date$ */ | 72 /* commit time: $Format:%ai$ */ |
75 | 73 |