Mercurial > dropbear
comparison libtomcrypt/src/modes/xts/xts_mult_x.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 Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects | 12 Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects |
15 */ | 13 */ |
16 | 14 |
17 #ifdef LTC_XTS_MODE | 15 #ifdef LTC_XTS_MODE |
18 | 16 |
19 /** multiply by x | 17 /** multiply by x |
20 @param I The value to multiply by x (LFSR shift) | 18 @param I The value to multiply by x (LFSR shift) |
21 */ | 19 */ |
22 void xts_mult_x(unsigned char *I) | 20 void xts_mult_x(unsigned char *I) |
23 { | 21 { |
24 int x; | 22 int x; |
25 unsigned char t, tt; | 23 unsigned char t, tt; |
26 | 24 |
27 for (x = t = 0; x < 16; x++) { | 25 for (x = t = 0; x < 16; x++) { |
28 tt = I[x] >> 7; | 26 tt = I[x] >> 7; |
29 I[x] = ((I[x] << 1) | t) & 0xFF; | 27 I[x] = ((I[x] << 1) | t) & 0xFF; |
30 t = tt; | 28 t = tt; |
31 } | 29 } |
32 if (tt) { | 30 if (tt) { |
33 I[0] ^= 0x87; | 31 I[0] ^= 0x87; |
34 } | 32 } |
35 } | 33 } |
36 | 34 |
37 #endif | 35 #endif |
38 | 36 |
39 /* $Source$ */ | 37 /* ref: $Format:%D$ */ |
40 /* $Revision$ */ | 38 /* git commit: $Format:%H$ */ |
41 /* $Date$ */ | 39 /* commit time: $Format:%ai$ */ |
42 |