fix compile on MacOS X and MinGW

pull/2/head
weidai 2009-04-05 19:58:48 +00:00
parent 26666baa38
commit 5b809d7931
3 changed files with 11 additions and 5 deletions

View File

@ -12,7 +12,6 @@ MKDIR = mkdir
EGREP = egrep
UNAME = $(shell uname)
ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86|amd64")
ISMINGW = $(shell uname | $(EGREP) -c "MINGW32")
# Default prefix for make install
ifeq ($(PREFIX),)
@ -29,6 +28,7 @@ GCC42_OR_LATER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(GCC\) (4.[2-9]|[
INTEL_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\)")
GAS210_OR_LATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])")
GAS217_OR_LATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
ISMINGW = $(shell $(CXX) --version 2>&1 | $(EGREP) -c "mingw")
ifneq ($(GCC42_OR_LATER),0)
ifneq ($(UNAME),Darwin)
@ -53,12 +53,12 @@ CXXFLAGS += -Wa,--divide # allow use of "/" operator
endif
endif
endif # ISX86
ifeq ($(ISMINGW),1)
LDLIBS += -lws2_32
endif
endif # ISX86
ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist
CXXFLAGS += -mbnu210
else

View File

@ -73,6 +73,10 @@ being unloaded from L1 cache, until that round is finished.
#include <alloca.h>
#endif
#ifdef __MINGW32__
#include <malloc.h>
#endif
NAMESPACE_BEGIN(CryptoPP)
#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
@ -909,7 +913,7 @@ void Rijndael_Enc_AdvancedProcessBlocks(void *locals, const word32 *k);
}
#endif
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86
static inline bool AliasedWithTable(const byte *begin, const byte *end)
{
@ -923,6 +927,7 @@ static inline bool AliasedWithTable(const byte *begin, const byte *end)
size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const
{
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
if (length < BLOCKSIZE)
return length;
@ -976,6 +981,7 @@ size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
return length%16;
}
else
#endif
return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);
}

View File

@ -41,7 +41,7 @@ class CRYPTOPP_DLL Rijndael : public Rijndael_Info, public BlockCipherDocumentat
{
public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86
size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
#endif
};