Path: blob/master/libs/tomcrypt/src/modes/xts/xts_mult_x.c
5972 views
/* LibTomCrypt, modular cryptographic library -- Tom St Denis1*2* LibTomCrypt is a library that provides various cryptographic3* algorithms in a highly modular and flexible manner.4*5* The library is free for all purposes without any express6* guarantee it works.7*/8#include "tomcrypt.h"910/**11Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects12*/1314#ifdef LTC_XTS_MODE1516/** multiply by x17@param I The value to multiply by x (LFSR shift)18*/19void xts_mult_x(unsigned char *I)20{21int x;22unsigned char t, tt;2324for (x = t = 0; x < 16; x++) {25tt = I[x] >> 7;26I[x] = ((I[x] << 1) | t) & 0xFF;27t = tt;28}29if (tt) {30I[0] ^= 0x87;31}32}3334#endif353637