Skip to content

Commit

Permalink
merge in 5.0.4 changes (exclude DES and SHA-2 from DLL),
Browse files Browse the repository at this point in the history
attempt (failed) to build DLL with GCC
  • Loading branch information
weidai11 committed Jul 10, 2003
1 parent 699e621 commit 473e5df
Show file tree
Hide file tree
Showing 20 changed files with 474 additions and 432 deletions.
36 changes: 32 additions & 4 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@ endif

OBJS = $(SRCS:.cpp=.o)
# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
TESTOBJS = bench.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o
TESTOBJS = bench.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS))

DLLSRCS = algebra.cpp algparam.cpp asn.cpp basecode.cpp cbcmac.cpp channels.cpp cryptlib.cpp des.cpp dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp integer.cpp iterhash.cpp misc.cpp modes.cpp modexppc.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp pkcspad.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp rijndael.cpp rng.cpp rsa.cpp sha.cpp simple.cpp skipjack.cpp strciphr.cpp trdlocal.cpp
DLLOBJS = $(DLLSRCS:.cpp=.export.o)
LIBIMPORTOBJS = $(LIBOBJS:.o=import.o)
TESTIMPORTOBJS = $(TESTOBJS:.o=import.o)
DLLTESTOBJS = dlltest.dllonly.o

all: cryptest.exe

clean:
$(RM) cryptest.exe libcryptopp.a $(LIBOBJS) $(TESTOBJS)
$(RM) cryptest.exe libcryptopp.a $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)

libcryptopp.a: $(LIBOBJS)
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
Expand All @@ -62,14 +68,36 @@ cryptest.exe: libcryptopp.a $(TESTOBJS)
nolib: $(OBJS) # makes it faster to test changes
$(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)

dll: cryptest.import.exe dlltest.exe

cryptopp.dll: $(DLLOBJS)
$(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a

libcryptopp.import.a: $(LIBIMPORTOBJS)
$(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
$(RANLIB) $@

cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
$(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS)

dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
$(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)

adhoc.cpp: adhoc.cpp.proto
ifeq ($(wildcard adhoc.cpp),)
cp adhoc.cpp.proto adhoc.cpp
else
touch adhoc.cpp
endif

.SUFFIXES: .cpp
%.dllonly.o : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c $< -o $@

%.import.o : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c $< -o $@

%.export.o : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c $< -o $@

.cpp.o:
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c $<
4 changes: 3 additions & 1 deletion Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ History
5.03 - created DLL version of Crypto++ for FIPS 140-2 validation
- fixed vulnerabilities in GetNextIV for CTR and OFB modes

5.0.4 - Removed DES, SHA-256, SHA-384, SHA-512 from DLL

5.1 - added PSS padding and changed PSSR to track IEEE P1363a draft standard
- added blinding for RSA and Rabin to defend against timing attacks
on decryption operations
Expand All @@ -260,4 +262,4 @@ History
- fixed a number of compiler warnings, minor bugs, and portability problems
- removed Sapphire

5.2 - Merged in changes for 5.01 - 5.03
5.2 - Merged in changes for 5.01 - 5.04
65 changes: 36 additions & 29 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,35 +191,6 @@ NAMESPACE_END
# pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355)
#endif

#ifdef _MSC_VER

#ifdef CRYPTOPP_EXPORTS
#define CRYPTOPP_IS_DLL
#define CRYPTOPP_DLL __declspec(dllexport)
#elif defined(CRYPTOPP_IMPORTS)
#define CRYPTOPP_IS_DLL
#define CRYPTOPP_DLL __declspec(dllimport)
#else
#define CRYPTOPP_DLL
#endif

#define CRYPTOPP_API __stdcall

#else // _MSC_VER

#define CRYPTOPP_DLL
#define CRYPTOPP_API

#endif // _MSC_VER

#ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
#define CRYPTOPP_MANUAL_EXTERN
#else
#define CRYPTOPP_MANUAL_EXTERN extern
#endif

#define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_MANUAL_EXTERN template class CRYPTOPP_DLL

// ***************** determine availability of OS features ********************

#ifndef NO_OS_DEPENDENCE
Expand Down Expand Up @@ -278,4 +249,40 @@ NAMESPACE_END

#endif // NO_OS_DEPENDENCE

// ***************** DLL related ********************

#ifdef CRYPTOPP_WIN32_AVAILABLE

#ifdef CRYPTOPP_EXPORTS
#define CRYPTOPP_IS_DLL
#define CRYPTOPP_DLL __declspec(dllexport)
#elif defined(CRYPTOPP_IMPORTS)
#define CRYPTOPP_IS_DLL
#define CRYPTOPP_DLL __declspec(dllimport)
#else
#define CRYPTOPP_DLL
#endif

#define CRYPTOPP_API __stdcall

#else // CRYPTOPP_WIN32_AVAILABLE

#define CRYPTOPP_NO_DLL
#define CRYPTOPP_DLL
#define CRYPTOPP_API

#endif // CRYPTOPP_WIN32_AVAILABLE

#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
#else
#define CRYPTOPP_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
#endif

#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
#else
#define CRYPTOPP_STATIC_TEMPLATE_CLASS extern template class
#endif

#endif
2 changes: 1 addition & 1 deletion cryptdll.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions cryptest.dsw
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ Package=<4>

###############################################################################

Project: "dlltest"=.\dlltest.dsp - Package Owner=<4>

Package=<5>
{{{
}}}

Package=<4>
{{{
}}}

###############################################################################

Global:

Package=<5>
Expand Down
6 changes: 3 additions & 3 deletions cryptlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
In the FIPS 140-2 validated DLL version of Crypto++, only the following implementation class are available.
<dl>
<dt>Block Ciphers<dd>
AES, DES, DES_EDE2, DES_EDE3, SKIPJACK
AES, DES_EDE2, DES_EDE3, SKIPJACK
<dt>Cipher Modes (replace template parameter BC with one of the block ciphers above)<dd>
ECB_Mode <BC>, CTR_Mode <BC>, CBC_Mode <BC>, CFB_Mode <BC>, OFB_Mode <BC>
<dt>Hash Functions<dd>
SHA, SHA256, SHA384, SHA512
SHA
<dt>Public Key Signature Schemes<dd>
RSASSA <PKCS1v15, SHA>, DSA, ECDSA <ECP, SHA>, ECDSA <EC2N, SHA>
<dt>Message Authentication Codes<dd>
HMAC <SHA>, HMAC <SHA256>, HMAC <SHA384>, HMAC <SHA512>, CBC_MAC <DES>, CBC_MAC <DES_EDE2>, CBC_MAC <DES_EDE3>
HMAC <SHA>, CBC_MAC <DES_EDE2>, CBC_MAC <DES_EDE3>
<dt>Random Number Generators<dd>
AutoSeededX917RNG <DES_EDE3>
<dt>Key Agreement<dd>
Expand Down
2 changes: 1 addition & 1 deletion cryptopp.rc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "free crypto library, more info at www.cryptopp.com\0"
VALUE "Comments", "free crypto library, more information available at www.cryptopp.com\0"
VALUE "CompanyName", "Wei Dai\0"
VALUE "FileDescription", "Crypto++� Library DLL\0"
VALUE "FileVersion", "5, 2, 0, 0\0"
Expand Down
Loading

0 comments on commit 473e5df

Please sign in to comment.