Add crossbuild patch to 1.2 FIPS branch. OpenSSL-fips-1_2_1
authorDr. Stephen Henson <steve@openssl.org>
Sun, 25 Sep 2011 15:51:57 +0000 (15:51 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 25 Sep 2011 15:51:57 +0000 (15:51 +0000)
Configure
Makefile.org
apps/Makefile
config
fips/fipsld
fips/sha/Makefile

index 1997020984ca0a8e91d6b7ca77c1b255738c57c3..92667a8c0b1679e2592efa3b83565d096188d93b 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -566,7 +566,8 @@ my $idx_arflags = $idx++;
 my $prefix="";
 my $openssldir="";
 my $exe_ext="";
-my $install_prefix="";
+my $install_prefix="$ENV{'INSTALL_PREFIX'}";
+my $cross_compile_prefix="$ENV{'CROSS_COMPILE'}";
 my $fipslibdir="/usr/local/ssl/lib/fips-1.0/";
 my $nofipscanistercheck=0;
 my $fipsdso=0;
@@ -1397,7 +1398,16 @@ while (<IN>)
        s/^PLATFORM=.*$/PLATFORM=$target/;
        s/^OPTIONS=.*$/OPTIONS=$options/;
        s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
-       s/^CC=.*$/CC= $cc/;
+       if ($cross_compile_prefix)
+               {
+               s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$cc/;
+               s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
+               s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;
+               }
+       else    {
+               s/^CC=.*$/CC= $cc/;
+               s/^RANLIB=.*/RANLIB= $ranlib/;
+               }
        s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
        s/^CFLAG=.*$/CFLAG= $cflags/;
        s/^DEPFLAG=.*$/DEPFLAG= $depflags/;
@@ -1416,7 +1426,6 @@ while (<IN>)
        s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
        s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
        s/^PROCESSOR=.*/PROCESSOR= $processor/;
-       s/^RANLIB=.*/RANLIB= $ranlib/;
        s/^ARFLAGS=.*/ARFLAGS= $arflags/;
        s/^PERL=.*/PERL= $perl/;
        s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
index d77a3e8762c37973a6103571de81d823036fe315..5b60bb1a26f6edb937a1b995817da41070e76ca7 100644 (file)
@@ -512,12 +512,14 @@ dclean:
        @set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
 
 rehash: rehash.time
-rehash.time: certs
-       @(OPENSSL="`pwd`/util/opensslwrap.sh"; \
-         OPENSSL_DEBUG_MEMORY=on; \
-         export OPENSSL OPENSSL_DEBUG_MEMORY; \
-         $(PERL) tools/c_rehash certs)
-       touch rehash.time
+rehash.time: certs apps
+       @if [ -z "$(CROSS_COMPILE)" ]; then \
+               (OPENSSL="`pwd`/util/opensslwrap.sh"; \
+               OPENSSL_DEBUG_MEMORY=on; \
+               export OPENSSL OPENSSL_DEBUG_MEMORY; \
+               $(PERL) tools/c_rehash certs) && \
+               touch rehash.time; \
+       else :; fi
 
 test:   tests
 
index e00e7a6cc56f61dc4d394a6bfba25535dc1584e3..3aef7fb07b16258db17f1c19daba5aa9fee6d215 100644 (file)
@@ -153,17 +153,14 @@ $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
        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; \
+         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 \
-               CC=$${CC} 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 ..; \
-         OPENSSL="`pwd`/util/opensslwrap.sh"; export OPENSSL; \
-         $(PERL) tools/c_rehash certs)
 
 progs.h: progs.pl
        $(PERL) progs.pl $(E_EXE) >progs.h
diff --git a/config b/config
index 28b52acdc67d3965055c3d8e24f3982f9f3a1c2e..91231f98f0dc91348b8f5160622b922d416e39c9 100755 (executable)
--- a/config
+++ b/config
@@ -48,10 +48,10 @@ done
 
 # First get uname entries that we use below
 
-MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
-RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
-SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown"
-VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
+[ "$MACHINE" ] || MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown"
+[ "$RELEASE" ] || RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown"
+[ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null`  || SYSTEM="unknown"
+[ "$BUILD" ] || VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown"
 
 
 # Now test for ISC and SCO, since it is has a braindamaged uname.
index c71d4d95a5fba9ba1d6b9c42ebf07cf27b62d3ad..8c26c8596dec1f1e85b5c100f17fbadfdc083ecf 100755 (executable)
@@ -117,7 +117,11 @@ lib*|*.dll)        # must be linking a shared lib...
                ${_WL_PREMAIN} "$@"
 
        # generate signature...
-       SIG=`"${THERE}/fips/fips_premain_dso" "${TARGET}"`
+       if [ -z "${FIPS_SIG}" ]; then
+               SIG=`"${THERE}/fips/fips_premain_dso" "${TARGET}"`
+       else
+               SIG=`"${FIPS_SIG}" -dso "${TARGET}"`
+       fi
        /bin/rm -f "${TARGET}"
        if [ -z "${SIG}" ]; then
           echo "unable to collect signature"; exit 1
@@ -156,7 +160,11 @@ lib*|*.dll)        # must be linking a shared lib...
                ${_WL_PREMAIN} "$@"
 
        # generate signature...
-       SIG=`"${TARGET}"`
+       if [ -z "${FIPS_SIG}" ]; then
+               SIG=`"${TARGET}"`
+       else
+               SIG=`"${FIPS_SIG}" -exe "${TARGET}"`
+       fi
        /bin/rm -f "${TARGET}"
        if [ -z "${SIG}" ]; then
           echo "unable to collect signature"; exit 1
index ba8eb02bafa66cf1e9317639eeb40b50d67fd74e..5304e50920f48a6c10b3b2e9e0ee6c556b2e3d50 100644 (file)
@@ -47,8 +47,12 @@ lib: $(LIBOBJ)
        @echo $(LIBOBJ) > lib
 
 ../fips_standalone_sha1$(EXE_EXT): fips_standalone_sha1.o
+       if [ -z "$(HOSTCC)" ] ; then \
        FIPS_SHA_ASM=""; for i in $(SHA1_ASM_OBJ) sha1dgst.o ; do FIPS_SHA_ASM="$$FIPS_SHA_ASM ../../crypto/sha/$$i" ; done; \
-       $(CC) -o $@ $(CFLAGS) fips_standalone_sha1.o $$FIPS_SHA_ASM
+       $(CC) -o $@ $(CFLAGS) fips_standalone_sha1.o $$FIPS_SHA_ASM ; \
+       else \
+               $(HOSTCC) $(HOSTCFLAGS) -o $ $@ -I../../include -I../../crypto fips_standalone_sha1.c ../../crypto/sha/sha1dgst.c ; \
+       fi
 
 files:
        $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO