Mercurial > dropbear
comparison libtomcrypt/src/mac/f9/f9_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 f9_process.c | 12 @file f9_process.c |
42 | 40 |
43 #ifdef LTC_FAST | 41 #ifdef LTC_FAST |
44 if (f9->buflen == 0) { | 42 if (f9->buflen == 0) { |
45 while (inlen >= (unsigned long)f9->blocksize) { | 43 while (inlen >= (unsigned long)f9->blocksize) { |
46 for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) { | 44 for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) { |
47 *((LTC_FAST_TYPE*)&(f9->IV[x])) ^= *((LTC_FAST_TYPE*)&(in[x])); | 45 *(LTC_FAST_TYPE_PTR_CAST(&(f9->IV[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(in[x]))); |
48 } | 46 } |
49 cipher_descriptor[f9->cipher].ecb_encrypt(f9->IV, f9->IV, &f9->key); | 47 cipher_descriptor[f9->cipher].ecb_encrypt(f9->IV, f9->IV, &f9->key); |
50 for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) { | 48 for (x = 0; x < f9->blocksize; x += sizeof(LTC_FAST_TYPE)) { |
51 *((LTC_FAST_TYPE*)&(f9->ACC[x])) ^= *((LTC_FAST_TYPE*)&(f9->IV[x])); | 49 *(LTC_FAST_TYPE_PTR_CAST(&(f9->ACC[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(f9->IV[x]))); |
52 } | 50 } |
53 in += f9->blocksize; | 51 in += f9->blocksize; |
54 inlen -= f9->blocksize; | 52 inlen -= f9->blocksize; |
55 } | 53 } |
56 } | 54 } |
57 #endif | 55 #endif |
58 | 56 |
59 while (inlen) { | 57 while (inlen) { |
60 if (f9->buflen == f9->blocksize) { | 58 if (f9->buflen == f9->blocksize) { |
61 cipher_descriptor[f9->cipher].ecb_encrypt(f9->IV, f9->IV, &f9->key); | 59 cipher_descriptor[f9->cipher].ecb_encrypt(f9->IV, f9->IV, &f9->key); |
62 for (x = 0; x < f9->blocksize; x++) { | 60 for (x = 0; x < f9->blocksize; x++) { |
63 f9->ACC[x] ^= f9->IV[x]; | 61 f9->ACC[x] ^= f9->IV[x]; |
64 } | 62 } |
65 f9->buflen = 0; | 63 f9->buflen = 0; |
66 } | 64 } |
67 f9->IV[f9->buflen++] ^= *in++; | 65 f9->IV[f9->buflen++] ^= *in++; |
68 --inlen; | 66 --inlen; |
69 } | 67 } |
70 return CRYPT_OK; | 68 return CRYPT_OK; |
71 } | 69 } |
72 | 70 |
73 #endif | 71 #endif |
74 | 72 |
75 /* $Source$ */ | 73 /* ref: $Format:%D$ */ |
76 /* $Revision$ */ | 74 /* git commit: $Format:%H$ */ |
77 /* $Date$ */ | 75 /* commit time: $Format:%ai$ */ |
78 | 76 |