Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/tomcrypt/src/modes/xts/xts_mult_x.c
5972 views
1
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
2
*
3
* LibTomCrypt is a library that provides various cryptographic
4
* algorithms in a highly modular and flexible manner.
5
*
6
* The library is free for all purposes without any express
7
* guarantee it works.
8
*/
9
#include "tomcrypt.h"
10
11
/**
12
Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects
13
*/
14
15
#ifdef LTC_XTS_MODE
16
17
/** multiply by x
18
@param I The value to multiply by x (LFSR shift)
19
*/
20
void xts_mult_x(unsigned char *I)
21
{
22
int x;
23
unsigned char t, tt;
24
25
for (x = t = 0; x < 16; x++) {
26
tt = I[x] >> 7;
27
I[x] = ((I[x] << 1) | t) & 0xFF;
28
t = tt;
29
}
30
if (tt) {
31
I[0] ^= 0x87;
32
}
33
}
34
35
#endif
36
37