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

Method Update

src/cryptopp/cmac.cpp:58–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void CMAC_Base::Update(const byte *input, size_t length)
59{
60 CRYPTOPP_ASSERT((input && length) || !(input || length));
61 if (!length)
62 return;
63
64 BlockCipher &cipher = AccessCipher();
65 unsigned int blockSize = cipher.BlockSize();
66
67 if (m_counter > 0)
68 {
69 const unsigned int len = UnsignedMin(blockSize - m_counter, length);
70 if (len)
71 {
72 xorbuf(m_reg+m_counter, input, len);
73 length -= len;
74 input += len;
75 m_counter += len;
76 }
77
78 if (m_counter == blockSize && length > 0)
79 {
80 cipher.ProcessBlock(m_reg);
81 m_counter = 0;
82 }
83 }
84
85 if (length > blockSize)
86 {
87 CRYPTOPP_ASSERT(m_counter == 0);
88 size_t leftOver = 1 + cipher.AdvancedProcessBlocks(m_reg, input, m_reg, length-1, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
89 input += (length - leftOver);
90 length = leftOver;
91 }
92
93 if (length > 0)
94 {
95 CRYPTOPP_ASSERT(m_counter + length <= blockSize);
96 xorbuf(m_reg+m_counter, input, length);
97 m_counter += (unsigned int)length;
98 }
99
100 CRYPTOPP_ASSERT(m_counter > 0);
101}
102
103void CMAC_Base::TruncatedFinal(byte *mac, size_t size)
104{

Callers

nothing calls this directly

Calls 5

UnsignedMinFunction · 0.85
xorbufFunction · 0.85
ProcessBlockMethod · 0.80
AdvancedProcessBlocksMethod · 0.80
BlockSizeMethod · 0.45

Tested by

no test coverage detected