MCPcopy Create free account
hub / github.com/LUX-Core/lux / MulU

Function MulU

src/cryptopp/cmac.cpp:11–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9NAMESPACE_BEGIN(CryptoPP)
10
11static void MulU(byte *k, unsigned int length)
12{
13 byte carry = 0;
14
15 for (int i=length-1; i>=1; i-=2)
16 {
17 byte carry2 = k[i] >> 7;
18 k[i] += k[i] + carry;
19 carry = k[i-1] >> 7;
20 k[i-1] += k[i-1] + carry2;
21 }
22
23 if (carry)
24 {
25 switch (length)
26 {
27 case 8:
28 k[7] ^= 0x1b;
29 break;
30 case 16:
31 k[15] ^= 0x87;
32 break;
33 case 32:
34 k[30] ^= 4;
35 k[31] ^= 0x23;
36 break;
37 default:
38 throw InvalidArgument("CMAC: " + IntToString(length) + " is not a supported cipher block size");
39 }
40 }
41}
42
43void CMAC_Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
44{

Callers 1

UncheckedSetKeyMethod · 0.85

Calls 1

IntToStringFunction · 0.85

Tested by

no test coverage detected