Commit 53ddf0cc authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

FIPS portability patches.

Submitted by:  Brad House <brad@mainstreetsoftworks.com>
parent 43df8ea9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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.
+2 −1
Original line number Diff line number Diff line
@@ -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)
+11 −0
Original line number Diff line number Diff line
@@ -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 */
+7 −1
Original line number Diff line number Diff line
@@ -77,6 +77,11 @@ static void *instruction_pointer(void)
# elif	defined(__ppc__) || defined(__powerpc) || defined(__powerpc__) || \
	defined(__POWERPC__) || defined(_POWER) || defined(__PPC__) || \
	defined(__PPC64__) || defined(__powerpc64__)
/* 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 */
@@ -84,6 +89,7 @@ static void *instruction_pointer(void)
			"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;
+15 −0
Original line number Diff line number Diff line
@@ -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 ]