Mercurial > dropbear
annotate libtomcrypt/src/modes/xts/xts_mult_x.c @ 1447:8f88f4290b22
document --enable-static in place of STATIC=1
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 27 Jun 2017 22:42:32 +0800 |
parents | f849a5ca2efc |
children | 6dba84798cd5 |
rev | line source |
---|---|
1435
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
2 * |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
3 * LibTomCrypt is a library that provides various cryptographic |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
4 * algorithms in a highly modular and flexible manner. |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
5 * |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
6 * The library is free for all purposes without any express |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
7 * guarantee it works. |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
8 * |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
9 * Tom St Denis, [email protected], http://libtom.org |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
10 */ |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
11 #include "tomcrypt.h" |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
12 |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
13 /** |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
14 Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
15 */ |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
16 |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
17 #ifdef LTC_XTS_MODE |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
18 |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
19 /** multiply by x |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
20 @param I The value to multiply by x (LFSR shift) |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
21 */ |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
22 void xts_mult_x(unsigned char *I) |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
23 { |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
24 int x; |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
25 unsigned char t, tt; |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
26 |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
27 for (x = t = 0; x < 16; x++) { |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
28 tt = I[x] >> 7; |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
29 I[x] = ((I[x] << 1) | t) & 0xFF; |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
30 t = tt; |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
31 } |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
32 if (tt) { |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
33 I[0] ^= 0x87; |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
34 } |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
35 } |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
36 |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
37 #endif |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
38 |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
39 /* $Source$ */ |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
40 /* $Revision$ */ |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
41 /* $Date$ */ |
f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
42 |