5 #ifndef CRYPTOPP_IMPORTS
11 static void MulU(
byte *k,
unsigned int length)
15 for (
int i=length-1; i>=1; i-=2)
17 byte carry2 = k[i] >> 7;
20 k[i-1] += k[i-1] + carry2;
46 unsigned int blockSize = cipher.
BlockSize();
48 cipher.
SetKey(key, length, params);
53 MulU(m_reg+blockSize, blockSize);
54 memcpy(m_reg+2*blockSize, m_reg+blockSize, blockSize);
55 MulU(m_reg+2*blockSize, blockSize);
60 assert((input && length) || !(input || length));
65 unsigned int blockSize = cipher.
BlockSize();
69 const unsigned int len =
UnsignedMin(blockSize - m_counter, length);
72 xorbuf(m_reg+m_counter, input, len);
78 if (m_counter == blockSize && length > 0)
85 if (length > blockSize)
87 assert(m_counter == 0);
89 input += (length - leftOver);
95 assert(m_counter + length <= blockSize);
96 xorbuf(m_reg+m_counter, input, length);
97 m_counter += (
unsigned int)length;
100 assert(m_counter > 0);
105 ThrowIfInvalidTruncatedSize(size);
108 unsigned int blockSize = cipher.
BlockSize();
110 if (m_counter < blockSize)
112 m_reg[m_counter] ^= 0x80;
118 memcpy(mac, m_reg, size);
121 memset(m_reg, 0, blockSize);