From 0406ce26460d2b656ddcb3ffadc325d1cc91da15 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Thu, 23 Aug 2007 12:13:55 +0000 Subject: [PATCH] Engage x86_64 assembler in Win64 build. --- ms/do_fips.bat | 97 +++++++++++++++++++++++++++++++----------------- ms/segrenam.pl | 1 + util/mk1mf.pl | 1 + util/pl/VC-32.pl | 19 ++++++++++ 4 files changed, 83 insertions(+), 35 deletions(-) diff --git a/ms/do_fips.bat b/ms/do_fips.bat index 3b5a83bb56..d82e97b673 100644 --- a/ms/do_fips.bat +++ b/ms/do_fips.bat @@ -1,8 +1,6 @@ - @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 diff --git a/ms/segrenam.pl b/ms/segrenam.pl index 8be9888787..2ab22a0459 100644 --- a/ms/segrenam.pl +++ b/ms/segrenam.pl @@ -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" ); # ################################################################# diff --git a/util/mk1mf.pl b/util/mk1mf.pl index 4fb070effb..95daff5c04 100755 --- a/util/mk1mf.pl +++ b/util/mk1mf.pl @@ -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, diff --git a/util/pl/VC-32.pl b/util/pl/VC-32.pl index e61a997de5..af3569cff3 100644 --- a/util/pl/VC-32.pl +++ b/util/pl/VC-32.pl @@ -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/) { -- 2.25.1