1 // SPDX-License-Identifier: BSD-2-Clause
2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 *
4 * LibTomCrypt is a library that provides various cryptographic
5 * algorithms in a highly modular and flexible manner.
6 *
7 * The library is free for all purposes without any express
8 * guarantee it works.
9 */
10 #include "tomcrypt_private.h"
11
12 /**
13 Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects
14 */
15
16 #ifdef LTC_XTS_MODE
17
18 /** multiply by x
19 @param I The value to multiply by x (LFSR shift)
20 */
xts_mult_x(unsigned char * I)21 void xts_mult_x(unsigned char *I)
22 {
23 int x;
24 unsigned char t, tt;
25
26 for (x = t = 0; x < 16; x++) {
27 tt = I[x] >> 7;
28 I[x] = ((I[x] << 1) | t) & 0xFF;
29 t = tt;
30 }
31 if (tt) {
32 I[0] ^= 0x87;
33 }
34 }
35
36 #endif
37
38 /* ref: $Format:%D$ */
39 /* git commit: $Format:%H$ */
40 /* commit time: $Format:%ai$ */
41