diff options
author | Jeffrey Walton <noloader@gmail.com> | 2023-04-15 16:45:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-15 16:45:02 -0400 |
commit | f5f63850f9a5521e45de3cc45be61309a2e71ab2 (patch) | |
tree | d9ec904ebd511ae673e89790a407f0cdcf0b9bbc /modes.cpp | |
parent | 358d0cfecd593d55160df38e133b9450aaf1cd59 (diff) | |
download | cryptopp-git-f5f63850f9a5521e45de3cc45be61309a2e71ab2.tar.gz |
Use std namespace for memset, memcpy, memcmp (#1204)
Diffstat (limited to 'modes.cpp')
-rw-r--r-- | modes.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -44,16 +44,16 @@ void CFB_ModePolicy::Iterate(byte *output, const byte *input, CipherDir dir, siz m_cipher->ProcessAndXorBlock(m_register, input, output);
if (iterationCount > 1)
m_cipher->AdvancedProcessBlocks(output, PtrAdd(input,s), PtrAdd(output,s), (iterationCount-1)*s, 0);
- memcpy(m_register, PtrAdd(output,(iterationCount-1)*s), s);
+ std::memcpy(m_register, PtrAdd(output,(iterationCount-1)*s), s);
}
else
{
// make copy first in case of in-place decryption
- memcpy(m_temp, PtrAdd(input,(iterationCount-1)*s), s);
+ std::memcpy(m_temp, PtrAdd(input,(iterationCount-1)*s), s);
if (iterationCount > 1)
m_cipher->AdvancedProcessBlocks(input, PtrAdd(input,s), PtrAdd(output,s), (iterationCount-1)*s, BlockTransformation::BT_ReverseDirection);
m_cipher->ProcessAndXorBlock(m_register, input, output);
- memcpy(m_register, m_temp, s);
+ std::memcpy(m_register, m_temp, s);
}
}
@@ -108,7 +108,7 @@ void OFB_ModePolicy::WriteKeystream(byte *keystreamBuffer, size_t iterationCount m_cipher->ProcessBlock(m_register, keystreamBuffer);
if (iterationCount > 1)
m_cipher->AdvancedProcessBlocks(keystreamBuffer, NULLPTR, PtrAdd(keystreamBuffer, s), s*(iterationCount-1), 0);
- memcpy(m_register, PtrAdd(keystreamBuffer, (iterationCount-1)*s), s);
+ std::memcpy(m_register, PtrAdd(keystreamBuffer, (iterationCount-1)*s), s);
}
void OFB_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
@@ -204,7 +204,7 @@ void CBC_Encryption::ProcessData(byte *outString, const byte *inString, size_t l m_cipher->AdvancedProcessBlocks(inString, m_register, outString, blockSize, BlockTransformation::BT_XorInput);
if (length > blockSize)
m_cipher->AdvancedProcessBlocks(PtrAdd(inString,blockSize), outString, PtrAdd(outString,blockSize), length-blockSize, BlockTransformation::BT_XorInput);
- memcpy(m_register, PtrAdd(outString, length - blockSize), blockSize);
+ std::memcpy(m_register, PtrAdd(outString, length - blockSize), blockSize);
}
size_t CBC_CTS_Encryption::ProcessLastBlock(byte *outString, size_t outLength, const byte *inString, size_t inLength)
@@ -219,7 +219,7 @@ size_t CBC_CTS_Encryption::ProcessLastBlock(byte *outString, size_t outLength, c throw InvalidArgument("CBC_Encryption: message is too short for ciphertext stealing");
// steal from IV
- memcpy(outString, m_register, inLength);
+ std::memcpy(outString, m_register, inLength);
outString = m_stolenIV;
}
else
@@ -229,13 +229,13 @@ size_t CBC_CTS_Encryption::ProcessLastBlock(byte *outString, size_t outLength, c m_cipher->ProcessBlock(m_register);
inString = PtrAdd(inString, blockSize);
inLength -= blockSize;
- memcpy(PtrAdd(outString, blockSize), m_register, inLength);
+ std::memcpy(PtrAdd(outString, blockSize), m_register, inLength);
}
// output last full ciphertext block
xorbuf(m_register, inString, inLength);
m_cipher->ProcessBlock(m_register);
- memcpy(outString, m_register, blockSize);
+ std::memcpy(outString, m_register, blockSize);
return used;
}
@@ -253,7 +253,7 @@ void CBC_Decryption::ProcessData(byte *outString, const byte *inString, size_t l // save copy now in case of in-place decryption
const unsigned int blockSize = BlockSize();
- memcpy(m_temp, PtrAdd(inString, length-blockSize), blockSize);
+ std::memcpy(m_temp, PtrAdd(inString, length-blockSize), blockSize);
if (length > blockSize)
m_cipher->AdvancedProcessBlocks(PtrAdd(inString,blockSize), inString, PtrAdd(outString,blockSize), length-blockSize, BlockTransformation::BT_ReverseDirection|BlockTransformation::BT_AllowParallel);
m_cipher->ProcessAndXorBlock(inString, m_register, outString);
@@ -281,19 +281,19 @@ size_t CBC_CTS_Decryption::ProcessLastBlock(byte *outString, size_t outLength, c }
// decrypt last partial plaintext block
- memcpy(m_temp, pn2, blockSize);
+ std::memcpy(m_temp, pn2, blockSize);
m_cipher->ProcessBlock(m_temp);
xorbuf(m_temp, pn1, inLength);
if (stealIV)
{
- memcpy(outString, m_temp, inLength);
+ std::memcpy(outString, m_temp, inLength);
}
else
{
- memcpy(PtrAdd(outString, blockSize), m_temp, inLength);
+ std::memcpy(PtrAdd(outString, blockSize), m_temp, inLength);
// decrypt next to last plaintext block
- memcpy(m_temp, pn1, inLength);
+ std::memcpy(m_temp, pn1, inLength);
m_cipher->ProcessBlock(m_temp);
xorbuf(outString, m_temp, m_register, blockSize);
}
|