MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / multByTwo

Function multByTwo

libcppcryptfs/crypt/eme.cpp:64–83  ·  view source on GitHub ↗

multByTwo - GF multiplication as specified in the EME-32 draft

Source from the content-addressed store, hash-verified

62
63 // multByTwo - GF multiplication as specified in the EME-32 draft
64static void multByTwo(BYTE *out, const BYTE *in, int len) {
65 if (len != 16) {
66 panic(L"len must be 16");
67 }
68 BYTE tmp[16];
69
70 tmp[0] = 2 * in[0];
71 if (in[15] >= 128) {
72 tmp[0] = tmp[0] ^ 135;
73 }
74 for (int j = 1; j < 16; j++) {
75 tmp[j] = 2 * in[j];
76 if (in[j - 1] >= 128) {
77 tmp[j] += 1;
78 }
79 }
80
81 for (int i = 0; i < 16; i++)
82 out[i] = tmp[i];
83}
84
85static void xorBlocks(BYTE* out, const BYTE* in1, const BYTE* in2, int len) {
86

Callers 2

tabulateLMethod · 0.85
EmeTransformFunction · 0.85

Calls 1

panicFunction · 0.85

Tested by

no test coverage detected