Revert 823bc93357 (Issue 302)

The 823 commit introduced a subtle bug we were not able to detect during testing. However, users experienced it in the field. We are reverting it because we violated the "do no harm" rule. The next steps are (1) completely remediation and (2) proper testing of the unit
pull/308/head
Jeffrey Walton 2016-09-23 01:58:00 -04:00
parent 15855226fa
commit f9ee4e2dab
1 changed files with 2 additions and 10 deletions

View File

@ -1253,14 +1253,10 @@ size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
byte *space = NULL;
do {
#if (CRYPTOPP_MSC_VERSION >= 1400)
// http://msdn.microsoft.com/en-us/library/5471dc8s.aspx
space = (byte *)_malloca(255+sizeof(Locals));
space += (256-(size_t)space%256)%256;
#else
// Microsoft C&A violation, http://msdn.microsoft.com/en-us/library/5471dc8s.aspx
// Also see http://github.com/weidai11/cryptopp/issues/302
space = (byte *)alloca(255+sizeof(Locals));
space += (256-(size_t)space%256)%256;
#endif
}
while (AliasedWithTable(space, space+sizeof(Locals)));
@ -1292,10 +1288,6 @@ size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
Rijndael_Enc_AdvancedProcessBlocks(&locals, m_key);
#if (CRYPTOPP_MSC_VERSION >= 1400)
_freea(space);
#endif
return length % BLOCKSIZE;
}
#endif