aboutsummaryrefslogtreecommitdiff
path: root/openssl/ms
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-03-30 12:36:28 +0000
committermarha <marha@users.sourceforge.net>2010-03-30 12:36:28 +0000
commitff48c0d9098080b51ea12710029135916d117806 (patch)
tree96e6af9caf170ba21a1027b24e306a07e27d7b75 /openssl/ms
parentbb731f5ac92655c4860a41fa818a7a63005f8369 (diff)
downloadvcxsrv-ff48c0d9098080b51ea12710029135916d117806.tar.gz
vcxsrv-ff48c0d9098080b51ea12710029135916d117806.tar.bz2
vcxsrv-ff48c0d9098080b51ea12710029135916d117806.zip
svn merge -r514:HEAD ^/branches/released .
Diffstat (limited to 'openssl/ms')
-rw-r--r--openssl/ms/README2
-rw-r--r--openssl/ms/do_fips.bat204
-rw-r--r--openssl/ms/do_masm.bat74
-rw-r--r--openssl/ms/do_ms.bat20
-rw-r--r--openssl/ms/do_nasm.bat72
-rw-r--r--openssl/ms/mingw32.bat6
-rw-r--r--openssl/ms/mw.bat52
-rw-r--r--openssl/ms/segrenam.pl65
-rw-r--r--openssl/ms/test.bat5
-rw-r--r--openssl/ms/uplink-common.pl22
-rw-r--r--openssl/ms/uplink-ia64.pl50
-rw-r--r--openssl/ms/uplink-x86.pl33
-rw-r--r--openssl/ms/uplink-x86_64.pl64
-rw-r--r--openssl/ms/x86asm.bat30
14 files changed, 220 insertions, 479 deletions
diff --git a/openssl/ms/README b/openssl/ms/README
index 7a45db108..07f1925d5 100644
--- a/openssl/ms/README
+++ b/openssl/ms/README
@@ -4,7 +4,7 @@ to build with visual C++ 4.[01].
The results will be in the out directory.
-These makefiles and def files were generated my typing
+These makefiles and def files were generated by typing
perl util\mk1mf.pl VC-NT >ms/nt.mak
perl util\mk1mf.pl VC-NT dll >ms/ntdll.mak
diff --git a/openssl/ms/do_fips.bat b/openssl/ms/do_fips.bat
deleted file mode 100644
index 8d27eb05b..000000000
--- a/openssl/ms/do_fips.bat
+++ /dev/null
@@ -1,204 +0,0 @@
-@echo off
-
-SET ASM=%1
-
-if NOT X%PROCESSOR_ARCHITECTURE% == X goto defined
-
-echo Processor Architecture Undefined: defaulting to X86
-
-goto X86
-
-:defined
-
-if %PROCESSOR_ARCHITECTURE% == x86 goto X86
-
-if %PROCESSOR_ARCHITECTURE% == IA64 goto IA64
-
-if %PROCESSOR_ARCHITECTURE% == AMD64 goto AMD64
-
-echo Processor Architecture Unrecognized: defaulting to X86
-
-:X86
-echo Auto Configuring for X86
-
-SET TARGET=VC-WIN32
-
-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
-perl bn-586.pl win32n %ASMOPTS% > bn_win32.asm
-if ERRORLEVEL 1 goto error
-perl co-586.pl win32n %ASMOPTS% > co_win32.asm
-if ERRORLEVEL 1 goto error
-perl mo-586.pl win32n %ASMOPTS% > mt_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo AES
-cd crypto\aes\asm
-perl aes-586.pl win32n %ASMOPTS% > a_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo DES
-cd crypto\des\asm
-perl des-586.pl win32n %ASMOPTS% > d_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo "crypt(3)"
-
-cd crypto\des\asm
-perl crypt586.pl win32n %ASMOPTS% > y_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo Blowfish
-
-cd crypto\bf\asm
-perl bf-586.pl win32n %ASMOPTS% > b_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo CAST5
-cd crypto\cast\asm
-perl cast-586.pl win32n %ASMOPTS% > c_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo RC4
-cd crypto\rc4\asm
-perl rc4-586.pl win32n %ASMOPTS% > r4_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo MD5
-cd crypto\md5\asm
-perl md5-586.pl win32n %ASMOPTS% > m5_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo SHA1
-cd crypto\sha\asm
-perl sha1-586.pl win32n %ASMOPTS% > s1_win32.asm
-if ERRORLEVEL 1 goto error
-perl sha512-sse2.pl win32n %ASMOPTS% > sha512-sse2.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo RIPEMD160
-cd crypto\ripemd\asm
-perl rmd-586.pl win32n %ASMOPTS% > rm_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo RC5\32
-cd crypto\rc5\asm
-perl rc5-586.pl win32n %ASMOPTS% > r5_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..\..\..
-
-echo CPU-ID
-cd crypto
-perl x86cpuid.pl win32n %ASMOPTS% > cpu_win32.asm
-if ERRORLEVEL 1 goto error
-cd ..
-
-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
-
-perl util\mkfiles.pl >MINFO
-@if ERRORLEVEL 1 goto error
-perl util\mk1mf.pl dll %ASM% %TARGET% >ms\ntdll.mak
-@if ERRORLEVEL 1 goto error
-
-perl util\mkdef.pl 32 libeay > ms\libeay32.def
-@if ERRORLEVEL 1 goto error
-perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
-@if ERRORLEVEL 1 goto error
-
-nmake -f ms\ntdll.mak clean
-nmake -f ms\ntdll.mak
-@if ERRORLEVEL 1 goto error
-
-@echo.
-@echo.
-@echo.
-@echo ***************************
-@echo ****FIPS BUILD SUCCESS*****
-@echo ***************************
-
-@goto end
-
-:error
-
-@echo.
-@echo.
-@echo.
-@echo ***************************
-@echo ****FIPS BUILD FAILURE*****
-@echo ***************************
-
-:end
diff --git a/openssl/ms/do_masm.bat b/openssl/ms/do_masm.bat
deleted file mode 100644
index a8575321f..000000000
--- a/openssl/ms/do_masm.bat
+++ /dev/null
@@ -1,74 +0,0 @@
-@SET ASMOPTS=-DOPENSSL_IA32_SSE2
-@echo Generating x86 for MASM assember
-
-@echo Bignum
-@cd crypto\bn\asm
-@perl bn-586.pl win32 %ASMOPTS% > bn_win32.asm
-@perl co-586.pl win32 %ASMOPTS% > co_win32.asm
-@perl mo-586.pl win32 %ASMOPTS% > mt_win32.asm
-@cd ..\..\..
-
-@echo AES
-@cd crypto\aes\asm
-@perl aes-586.pl win32 %ASMOPTS% > a_win32.asm
-@cd ..\..\..
-
-@echo DES
-@cd crypto\des\asm
-@perl des-586.pl win32 %ASMOPTS% > d_win32.asm
-@cd ..\..\..
-
-@echo "crypt(3)"
-
-@cd crypto\des\asm
-@perl crypt586.pl win32 %ASMOPTS% > y_win32.asm
-@cd ..\..\..
-
-@echo Blowfish
-
-@cd crypto\bf\asm
-@perl bf-586.pl win32 %ASMOPTS% > b_win32.asm
-@cd ..\..\..
-
-@echo CAST5
-@cd crypto\cast\asm
-@perl cast-586.pl win32 %ASMOPTS% > c_win32.asm
-@cd ..\..\..
-
-@echo RC4
-@cd crypto\rc4\asm
-@perl rc4-586.pl win32 %ASMOPTS% > r4_win32.asm
-@cd ..\..\..
-
-@echo MD5
-@cd crypto\md5\asm
-@perl md5-586.pl win32 %ASMOPTS% > m5_win32.asm
-@cd ..\..\..
-
-@echo SHA1
-@cd crypto\sha\asm
-@perl sha1-586.pl win32 %ASMOPTS% > s1_win32.asm
-@perl sha512-sse2.pl win32 %ASMOPTS% > sha512-sse2.asm
-@cd ..\..\..
-
-@echo RIPEMD160
-@cd crypto\ripemd\asm
-@perl rmd-586.pl win32 %ASMOPTS% > rm_win32.asm
-@cd ..\..\..
-
-@echo RC5\32
-@cd crypto\rc5\asm
-@perl rc5-586.pl win32 %ASMOPTS% > r5_win32.asm
-@cd ..\..\..
-
-@echo CPU-ID
-@cd crypto
-@perl x86cpuid.pl win32 %ASMOPTS% > cpu_win32.asm
-@cd ..
-
-perl util\mkfiles.pl >MINFO
-perl util\mk1mf.pl VC-WIN32 >ms\nt.mak
-perl util\mk1mf.pl dll VC-WIN32 >ms\ntdll.mak
-
-perl util\mkdef.pl 32 libeay > ms\libeay32.def
-perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
diff --git a/openssl/ms/do_ms.bat b/openssl/ms/do_ms.bat
index 9323336f9..55014d3fc 100644
--- a/openssl/ms/do_ms.bat
+++ b/openssl/ms/do_ms.bat
@@ -1,9 +1,11 @@
-
-perl util\mkfiles.pl >MINFO
-perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak
-perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak
-perl util\mk1mf.pl no-asm VC-CE >ms\ce.mak
-perl util\mk1mf.pl dll no-asm VC-CE >ms\cedll.mak
-
-perl util\mkdef.pl 32 libeay > ms\libeay32.def
-perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
+
+perl util\mkfiles.pl >MINFO
+perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak
+perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak
+if x%OSVERSION% == x goto skipce
+perl util\mk1mf.pl no-asm VC-CE >ms\ce.mak
+perl util\mk1mf.pl dll no-asm VC-CE >ms\cedll.mak
+:skipce
+
+perl util\mkdef.pl 32 libeay > ms\libeay32.def
+perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
diff --git a/openssl/ms/do_nasm.bat b/openssl/ms/do_nasm.bat
index 7656c498d..7b3f3edbf 100644
--- a/openssl/ms/do_nasm.bat
+++ b/openssl/ms/do_nasm.bat
@@ -1,76 +1,4 @@
-@echo off
-
-SET ASMOPTS=-DOPENSSL_IA32_SSE2
-echo Generating x86 for NASM assember
-
-echo Bignum
-cd crypto\bn\asm
-perl bn-586.pl win32n %ASMOPTS% > bn_win32.asm
-perl co-586.pl win32n %ASMOPTS% > co_win32.asm
-perl mo-586.pl win32n %ASMOPTS% > mt_win32.asm
-cd ..\..\..
-
-echo AES
-cd crypto\aes\asm
-perl aes-586.pl win32n %ASMOPTS% > a_win32.asm
-cd ..\..\..
-
-echo DES
-cd crypto\des\asm
-perl des-586.pl win32n %ASMOPTS% > d_win32.asm
-cd ..\..\..
-
-echo "crypt(3)"
-
-cd crypto\des\asm
-perl crypt586.pl win32n %ASMOPTS% > y_win32.asm
-cd ..\..\..
-
-echo Blowfish
-
-cd crypto\bf\asm
-perl bf-586.pl win32n %ASMOPTS% > b_win32.asm
-cd ..\..\..
-
-echo CAST5
-cd crypto\cast\asm
-perl cast-586.pl win32n %ASMOPTS% > c_win32.asm
-cd ..\..\..
-
-echo RC4
-cd crypto\rc4\asm
-perl rc4-586.pl win32n %ASMOPTS% > r4_win32.asm
-cd ..\..\..
-
-echo MD5
-cd crypto\md5\asm
-perl md5-586.pl win32n %ASMOPTS% > m5_win32.asm
-cd ..\..\..
-
-echo SHA1
-cd crypto\sha\asm
-perl sha1-586.pl win32n %ASMOPTS% > s1_win32.asm
-perl sha512-sse2.pl win32n %ASMOPTS% > sha512-sse2.asm
-cd ..\..\..
-
-echo RIPEMD160
-cd crypto\ripemd\asm
-perl rmd-586.pl win32n %ASMOPTS% > rm_win32.asm
-cd ..\..\..
-
-echo RC5\32
-cd crypto\rc5\asm
-perl rc5-586.pl win32n %ASMOPTS% > r5_win32.asm
-cd ..\..\..
-
-echo CPU-ID
-cd crypto
-perl x86cpuid.pl win32n %ASMOPTS% > cpu_win32.asm
-cd ..
-
-echo on
-
perl util\mkfiles.pl >MINFO
perl util\mk1mf.pl nasm VC-WIN32 >ms\nt.mak
perl util\mk1mf.pl dll nasm VC-WIN32 >ms\ntdll.mak
diff --git a/openssl/ms/mingw32.bat b/openssl/ms/mingw32.bat
index f9377a869..06b573387 100644
--- a/openssl/ms/mingw32.bat
+++ b/openssl/ms/mingw32.bat
@@ -60,10 +60,6 @@ echo RC5\32
cd crypto\rc5\asm
perl rc5-586.pl gaswin > r5-win32.s
cd ..\..\..
-echo CPUID
-cd crypto
-perl x86cpuid.pl gaswin > cpu-win32.s
-cd ..
:noasm
@@ -83,7 +79,7 @@ mingw32-make -f ms/mingw32a.mak
if errorlevel 1 goto end
echo Generating the DLLs and input libraries
-dllwrap --dllname libeay32.dll --output-lib out/libeay32.a --def ms/libeay32.def out/libcrypto.a -lwsock32 -lgdi32
+dllwrap --dllname libeay32.dll --output-lib out/libeay32.a --def ms/libeay32.def out/libcrypto.a -lws2_32 -lgdi32
if errorlevel 1 goto end
dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a
if errorlevel 1 goto end
diff --git a/openssl/ms/mw.bat b/openssl/ms/mw.bat
index c5ccd693e..35e00a450 100644
--- a/openssl/ms/mw.bat
+++ b/openssl/ms/mw.bat
@@ -1,26 +1,26 @@
-@rem OpenSSL with Mingw32
-@rem --------------------
-
-@rem Makefile
-perl util\mkfiles.pl >MINFO
-perl util\mk1mf.pl Mingw32 >ms\mingw32.mak
-@rem DLL definition files
-perl util\mkdef.pl 32 libeay >ms\libeay32.def
-if errorlevel 1 goto end
-perl util\mkdef.pl 32 ssleay >ms\ssleay32.def
-if errorlevel 1 goto end
-
-@rem Build the libraries
-make -f ms/mingw32.mak
-if errorlevel 1 goto end
-
-@rem Generate the DLLs and input libraries
-dllwrap --dllname libeay32.dll --output-lib out/libeay32.a --def ms/libeay32.def out/libcrypto.a -lwsock32 -lgdi32
-if errorlevel 1 goto end
-dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a
-if errorlevel 1 goto end
-
-echo Done compiling OpenSSL
-
-:end
-
+@rem OpenSSL with Mingw32
+@rem --------------------
+
+@rem Makefile
+perl util\mkfiles.pl >MINFO
+perl util\mk1mf.pl Mingw32 >ms\mingw32.mak
+@rem DLL definition files
+perl util\mkdef.pl 32 libeay >ms\libeay32.def
+if errorlevel 1 goto end
+perl util\mkdef.pl 32 ssleay >ms\ssleay32.def
+if errorlevel 1 goto end
+
+@rem Build the libraries
+make -f ms/mingw32.mak
+if errorlevel 1 goto end
+
+@rem Generate the DLLs and input libraries
+dllwrap --dllname libeay32.dll --output-lib out/libeay32.a --def ms/libeay32.def out/libcrypto.a -lws2_32 -lgdi32
+if errorlevel 1 goto end
+dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a
+if errorlevel 1 goto end
+
+echo Done compiling OpenSSL
+
+:end
+
diff --git a/openssl/ms/segrenam.pl b/openssl/ms/segrenam.pl
deleted file mode 100644
index 2ab22a045..000000000
--- a/openssl/ms/segrenam.pl
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env perl
-
-my $quiet = 1;
-
-unpack("L",pack("N",1))!=1 || die "only little-endian hosts are supported";
-
-# first argument can specify custom suffix...
-$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" ); #
-#################################################################
-
-# collect file list
-foreach (@ARGV) {
- if (/\*/) { push(@files,glob($_)); }
- else { push(@files,$_); }
-}
-
-use Fcntl;
-use Fcntl ":seek";
-
-foreach (@files) {
- $file=$_;
- print "processing $file\n" unless $quiet;
-
- sysopen(FD,$file,O_RDWR|O_BINARY) || die "sysopen($file): $!";
-
- # read IMAGE_DOS_HEADER
- sysread(FD,$mz,64)==64 || die "$file is too short";
- @dos_header=unpack("a2C58I",$mz);
- if (@dos_header[0] eq "MZ") {
- $e_lfanew=pop(@dos_header);
- sysseek(FD,$e_lfanew,SEEK_SET) || die "$file is too short";
- sysread(FD,$Magic,4)==4 || die "$file is too short";
- unpack("I",$Magic)==0x4550 || die "$file is not COFF image";
- } elsif ($file =~ /\.obj$/i) {
- # .obj files have no IMAGE_DOS_HEADER
- sysseek(FD,0,SEEK_SET) || die "unable to rewind $file";
- } else { next; }
-
- # read IMAGE_FILE_HEADER
- sysread(FD,$coff,20)==20 || die "$file is too short";
- ($Machine,$NumberOfSections,$TimeDateStamp,
- $PointerToSymbolTable,$NumberOfSysmbols,
- $SizeOfOptionalHeader,$Characteristics)=unpack("SSIIISS",$coff);
-
- # skip over IMAGE_OPTIONAL_HEADER
- sysseek(FD,$SizeOfOptionalHeader,SEEK_CUR) || die "$file is too short";
-
- # traverse IMAGE_SECTION_HEADER table
- for($i=0;$i<$NumberOfSections;$i++) {
- sysread(FD,$SectionHeader,40)==40 || die "$file is too short";
- ($Name,@opaque)=unpack("Z8C*",$SectionHeader);
- if ($map{$Name}) {
- sysseek(FD,-40,SEEK_CUR) || die "unable to rewind $file";
- syswrite(FD,pack("a8C*",$map{$Name},@opaque))==40 || die "syswrite failed: $!";
- printf " %-8s -> %.8s\n",$Name,$map{$Name} unless $quiet;
- }
- }
- close(FD);
-}
diff --git a/openssl/ms/test.bat b/openssl/ms/test.bat
index f72926178..f490546eb 100644
--- a/openssl/ms/test.bat
+++ b/openssl/ms/test.bat
@@ -35,10 +35,6 @@ echo md5test
md5test
if errorlevel 1 goto done
-echo md2test
-md2test
-if errorlevel 1 goto done
-
echo rc2test
rc2test
if errorlevel 1 goto done
@@ -181,7 +177,6 @@ echo test sslv2/sslv3 with both client and server authentication via BIO pair
%SSL_TEST% -bio_pair -server_auth -client_auth
if errorlevel 1 goto done
-
echo passed all tests
goto end
:done
diff --git a/openssl/ms/uplink-common.pl b/openssl/ms/uplink-common.pl
new file mode 100644
index 000000000..1d20e6e03
--- /dev/null
+++ b/openssl/ms/uplink-common.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+#
+# pull APPLINK_MAX value from applink.c...
+$applink_c=$0;
+$applink_c=~s|[^/\\]+$||g;
+$applink_c.="applink.c";
+open(INPUT,$applink_c) || die "can't open $applink_c: $!";
+@max=grep {/APPLINK_MAX\s+(\d+)/} <INPUT>;
+close(INPUT);
+($#max==0) or die "can't find APPLINK_MAX in $applink_c";
+
+$max[0]=~/APPLINK_MAX\s+(\d+)/;
+$N=$1; # number of entries in OPENSSL_UplinkTable not including
+ # OPENSSL_UplinkTable[0], which contains this value...
+
+1;
+
+# Idea is to fill the OPENSSL_UplinkTable with pointers to stubs
+# which invoke 'void OPENSSL_Uplink (ULONG_PTR *table,int index)';
+# and then dereference themselves. Latter shall result in endless
+# loop *unless* OPENSSL_Uplink does not replace 'table[index]' with
+# something else, e.g. as 'table[index]=unimplemented;'...
diff --git a/openssl/ms/uplink-ia64.pl b/openssl/ms/uplink-ia64.pl
new file mode 100644
index 000000000..4204c73d5
--- /dev/null
+++ b/openssl/ms/uplink-ia64.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+
+$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
+push(@INC,"${dir}.");
+
+require "uplink-common.pl";
+
+local $V=8; # max number of args uplink functions may accept...
+my $loc0 = "r".(32+$V);
+print <<___;
+.text
+.global OPENSSL_Uplink#
+.type OPENSSL_Uplink#,\@function
+
+___
+for ($i=1;$i<=$N;$i++) {
+print <<___;
+.proc lazy$i#
+lazy$i:
+ .prologue
+{ .mii; .save ar.pfs,$loc0
+ alloc loc0=ar.pfs,$V,3,2,0
+ .save b0,loc1
+ mov loc1=b0
+ addl loc2=\@ltoff(OPENSSL_UplinkTable#),gp };;
+ .body
+{ .mmi; ld8 out0=[loc2]
+ mov out1=$i };;
+{ .mib; add loc2=8*$i,out0
+ br.call.sptk.many b0=OPENSSL_Uplink# };;
+{ .mmi; ld8 r31=[loc2];;
+ ld8 r30=[r31],8 };;
+{ .mii; ld8 gp=[r31]
+ mov b6=r30
+ mov b0=loc1 };;
+{ .mib; mov ar.pfs=loc0
+ br.many b6 };;
+.endp lazy$i#
+
+___
+}
+print <<___;
+.data
+.global OPENSSL_UplinkTable#
+OPENSSL_UplinkTable: data8 $N // amount of following entries
+___
+for ($i=1;$i<=$N;$i++) { print " data8 \@fptr(lazy$i#)\n"; }
+print <<___;
+.size OPENSSL_UplinkTable,.-OPENSSL_UplinkTable#
+___
diff --git a/openssl/ms/uplink-x86.pl b/openssl/ms/uplink-x86.pl
new file mode 100644
index 000000000..0dffc14fc
--- /dev/null
+++ b/openssl/ms/uplink-x86.pl
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+
+$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
+push(@INC, "${dir}.", "${dir}../crypto/perlasm");
+require "x86asm.pl";
+
+require "uplink-common.pl";
+
+&asm_init($ARGV[0],"uplink-x86");
+
+&external_label("OPENSSL_Uplink");
+&public_label("OPENSSL_UplinkTable");
+
+for ($i=1;$i<=$N;$i++) {
+&function_begin_B("_\$lazy${i}");
+ &lea ("eax",&DWP(&label("OPENSSL_UplinkTable")));
+ &push ("eax");
+ &push ($i);
+ &call (&label("OPENSSL_Uplink"));
+ &add ("esp",8);
+ &pop ("eax");
+ &jmp_ptr(&DWP(4*$i,"eax"));
+&function_end_B("_\$lazy${i}");
+}
+
+&dataseg();
+&align(4);
+&set_label("OPENSSL_UplinkTable");
+&data_word($N);
+for ($i=1;$i<=$N;$i++) {
+&data_word(&label("_\$lazy${i}"));
+}
+&asm_finish();
diff --git a/openssl/ms/uplink-x86_64.pl b/openssl/ms/uplink-x86_64.pl
new file mode 100644
index 000000000..9acbf6be6
--- /dev/null
+++ b/openssl/ms/uplink-x86_64.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/env perl
+
+$output=shift;
+$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
+open STDOUT,"| $^X ${dir}../crypto/perlasm/x86_64-xlate.pl $output";
+push(@INC,"${dir}.");
+
+require "uplink-common.pl";
+
+$prefix="_lazy";
+
+print <<___;
+.text
+.extern OPENSSL_Uplink
+.globl OPENSSL_UplinkTable
+___
+for ($i=1;$i<=$N;$i++) {
+print <<___;
+.type $prefix${i},\@abi-omnipotent
+.align 16
+$prefix${i}:
+ .byte 0x48,0x83,0xEC,0x28 # sub rsp,40
+ mov %rcx,48(%rsp)
+ mov %rdx,56(%rsp)
+ mov %r8,64(%rsp)
+ mov %r9,72(%rsp)
+ lea OPENSSL_UplinkTable(%rip),%rcx
+ mov \$$i,%rdx
+ call OPENSSL_Uplink
+ mov 48(%rsp),%rcx
+ mov 56(%rsp),%rdx
+ mov 64(%rsp),%r8
+ mov 72(%rsp),%r9
+ lea OPENSSL_UplinkTable(%rip),%rax
+ add \$40,%rsp
+ jmp *8*$i(%rax)
+$prefix${i}_end:
+.size $prefix${i},.-$prefix${i}
+___
+}
+print <<___;
+.data
+OPENSSL_UplinkTable:
+ .quad $N
+___
+for ($i=1;$i<=$N;$i++) { print " .quad $prefix$i\n"; }
+print <<___;
+.section .pdata,"r"
+.align 4
+___
+for ($i=1;$i<=$N;$i++) {
+print <<___;
+ .rva $prefix${i},$prefix${i}_end,${prefix}_unwind_info
+___
+}
+print <<___;
+.section .xdata,"r"
+.align 8
+${prefix}_unwind_info:
+ .byte 0x01,0x04,0x01,0x00
+ .byte 0x04,0x42,0x00,0x00
+___
+
+close STDOUT;
diff --git a/openssl/ms/x86asm.bat b/openssl/ms/x86asm.bat
index ba2663781..03563c6b0 100644
--- a/openssl/ms/x86asm.bat
+++ b/openssl/ms/x86asm.bat
@@ -1,63 +1,57 @@
@echo off
+echo Generating x86 assember
+
echo Bignum
cd crypto\bn\asm
-perl x86.pl %1 > bn%2
-perl bn-586.pl %1 > bn%2
-perl co-586.pl %1 > co%2
+perl x86.pl win32n > bn-win32.asm
cd ..\..\..
echo DES
cd crypto\des\asm
-perl des-586.pl %1 > d%2
+perl des-586.pl win32n > d-win32.asm
cd ..\..\..
echo "crypt(3)"
cd crypto\des\asm
-perl crypt586.pl %1 > y%2
+perl crypt586.pl win32n > y-win32.asm
cd ..\..\..
echo Blowfish
cd crypto\bf\asm
-perl bf-586.pl %1 > b%2
+perl bf-586.pl win32n > b-win32.asm
cd ..\..\..
echo CAST5
cd crypto\cast\asm
-perl cast-586.pl %1 > c%2
+perl cast-586.pl win32n > c-win32.asm
cd ..\..\..
echo RC4
cd crypto\rc4\asm
-perl rc4-586.pl %1 > r4%2
+perl rc4-586.pl win32n > r4-win32.asm
cd ..\..\..
echo MD5
cd crypto\md5\asm
-perl md5-586.pl %1 > m5%2
+perl md5-586.pl win32n > m5-win32.asm
cd ..\..\..
echo SHA1
cd crypto\sha\asm
-perl sha1-586.pl %1 > s1%2
+perl sha1-586.pl win32n > s1-win32.asm
cd ..\..\..
echo RIPEMD160
cd crypto\ripemd\asm
-perl rmd-586.pl %1 > rm%2
+perl rmd-586.pl win32n > rm-win32.asm
cd ..\..\..
echo RC5\32
cd crypto\rc5\asm
-perl rc5-586.pl %1 > r5%2
+perl rc5-586.pl win32n > r5-win32.asm
cd ..\..\..
-echo CPUID
-cd crypto
-perl x86cpuid.pl %1 > x86cpuid%2
-cd ..\
-
-
echo on