Make -DOPENSSL_FIPSSYMS work for assembly language builds.

This commit is contained in:
Dr. Stephen Henson
2011-02-17 19:03:52 +00:00
parent 38bae7baa5
commit 5d439d6955
4 changed files with 30 additions and 6 deletions

View File

@@ -6,8 +6,9 @@
*) Add experimental option FIPSSYMS to give all symbols in *) Add experimental option FIPSSYMS to give all symbols in
fipscanister.o and FIPS or fips prefix. This will avoid fipscanister.o and FIPS or fips prefix. This will avoid
conflicts with future versions of OpenSSL. Only works for conflicts with future versions of OpenSSL. Add perl script
no-asm at present. util/fipsas.pl to preprocess assembly language source files
and rename any affected symbols.
[Steve Henson] [Steve Henson]
*) Add selftest checks and algorithm block of non-fips algorithms in *) Add selftest checks and algorithm block of non-fips algorithms in

View File

@@ -78,7 +78,7 @@ LIBDIR=lib
# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
# gcc, then the driver will automatically translate it to -xarch=v8plus # gcc, then the driver will automatically translate it to -xarch=v8plus
# and pass it down to assembler. # and pass it down to assembler.
AS=$(CC) -c #AS=$(CC) -c
ASFLAG=$(CFLAG) ASFLAG=$(CFLAG)
# For x86 assembler: Set PROCESSOR to 386 if you want to support # For x86 assembler: Set PROCESSOR to 386 if you want to support
@@ -205,7 +205,7 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
CC='$(CC)' CFLAG='$(CFLAG)' \ CC='$(CC)' CFLAG='$(CFLAG)' \
AS='$(CC)' ASFLAG='$(CFLAG) -c' \ ASFLAG='$(CFLAG) -c' \
AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \ AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
CROSS_COMPILE='$(CROSS_COMPILE)' \ CROSS_COMPILE='$(CROSS_COMPILE)' \
PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \ PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \
@@ -367,6 +367,11 @@ build_crypto:
else \ else \
ARX='${AR}' ; \ ARX='${AR}' ; \
fi ; export ARX ; \ fi ; export ARX ; \
if [ $(FIPSCANISTERINTERNAL) = "y" ]; then \
AS='$(PERL) $${TOP}/util/fipsas.pl $${TOP} $${<} $(CC)' ; \
else \
AS='$(CC) -c' ; \
fi ; export AS ; \
dir=crypto; target=all; $(BUILD_ONE_CMD) dir=crypto; target=all; $(BUILD_ONE_CMD)
build_ssl: build_ssl:
@dir=ssl; target=all; $(BUILD_ONE_CMD) @dir=ssl; target=all; $(BUILD_ONE_CMD)

View File

@@ -78,7 +78,7 @@ LIBDIR=lib
# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
# gcc, then the driver will automatically translate it to -xarch=v8plus # gcc, then the driver will automatically translate it to -xarch=v8plus
# and pass it down to assembler. # and pass it down to assembler.
AS=$(CC) -c #AS=$(CC) -c
ASFLAG=$(CFLAG) ASFLAG=$(CFLAG)
# For x86 assembler: Set PROCESSOR to 386 if you want to support # For x86 assembler: Set PROCESSOR to 386 if you want to support
@@ -205,7 +205,7 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS} \
BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
CC='$(CC)' CFLAG='$(CFLAG)' \ CC='$(CC)' CFLAG='$(CFLAG)' \
AS='$(CC)' ASFLAG='$(CFLAG) -c' \ ASFLAG='$(CFLAG) -c' \
AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \ AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
CROSS_COMPILE='$(CROSS_COMPILE)' \ CROSS_COMPILE='$(CROSS_COMPILE)' \
PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \ PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \
@@ -367,6 +367,11 @@ build_crypto:
else \ else \
ARX='${AR}' ; \ ARX='${AR}' ; \
fi ; export ARX ; \ fi ; export ARX ; \
if [ $(FIPSCANISTERINTERNAL) = "y" ]; then \
AS='$(PERL) $${TOP}/util/fipsas.pl $${TOP} $${<} $(CC) -c' ; \
else \
AS='$(CC) -c' ; \
fi ; export AS ; \
dir=crypto; target=all; $(BUILD_ONE_CMD) dir=crypto; target=all; $(BUILD_ONE_CMD)
build_ssl: build_ssl:
@dir=ssl; target=all; $(BUILD_ONE_CMD) @dir=ssl; target=all; $(BUILD_ONE_CMD)

View File

@@ -9,6 +9,19 @@ my @ARGS = @ARGV;
my $top = shift @ARGS; my $top = shift @ARGS;
my $target = shift @ARGS; my $target = shift @ARGS;
# HACK to disable operation if no OPENSSL_FIPSSYMS option.
# will go away when tested more fully.
my $enabled = 0;
foreach (@ARGS) { $enabled = 1 if /-DOPENSSL_FIPSSYMS/ ; }
if ($enabled == 0)
{
system @ARGS;
exit $?
}
# Open symbol rename file. # Open symbol rename file.
open(IN, "$top/fips/fipssyms.h") || die "Can't open fipssyms.h"; open(IN, "$top/fips/fipssyms.h") || die "Can't open fipssyms.h";