diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-10-08 12:05:33 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-10-08 12:05:33 -0400 |
commit | 6e436427fbc63fa5932175f3ebcee03d900258bf (patch) | |
tree | 6130386f85470c82709a83b1eab43c9f561b31c8 /rijndael.cpp | |
parent | ebcd91a0ac1b1aa3f4723ae19dab0c74eccad495 (diff) | |
download | cryptopp-git-6e436427fbc63fa5932175f3ebcee03d900258bf.tar.gz |
Use SetMark to avoid unneeded zeroization in Rijndael
Diffstat (limited to 'rijndael.cpp')
-rw-r--r-- | rijndael.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rijndael.cpp b/rijndael.cpp index 141ba646..90663535 100644 --- a/rijndael.cpp +++ b/rijndael.cpp @@ -316,6 +316,9 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keyLen, c #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86
m_aliasBlock.New(s_sizeToAllocate);
+ // The alias block is only used on IA-32 when unaligned data access is in effect.
+ // Setting the low water mark to 0 avoids zeroization when m_aliasBlock is unused.
+ m_aliasBlock.SetMark(0);
#endif
m_rounds = keyLen/4 + 6;
@@ -1146,6 +1149,7 @@ size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo return length;
static const byte *zeros = (const byte*)(Te+256);
+ m_aliasBlock.SetMark(m_aliasBlock.size());
byte *space = NULLPTR, *originalSpace = const_cast<byte*>(m_aliasBlock.data());
// round up to nearest 256 byte boundary
|