1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 3 #include "tomcrypt_private.h" 4 5 /** 6 Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects 7 */ 8 9 #ifdef LTC_XTS_MODE 10 11 /** multiply by x 12 @param I The value to multiply by x (LFSR shift) 13 */ xts_mult_x(unsigned char * I)14void xts_mult_x(unsigned char *I) 15 { 16 int x; 17 unsigned char t, tt; 18 19 for (x = t = 0; x < 16; x++) { 20 tt = I[x] >> 7; 21 I[x] = ((I[x] << 1) | t) & 0xFF; 22 t = tt; 23 } 24 if (tt) { 25 I[0] ^= 0x87; 26 } 27 } 28 29 #endif 30