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

Method ProcessLastBlock

src/cryptopp/modes.cpp:188–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void CBC_CTS_Encryption::ProcessLastBlock(byte *outString, const byte *inString, size_t length)
189{
190 if (length <= BlockSize())
191 {
192 if (!m_stolenIV)
193 throw InvalidArgument("CBC_Encryption: message is too short for ciphertext stealing");
194
195 // steal from IV
196 memcpy(outString, m_register, length);
197 outString = m_stolenIV;
198 }
199 else
200 {
201 // steal from next to last block
202 xorbuf(m_register, inString, BlockSize());
203 m_cipher->ProcessBlock(m_register);
204 inString += BlockSize();
205 length -= BlockSize();
206 memcpy(outString+BlockSize(), m_register, length);
207 }
208
209 // output last full ciphertext block
210 xorbuf(m_register, inString, length);
211 m_cipher->ProcessBlock(m_register);
212 memcpy(outString, m_register, BlockSize());
213}
214
215void CBC_Decryption::ResizeBuffers()
216{

Callers 1

LastPutMethod · 0.45

Calls 4

memcpyFunction · 0.85
xorbufFunction · 0.85
ProcessBlockMethod · 0.80
BlockSizeFunction · 0.70

Tested by

no test coverage detected