summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2009-04-05 19:58:48 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2009-04-05 19:58:48 +0000
commit78249d5ff4e87d2751c7f51e960d360124ed073a (patch)
treec9166df4f9ca8a1f7e608a26fcc5c68d07acf872
parentfbba0d7c2165347cbab96bd5111c1732fb9f395b (diff)
downloadcryptopp-78249d5ff4e87d2751c7f51e960d360124ed073a.tar.gz
fix compile on MacOS X and MinGW
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@463 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--GNUmakefile6
-rw-r--r--rijndael.cpp8
-rw-r--r--rijndael.h2
3 files changed, 11 insertions, 5 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 4f73103..291eb60 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -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
diff --git a/rijndael.cpp b/rijndael.cpp
index a2c7be3..74893d1 100644
--- a/rijndael.cpp
+++ b/rijndael.cpp
@@ -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);
}
diff --git a/rijndael.h b/rijndael.h
index 483b8dd..d602186 100644
--- a/rijndael.h
+++ b/rijndael.h
@@ -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
};