summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2012-10-29 22:26:27 +0000
committerAndy Polyakov <appro@openssl.org>2012-10-29 22:26:27 +0000
commit9abbb6aa89f16192bb1a10fd1216ee480e79ba76 (patch)
tree38ab8d955d31e3c8dcd55d5be13396e02d8b258d
parent3b4f1f302dd1d3a8b71d82bf3900802945a0b431 (diff)
Cumulative updates from HEAD.
-rw-r--r--e_os.h8
-rw-r--r--fips/sha/Makefile3
-rw-r--r--test/Makefile1
-rw-r--r--util/fipslink.pl45
-rwxr-xr-xutil/mk1mf.pl6
-rw-r--r--util/pl/VC-32.pl19
6 files changed, 52 insertions, 30 deletions
diff --git a/e_os.h b/e_os.h
index 6fec78d5ee..efe58fb97e 100644
--- a/e_os.h
+++ b/e_os.h
@@ -306,7 +306,7 @@ static unsigned int _strlen31(const char *str)
# undef isupper
# undef isxdigit
# endif
-# if defined(_MSC_VER) && !defined(_DLL) && defined(stdin)
+# if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(_DLL) && defined(stdin)
# if _MSC_VER>=1300
# undef stdin
# undef stdout
@@ -332,8 +332,10 @@ static unsigned int _strlen31(const char *str)
# endif
# endif
# endif
-# include <io.h>
-# include <fcntl.h>
+# if !defined(OPENSSL_FIPSCANISTER)
+# include <io.h>
+# include <fcntl.h>
+# endif
# ifdef OPENSSL_SYS_WINCE
# define OPENSSL_NO_POSIX_IO
diff --git a/fips/sha/Makefile b/fips/sha/Makefile
index 9bc598301f..0878e7bf64 100644
--- a/fips/sha/Makefile
+++ b/fips/sha/Makefile
@@ -30,7 +30,8 @@ LIB=$(TOP)/libcrypto.a
LIBSRC=fips_sha1_selftest.c
LIBOBJ=fips_sha1_selftest.o
-SRC= $(LIBSRC) fips_standalone_sha1.c
+SRC= $(LIBSRC)
+PROGS= fips_standalone_sha1.c
EXHEADER=
HEADER=
diff --git a/test/Makefile b/test/Makefile
index 2fcc78d46a..3f9770663b 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -12,6 +12,7 @@ PERL= perl
# KRB5 stuff
KRB5_INCLUDES=
LIBKRB5=
+TEST= fips_algvs.c
PEX_LIBS=
EX_LIBS= #-lnsl -lsocket
diff --git a/util/fipslink.pl b/util/fipslink.pl
index 331c456878..0f87f7dbc9 100644
--- a/util/fipslink.pl
+++ b/util/fipslink.pl
@@ -27,33 +27,30 @@ if (exists $ENV{"PREMAIN_DSO_EXE"})
$fips_premain_dso = "";
}
-my $fips_sig = $ENV{"FIPS_SIG"};
-if (defined $fips_sig)
- {
- if ($fips_premain_dso ne "")
- {
- $fips_premain_dso = "$fips_sig -dso";
- }
- else
- {
- $fips_premain_dso = "$fips_sig -exe";
- }
- }
-
check_hash($sha1_exe, "fips_premain.c");
check_hash($sha1_exe, "fipscanister.lib");
print "Integrity check OK\n";
-print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n";
-system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c";
-die "First stage Compile failure" if $? != 0;
+if (is_premain_linked(@ARGV)) {
+ print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n";
+ system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c";
+ die "First stage Compile failure" if $? != 0;
+} elsif (!defined($ENV{FIPS_SIG})) {
+ die "no fips_premain.obj linked";
+}
print "$fips_link @ARGV\n";
system "$fips_link @ARGV";
die "First stage Link failure" if $? != 0;
+if (defined($ENV{FIPS_SIG})) {
+ print "$ENV{FIPS_SIG} $fips_target\n";
+ system "$ENV{FIPS_SIG} $fips_target";
+ die "$ENV{FIPS_SIG} $fips_target failed" if $? != 0;
+ exit;
+}
print "$fips_premain_dso $fips_target\n";
system("$fips_premain_dso $fips_target >$fips_target.sha1");
@@ -74,6 +71,22 @@ print "$fips_link @ARGV\n";
system "$fips_link @ARGV";
die "Second stage Link failure" if $? != 0;
+sub is_premain_linked
+ {
+ return 1 if (grep /fips_premain\.obj/,@_);
+ foreach (@_)
+ {
+ if (/^@(.*)/ && -f $1)
+ {
+ open FD,$1 or die "can't open $1";
+ my $ret = (grep /fips_premain\.obj/,<FD>)?1:0;
+ close FD;
+ return $ret;
+ }
+ }
+ return 0;
+ }
+
sub check_hash
{
my ($sha1_exe, $filename) = @_;
diff --git a/util/mk1mf.pl b/util/mk1mf.pl
index 2325607e8f..8934ababa1 100755
--- a/util/mk1mf.pl
+++ b/util/mk1mf.pl
@@ -864,13 +864,13 @@ if ($fips)
}
$rules.=&cc_compile_target("\$(OBJ_D)${o}fips_standalone_sha1$obj",
"fips${o}sha${o}fips_standalone_sha1.c",
- "\$(SHLIB_CFLAGS)");
+ "\$(APP_CFLAGS)");
$rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
"fips${o}fips_premain.c",
- "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)");
+ "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(APP_CFLAGS)");
$rules.=&cc_compile_target("\$(OBJ_D)${o}fips_algvs$obj",
"test${o}fips_algvs.c",
- "\$(SHLIB_CFLAGS)");
+ "\$(APP_CFLAGS)");
}
foreach (values %lib_nam)
diff --git a/util/pl/VC-32.pl b/util/pl/VC-32.pl
index aef3de23ea..85299cccbc 100644
--- a/util/pl/VC-32.pl
+++ b/util/pl/VC-32.pl
@@ -49,8 +49,7 @@ if ($FLAVOR =~ /WIN64/)
# considered safe to ignore.
#
$base_cflags= " $mf_cflag";
- my $f = $shlib?' /MD':' /MT';
- $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
+ my $f = ($shlib and !$fipscanisterbuild)?' /MD':' /MT';
$opt_cflags=$f.' /Ox';
$dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
$lflags="/nologo /subsystem:console /opt:ref";
@@ -127,19 +126,24 @@ elsif ($FLAVOR =~ /CE/)
$base_cflags.=" $wcecdefs";
$base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'}));
$base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'}));
- $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics...
- $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG';
+ if (`cl 2>&1` =~ /Version 1[4-9]\./) {
+ $base_cflags.=($shlib and !$fipscanisterbuild)?' /MD':' /MT';
+ } else {
+ $base_cflags.=' /MC';
+ }
+ $opt_cflags=' /O1i'; # optimize for space, but with intrinsics...
+ $dbg_clfags=' /Od -DDEBUG -D_DEBUG';
$lflags="/nologo /opt:ref $wcelflag";
}
else # Win32
{
$base_cflags= " $mf_cflag";
- my $f = $shlib?' /MD':' /MT';
- $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
+ my $f = ($shlib and !$fipscanisterbuild)?' /MD':' /MT';
$opt_cflags=$f.' /Ox /O2 /Ob2';
$dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
$lflags="/nologo /subsystem:console /opt:ref";
}
+$lib_cflag='/Zl' if (!$shlib or $fipscanisterbuild); # remove /DEFAULTLIBs
$mlflags='';
$out_def ="out32"; $out_def.="dll" if ($shlib);
@@ -284,7 +288,8 @@ elsif ($shlib && $FLAVOR =~ /CE/)
{
$mlflags.=" $lflags /dll";
$lflags.=' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'}));
- $lib_cflag.=" -D_WINDLL -D_DLL";
+ $lib_cflag.=" -D_WINDLL";
+ $lib_cflag.=" -D_DLL" if (!$fipscanisterbuild);
}
sub do_lib_rule