Add DLL testing code to cryptest.nmake

pull/778/head
Jeffrey Walton 2019-01-07 14:53:41 -05:00
parent c9639c2086
commit 2166dc903d
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 26 additions and 13 deletions

View File

@ -16,9 +16,12 @@
# You must also add /DCRYPTOPP_DEBUG or /DDEBUG if you want a debug build with # You must also add /DCRYPTOPP_DEBUG or /DDEBUG if you want a debug build with
# the library's assert. The library moved from Posix NDEBUG and assert() to # the library's assert. The library moved from Posix NDEBUG and assert() to
# CRYPTOPP_ASSERT at 5.6.5 due to CVE-2016-7420. CRYPTOPP_ASSERT has the # CRYPTOPP_ASSERT at 5.6.5 due to CVE-2016-7420. CRYPTOPP_ASSERT has the
# additional benefit of using DebugBreak(), and the program does not crash # additional benefit of using DebugBreak(), and the program does not crash
# while you are debugging it like would happen with Posix assert(). # while you are debugging it like would happen with Posix assert().
# There is mention of cryptopp.dll and CRYPTOPP_IMPORTS below. They are for
# for testing. Attempting to produce a working DLL on Windows fails.
# The list of LIB_SRCS and TEST_SRCS was generated under Linux with # The list of LIB_SRCS and TEST_SRCS was generated under Linux with
# "make sources | fold -w74 -s". The list of LIB_OBJS and TEST_OBJS was # "make sources | fold -w74 -s". The list of LIB_OBJS and TEST_OBJS was
# generated with "make sources | fold -w74 -s | sed 's|.cpp|.obj|g'". The # generated with "make sources | fold -w74 -s | sed 's|.cpp|.obj|g'". The
@ -212,32 +215,29 @@ LIB_OBJS = $(LIB_OBJS) neon_simd.obj
all: cryptest.exe all: cryptest.exe
# For testing cryptopp.dll and CRYPTOPP_IMPORTS
#cryptest.exe: pch.pch cryptopp.lib $(TEST_OBJS)
# $(LD) $(LDFLAGS) $(TEST_OBJS) cryptopp.lib $(LDLIBS) /out:$@
cryptest.exe: pch.pch cryptlib.lib $(TEST_OBJS) cryptest.exe: pch.pch cryptlib.lib $(TEST_OBJS)
$(LD) $(LDFLAGS) $(TEST_OBJS) cryptlib.lib $(LDLIBS) /out:$@ $(LD) $(LDFLAGS) $(TEST_OBJS) cryptlib.lib $(LDLIBS) /out:$@
cryptlib.lib: $(LIB_OBJS) cryptlib.lib: $(LIB_OBJS)
$(AR) $(ARFLAGS) $(LIB_OBJS) /out:$@ $(AR) $(ARFLAGS) $(LIB_OBJS) /out:$@
#map2def source code available in TestPrograms/ cryptopp.dump: cryptlib.lib
# map2def.exe: map2def.obj dumpbin.exe /LINKERMEMBER cryptlib.lib /OUT:$@
# $(LD) map2def.obj kernel32.lib /out:$@
#dump2def source code available in TestPrograms/
#dump2def.exe: dump2def.obj
# $(LD) dump2def.obj kernel32.lib /out:$@
cryptopp.map: cryptopp.map:
$(LD) $(LDFLAGS) /DLL /MAP /MAPINFO:EXPORTS $(LIB_OBJS) $(LD) $(LDFLAGS) /DLL /MAP /MAPINFO:EXPORTS $(LIB_OBJS)
mv cryptlib.map cryptopp.map mv cryptlib.map cryptopp.map
cryptopp.dump: cryptlib.lib
dumpbin.exe /LINKERMEMBER cryptlib.lib /OUT:$@
cryptopp.def: cryptlib.lib cryptopp.dump cryptopp.def: cryptlib.lib cryptopp.dump
dump2def.exe cryptopp.dump cryptopp.def dump2def.exe cryptopp.dump cryptopp.def
cryptopp.dll: $(LIB_OBJS) cryptopp.def # LD produces 3 output artifacts for cryptopp.dll
$(LD) $(LDFLAGS) /DLL /DEF:cryptopp.def /IGNORE:4102 $(LIB_OBJS) $(LDLIBS) /out:$@ cryptopp.dll cryptopp.lib cryptopp.exp: $(LIB_OBJS) cryptopp.def
$(LD) $(LDFLAGS) /DLL /DEF:cryptopp.def /IGNORE:4102 $(LIB_OBJS) $(LDLIBS) /out:cryptopp.dll
clean: clean:
$(RM) /F /Q pch.pch $(LIB_OBJS) pch.obj rdrand-x86.obj rdrand-x64.obj x64masm.obj x64dll.obj cryptlib.lib $(TEST_OBJS) cryptest.exe *.pdb $(RM) /F /Q pch.pch $(LIB_OBJS) pch.obj rdrand-x86.obj rdrand-x64.obj x64masm.obj x64dll.obj cryptlib.lib $(TEST_OBJS) cryptest.exe *.pdb
@ -271,6 +271,19 @@ chacha_avx.obj:
$(CXX) $(CXXFLAGS) /arch:AVX /c chacha_avx.cpp $(CXX) $(CXXFLAGS) /arch:AVX /c chacha_avx.cpp
!endif !endif
# For testing cryptopp.dll and CRYPTOPP_IMPORTS
#CXXFLAGS_IMPORTS = /wd4275 /DCRYPTOPP_IMPORTS
#test.obj:
# $(CXX) $(CXXFLAGS) $(CXXFLAGS_IMPORTS) /c $*.cpp
#*test.obj:
# $(CXX) $(CXXFLAGS) $(CXXFLAGS_IMPORTS) /c $*.cpp
#bench*.obj:
# $(CXX) $(CXXFLAGS) $(CXXFLAGS_IMPORTS) /c $*.cpp
#regtest*.obj:
# $(CXX) $(CXXFLAGS) $(CXXFLAGS_IMPORTS) /c $*.cpp
#validat*.obj:
# $(CXX) $(CXXFLAGS) $(CXXFLAGS_IMPORTS) /c $*.cpp
.cpp.obj: .cpp.obj:
$(CXX) $(CXXFLAGS) /c $< $(CXX) $(CXXFLAGS) /c $<