Skip to content

Commit

Permalink
Add call for _malloca/_freea. They are SDLC compliance items on Windo…
Browse files Browse the repository at this point in the history
…ws platform
  • Loading branch information
noloader committed Feb 9, 2016
1 parent b773052 commit 823bc93
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rijndael.cpp
Expand Up @@ -1232,13 +1232,12 @@ size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
size_t regSpill, lengthAndCounterFlag, keysBegin;
};

size_t increment = BLOCKSIZE;
const byte* zeros = (byte *)(Te+256);
byte *space;
byte *space = NULL;

do {
#if (CRYPTOPP_MSC_VERSION >= 1400)
// https://msdn.microsoft.com/en-us/library/5471dc8s.aspx
#if (CRYPTOPP_MSC_VERION >= 1400)
space = (byte *)_malloca(255+sizeof(Locals));
space += (256-(size_t)space%256)%256;
#else
Expand All @@ -1248,6 +1247,7 @@ size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
}
while (AliasedWithTable(space, space+sizeof(Locals)));

size_t increment = BLOCKSIZE;
if (flags & BT_ReverseDirection)
{
assert(length % BLOCKSIZE == 0);
Expand All @@ -1274,6 +1274,11 @@ size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
locals.keysBegin = (12-keysToCopy)*16;

Rijndael_Enc_AdvancedProcessBlocks(&locals, m_key);

#if (CRYPTOPP_MSC_VERSION >= 1400)
_freea(space);
#endif

return length % BLOCKSIZE;
}
#endif
Expand Down

1 comment on commit 823bc93

@noloader
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also see Issue 302: AES and incorrect argument to _freea() under Microsoft compilers. We backed out the 823 commit at [Commit f9ee4e2](http://github.com/weidai11/cryptopp/commit /f9ee4e2dab3258696770f6d786adbb508632df85).

Please sign in to comment.