Updates to build system from FIPS branch. Make fipscanisterbuild work and
authorDr. Stephen Henson <steve@openssl.org>
Wed, 17 Sep 2008 15:56:42 +0000 (15:56 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 17 Sep 2008 15:56:42 +0000 (15:56 +0000)
build FIPS test programs.

Makefile.shared
apps/Makefile
crypto/Makefile
ssl/Makefile
test/Makefile

index c6006f70bf5c1d63268bbf128afd0612b3307c0c..3183436ac631b0f3593dc14e77c1d24014d0df33 100644 (file)
@@ -101,15 +101,13 @@ LINK_SO=  \
     LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
     SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
     SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
-    nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
     LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
     LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
     LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
     $${SHAREDCMD} $${SHAREDFLAGS} \
        -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
        $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
-  ) && $(SYMLINK_SO); \
-  ( $(SET_X); rm -f lib$(LIBNAME).exp )
+  ) && $(SYMLINK_SO)
 
 SYMLINK_SO=    \
        if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
@@ -202,8 +200,10 @@ link_app.bsd:
 # to use native NSModule(3) API and refers to dlfcn as termporary hack.
 link_o.darwin:
        @ $(CALC_VERSIONS); \
-       SHLIB=lib$(LIBNAME); \
-       SHLIB_SUFFIX=.so; \
+       SHLIB=`expr "$$THIS" : '.*/\([^/\.]*\)\.'`; \
+       SHLIB=$${SHLIB:-lib$(LIBNAME)}; \
+       SHLIB_SUFFIX=`expr "$$THIS" : '.*\(\.[^\.]*\)$$'`; \
+       SHLIB_SUFFIX=$${SHLIB_SUFFIX:-.so}; \
        ALLSYMSFLAGS='-all_load'; \
        NOALLSYMSFLAGS=''; \
        SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS)"; \
index 7eade4e2741bd194e32db32d58b36cd210e0cb2a..798bfc9eee80c000d605eb18ca398cb89657d53f 100644 (file)
@@ -152,10 +152,13 @@ $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
        $(RM) $(EXE)
        shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
                shlib_target="$(SHLIB_TARGET)"; \
+       elif [ -n "$(FIPSCANLIB)" ]; then \
+         FIPSLD_CC=$(CC); CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
        fi; \
        LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
+       [ "x$(FIPSCANLIB)" = "xlibfips" ] && LIBRARIES="$$LIBRARIES -lfips"; \
        $(MAKE) -f $(TOP)/Makefile.shared -e \
-               APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \
+               CC=$${CC} APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \
                LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
                link_app.$${shlib_target}
        -(cd ..; \
index 0107227d3a8ffc4331e508da385f10cd0b6ba4ee..ddecf09a81763b3b4b56fa24b2c5980d07bb6751 100644 (file)
@@ -47,7 +47,7 @@ ALL=    $(GENERAL) $(SRC) $(HEADER)
 top:
        @(cd ..; $(MAKE) DIRS=$(DIR) all)
 
-all: shared
+all: lib
 
 buildinf.h: ../Makefile
        ( echo "#ifndef MK1MF_BUILD"; \
@@ -95,7 +95,7 @@ links:
        @target=links; $(RECURSIVE_MAKE)
 
 # lib: and $(LIB): are splitted to avoid end-less loop
-lib:   $(LIB)
+lib:   buildinf.h $(LIB) subdirs
        @touch lib
 $(LIB):        $(LIBOBJ)
        $(ARX) $(LIB) $(LIBOBJ)
index cb4267f5de67bdc73bc3e291e869c99cd8a8d2c4..ba8dff90fc4ba6f4834f85bbd429c029fa8a91d4 100644 (file)
@@ -53,7 +53,7 @@ ALL=    $(GENERAL) $(SRC) $(HEADER)
 top:
        (cd ..; $(MAKE) DIRS=$(DIR) all)
 
-all:   shared
+all:   lib
 
 lib:   $(LIBOBJ)
        $(AR) $(LIB) $(LIBOBJ)
index 3e58351cb9b88d44446d20e5a5ac55cfa503c9ce..f9e6240dd06ae1e1b7feed9cf40f2437ec80e088 100644 (file)
@@ -5,7 +5,7 @@
 DIR=           test
 TOP=           ..
 CC=            cc
-INCLUDES=      -I$(TOP) -I../include $(KRB5_INCLUDES)
+INCLUDES=      -I$(TOP) -I../include $(KRB5_INCLUDES) -I$(TOP)/fips
 CFLAG=         -g
 MAKEDEPEND=    $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 PERL=          perl
@@ -27,6 +27,7 @@ DLIBCRYPTO= ../libcrypto.a
 DLIBSSL= ../libssl.a
 LIBCRYPTO= -L.. -lcrypto
 LIBSSL= -L.. -lssl
+LIBFIPS= -L.. -lfips
 
 BNTEST=                bntest
 ECTEST=                ectest
@@ -59,6 +60,18 @@ RSATEST=     rsa_test
 ENGINETEST=    enginetest
 EVPTEST=       evp_test
 IGETEST=       igetest
+FIPS_SHATEST=  fips_shatest
+FIPS_DESTEST=  fips_desmovs
+FIPS_RANDTEST= fips_randtest
+FIPS_AESTEST=  fips_aesavs
+FIPS_HMACTEST= fips_hmactest
+FIPS_RSAVTEST= fips_rsavtest
+FIPS_RSASTEST= fips_rsastest
+FIPS_RSAGTEST= fips_rsagtest
+FIPS_DSATEST=  fips_dsatest
+FIPS_DSSVS=    fips_dssvs
+FIPS_RNGVS=    fips_rngvs
+FIPS_TEST_SUITE=fips_test_suite
 
 TESTS=         alltests
 
@@ -69,7 +82,13 @@ EXE= $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT)  $(ECDSATEST)$(EXE_EXT) $(ECDHTEST)
        $(MDC2TEST)$(EXE_EXT) $(RMDTEST)$(EXE_EXT) \
        $(RANDTEST)$(EXE_EXT) $(DHTEST)$(EXE_EXT) $(ENGINETEST)$(EXE_EXT) \
        $(BFTEST)$(EXE_EXT) $(CASTTEST)$(EXE_EXT) $(SSLTEST)$(EXE_EXT) $(EXPTEST)$(EXE_EXT) $(DSATEST)$(EXE_EXT) $(RSATEST)$(EXE_EXT) \
-       $(EVPTEST)$(EXE_EXT) $(IGETEST)$(EXE_EXT)
+       $(EVPTEST)$(EXE_EXT) $(IGETEST)$(EXE_EXT) \
+       $(FIPS_SHATEST)$(EXE_EXT) $(FIPS_DESTEST)$(EXE_EXT) \
+       $(FIPS_RANDTEST)$(EXE_EXT) $(FIPS_AESTEST)$(EXE_EXT) \
+       $(FIPS_HMACTEST)$(EXE_EXT) $(FIPS_RSAVTEST)$(EXE_EXT) \
+       $(FIPS_RSASTEST)$(EXE_EXT) $(FIPS_RSAGTEST)$(EXE_EXT) \
+       $(FIPS_DSSVS)$(EXE_EXT) $(FIPS_DSATEST)$(EXE_EXT) \
+       $(FIPS_RNGVS)$(EXE_EXT) $(FIPS_TEST_SUITE)$(EXE_EXT)
 
 # $(METHTEST)$(EXE_EXT)
 
@@ -81,7 +100,12 @@ OBJ=        $(BNTEST).o $(ECTEST).o  $(ECDSATEST).o $(ECDHTEST).o $(IDEATEST).o \
        $(MDC2TEST).o $(RMDTEST).o \
        $(RANDTEST).o $(DHTEST).o $(ENGINETEST).o $(CASTTEST).o \
        $(BFTEST).o  $(SSLTEST).o  $(DSATEST).o  $(EXPTEST).o $(RSATEST).o \
-       $(EVPTEST).o $(IGETEST).o
+       $(EVPTEST).o $(IGETEST).o \
+       $(FIPS_SHATEST).o $(FIPS_DESTEST).o $(FIPS_RANDTEST).o \
+       $(FIPS_AESTEST).o $(FIPS_HMACTEST).o $(FIPS_RSAVTEST).o \
+       $(FIPS_RSASTEST).o $(FIPS_RSAGTEST).o \
+       $(FIPS_DSSVS).o $(FIPS_DSATEST).o $(FIPS_RNGVS).o $(FIPS_TEST_SUITE).o
+
 SRC=   $(BNTEST).c $(ECTEST).c  $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c \
        $(MD2TEST).c  $(MD4TEST).c $(MD5TEST).c \
        $(HMACTEST).c \
@@ -89,7 +113,11 @@ SRC=        $(BNTEST).c $(ECTEST).c  $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c \
        $(DESTEST).c $(SHATEST).c $(SHA1TEST).c $(MDC2TEST).c $(RMDTEST).c \
        $(RANDTEST).c $(DHTEST).c $(ENGINETEST).c $(CASTTEST).c \
        $(BFTEST).c  $(SSLTEST).c $(DSATEST).c   $(EXPTEST).c $(RSATEST).c \
-       $(EVPTEST).c $(IGETEST).c
+       $(EVPTEST).c $(IGETEST).c \
+       $(FIPS_SHATEST).c $(FIPS_DESTEST).c $(FIPS_RANDTEST).c \
+       $(FIPS_AESTEST).c $(FIPS_HMACTEST).c $(FIPS_RSAVTEST).c \
+       $(FIPS_RSASTEST).c $(FIPS_RSAGTEST).c \
+       $(FIPS_DSSVS).c $(FIPS_DSATEST).c $(FIPS_RNGVS).c $(FIPS_TEST_SUITE).c
 
 EXHEADER= 
 HEADER=        $(EXHEADER)
@@ -147,6 +175,9 @@ test_sha:
        ../util/shlib_wrap.sh ./$(SHA1TEST)
        ../util/shlib_wrap.sh ./$(SHA256TEST)
        ../util/shlib_wrap.sh ./$(SHA512TEST)
+       if [ -n "$(FIPSCANLIB)" ]; then \
+         ../util/shlib_wrap.sh ./$(FIPS_SHATEST) < SHAmix.req | diff -w SHAmix.fax - ; \
+       fi
 
 test_mdc2:
        ../util/shlib_wrap.sh ./$(MDC2TEST)
@@ -183,6 +214,9 @@ test_rc5:
 
 test_rand:
        ../util/shlib_wrap.sh ./$(RANDTEST)
+       if [ -n "$(FIPSCANLIB)" ]; then \
+         ../util/shlib_wrap.sh ./$(FIPS_RANDTEST); \
+       fi
 
 test_enc:
        sh ./testenc
@@ -247,6 +281,9 @@ test_dsa:
        @echo "Generate a set of DSA parameters"
        ../util/shlib_wrap.sh ./$(DSATEST)
        ../util/shlib_wrap.sh ./$(DSATEST) -app2_1
+       if [ -n "$(FIPSCANLIB)" ]; then \
+         ../util/shlib_wrap.sh ./$(FIPS_DSATEST); \
+       fi
 
 test_gen:
        @echo "Generate and verify a certificate request"
@@ -266,6 +303,9 @@ test_engine:
 test_ssl: keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
                intP1.ss intP2.ss
        @echo "test SSL protocol"
+       @if [ -n "$(FIPSCANLIB)" ]; then \
+         sh ./testfipsssl keyU.ss certU.ss certCA.ss; \
+       fi
        ../util/shlib_wrap.sh ./$(SSLTEST) -test_cipherlist
        @sh ./testssl keyU.ss certU.ss certCA.ss
        @sh ./testsslproxy keyP1.ss certP1.ss intP1.ss
@@ -302,7 +342,7 @@ dclean:
        mv -f Makefile.new $(MAKEFILE)
 
 clean:
-       rm -f .rnd tmp.bntest tmp.bctest *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE) *.ss *.srl log
+       rm -f .rnd tmp.bntest tmp.bctest *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE) *.ss *.srl log dummytest
 
 $(DLIBSSL):
        (cd ..; $(MAKE) DIRS=ssl all)
@@ -314,6 +354,7 @@ BUILD_CMD=shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
                shlib_target="$(SHLIB_TARGET)"; \
        fi; \
        LIBRARIES="$(LIBSSL) $(LIBCRYPTO) $(LIBKRB5)"; \
+       [ "$(FIPSCANLIB)" = "libfips" ] && LIBRARIES="$$LIBRARIES -lfips"; \
        $(MAKE) -f $(TOP)/Makefile.shared -e \
                APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
                LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
@@ -349,6 +390,69 @@ $(SHA256TEST)$(EXE_EXT): $(SHA256TEST).o $(DLIBCRYPTO)
 $(SHA512TEST)$(EXE_EXT): $(SHA512TEST).o $(DLIBCRYPTO)
        @target=$(SHA512TEST); $(BUILD_CMD)
 
+FIPS_BUILD_CMD=shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
+               shlib_target="$(SHLIB_TARGET)"; \
+       fi; \
+       if [ "$(FIPSCANLIB)" = "libfips" ]; then \
+               LIBRARIES="-L$(TOP) -lfips"; \
+       elif [ -n "$(FIPSCANLIB)" ]; then \
+               FIPSLD_CC=$(CC); CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
+               LIBRARIES="$${FIPSLIBDIR:-$(TOP)/fips/}fipscanister.o"; \
+       fi; \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
+               CC=$${CC} APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               link_app.$${shlib_target}
+
+FIPS_CRYPTO_BUILD_CMD=shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
+               shlib_target="$(SHLIB_TARGET)"; \
+       fi; \
+       LIBRARIES="$(LIBSSL) $(LIBCRYPTO) $(LIBKRB5)"; \
+       if [ -z "$(SHARED_LIBS)" -a -n "$(FIPSCANLIB)" ] ; then \
+               FIPSLD_CC=$(CC); CC=$(TOP)/fips/fipsld; export CC FIPSLD_CC; \
+       fi; \
+       [ "$(FIPSCANLIB)" = "libfips" ] && LIBRARIES="$$LIBRARIES -lfips"; \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
+               CC=$${CC} APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               link_app.$${shlib_target}
+
+$(FIPS_SHATEST)$(EXE_EXT): $(FIPS_SHATEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_SHATEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_AESTEST)$(EXE_EXT): $(FIPS_AESTEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_AESTEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_DESTEST)$(EXE_EXT): $(FIPS_DESTEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_DESTEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_HMACTEST)$(EXE_EXT): $(FIPS_HMACTEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_HMACTEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_RANDTEST)$(EXE_EXT): $(FIPS_RANDTEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_RANDTEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_RSAVTEST)$(EXE_EXT): $(FIPS_RSAVTEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_RSAVTEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_RSASTEST)$(EXE_EXT): $(FIPS_RSASTEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_RSASTEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_RSAGTEST)$(EXE_EXT): $(FIPS_RSAGTEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_RSAGTEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_DSATEST)$(EXE_EXT): $(FIPS_DSATEST).o $(DLIBCRYPTO)
+       @target=$(FIPS_DSATEST); $(FIPS_BUILD_CMD)
+
+$(FIPS_DSSVS)$(EXE_EXT): $(FIPS_DSSVS).o $(DLIBCRYPTO)
+       @target=$(FIPS_DSSVS); $(FIPS_BUILD_CMD)
+
+$(FIPS_RNGVS)$(EXE_EXT): $(FIPS_RNGVS).o $(DLIBCRYPTO)
+       @target=$(FIPS_RNGVS); $(FIPS_BUILD_CMD)
+
+$(FIPS_TEST_SUITE)$(EXE_EXT): $(FIPS_TEST_SUITE).o $(DLIBCRYPTO)
+       @target=$(FIPS_TEST_SUITE); $(FIPS_BUILD_CMD)
+
 $(RMDTEST)$(EXE_EXT): $(RMDTEST).o $(DLIBCRYPTO)
        @target=$(RMDTEST); $(BUILD_CMD)
 
@@ -395,7 +499,7 @@ $(METHTEST)$(EXE_EXT): $(METHTEST).o $(DLIBCRYPTO)
        @target=$(METHTEST); $(BUILD_CMD)
 
 $(SSLTEST)$(EXE_EXT): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO)
-       @target=$(SSLTEST); $(BUILD_CMD)
+       @target=$(SSLTEST); $(FIPS_CRYPTO_BUILD_CMD)
 
 $(ENGINETEST)$(EXE_EXT): $(ENGINETEST).o $(DLIBCRYPTO)
        @target=$(ENGINETEST); $(BUILD_CMD)