]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
FIPS portability patches.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 5 Feb 2007 18:42:12 +0000 (18:42 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 5 Feb 2007 18:42:12 +0000 (18:42 +0000)
Submitted by:  Brad House <brad@mainstreetsoftworks.com>

CHANGES
Configure
crypto/dso/dso_dlfcn.c
fips-1.0/fips_canister.c
fips-1.0/fipsld

diff --git a/CHANGES b/CHANGES
index 4106f0d706eb908c05f7d4cd2abfb102deb9aae4..4e53b4efe8dc554e4f7cc849c3c9e2a253f109e2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@
 
  Changes between 0.9.7l and 0.9.7m-fips2 [xx XXX xxxx]
 
+  *) FIPS portability patches.
+     [Brad House <brad@mainstreetsoftworks.com>]
+
   *) Move error strings for remaing libraries into separate files to avoid 
      unnecessary dependencies for fipscanister.o which doesn't require the
      loading of error strings.
index f001f693b4bc988b67a37c459ec23f3ad56b296a..5c186e341fa7b993b2e9025467a2e36c5f910c5f 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -460,13 +460,14 @@ my %table=(
 # SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the SCO cc.
 "sco5-cc",  "cc:-belf::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 "sco5-gcc",  "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-
+"sco6-cc",  "cc:-O::-Kpthread::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 
 # IBM's AIX.
 "aix3-cc",    "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
 "aix-gcc",    "gcc:-O3 -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR:asm/aix_ppc32.o:::::::::dlfcn:",
 "aix-cc",     "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384::-qthreaded:AIX::BN_LLONG RC4_CHAR:asm/aix_ppc32.o:::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 "aix64-cc",   "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:asm/aix_ppc64.o:::::::::dlfcn:aix-shared::-q64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
+"aix64-gcc",   "gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:asm/aix_ppc64.o:::::::::dlfcn:aix-shared::-maix64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
 
 #
 # Cray T90 and similar (SDSC)
index 0422a4859aa429770cb152979c8239b24c42a902..6974d02f22dc2c54fc171bf861e49e7d66ae3c5f 100644 (file)
@@ -294,6 +294,15 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
        return(translated);
        }
 
+/* This section uses dladdr() which appears to be a GNU extension, though
+ * some other OS's have adopted it.  Specifically, AIX4, AIX5, and SCO5
+ * do not support dladdr().
+ * No reference to DSO_pathbyaddr() is made, and appears to be a function
+ * which was added during construction of FIPS support in OpenSSL.  It appears
+ * that it has been replaced by FIPS_ref_point() in fipscanister.c
+ * Removing the below code fixes compile-time issues on the afore-mentioned
+ * OS's */
+#ifdef DEADBEEF_0
 #ifdef OPENSSL_FIPS
 static void dlfcn_ref_point(){}
 
@@ -322,4 +331,6 @@ int DSO_pathbyaddr(void *addr,char *path,int sz)
        return -1;
        }
 #endif
+#endif /* DEADBEEF_0 */
+
 #endif /* DSO_DLFCN */
index 7dec62bb64bc1b01b42747fbfd908581a16f7486..37258c4dbf71f3379530719f02209d5481f00c25 100644 (file)
@@ -77,13 +77,19 @@ static void *instruction_pointer(void)
 # elif defined(__ppc__) || defined(__powerpc) || defined(__powerpc__) || \
        defined(__POWERPC__) || defined(_POWER) || defined(__PPC__) || \
        defined(__PPC64__) || defined(__powerpc64__)
-#   define INSTRUCTION_POINTER_IMPLEMENTED
+/* GCC on AIX cannot use inline ASM since the assembler used is the
+ * native assembler, not GNU as. Prevent INSTRUCTION_POINTER_IMPLEMENTED
+ * from being defined. It will use the fallback method which is the
+ * same as xlC uses for AIX in FIPS_ref_point() */
+#   ifndef (_AIX)
+#     define INSTRUCTION_POINTER_IMPLEMENTED
     void *scratch;
     __asm __volatile ( "mfspr  %1,8\n\t"       /* save lr */
                        "bl     .+4\n\t"
                        "mfspr  %0,8\n\t"       /* mflr ret */
                        "mtspr  8,%1"           /* restore lr */
                        : "=r"(ret),"=r"(scratch) );
+#   endif /* !_AIX */
 # elif defined(__sparc) || defined(__sparc__) || defined(__sparcv9)
 #   define INSTRUCTION_POINTER_IMPLEMENTED
     void *scratch;
index d5fd785fab5bd897dcc3e063672b48231736f926..92c864ede4e20f91a454f936844a08cf0d62a478 100755 (executable)
@@ -22,6 +22,21 @@ CC=${FIPSLD_CC:-${CC}}
     [ $# -ge 1 ]
 ) && exec ${CC} "$@"
 
+# If using an auto-tooled (autoconf/automake/libtool) project,
+# configure will fail when testing the compiler or even performing
+# simple checks.  Pass-thru to compiler directly if not linking
+# to libcrypto, allowing auto-tooled applications to utilize fipsld
+# (e.g.  CC=/usr/local/ssl/bin/fipsld FIPSLD_CC=gcc ./configure && make )
+case "$*" in
+       *libcrypto.a*)
+       ;;
+       *-lcrypto*)
+       ;;
+       *)
+               exec ${CC} $*
+       ;;
+esac
+
 # Turn on debugging output?
 (   while [ "x$1" != "x" -a "x$1" != "x-DDEBUG_FINGERPRINT_PREMAIN" ]; do shift; done;
     [ $# -ge 1 ]