Commit 0406ce26 authored by Andy Polyakov's avatar Andy Polyakov
Browse files

Engage x86_64 assembler in Win64 build.

parent 76108ba7
Loading
Loading
Loading
Loading
+62 −35
Original line number Diff line number Diff line

@echo off

SET ASMOPTS=-DOPENSSL_IA32_SSE2
SET ASM=no-asm
SET ASM=%1

if NOT X%PROCESSOR_ARCHITECTURE% == X goto defined 

@@ -25,38 +23,10 @@ echo Auto Configuring for X86

SET TARGET=VC-WIN32

if NOT x%1% == xno-asm SET ASM=nasm

goto compile

:IA64

echo Auto Configuring for IA64
SET TARGET=VC-WIN64I
perl ms\uplink.pl win64i > ms\uptable.asm
if ERRORLEVEL 1 goto error
ias -o ms\uptable.obj ms\uptable.asm
if ERRORLEVEL 1 goto error

goto compile

:AMD64

echo Auto Configuring for AMD64
SET TARGET=VC-WIN64A
perl ms\uplink.pl win64a > ms\uptable.asm
if ERRORLEVEL 1 goto error
ml64 -c -Foms\uptable.obj ms\uptable.asm
if ERRORLEVEL 1 goto error


:compile

perl Configure %TARGET% fipscanisterbuild
pause

if %ASM% == no-asm goto skipasm
if x%ASM% == xno-asm goto compile
echo Generating x86 for NASM assember
SET ASM=nasm
SET ASMOPTS=-DOPENSSL_IA32_SSE2

echo Bignum
cd crypto\bn\asm
@@ -138,7 +108,64 @@ perl x86cpuid.pl win32n %ASMOPTS% > cpu_win32.asm
if ERRORLEVEL 1 goto error
cd ..

:skipasm
goto compile

:IA64

echo Auto Configuring for IA64
SET TARGET=VC-WIN64I
perl ms\uplink.pl win64i > ms\uptable.asm
if ERRORLEVEL 1 goto error
ias -o ms\uptable.obj ms\uptable.asm
if ERRORLEVEL 1 goto error

goto compile

:AMD64

echo Auto Configuring for AMD64
SET TARGET=VC-WIN64A
perl ms\uplink.pl win64a > ms\uptable.asm
if ERRORLEVEL 1 goto error
ml64 -c -Foms\uptable.obj ms\uptable.asm
if ERRORLEVEL 1 goto error

if x%ASM% == xno-asm goto compile
echo Generating x86_64 for ML64 assember
SET ASM=ml64

echo Bignum
cd crypto\bn\asm
perl x86_64-mont.pl x86_64-mont.asm
if ERRORLEVEL 1 goto error
cd ..\..\..

echo AES
cd crypto\aes\asm
perl aes-x86_64.pl aes-x86_64.asm
if ERRORLEVEL 1 goto error
cd ..\..\..

echo SHA
cd crypto\sha\asm
perl sha1-x86_64.pl sha1-x86_64.asm
if ERRORLEVEL 1 goto error
perl sha512-x86_64.pl sha256-x86_64.asm
if ERRORLEVEL 1 goto error
perl sha512-x86_64.pl sha512-x86_64.asm
if ERRORLEVEL 1 goto error
cd ..\..\..

echo CPU-ID
cd crypto
perl x86_64cpuid.pl cpuid-x86_64.asm
if ERRORLEVEL 1 goto error
cd ..

:compile

perl Configure %TARGET% fipscanisterbuild
pause

echo on

+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ $suffix=(@ARGV[0]=~/^\$/) ? shift(@ARGV) : "\$m";
#################################################################
# rename segments in COFF modules according to %map table below	#
%map=(	".text" => "fipstx$suffix",				#
	".text\$"=> "fipstx$suffix",				#
	".rdata"=> "fipsrd$suffix",				#
	".data" => "fipsda$suffix"	);			#
#################################################################
+1 −0
Original line number Diff line number Diff line
@@ -1277,6 +1277,7 @@ sub read_options
		"no-hmac" => \$no_hmac,
		"no-asm" => \$no_asm,
		"nasm" => \$nasm,
		"ml64" => \$ml64,
		"nw-nasm" => \$nw_nasm,
		"nw-mwasm" => \$nw_mwasm,
		"gaswin" => \$gaswin,
+19 −0
Original line number Diff line number Diff line
@@ -172,6 +172,10 @@ $app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/);
if ($nasm) {
	$asm='nasmw -f win32';
	$afile='-o ';
} elsif ($ml64) {
	$asm='ml64 /c /Cp /Cx';
	$asm.=' /Zi' if $debug;
	$afile='/Fo';
} else {
	$asm='ml /Cp /coff /c /Cx';
	$asm.=" /Zi" if $debug;
@@ -187,6 +191,8 @@ $bf_enc_obj='';
$bf_enc_src='';

if (!$no_asm)
    {
    if ($FLAVOR =~ "WIN32")
	{
	$aes_asm_obj='crypto\aes\asm\a_win32.obj';
	$aes_asm_src='crypto\aes\asm\a_win32.asm';
@@ -214,6 +220,19 @@ if (!$no_asm)
	$cpuid_asm_src='crypto\cpu_win32.asm';
	$cflags.=" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
	}
    elsif ($FLAVOR =~ "WIN64A")
	{
	$aes_asm_obj='$(OBJ_D)\aes-x86_64.obj';
	$aes_asm_src='crypto\aes\asm\aes-x86_64.asm';
	$bn_asm_obj='$(OBJ_D)\x86_64-mont.obj $(OBJ_D)\bn_asm.obj';
	$bn_asm_src='crypto\bn\asm\x86_64-mont.asm';
	$sha1_asm_obj='$(OBJ_D)\sha1-x86_64.obj $(OBJ_D)\sha256-x86_64.obj $(OBJ_D)\sha512-x86_64.obj';
	$sha1_asm_src='crypto\sha\asm\sha1-x86_64.asm crypto\sha\asm\sha256-x86_64.asm crypto\sha\asm\sha512-x86_64.asm';
	$cpuid_asm_obj='$(OBJ_D)\cpuid-x86_64.obj';
	$cpuid_asm_src='crypto\cpuid-x86_64.asm';
	$cflags.=" -DOPENSSL_CPUID_OBJ -DAES_ASM -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM";
	}
    }

if ($shlib && $FLAVOR !~ /CE/)
	{