|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
rijndael.cpp alloca issue using make on mingwI saw this was brought up in another thread but I just wanted to make sure I got this right. I am using plane-jane mingw/msys on winxp (don't shoot me) and the only error I get while running make is: g++ -DNDEBUG -g -O2 -pipe -c rijndael.cpp rijndael.cpp: In member function `virtual size_t CryptoPP::Rijndael::Enc::AdvancedProcessBlocks(const byte*, const byte*, byte*, size_t, CryptoPP::word32) const': rijndael.cpp:945: error: `alloca' was not declared in this scope make: *** [rijndael.o] Error 1 I did some searching and supposedly stdlib.h has alloca, but that is the not the case for my compiler and tool set (using g++ 3.4.5 and msys 1.0). So I just changed line 945 from: space = (byte *)alloca(255+sizeof(Locals)); to space = (byte *)malloc(255+sizeof(Locals)); It compiled fine. I have not tested the function. What is the difference between alloca and malloc? I see none and read that alloca is ancient and should be put to rest. Let me know if this is a no-no. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: rijndael.cpp alloca issue using make on mingwHere is a patch that fixes that issue for me: http://allmydata.org/trac/pycryptopp/changeset?new=622% 40cryptopp&old=620%40cryptopp This patch was initially committed to the pycryptopp repository in two steps: http://allmydata.org/trac/pycryptopp/changeset/621/cryptopp http://allmydata.org/trac/pycryptopp/changeset/622/cryptopp Regards, Zooko --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: rijndael.cpp alloca issue using make on mingwRegarding the alloca and malloc difference.
You can't just change the code from alloca to malloc because malloc allocates memory from the heap and has to be free'd while alloca allocates memory from the stack and the memory is "free'd" when the function returns.
If you change the code from alloca to malloc you have to explicitly free the pointer returned by malloc. -- Vargas P.S.: Sorry by the duplicate mail Zooko, I've replied to you instead of replying to the group.
On Tue, Sep 15, 2009 at 13:19, Zooko Wilcox-O'Hearn <zooko@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: rijndael.cpp alloca issue using make on mingwI read about that fix and tried it before, but sadly it does not fix my install. I do not have alloca in any library, stdlib included. So the fix for an apple compiler does not work for the winxp mingw compiler tool set.
Again, I am wondering what is wrong with using malloc vs alloca. Why is this the only spot in the whole crypto library that alloca is being used? Can it be changed to malloc given the same function ins/outs and then there would be no need for sun/apple specific exceptions. Thanks for your time, K On Tue, Sep 15, 2009 at 12:19 PM, Zooko Wilcox-O'Hearn <zooko@...> wrote: Here is a patch that fixes that issue for me: --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: rijndael.cpp alloca issue using make on mingwI guess you can change from "alloca" to "malloc", but you have to remember to free the memory before the return statement.
-- Vargas On Thu, Sep 17, 2009 at 18:21, Kevin Nasman <zootaloo99@...> wrote: I read about that fix and tried it before, but sadly it does not fix my install. I do not have alloca in any library, stdlib included. So the fix for an apple compiler does not work for the winxp mingw compiler tool set. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: rijndael.cpp alloca issue using make on mingwNo, please don't do that. Alloca is being used to find some
stack space that isn't cache-aliased with static lookup tables, in order to
defend against timing attacks. It's easy to just apply Zooko's fix. I'll also
get this fixed in the next release.
|
|
|
Re: rijndael.cpp alloca issue using make on mingwKevin, the relevant fix for mingw is "#include
<malloc.h>", not "#include <stdlib.h>".
|
|
|
Re: rijndael.cpp alloca issue using make on mingwOK thank you very much that makes more sense to me now (with regards to difference between alloca and malloc). -k On Thu, Sep 17, 2009 at 8:55 PM, Wei Dai <weidai@...> wrote:
|
| Free embeddable forum powered by Nabble | Forum Help |