From f9ee4e2dab3258696770f6d786adbb508632df85 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 23 Sep 2016 01:58:00 -0400 Subject: [PATCH] Revert 823bc93357da32a3 (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 --- rijndael.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/rijndael.cpp b/rijndael.cpp index b4ca2d84..4a7b92f6 100644 --- a/rijndael.cpp +++ b/rijndael.cpp @@ -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