aboutsummaryrefslogtreecommitdiff
path: root/openssl/ms
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/ms')
-rw-r--r--openssl/ms/.rndbin0 -> 1024 bytes
-rw-r--r--openssl/ms/32all.bat20
-rw-r--r--openssl/ms/README13
-rw-r--r--openssl/ms/applink.c94
-rw-r--r--openssl/ms/bcb4.bat6
-rw-r--r--openssl/ms/certCA.srl1
-rw-r--r--openssl/ms/certCA.ss10
-rw-r--r--openssl/ms/certU.ss10
-rw-r--r--openssl/ms/cmp.pl47
-rw-r--r--openssl/ms/do_fips.bat204
-rw-r--r--openssl/ms/do_masm.bat74
-rw-r--r--openssl/ms/do_ms.bat9
-rw-r--r--openssl/ms/do_nasm.bat80
-rw-r--r--openssl/ms/do_nt.bat7
-rw-r--r--openssl/ms/do_win64a.bat9
-rw-r--r--openssl/ms/do_win64i.bat9
-rw-r--r--openssl/ms/keyCA.ss9
-rw-r--r--openssl/ms/keyU.ss9
-rw-r--r--openssl/ms/mingw32.bat94
-rw-r--r--openssl/ms/mw.bat26
-rw-r--r--openssl/ms/req2CA.ss29
-rw-r--r--openssl/ms/reqCA.ss8
-rw-r--r--openssl/ms/reqU.ss8
-rw-r--r--openssl/ms/segrenam.pl65
-rw-r--r--openssl/ms/speed32.bat37
-rw-r--r--openssl/ms/tenc.bat14
-rw-r--r--openssl/ms/tencce.bat19
-rw-r--r--openssl/ms/test.bat190
-rw-r--r--openssl/ms/testce.bat234
-rw-r--r--openssl/ms/testce2.bat2
-rw-r--r--openssl/ms/testenc.bat94
-rw-r--r--openssl/ms/testencce.bat97
-rw-r--r--openssl/ms/testpem.bat32
-rw-r--r--openssl/ms/testpemce.bat42
-rw-r--r--openssl/ms/testss.bat98
-rw-r--r--openssl/ms/testssce.bat104
-rw-r--r--openssl/ms/tlhelp32.h136
-rw-r--r--openssl/ms/tpem.bat6
-rw-r--r--openssl/ms/tpemce.bat8
-rw-r--r--openssl/ms/uplink.c116
-rw-r--r--openssl/ms/uplink.h29
-rw-r--r--openssl/ms/uplink.pl204
-rw-r--r--openssl/ms/x86asm.bat63
43 files changed, 2366 insertions, 0 deletions
diff --git a/openssl/ms/.rnd b/openssl/ms/.rnd
new file mode 100644
index 000000000..0566b46df
--- /dev/null
+++ b/openssl/ms/.rnd
Binary files differ
diff --git a/openssl/ms/32all.bat b/openssl/ms/32all.bat
new file mode 100644
index 000000000..aaab9b0c9
--- /dev/null
+++ b/openssl/ms/32all.bat
@@ -0,0 +1,20 @@
+set OPTS=no-asm
+
+perl Configure VC-WIN32
+perl util\mkfiles.pl >MINFO
+perl util\mk1mf.pl %OPTS% debug VC-WIN32 >d32.mak
+perl util\mk1mf.pl %OPTS% VC-WIN32 >32.mak
+perl util\mk1mf.pl %OPTS% debug dll VC-WIN32 >d32dll.mak
+perl util\mk1mf.pl %OPTS% dll VC-WIN32 >32dll.mak
+perl util\mkdef.pl 32 libeay > ms\libeay32.def
+perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
+
+nmake -f d32.mak
+@if errorlevel 1 goto end
+nmake -f 32.mak
+@if errorlevel 1 goto end
+nmake -f d32dll.mak
+@if errorlevel 1 goto end
+nmake -f 32dll.mak
+
+:end
diff --git a/openssl/ms/README b/openssl/ms/README
new file mode 100644
index 000000000..7a45db108
--- /dev/null
+++ b/openssl/ms/README
@@ -0,0 +1,13 @@
+Run these makefiles from the top level as in
+nmake -f ms\makefilename
+to build with visual C++ 4.[01].
+
+The results will be in the out directory.
+
+These makefiles and def files were generated my typing
+
+perl util\mk1mf.pl VC-NT >ms/nt.mak
+perl util\mk1mf.pl VC-NT dll >ms/ntdll.mak
+
+perl util\mkdef.pl 32 crypto > ms/crypto32.def
+perl util\mkdef.pl 32 ssl > ms/ssl32.def
diff --git a/openssl/ms/applink.c b/openssl/ms/applink.c
new file mode 100644
index 000000000..54a0a6426
--- /dev/null
+++ b/openssl/ms/applink.c
@@ -0,0 +1,94 @@
+#define APPLINK_STDIN 1
+#define APPLINK_STDOUT 2
+#define APPLINK_STDERR 3
+#define APPLINK_FPRINTF 4
+#define APPLINK_FGETS 5
+#define APPLINK_FREAD 6
+#define APPLINK_FWRITE 7
+#define APPLINK_FSETMOD 8
+#define APPLINK_FEOF 9
+#define APPLINK_FCLOSE 10 /* should not be used */
+
+#define APPLINK_FOPEN 11 /* solely for completeness */
+#define APPLINK_FSEEK 12
+#define APPLINK_FTELL 13
+#define APPLINK_FFLUSH 14
+#define APPLINK_FERROR 15
+#define APPLINK_CLEARERR 16
+#define APPLINK_FILENO 17 /* to be used with below */
+
+#define APPLINK_OPEN 18 /* formally can't be used, as flags can vary */
+#define APPLINK_READ 19
+#define APPLINK_WRITE 20
+#define APPLINK_LSEEK 21
+#define APPLINK_CLOSE 22
+#define APPLINK_MAX 22 /* always same as last macro */
+
+#ifndef APPMACROS_ONLY
+#include <stdio.h>
+#include <io.h>
+#include <fcntl.h>
+
+static void *app_stdin(void) { return stdin; }
+static void *app_stdout(void) { return stdout; }
+static void *app_stderr(void) { return stderr; }
+static int app_feof(FILE *fp) { return feof(fp); }
+static int app_ferror(FILE *fp) { return ferror(fp); }
+static void app_clearerr(FILE *fp) { clearerr(fp); }
+static int app_fileno(FILE *fp) { return _fileno(fp); }
+static int app_fsetmod(FILE *fp,char mod)
+{ return _setmode (_fileno(fp),mod=='b'?_O_BINARY:_O_TEXT); }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+__declspec(dllexport)
+void **
+#if defined(__BORLANDC__)
+__stdcall /* __stdcall appears to be the only way to get the name
+ * decoration right with Borland C. Otherwise it works
+ * purely incidentally, as we pass no parameters. */
+#else
+__cdecl
+#endif
+OPENSSL_Applink(void)
+{ static int once=1;
+ static void *OPENSSL_ApplinkTable[APPLINK_MAX+1]={(void *)APPLINK_MAX};
+
+ if (once)
+ { OPENSSL_ApplinkTable[APPLINK_STDIN] = app_stdin;
+ OPENSSL_ApplinkTable[APPLINK_STDOUT] = app_stdout;
+ OPENSSL_ApplinkTable[APPLINK_STDERR] = app_stderr;
+ OPENSSL_ApplinkTable[APPLINK_FPRINTF] = fprintf;
+ OPENSSL_ApplinkTable[APPLINK_FGETS] = fgets;
+ OPENSSL_ApplinkTable[APPLINK_FREAD] = fread;
+ OPENSSL_ApplinkTable[APPLINK_FWRITE] = fwrite;
+ OPENSSL_ApplinkTable[APPLINK_FSETMOD] = app_fsetmod;
+ OPENSSL_ApplinkTable[APPLINK_FEOF] = app_feof;
+ OPENSSL_ApplinkTable[APPLINK_FCLOSE] = fclose;
+
+ OPENSSL_ApplinkTable[APPLINK_FOPEN] = fopen;
+ OPENSSL_ApplinkTable[APPLINK_FSEEK] = fseek;
+ OPENSSL_ApplinkTable[APPLINK_FTELL] = ftell;
+ OPENSSL_ApplinkTable[APPLINK_FFLUSH] = fflush;
+ OPENSSL_ApplinkTable[APPLINK_FERROR] = app_ferror;
+ OPENSSL_ApplinkTable[APPLINK_CLEARERR] = app_clearerr;
+ OPENSSL_ApplinkTable[APPLINK_FILENO] = app_fileno;
+
+ OPENSSL_ApplinkTable[APPLINK_OPEN] = _open;
+ OPENSSL_ApplinkTable[APPLINK_READ] = _read;
+ OPENSSL_ApplinkTable[APPLINK_WRITE] = _write;
+ OPENSSL_ApplinkTable[APPLINK_LSEEK] = _lseek;
+ OPENSSL_ApplinkTable[APPLINK_CLOSE] = _close;
+
+ once = 0;
+ }
+
+ return OPENSSL_ApplinkTable;
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/openssl/ms/bcb4.bat b/openssl/ms/bcb4.bat
new file mode 100644
index 000000000..71a670e79
--- /dev/null
+++ b/openssl/ms/bcb4.bat
@@ -0,0 +1,6 @@
+perl Configure BC-32
+perl util\mkfiles.pl > MINFO
+
+@rem create make file
+perl util\mk1mf.pl no-asm BC-NT > bcb.mak
+
diff --git a/openssl/ms/certCA.srl b/openssl/ms/certCA.srl
new file mode 100644
index 000000000..2cfaa3ba2
--- /dev/null
+++ b/openssl/ms/certCA.srl
@@ -0,0 +1 @@
+1D
diff --git a/openssl/ms/certCA.ss b/openssl/ms/certCA.ss
new file mode 100644
index 000000000..b48c657ae
--- /dev/null
+++ b/openssl/ms/certCA.ss
@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBXDCCAQYCAQAwDQYJKoZIhvcNAQEEBQAwOTELMAkGA1UEBhMCQVUxFzAVBgNV
+BAoTDkRvZGd5IEJyb3RoZXJzMREwDwYDVQQDEwhEb2RneSBDQTAeFw05ODA3MjEw
+NjUwMTZaFw05ODA4MjAwNjUwMTZaMDkxCzAJBgNVBAYTAkFVMRcwFQYDVQQKEw5E
+b2RneSBCcm90aGVyczERMA8GA1UEAxMIRG9kZ3kgQ0EwXDANBgkqhkiG9w0BAQEF
+AANLADBIAkEA0DQLenM/ncK6CwSEJhOO1WfZUPUEi4pvos9fHW459jh3rRDADgi3
+fiCYxoRVSQhvB47kDZ3ViNg5yrDhy7F9ywIDAQABMA0GCSqGSIb3DQEBBAUAA0EA
+S564l3SBxJ+QcIXthGGDyP5zkxTf/1fHfelW9LNgu6lZTdy9Dlp/NecPekzRmZEM
+WiGXGkKNeuo8PsnGJHP9Qg==
+-----END CERTIFICATE-----
diff --git a/openssl/ms/certU.ss b/openssl/ms/certU.ss
new file mode 100644
index 000000000..095ea1433
--- /dev/null
+++ b/openssl/ms/certU.ss
@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBcTCCARsCARwwDQYJKoZIhvcNAQEEBQAwOTELMAkGA1UEBhMCQVUxFzAVBgNV
+BAoTDkRvZGd5IEJyb3RoZXJzMREwDwYDVQQDEwhEb2RneSBDQTAeFw05ODA3MjEw
+NjUwMjdaFw05ODA4MjAwNjUwMjdaME4xCzAJBgNVBAYTAkFVMRcwFQYDVQQKEw5E
+b2RneSBCcm90aGVyczESMBAGA1UEAxMJQnJvdGhlciAxMRIwEAYDVQQDEwlCcm90
+aGVyIDIwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA0e4qorOr/zuLB9NvRaXhJVaI
+HaGGasa7eMAjVPitWAXkN+DxXiGH1CnMgQraKiYzsEVP15xtxkevEvK5jJpOwwID
+AQABMA0GCSqGSIb3DQEBBAUAA0EAZhcPV+SWwaszFuDTYc6fUurcV9OeXUqoxSQy
+MnLZPTyWubHbbkUr9fUfdf7Cc7dFqGzag05VHkNQUS9VjMzjIQ==
+-----END CERTIFICATE-----
diff --git a/openssl/ms/cmp.pl b/openssl/ms/cmp.pl
new file mode 100644
index 000000000..95b257fe4
--- /dev/null
+++ b/openssl/ms/cmp.pl
@@ -0,0 +1,47 @@
+#!/usr/local/bin/perl
+
+($#ARGV == 1) || die "usage: cmp.pl <file1> <file2>\n";
+
+open(IN0,"<$ARGV[0]") || die "unable to open $ARGV[0]\n";
+open(IN1,"<$ARGV[1]") || die "unable to open $ARGV[1]\n";
+binmode IN0;
+binmode IN1;
+
+$tot=0;
+$ret=1;
+for (;;)
+ {
+ $n1=sysread(IN0,$b1,4096);
+ $n2=sysread(IN1,$b2,4096);
+
+ last if ($n1 != $n2);
+ last if ($b1 ne $b2);
+ last if ($n1 < 0);
+ if ($n1 == 0)
+ {
+ $ret=0;
+ last;
+ }
+ $tot+=$n1;
+ }
+
+close(IN0);
+close(IN1);
+if ($ret)
+ {
+ printf STDERR "$ARGV[0] and $ARGV[1] are different\n";
+ @a1=unpack("C*",$b1);
+ @a2=unpack("C*",$b2);
+ for ($i=0; $i<=$#a1; $i++)
+ {
+ if ($a1[$i] ne $a2[$i])
+ {
+ printf "%02X %02X <<\n",$a1[$i],$a2[$i];
+ last;
+ }
+ }
+ $nm=$tot+$n1;
+ $tot+=$i+1;
+ printf STDERR "diff at char $tot of $nm\n";
+ }
+exit($ret);
diff --git a/openssl/ms/do_fips.bat b/openssl/ms/do_fips.bat
new file mode 100644
index 000000000..8d27eb05b
--- /dev/null
+++ b/openssl/ms/do_fips.bat
@@ -0,0 +1,204 @@
+@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
new file mode 100644
index 000000000..a8575321f
--- /dev/null
+++ b/openssl/ms/do_masm.bat
@@ -0,0 +1,74 @@
+@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
new file mode 100644
index 000000000..9323336f9
--- /dev/null
+++ b/openssl/ms/do_ms.bat
@@ -0,0 +1,9 @@
+
+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
diff --git a/openssl/ms/do_nasm.bat b/openssl/ms/do_nasm.bat
new file mode 100644
index 000000000..7656c498d
--- /dev/null
+++ b/openssl/ms/do_nasm.bat
@@ -0,0 +1,80 @@
+
+@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
+perl util\mk1mf.pl nasm BC-NT >ms\bcb.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_nt.bat b/openssl/ms/do_nt.bat
new file mode 100644
index 000000000..9c06c27ca
--- /dev/null
+++ b/openssl/ms/do_nt.bat
@@ -0,0 +1,7 @@
+
+perl util\mkfiles.pl >MINFO
+perl util\mk1mf.pl no-asm VC-NT >ms\nt.mak
+perl util\mk1mf.pl dll no-asm VC-NT >ms\ntdll.mak
+
+perl util\mkdef.pl libeay NT > ms\libeay32.def
+perl util\mkdef.pl ssleay NT > ms\ssleay32.def
diff --git a/openssl/ms/do_win64a.bat b/openssl/ms/do_win64a.bat
new file mode 100644
index 000000000..825c69022
--- /dev/null
+++ b/openssl/ms/do_win64a.bat
@@ -0,0 +1,9 @@
+
+perl util\mkfiles.pl >MINFO
+perl ms\uplink.pl win64a > ms\uptable.asm
+ml64 -c -Foms\uptable.obj ms\uptable.asm
+perl util\mk1mf.pl no-asm VC-WIN64A >ms\nt.mak
+perl util\mk1mf.pl dll no-asm VC-WIN64A >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_win64i.bat b/openssl/ms/do_win64i.bat
new file mode 100644
index 000000000..7bfc2f181
--- /dev/null
+++ b/openssl/ms/do_win64i.bat
@@ -0,0 +1,9 @@
+
+perl util\mkfiles.pl >MINFO
+perl ms\uplink.pl win64i > ms\uptable.asm
+ias -o ms\uptable.obj ms\uptable.asm
+perl util\mk1mf.pl no-asm VC-WIN64I >ms\nt.mak
+perl util\mk1mf.pl dll no-asm VC-WIN64I >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/keyCA.ss b/openssl/ms/keyCA.ss
new file mode 100644
index 000000000..933c2cd6e
--- /dev/null
+++ b/openssl/ms/keyCA.ss
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOwIBAAJBANA0C3pzP53CugsEhCYTjtVn2VD1BIuKb6LPXx1uOfY4d60QwA4I
+t34gmMaEVUkIbweO5A2d1YjYOcqw4cuxfcsCAwEAAQJAOT9WOKEfyN0WEpl3TJDs
+ITmgw2XbjhLOh1HFsW3xegWlaOuhL/wGamz7n7zzL/RQF3JP/VvpGk2F8VD9JhwT
+wQIhAPmqM3fLttBoCQuwQRdIPfB7Ps3THqx6N8AJ04z3I1ejAiEA1XyDd7bLpWrw
+/oA8CmR4b/KCGfvRwAL/Qej/rQliw7kCIQCYRzSvO8ScpuflhjKdZcXJuRJcbgnG
+f6Ejc5rh3xdiawIhALMmLdzEFNjXiSzIx5mg/kBTLUJIw5dx7GqO8B9xBORhAiA5
+oTN/hgvvrkkmRsHQpNBmzAEGBzhMEEq9lD6ZWrTSRg==
+-----END RSA PRIVATE KEY-----
diff --git a/openssl/ms/keyU.ss b/openssl/ms/keyU.ss
new file mode 100644
index 000000000..05d356e7a
--- /dev/null
+++ b/openssl/ms/keyU.ss
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBPAIBAAJBANHuKqKzq/87iwfTb0Wl4SVWiB2hhmrGu3jAI1T4rVgF5Dfg8V4h
+h9QpzIEK2iomM7BFT9ecbcZHrxLyuYyaTsMCAwEAAQJBAIxtM6n4ZCJscxj+D13Y
+k13Fn3Gqvd6pJ3ijlj7dxh6tRBBQ3W9qmQflyvEc81giI2XtbVYBOEJKtJ1cWWZm
+gAkCIQDpEoOuc4KCI5ti6aMJvtxlXWNHbkXCxtbeIjH4+FnH9QIhAOaU3XVeWWOK
+PnnO87KniDjHQqWLnooivDGRK+FUKeDXAiEA2MjEvFVqFVvDIsxHPkBNROcI+Z6i
+ulkx76kErBtrfqUCIHN5uBLQZmngUPuFtiwRlLoCqJDphENfs+oK7vPQx4xPAiEA
+hnY2Ulrpld83IG6bUs95Loc8Fk81hez5YwmhsFEXVtk=
+-----END RSA PRIVATE KEY-----
diff --git a/openssl/ms/mingw32.bat b/openssl/ms/mingw32.bat
new file mode 100644
index 000000000..f9377a869
--- /dev/null
+++ b/openssl/ms/mingw32.bat
@@ -0,0 +1,94 @@
+@rem OpenSSL with Mingw32+GNU as
+@rem ---------------------------
+
+perl Configure mingw %1 %2 %3 %4 %5 %6 %7 %8
+
+@echo off
+
+perl -e "exit 1 if '%1' eq 'no-asm'"
+if errorlevel 1 goto noasm
+
+echo Generating x86 for GNU assember
+
+echo Bignum
+cd crypto\bn\asm
+perl bn-586.pl gaswin > bn-win32.s
+perl co-586.pl gaswin > co-win32.s
+cd ..\..\..
+
+echo DES
+cd crypto\des\asm
+perl des-586.pl gaswin > d-win32.s
+cd ..\..\..
+
+echo crypt
+cd crypto\des\asm
+perl crypt586.pl gaswin > y-win32.s
+cd ..\..\..
+
+echo Blowfish
+cd crypto\bf\asm
+perl bf-586.pl gaswin > b-win32.s
+cd ..\..\..
+
+echo CAST5
+cd crypto\cast\asm
+perl cast-586.pl gaswin > c-win32.s
+cd ..\..\..
+
+echo RC4
+cd crypto\rc4\asm
+perl rc4-586.pl gaswin > r4-win32.s
+cd ..\..\..
+
+echo MD5
+cd crypto\md5\asm
+perl md5-586.pl gaswin > m5-win32.s
+cd ..\..\..
+
+echo SHA1
+cd crypto\sha\asm
+perl sha1-586.pl gaswin > s1-win32.s
+cd ..\..\..
+
+echo RIPEMD160
+cd crypto\ripemd\asm
+perl rmd-586.pl gaswin > rm-win32.s
+cd ..\..\..
+
+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
+
+echo Generating makefile
+perl util\mkfiles.pl >MINFO
+perl util\mk1mf.pl gaswin Mingw32 >ms\mingw32a.mak
+echo Generating 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 copy ms\tlhelp32.h outinc
+
+echo Building the libraries
+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
+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/mw.bat b/openssl/ms/mw.bat
new file mode 100644
index 000000000..c5ccd693e
--- /dev/null
+++ b/openssl/ms/mw.bat
@@ -0,0 +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
+
diff --git a/openssl/ms/req2CA.ss b/openssl/ms/req2CA.ss
new file mode 100644
index 000000000..d061fb2a0
--- /dev/null
+++ b/openssl/ms/req2CA.ss
@@ -0,0 +1,29 @@
+Certificate Request:
+ Data:
+ Version: 0 (0x0)
+ Subject: C=AU, O=Dodgy Brothers, CN=Dodgy CA
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (512 bit)
+ Modulus (512 bit):
+ 00:d0:34:0b:7a:73:3f:9d:c2:ba:0b:04:84:26:13:
+ 8e:d5:67:d9:50:f5:04:8b:8a:6f:a2:cf:5f:1d:6e:
+ 39:f6:38:77:ad:10:c0:0e:08:b7:7e:20:98:c6:84:
+ 55:49:08:6f:07:8e:e4:0d:9d:d5:88:d8:39:ca:b0:
+ e1:cb:b1:7d:cb
+ Exponent: 65537 (0x10001)
+ Attributes:
+ a0:00
+ Signature Algorithm: md5WithRSAEncryption
+ 8d:15:e6:8e:49:0f:07:fb:e0:72:ad:f0:04:9a:c8:5d:e7:1b:
+ ed:99:c9:c3:3c:f5:8e:4d:a1:5e:e1:40:75:2c:24:f0:c6:dd:
+ 10:87:35:26:1d:cc:79:3f:a2:c6:a0:04:c8:52:78:ed:26:32:
+ d3:1b:a7:cd:5e:8c:55:92:dd:88
+-----BEGIN CERTIFICATE REQUEST-----
+MIHzMIGeAgEAMDkxCzAJBgNVBAYTAkFVMRcwFQYDVQQKEw5Eb2RneSBCcm90aGVy
+czERMA8GA1UEAxMIRG9kZ3kgQ0EwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA0DQL
+enM/ncK6CwSEJhOO1WfZUPUEi4pvos9fHW459jh3rRDADgi3fiCYxoRVSQhvB47k
+DZ3ViNg5yrDhy7F9ywIDAQABoAAwDQYJKoZIhvcNAQEEBQADQQCNFeaOSQ8H++By
+rfAEmshd5xvtmcnDPPWOTaFe4UB1LCTwxt0QhzUmHcx5P6LGoATIUnjtJjLTG6fN
+XoxVkt2I
+-----END CERTIFICATE REQUEST-----
diff --git a/openssl/ms/reqCA.ss b/openssl/ms/reqCA.ss
new file mode 100644
index 000000000..1f7138cad
--- /dev/null
+++ b/openssl/ms/reqCA.ss
@@ -0,0 +1,8 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIHzMIGeAgEAMDkxCzAJBgNVBAYTAkFVMRcwFQYDVQQKEw5Eb2RneSBCcm90aGVy
+czERMA8GA1UEAxMIRG9kZ3kgQ0EwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA0DQL
+enM/ncK6CwSEJhOO1WfZUPUEi4pvos9fHW459jh3rRDADgi3fiCYxoRVSQhvB47k
+DZ3ViNg5yrDhy7F9ywIDAQABoAAwDQYJKoZIhvcNAQEFBQADQQA5DZSZgDXs8flG
+GZf4SGr8QpqkxSu9bZOYp/ySuz1khj7aupBrvZBmqZcZx4ZjAUN7UQpMWu2gyfKa
+mAiiLPFN
+-----END CERTIFICATE REQUEST-----
diff --git a/openssl/ms/reqU.ss b/openssl/ms/reqU.ss
new file mode 100644
index 000000000..91cce5966
--- /dev/null
+++ b/openssl/ms/reqU.ss
@@ -0,0 +1,8 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIIBCDCBswIBADBOMQswCQYDVQQGEwJBVTEXMBUGA1UEChMORG9kZ3kgQnJvdGhl
+cnMxEjAQBgNVBAMTCUJyb3RoZXIgMTESMBAGA1UEAxMJQnJvdGhlciAyMFwwDQYJ
+KoZIhvcNAQEBBQADSwAwSAJBANHuKqKzq/87iwfTb0Wl4SVWiB2hhmrGu3jAI1T4
+rVgF5Dfg8V4hh9QpzIEK2iomM7BFT9ecbcZHrxLyuYyaTsMCAwEAAaAAMA0GCSqG
+SIb3DQEBAgUAA0EAhB0p6LbiVq+XshLo5sBQN0rsROC1OgWrdS6ZUmMaigOKK069
+r1o+dGwbM5VCYGTZf0PW9OtGuArGct0laL5h4w==
+-----END CERTIFICATE REQUEST-----
diff --git a/openssl/ms/segrenam.pl b/openssl/ms/segrenam.pl
new file mode 100644
index 000000000..2ab22a045
--- /dev/null
+++ b/openssl/ms/segrenam.pl
@@ -0,0 +1,65 @@
+#!/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/speed32.bat b/openssl/ms/speed32.bat
new file mode 100644
index 000000000..95f7ce950
--- /dev/null
+++ b/openssl/ms/speed32.bat
@@ -0,0 +1,37 @@
+set makefile=ms\nt.mak
+
+perl Configure b
+del tmp\*.obj
+nmake -f %makefile%
+nmake -f %makefile%
+nmake -f %makefile%
+out\ssleay version -v -b -f >speed.1
+out\ssleay speed >speed.1l
+
+perl Configure bl-4c-2c
+del tmp\rc4*.obj tmp\bn*.obj tmp\md2_dgst.obj
+nmake -f %makefile%
+nmake -f %makefile%
+nmake -f %makefile%
+out\ssleay speed rc4 rsa md2 >speed.2l
+
+perl Configure bl-4c-ri
+del tmp\rc4*.obj
+nmake -f %makefile%
+nmake -f %makefile%
+nmake -f %makefile%
+out\ssleay speed rc4 >speed.3l
+
+perl Configure b2-is-ri-dp
+del tmp\i_*.obj tmp\rc4*.obj tmp\ecb_enc.obj tmp\bn*.obj
+nmake -f %makefile%
+nmake -f %makefile%
+nmake -f %makefile%
+out\ssleay speed rsa rc4 idea des >speed.4l
+
+type speed.1 >speed.log
+type speed.1l >>speed.log
+perl util\sp-diff.pl speed.1l speed.2l >>speed.log
+perl util\sp-diff.pl speed.1l speed.3l >>speed.log
+perl util\sp-diff.pl speed.1l speed.4l >>speed.log
+
diff --git a/openssl/ms/tenc.bat b/openssl/ms/tenc.bat
new file mode 100644
index 000000000..466fdfccb
--- /dev/null
+++ b/openssl/ms/tenc.bat
@@ -0,0 +1,14 @@
+rem called by testenc
+
+echo test %1 %2 %3 %4 %5 %6
+%ssleay% %1 %2 %3 %4 %5 %6 -e -bufsize 113 -k test -in %input% -out %tmp1%
+%ssleay% %1 %2 %3 %4 %5 %6 -d -bufsize 157 -k test -in %tmp1% -out %out1%
+%cmp% %input% %out1%
+if errorlevel 1 goto err
+
+echo test base64 %1 %2 %3 %4 %5 %6
+%ssleay% %1 %2 %3 %4 %5 %6 -a -e -bufsize 113 -k test -in %input% -out %tmp1%
+%ssleay% %1 %2 %3 %4 %5 %6 -a -d -bufsize 157 -k test -in %tmp1% -out %out1%
+%cmp% %input% %out1%
+
+:err
diff --git a/openssl/ms/tencce.bat b/openssl/ms/tencce.bat
new file mode 100644
index 000000000..6a944d767
--- /dev/null
+++ b/openssl/ms/tencce.bat
@@ -0,0 +1,19 @@
+rem called by testencce
+
+echo test %1 %2 %3 %4 %5 %6
+cecopy %input% CE:\OpenSSL
+cerun CE:\OpenSSL\%ssleay% %1 %2 %3 %4 %5 %6 -e -bufsize 113 -k test -in \OpenSSL\%input% -out \OpenSSL\%tmp1%
+cerun CE:\OpenSSL\%ssleay% %1 %2 %3 %4 %5 %6 -d -bufsize 157 -k test -in \OpenSSL\%tmp1% -out \OpenSSL\%out1%
+del %out1% >nul 2>&1
+cecopy CE:\OpenSSL\%out1% .
+%cmp% %input% %out1%
+if errorlevel 1 goto err
+
+echo test base64 %1 %2 %3 %4 %5 %6
+cerun CE:\OpenSSL\%ssleay% %1 %2 %3 %4 %5 %6 -a -e -bufsize 113 -k test -in \OpenSSL\%input% -out \OpenSSL\%tmp1%
+cerun CE:\OpenSSL\%ssleay% %1 %2 %3 %4 %5 %6 -a -d -bufsize 157 -k test -in \OpenSSL\%tmp1% -out \OpenSSL\%out1%
+del %out1% >nul 2>&1
+cecopy CE:\OpenSSL\%out1% .
+%cmp% %input% %out1%
+
+:err
diff --git a/openssl/ms/test.bat b/openssl/ms/test.bat
new file mode 100644
index 000000000..f72926178
--- /dev/null
+++ b/openssl/ms/test.bat
@@ -0,0 +1,190 @@
+@echo off
+
+set test=..\ms
+set opath=%PATH%
+PATH=..\ms;%PATH%
+set OPENSSL_CONF=..\apps\openssl.cnf
+
+rem run this from inside the bin directory
+
+echo rsa_test
+rsa_test
+if errorlevel 1 goto done
+
+echo destest
+destest
+if errorlevel 1 goto done
+
+echo ideatest
+ideatest
+if errorlevel 1 goto done
+
+echo bftest
+bftest
+if errorlevel 1 goto done
+
+echo shatest
+shatest
+if errorlevel 1 goto done
+
+echo sha1test
+sha1test
+if errorlevel 1 goto done
+
+echo md5test
+md5test
+if errorlevel 1 goto done
+
+echo md2test
+md2test
+if errorlevel 1 goto done
+
+echo rc2test
+rc2test
+if errorlevel 1 goto done
+
+echo rc4test
+rc4test
+if errorlevel 1 goto done
+
+echo randtest
+randtest
+if errorlevel 1 goto done
+
+echo dhtest
+dhtest
+if errorlevel 1 goto done
+
+echo exptest
+exptest
+if errorlevel 1 goto done
+
+echo dsatest
+dsatest
+if errorlevel 1 goto done
+
+echo ectest
+ectest
+if errorlevel 1 goto done
+
+echo testenc
+call %test%\testenc openssl
+if errorlevel 1 goto done
+
+echo testpem
+call %test%\testpem openssl
+if errorlevel 1 goto done
+
+echo testss
+call %test%\testss openssl
+if errorlevel 1 goto done
+
+set SSL_TEST=ssltest -key keyU.ss -cert certU.ss -c_key keyU.ss -c_cert certU.ss -CAfile certCA.ss
+
+echo test sslv2
+ssltest -ssl2
+if errorlevel 1 goto done
+
+echo test sslv2 with server authentication
+%SSL_TEST% -ssl2 -server_auth
+if errorlevel 1 goto done
+
+echo test sslv2 with client authentication
+%SSL_TEST% -ssl2 -client_auth
+if errorlevel 1 goto done
+
+echo test sslv2 with both client and server authentication
+%SSL_TEST% -ssl2 -server_auth -client_auth
+if errorlevel 1 goto done
+
+echo test sslv3
+ssltest -ssl3
+if errorlevel 1 goto done
+
+echo test sslv3 with server authentication
+%SSL_TEST% -ssl3 -server_auth
+if errorlevel 1 goto done
+
+echo test sslv3 with client authentication
+%SSL_TEST% -ssl3 -client_auth
+if errorlevel 1 goto done
+
+echo test sslv3 with both client and server authentication
+%SSL_TEST% -ssl3 -server_auth -client_auth
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3
+ssltest
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with server authentication
+%SSL_TEST% -server_auth
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with client authentication
+%SSL_TEST% -client_auth
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with both client and server authentication
+%SSL_TEST% -server_auth -client_auth
+if errorlevel 1 goto done
+
+echo test sslv2 via BIO pair
+ssltest -bio_pair -ssl2
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with 1024 bit DHE via BIO pair
+ssltest -bio_pair -dhe1024dsa -v
+if errorlevel 1 goto done
+
+echo test sslv2 with server authentication via BIO pair
+%SSL_TEST% -bio_pair -ssl2 -server_auth
+if errorlevel 1 goto done
+
+echo test sslv2 with client authentication via BIO pair
+%SSL_TEST% -bio_pair -ssl2 -client_auth
+if errorlevel 1 goto done
+
+echo test sslv2 with both client and server authentication via BIO pair
+%SSL_TEST% -bio_pair -ssl2 -server_auth -client_auth
+if errorlevel 1 goto done
+
+echo test sslv3 via BIO pair
+ssltest -bio_pair -ssl3
+if errorlevel 1 goto done
+
+echo test sslv3 with server authentication via BIO pair
+%SSL_TEST% -bio_pair -ssl3 -server_auth
+if errorlevel 1 goto done
+
+echo test sslv3 with client authentication via BIO pair
+%SSL_TEST% -bio_pair -ssl3 -client_auth
+if errorlevel 1 goto done
+
+echo test sslv3 with both client and server authentication via BIO pair
+%SSL_TEST% -bio_pair -ssl3 -server_auth -client_auth
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 via BIO pair
+ssltest -bio_pair
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with server authentication
+%SSL_TEST% -bio_pair -server_auth
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with client authentication via BIO pair
+%SSL_TEST% -bio_pair -client_auth
+if errorlevel 1 goto done
+
+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
+echo problems.....
+:end
+PATH=%opath%
diff --git a/openssl/ms/testce.bat b/openssl/ms/testce.bat
new file mode 100644
index 000000000..2ab010be6
--- /dev/null
+++ b/openssl/ms/testce.bat
@@ -0,0 +1,234 @@
+@echo off
+
+cemkdir CE:\OpenSSL
+
+set test=..\ms
+set opath=%PATH%
+PATH=..\ms;%PATH%
+cecopy ..\apps\openssl.cnf CE:\OpenSSL
+set OPENSSL_CONF=\OpenSSL\openssl.cnf
+set HOME=\OpenSSL
+set CERUN_PASS_ENV=OPENSSL_CONF HOME
+
+rem run this from inside the bin directory
+
+rem Copy the DLL's (though they'll only exist if we're in out32dll)
+if exist libeay32.dll cecopy libeay32.dll CE:\OpenSSL
+if exist ssleay32.dll cecopy ssleay32.dll CE:\OpenSSL
+
+echo rsa_test
+call %test%\testce2 rsa_test
+if errorlevel 1 goto done
+
+echo destest
+call %test%\testce2 destest
+if errorlevel 1 goto done
+
+echo ideatest
+call %test%\testce2 ideatest
+if errorlevel 1 goto done
+
+echo bftest
+call %test%\testce2 bftest
+if errorlevel 1 goto done
+
+echo shatest
+call %test%\testce2 shatest
+if errorlevel 1 goto done
+
+echo sha1test
+call %test%\testce2 sha1test
+if errorlevel 1 goto done
+
+echo md5test
+call %test%\testce2 md5test
+if errorlevel 1 goto done
+
+echo md2test
+call %test%\testce2 md2test
+if errorlevel 1 goto done
+
+echo mdc2test
+call %test%\testce2 mdc2test
+if errorlevel 1 goto done
+
+echo rc2test
+call %test%\testce2 rc2test
+if errorlevel 1 goto done
+
+echo rc4test
+call %test%\testce2 rc4test
+if errorlevel 1 goto done
+
+echo randtest
+call %test%\testce2 randtest
+if errorlevel 1 goto done
+
+echo dhtest
+call %test%\testce2 dhtest
+if errorlevel 1 goto done
+
+echo exptest
+call %test%\testce2 exptest
+if errorlevel 1 goto done
+
+echo dsatest
+call %test%\testce2 dsatest
+if errorlevel 1 goto done
+
+echo testenc
+call %test%\testencce openssl.exe
+if errorlevel 1 goto done
+
+echo testpem
+call %test%\testpemce openssl.exe
+if errorlevel 1 goto done
+
+cecopy openssl.exe CE:\OpenSSL
+
+echo verify
+copy ..\certs\*.pem cert.tmp >nul
+cecopy cert.tmp CE:\OpenSSL
+cemkdir CE:\OpenSSL\certs
+rem cecopy ..\certs\*.pem CE:\OpenSSL\certs
+cecopy ..\certs\ca-cert.pem CE:\OpenSSL\certs
+cecopy ..\certs\dsa-ca.pem CE:\OpenSSL\certs
+cecopy ..\certs\dsa-pca.pem CE:\OpenSSL\certs
+cecopy ..\certs\factory.pem CE:\OpenSSL\certs
+cecopy ..\certs\ICE-CA.pem CE:\OpenSSL\certs
+cecopy ..\certs\ICE-root.pem CE:\OpenSSL\certs
+cecopy ..\certs\ICE-user.pem CE:\OpenSSL\certs
+cecopy ..\certs\nortelCA.pem CE:\OpenSSL\certs
+cecopy ..\certs\pca-cert.pem CE:\OpenSSL\certs
+cecopy ..\certs\RegTP-4R.pem CE:\OpenSSL\certs
+cecopy ..\certs\RegTP-5R.pem CE:\OpenSSL\certs
+cecopy ..\certs\RegTP-6R.pem CE:\OpenSSL\certs
+cecopy ..\certs\rsa-cca.pem CE:\OpenSSL\certs
+cecopy ..\certs\thawteCb.pem CE:\OpenSSL\certs
+cecopy ..\certs\thawteCp.pem CE:\OpenSSL\certs
+cecopy ..\certs\timCA.pem CE:\OpenSSL\certs
+cecopy ..\certs\tjhCA.pem CE:\OpenSSL\certs
+cecopy ..\certs\vsign1.pem CE:\OpenSSL\certs
+cecopy ..\certs\vsign2.pem CE:\OpenSSL\certs
+cecopy ..\certs\vsign3.pem CE:\OpenSSL\certs
+cecopy ..\certs\vsignss.pem CE:\OpenSSL\certs
+cecopy ..\certs\vsigntca.pem CE:\OpenSSL\certs
+cerun CE:\OpenSSL\openssl verify -CAfile \OpenSSL\cert.tmp \OpenSSL\certs\*.pem
+
+echo testss
+call %test%\testssce openssl.exe
+if errorlevel 1 goto done
+
+cecopy ssltest.exe CE:\OpenSSL
+cecopy ..\apps\server.pem CE:\OpenSSL
+cecopy ..\apps\client.pem CE:\OpenSSL
+
+echo test sslv2
+cerun CE:\OpenSSL\ssltest -ssl2
+if errorlevel 1 goto done
+
+echo test sslv2 with server authentication
+cerun CE:\OpenSSL\ssltest -ssl2 -server_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2 with client authentication
+cerun CE:\OpenSSL\ssltest -ssl2 -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2 with both client and server authentication
+cerun CE:\OpenSSL\ssltest -ssl2 -server_auth -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv3
+cerun CE:\OpenSSL\ssltest -ssl3
+if errorlevel 1 goto done
+
+echo test sslv3 with server authentication
+cerun CE:\OpenSSL\ssltest -ssl3 -server_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv3 with client authentication
+cerun CE:\OpenSSL\ssltest -ssl3 -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv3 with both client and server authentication
+cerun CE:\OpenSSL\ssltest -ssl3 -server_auth -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3
+cerun CE:\OpenSSL\ssltest
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with server authentication
+cerun CE:\OpenSSL\ssltest -server_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with client authentication
+cerun CE:\OpenSSL\ssltest -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with both client and server authentication
+cerun CE:\OpenSSL\ssltest -server_auth -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2 via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -ssl2
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with 1024 bit DHE via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -dhe1024dsa -v
+if errorlevel 1 goto done
+
+echo test sslv2 with server authentication via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -ssl2 -server_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2 with client authentication via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -ssl2 -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2 with both client and server authentication via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -ssl2 -server_auth -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv3 via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -ssl3
+if errorlevel 1 goto done
+
+echo test sslv3 with server authentication via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -ssl3 -server_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv3 with client authentication via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -ssl3 -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv3 with both client and server authentication via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -ssl3 -server_auth -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 via BIO pair
+cerun CE:\OpenSSL\ssltest
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with server authentication
+cerun CE:\OpenSSL\ssltest -bio_pair -server_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with client authentication via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+echo test sslv2/sslv3 with both client and server authentication via BIO pair
+cerun CE:\OpenSSL\ssltest -bio_pair -server_auth -client_auth -CAfile \OpenSSL\cert.tmp
+if errorlevel 1 goto done
+
+del cert.tmp
+
+echo passed all tests
+goto end
+:done
+echo problems.....
+:end
+PATH=%opath%
+
diff --git a/openssl/ms/testce2.bat b/openssl/ms/testce2.bat
new file mode 100644
index 000000000..24265b948
--- /dev/null
+++ b/openssl/ms/testce2.bat
@@ -0,0 +1,2 @@
+cecopy %1.exe CE:\OpenSSL
+cerun CE:\OpenSSL\%1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/openssl/ms/testenc.bat b/openssl/ms/testenc.bat
new file mode 100644
index 000000000..4b99bd589
--- /dev/null
+++ b/openssl/ms/testenc.bat
@@ -0,0 +1,94 @@
+@echo off
+echo start testenc
+
+path=..\ms;%path%
+set ssleay=%1%
+set input=..\ms\testenc.bat
+set tmp1=..\ms\cipher.out
+set out1=..\ms\clear.out
+set cmp=perl ..\ms\cmp.pl
+
+cd
+call tenc.bat enc
+if errorlevel 1 goto err
+
+call tenc.bat rc4
+if errorlevel 1 goto err
+
+call tenc.bat des-cfb
+if errorlevel 1 goto err
+
+call tenc.bat des-ede-cfb
+if errorlevel 1 goto err
+
+call tenc.bat des-ede3-cfb
+if errorlevel 1 goto err
+
+call tenc.bat des-ofb
+if errorlevel 1 goto err
+
+call tenc.bat des-ede-ofb
+if errorlevel 1 goto err
+
+call tenc.bat des-ede3-ofb
+if errorlevel 1 goto err
+
+call tenc.bat des-ecb
+if errorlevel 1 goto err
+
+call tenc.bat des-ede
+if errorlevel 1 goto err
+
+call tenc.bat des-ede3
+if errorlevel 1 goto err
+
+call tenc.bat des-cbc
+if errorlevel 1 goto err
+
+call tenc.bat des-ede-cbc
+if errorlevel 1 goto err
+
+call tenc.bat des-ede3-cbc
+if errorlevel 1 goto err
+
+call tenc.bat idea-ecb
+if errorlevel 1 goto err
+
+call tenc.bat idea-cfb
+if errorlevel 1 goto err
+
+call tenc.bat idea-ofb
+if errorlevel 1 goto err
+
+call tenc.bat idea-cbc
+if errorlevel 1 goto err
+
+call tenc.bat rc2-ecb
+if errorlevel 1 goto err
+
+call tenc.bat rc2-cfb
+if errorlevel 1 goto err
+
+call tenc.bat rc2-ofb
+if errorlevel 1 goto err
+
+call tenc.bat rc2-cbc
+if errorlevel 1 goto err
+
+call tenc.bat bf-ecb
+if errorlevel 1 goto err
+
+call tenc.bat bf-cfb
+if errorlevel 1 goto err
+
+call tenc.bat bf-ofb
+if errorlevel 1 goto err
+
+call tenc.bat bf-cbc
+if errorlevel 1 goto err
+
+echo OK
+del %out1%
+del %tmp1%
+:err
+
diff --git a/openssl/ms/testencce.bat b/openssl/ms/testencce.bat
new file mode 100644
index 000000000..04faa5d99
--- /dev/null
+++ b/openssl/ms/testencce.bat
@@ -0,0 +1,97 @@
+@echo off
+echo start testenc
+
+path=..\ms;%path%
+set ssleay=%1%
+copy ..\ms\testenc.bat >nul
+set input=testenc.bat
+set tmp1=cipher.out
+set out1=clear.out
+set cmp=perl ..\ms\cmp.pl
+
+cecopy %ssleay% CE:\OpenSSL
+
+cd
+call tencce.bat enc
+if errorlevel 1 goto err
+
+call tencce.bat rc4
+if errorlevel 1 goto err
+
+call tencce.bat des-cfb
+if errorlevel 1 goto err
+
+call tencce.bat des-ede-cfb
+if errorlevel 1 goto err
+
+call tencce.bat des-ede3-cfb
+if errorlevel 1 goto err
+
+call tencce.bat des-ofb
+if errorlevel 1 goto err
+
+call tencce.bat des-ede-ofb
+if errorlevel 1 goto err
+
+call tencce.bat des-ede3-ofb
+if errorlevel 1 goto err
+
+call tencce.bat des-ecb
+if errorlevel 1 goto err
+
+call tencce.bat des-ede
+if errorlevel 1 goto err
+
+call tencce.bat des-ede3
+if errorlevel 1 goto err
+
+call tencce.bat des-cbc
+if errorlevel 1 goto err
+
+call tencce.bat des-ede-cbc
+if errorlevel 1 goto err
+
+call tencce.bat des-ede3-cbc
+if errorlevel 1 goto err
+
+call tencce.bat idea-ecb
+if errorlevel 1 goto err
+
+call tencce.bat idea-cfb
+if errorlevel 1 goto err
+
+call tencce.bat idea-ofb
+if errorlevel 1 goto err
+
+call tencce.bat idea-cbc
+if errorlevel 1 goto err
+
+call tencce.bat rc2-ecb
+if errorlevel 1 goto err
+
+call tencce.bat rc2-cfb
+if errorlevel 1 goto err
+
+call tencce.bat rc2-ofb
+if errorlevel 1 goto err
+
+call tencce.bat rc2-cbc
+if errorlevel 1 goto err
+
+call tencce.bat bf-ecb
+if errorlevel 1 goto err
+
+call tencce.bat bf-cfb
+if errorlevel 1 goto err
+
+call tencce.bat bf-ofb
+if errorlevel 1 goto err
+
+call tencce.bat bf-cbc
+if errorlevel 1 goto err
+
+echo OK
+del %out1% >nul 2>&1
+del %tmp1% >nul 2>&1
+:err
+
diff --git a/openssl/ms/testpem.bat b/openssl/ms/testpem.bat
new file mode 100644
index 000000000..005f13b67
--- /dev/null
+++ b/openssl/ms/testpem.bat
@@ -0,0 +1,32 @@
+@echo off
+set ssleay=%1%
+set tmp1=pem.out
+set cmp=fc.exe
+
+call tpem.bat crl ..\test\testcrl.pem
+if errorlevel 1 goto err
+
+call tpem.bat pkcs7 ..\test\testp7.pem
+if errorlevel 1 goto err
+
+call tpem.bat req ..\test\testreq2.pem
+if errorlevel 1 goto err
+
+call tpem.bat rsa ..\test\testrsa.pem
+if errorlevel 1 goto err
+
+call tpem.bat x509 ..\test\testx509.pem
+if errorlevel 1 goto err
+
+call tpem.bat x509 ..\test\v3-cert1.pem
+if errorlevel 1 goto err
+
+call tpem.bat x509 ..\test\v3-cert1.pem
+if errorlevel 1 goto err
+
+call tpem.bat sess_id ..\test\testsid.pem
+if errorlevel 1 goto err
+
+echo OK
+del %tmp1%
+:err
diff --git a/openssl/ms/testpemce.bat b/openssl/ms/testpemce.bat
new file mode 100644
index 000000000..c793c3e51
--- /dev/null
+++ b/openssl/ms/testpemce.bat
@@ -0,0 +1,42 @@
+@echo off
+set ssleay=%1%
+set tmp1=pem.out
+set cmp=fc.exe
+
+cecopy %ssleay% CE:\OpenSSL
+
+copy ..\test\testcrl.pem >nul
+call tpemce.bat crl testcrl.pem
+if errorlevel 1 goto err
+
+copy ..\test\testp7.pem >nul
+call tpemce.bat pkcs7 testp7.pem
+if errorlevel 1 goto err
+
+copy ..\test\testreq2.pem >nul
+call tpemce.bat req testreq2.pem
+if errorlevel 1 goto err
+
+copy ..\test\testrsa.pem >nul
+call tpemce.bat rsa testrsa.pem
+if errorlevel 1 goto err
+
+copy ..\test\testx509.pem >nul
+call tpemce.bat x509 testx509.pem
+if errorlevel 1 goto err
+
+copy ..\test\v3-cert1.pem >nul
+call tpemce.bat x509 v3-cert1.pem
+if errorlevel 1 goto err
+
+copy ..\test\v3-cert1.pem >nul
+call tpemce.bat x509 v3-cert1.pem
+if errorlevel 1 goto err
+
+copy ..\test\testsid.pem >nul
+call tpemce.bat sess_id testsid.pem
+if errorlevel 1 goto err
+
+echo OK
+del %tmp1% >nul 2>&1
+:err
diff --git a/openssl/ms/testss.bat b/openssl/ms/testss.bat
new file mode 100644
index 000000000..b4aaf3c60
--- /dev/null
+++ b/openssl/ms/testss.bat
@@ -0,0 +1,98 @@
+@echo off
+
+rem set ssleay=..\out\ssleay
+set ssleay=%1
+
+set reqcmd=%ssleay% req
+set x509cmd=%ssleay% x509 -sha1
+set verifycmd=%ssleay% verify
+
+set CAkey=keyCA.ss
+set CAcert=certCA.ss
+set CAserial=certCA.srl
+set CAreq=reqCA.ss
+set CAconf=..\test\CAss.cnf
+set CAreq2=req2CA.ss
+
+set Uconf=..\test\Uss.cnf
+set Ukey=keyU.ss
+set Ureq=reqU.ss
+set Ucert=certU.ss
+
+echo make a certificate request using 'req'
+%reqcmd% -config %CAconf% -out %CAreq% -keyout %CAkey% -new
+if errorlevel 1 goto e_req
+
+echo convert the certificate request into a self signed certificate using 'x509'
+%x509cmd% -CAcreateserial -in %CAreq% -days 30 -req -out %CAcert% -signkey %CAkey% >err.ss
+if errorlevel 1 goto e_x509
+
+echo --
+echo convert a certificate into a certificate request using 'x509'
+%x509cmd% -in %CAcert% -x509toreq -signkey %CAkey% -out %CAreq2% >err.ss
+if errorlevel 1 goto e_x509_2
+
+%reqcmd% -verify -in %CAreq% -noout
+if errorlevel 1 goto e_vrfy_1
+
+%reqcmd% -verify -in %CAreq2% -noout
+if errorlevel 1 goto e_vrfy_2
+
+%verifycmd% -CAfile %CAcert% %CAcert%
+if errorlevel 1 goto e_vrfy_3
+
+echo --
+echo make another certificate request using 'req'
+%reqcmd% -config %Uconf% -out %Ureq% -keyout %Ukey% -new >err.ss
+if errorlevel 1 goto e_req_gen
+
+echo --
+echo sign certificate request with the just created CA via 'x509'
+%x509cmd% -CAcreateserial -in %Ureq% -days 30 -req -out %Ucert% -CA %CAcert% -CAkey %CAkey% -CAserial %CAserial%
+if errorlevel 1 goto e_x_sign
+
+%verifycmd% -CAfile %CAcert% %Ucert%
+echo --
+echo Certificate details
+%x509cmd% -subject -issuer -startdate -enddate -noout -in %Ucert%
+
+echo Everything appeared to work
+echo --
+echo The generated CA certificate is %CAcert%
+echo The generated CA private key is %CAkey%
+echo The current CA signing serial number is in %CAserial%
+
+echo The generated user certificate is %Ucert%
+echo The generated user private key is %Ukey%
+echo --
+
+del err.ss
+
+goto end
+
+:e_req
+echo error using 'req' to generate a certificate request
+goto end
+:e_x509
+echo error using 'x509' to self sign a certificate request
+goto end
+:e_x509_2
+echo error using 'x509' convert a certificate to a certificate request
+goto end
+:e_vrfy_1
+echo first generated request is invalid
+goto end
+:e_vrfy_2
+echo second generated request is invalid
+goto end
+:e_vrfy_3
+echo first generated cert is invalid
+goto end
+:e_req_gen
+echo error using 'req' to generate a certificate request
+goto end
+:e_x_sign
+echo error using 'x509' to sign a certificate request
+goto end
+
+:end
diff --git a/openssl/ms/testssce.bat b/openssl/ms/testssce.bat
new file mode 100644
index 000000000..dbb25abdb
--- /dev/null
+++ b/openssl/ms/testssce.bat
@@ -0,0 +1,104 @@
+rem set ssleay=..\out\ssleay
+set ssleay=%1
+
+set reqcmd=%ssleay% req
+set x509cmd=%ssleay% x509
+set verifycmd=%ssleay% verify
+
+set CAkey=\OpenSSL\keyCA.ss
+set CAcert=\OpenSSL\certCA.ss
+set CAserial=\OpenSSL\certCA.srl
+set CAreq=\OpenSSL\reqCA.ss
+cecopy ..\test\CAss.cnf CE:\OpenSSL
+set CAconf=\OpenSSL\CAss.cnf
+set CAreq2=\OpenSSL\req2CA.ss
+
+cecopy ..\test\Uss.cnf CE:\OpenSSL
+set Uconf=\OpenSSL\Uss.cnf
+set Ukey=\OpenSSL\keyU.ss
+set Ureq=\OpenSSL\reqU.ss
+set Ucert=\OpenSSL\certU.ss
+
+echo make a certificate request using 'req'
+cerun CE:\OpenSSL\%reqcmd% -config %CAconf% -out %CAreq% -keyout %CAkey% -new
+if errorlevel 1 goto e_req
+
+echo convert the certificate request into a self signed certificate using 'x509'
+cerun CE:\OpenSSL\%x509cmd% -CAcreateserial -in %CAreq% -days 30 -req -out %CAcert% -signkey %CAkey% "> \OpenSSL\err.ss"
+if errorlevel 1 goto e_x509
+
+echo --
+echo convert a certificate into a certificate request using 'x509'
+cerun CE:\OpenSSL\%x509cmd% -in %CAcert% -x509toreq -signkey %CAkey% -out %CAreq2% "> \OpenSSL\err.ss"
+if errorlevel 1 goto e_x509_2
+
+cerun CE:\OpenSSL\%reqcmd% -verify -in %CAreq% -noout
+if errorlevel 1 goto e_vrfy_1
+
+cerun CE:\OpenSSL\%reqcmd% -verify -in %CAreq2% -noout
+if errorlevel 1 goto e_vrfy_2
+
+cerun CE:\OpenSSL\%verifycmd% -CAfile %CAcert% %CAcert%
+if errorlevel 1 goto e_vrfy_3
+
+echo --
+echo make another certificate request using 'req'
+cerun CE:\OpenSSL\%reqcmd% -config %Uconf% -out %Ureq% -keyout %Ukey% -new "> \OpenSSL\err.ss"
+if errorlevel 1 goto e_req_gen
+
+echo --
+echo sign certificate request with the just created CA via 'x509'
+cerun CE:\OpenSSL\%x509cmd% -CAcreateserial -in %Ureq% -days 30 -req -out %Ucert% -CA %CAcert% -CAkey %CAkey% -CAserial %CAserial%
+if errorlevel 1 goto e_x_sign
+
+cerun CE:\OpenSSL\%verifycmd% -CAfile %CAcert% %Ucert%
+echo --
+echo Certificate details
+cerun CE:\OpenSSL\%x509cmd% -subject -issuer -startdate -enddate -noout -in %Ucert%
+
+cecopy CE:%CAcert% .
+cecopy CE:%CAkey% .
+cecopy CE:%CAserial% .
+cecopy CE:%Ucert% .
+cecopy CE:%Ukey% .
+
+echo Everything appeared to work
+echo --
+echo The generated CA certificate is %CAcert%
+echo The generated CA private key is %CAkey%
+echo The current CA signing serial number is in %CAserial%
+
+echo The generated user certificate is %Ucert%
+echo The generated user private key is %Ukey%
+echo --
+
+cedel CE:\OpenSSL\err.ss
+
+goto end
+
+:e_req
+echo error using 'req' to generate a certificate request
+goto end
+:e_x509
+echo error using 'x509' to self sign a certificate request
+goto end
+:e_x509_2
+echo error using 'x509' convert a certificate to a certificate request
+goto end
+:e_vrfy_1
+echo first generated request is invalid
+goto end
+:e_vrfy_2
+echo second generated request is invalid
+goto end
+:e_vrfy_3
+echo first generated cert is invalid
+goto end
+:e_req_gen
+echo error using 'req' to generate a certificate request
+goto end
+:e_x_sign
+echo error using 'x509' to sign a certificate request
+goto end
+
+:end
diff --git a/openssl/ms/tlhelp32.h b/openssl/ms/tlhelp32.h
new file mode 100644
index 000000000..8f4222e34
--- /dev/null
+++ b/openssl/ms/tlhelp32.h
@@ -0,0 +1,136 @@
+/*
+ tlhelp32.h - Include file for Tool help functions.
+
+ Written by Mumit Khan <khan@nanotech.wisc.edu>
+
+ This file is part of a free library for the Win32 API.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+*/
+#ifndef _TLHELP32_H
+#define _TLHELP32_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define HF32_DEFAULT 1
+#define HF32_SHARED 2
+#define LF32_FIXED 0x1
+#define LF32_FREE 0x2
+#define LF32_MOVEABLE 0x4
+#define MAX_MODULE_NAME32 255
+#define TH32CS_SNAPHEAPLIST 0x1
+#define TH32CS_SNAPPROCESS 0x2
+#define TH32CS_SNAPTHREAD 0x4
+#define TH32CS_SNAPMODULE 0x8
+#define TH32CS_SNAPALL (TH32CS_SNAPHEAPLIST|TH32CS_SNAPPROCESS|TH32CS_SNAPTHREAD|TH32CS_SNAPMODULE)
+#define TH32CS_INHERIT 0x80000000
+typedef struct tagHEAPLIST32 {
+ DWORD dwSize;
+ DWORD th32ProcessID;
+ DWORD th32HeapID;
+ DWORD dwFlags;
+} HEAPLIST32,*PHEAPLIST32,*LPHEAPLIST32;
+typedef struct tagHEAPENTRY32 {
+ DWORD dwSize;
+ HANDLE hHandle;
+ DWORD dwAddress;
+ DWORD dwBlockSize;
+ DWORD dwFlags;
+ DWORD dwLockCount;
+ DWORD dwResvd;
+ DWORD th32ProcessID;
+ DWORD th32HeapID;
+} HEAPENTRY32,*PHEAPENTRY32,*LPHEAPENTRY32;
+typedef struct tagPROCESSENTRY32W {
+ DWORD dwSize;
+ DWORD cntUsage;
+ DWORD th32ProcessID;
+ DWORD th32DefaultHeapID;
+ DWORD th32ModuleID;
+ DWORD cntThreads;
+ DWORD th32ParentProcessID;
+ LONG pcPriClassBase;
+ DWORD dwFlags;
+ WCHAR szExeFile[MAX_PATH];
+} PROCESSENTRY32W,*PPROCESSENTRY32W,*LPPROCESSENTRY32W;
+typedef struct tagPROCESSENTRY32 {
+ DWORD dwSize;
+ DWORD cntUsage;
+ DWORD th32ProcessID;
+ DWORD th32DefaultHeapID;
+ DWORD th32ModuleID;
+ DWORD cntThreads;
+ DWORD th32ParentProcessID;
+ LONG pcPriClassBase;
+ DWORD dwFlags;
+ CHAR szExeFile[MAX_PATH];
+} PROCESSENTRY32,*PPROCESSENTRY32,*LPPROCESSENTRY32;
+typedef struct tagTHREADENTRY32 {
+ DWORD dwSize;
+ DWORD cntUsage;
+ DWORD th32ThreadID;
+ DWORD th32OwnerProcessID;
+ LONG tpBasePri;
+ LONG tpDeltaPri;
+ DWORD dwFlags;
+} THREADENTRY32,*PTHREADENTRY32,*LPTHREADENTRY32;
+typedef struct tagMODULEENTRY32W {
+ DWORD dwSize;
+ DWORD th32ModuleID;
+ DWORD th32ProcessID;
+ DWORD GlblcntUsage;
+ DWORD ProccntUsage;
+ BYTE *modBaseAddr;
+ DWORD modBaseSize;
+ HMODULE hModule;
+ WCHAR szModule[MAX_MODULE_NAME32 + 1];
+ WCHAR szExePath[MAX_PATH];
+} MODULEENTRY32W,*PMODULEENTRY32W,*LPMODULEENTRY32W;
+typedef struct tagMODULEENTRY32 {
+ DWORD dwSize;
+ DWORD th32ModuleID;
+ DWORD th32ProcessID;
+ DWORD GlblcntUsage;
+ DWORD ProccntUsage;
+ BYTE *modBaseAddr;
+ DWORD modBaseSize;
+ HMODULE hModule;
+ char szModule[MAX_MODULE_NAME32 + 1];
+ char szExePath[MAX_PATH];
+} MODULEENTRY32,*PMODULEENTRY32,*LPMODULEENTRY32;
+BOOL WINAPI Heap32First(LPHEAPENTRY32,DWORD,DWORD);
+BOOL WINAPI Heap32ListFirst(HANDLE,LPHEAPLIST32);
+BOOL WINAPI Heap32ListNext(HANDLE,LPHEAPLIST32);
+BOOL WINAPI Heap32Next(LPHEAPENTRY32);
+BOOL WINAPI Module32First(HANDLE,LPMODULEENTRY32);
+BOOL WINAPI Module32FirstW(HANDLE,LPMODULEENTRY32W);
+BOOL WINAPI Module32Next(HANDLE,LPMODULEENTRY32);
+BOOL WINAPI Module32NextW(HANDLE,LPMODULEENTRY32W);
+BOOL WINAPI Process32First(HANDLE,LPPROCESSENTRY32);
+BOOL WINAPI Process32FirstW(HANDLE,LPPROCESSENTRY32W);
+BOOL WINAPI Process32Next(HANDLE,LPPROCESSENTRY32);
+BOOL WINAPI Process32NextW(HANDLE,LPPROCESSENTRY32W);
+BOOL WINAPI Thread32First(HANDLE,LPTHREADENTRY32);
+BOOL WINAPI Thread32Next(HANDLE,LPTHREADENTRY32);
+BOOL WINAPI Toolhelp32ReadProcessMemory(DWORD,LPCVOID,LPVOID,DWORD,LPDWORD);
+HANDLE WINAPI CreateToolhelp32Snapshot(DWORD,DWORD);
+#ifdef UNICODE
+#define LPMODULEENTRY32 LPMODULEENTRY32W
+#define LPPROCESSENTRY32 LPPROCESSENTRY32W
+#define MODULEENTRY32 MODULEENTRY32W
+#define Module32First Module32FirstW
+#define Module32Next Module32NextW
+#define PMODULEENTRY32 PMODULEENTRY32W
+#define PPROCESSENTRY32 PPROCESSENTRY32W
+#define PROCESSENTRY32 PROCESSENTRY32W
+#define Process32First Process32FirstW
+#define Process32Next Process32NextW
+#endif /* UNICODE */
+#ifdef __cplusplus
+}
+#endif
+#endif /* _TLHELP32_H */
+
diff --git a/openssl/ms/tpem.bat b/openssl/ms/tpem.bat
new file mode 100644
index 000000000..7fc7a8327
--- /dev/null
+++ b/openssl/ms/tpem.bat
@@ -0,0 +1,6 @@
+rem called by testpem
+
+echo test %1 %2
+%ssleay% %1 -in %2 -out %tmp1%
+%cmp% %2 %tmp1%
+
diff --git a/openssl/ms/tpemce.bat b/openssl/ms/tpemce.bat
new file mode 100644
index 000000000..17b2acd39
--- /dev/null
+++ b/openssl/ms/tpemce.bat
@@ -0,0 +1,8 @@
+rem called by testpemce
+
+echo test %1 %2
+cecopy %2 CE:\OpenSSL
+cerun CE:\OpenSSL\%ssleay% %1 -in \OpenSSL\%2 -out \OpenSSL\%tmp1%
+del %tmp1% >nul 2>&1
+cecopy CE:\OpenSSL\%tmp1% .
+%cmp% %2 %tmp1%
diff --git a/openssl/ms/uplink.c b/openssl/ms/uplink.c
new file mode 100644
index 000000000..7b7da08d4
--- /dev/null
+++ b/openssl/ms/uplink.c
@@ -0,0 +1,116 @@
+#if (defined(_WIN64) || defined(_WIN32_WCE)) && !defined(UNICODE)
+#define UNICODE
+#endif
+#if defined(UNICODE) && !defined(_UNICODE)
+#define _UNICODE
+#endif
+#if defined(_UNICODE) && !defined(UNICODE)
+#define UNICODE
+#endif
+
+#include <windows.h>
+#include <tchar.h>
+#include <stdio.h>
+#include "uplink.h"
+void OPENSSL_showfatal(const char *,...);
+
+static TCHAR msg[128];
+
+static void unimplemented (void)
+{ OPENSSL_showfatal (sizeof(TCHAR)==sizeof(char)?"%s\n":"%S\n",msg);
+ ExitProcess (1);
+}
+
+void OPENSSL_Uplink (volatile void **table, int index)
+{ static HMODULE volatile apphandle=NULL;
+ static void ** volatile applinktable=NULL;
+ int len;
+ void (*func)(void)=unimplemented;
+ HANDLE h;
+ void **p;
+
+ /* Note that the below code is not MT-safe in respect to msg
+ * buffer, but what's the worst thing that can happen? Error
+ * message might be misleading or corrupted. As error condition
+ * is fatal and should never be risen, I accept the risk... */
+ /* One can argue that I should have used InterlockedExchangePointer
+ * or something to update static variables and table[]. Well,
+ * store instructions are as atomic as they can get and assigned
+ * values are effectively constant... So that volatile qualifier
+ * should be sufficient [it prohibits compiler to reorder memory
+ * access instructions]. */
+ do {
+ len = _stprintf (msg,_T("OPENSSL_Uplink(%p,%02X): "),table,index);
+ _tcscpy (msg+len,_T("unimplemented function"));
+
+ if ((h=apphandle)==NULL)
+ { if ((h=GetModuleHandle(NULL))==NULL)
+ { apphandle=(HMODULE)-1;
+ _tcscpy (msg+len,_T("no host application"));
+ break;
+ }
+ apphandle = h;
+ }
+ if ((h=apphandle)==(HMODULE)-1) /* revalidate */
+ break;
+
+ if (applinktable==NULL)
+ { void**(*applink)();
+
+ applink=(void**(*)())GetProcAddress(h,"OPENSSL_Applink");
+ if (applink==NULL)
+ { apphandle=(HMODULE)-1;
+ _tcscpy (msg+len,_T("no OPENSSL_Applink"));
+ break;
+ }
+ p = (*applink)();
+ if (p==NULL)
+ { apphandle=(HMODULE)-1;
+ _tcscpy (msg+len,_T("no ApplinkTable"));
+ break;
+ }
+ applinktable = p;
+ }
+ else
+ p = applinktable;
+
+ if (index > (int)p[0])
+ break;
+
+ if (p[index]) func = p[index];
+ } while (0);
+
+ table[index] = func;
+}
+
+#if defined(_MSC_VER) && defined(_M_IX86) && !defined(OPENSSL_NO_INLINE_ASM)
+#define LAZY(i) \
+__declspec(naked) static void lazy##i (void) { \
+ _asm push i \
+ _asm push OFFSET OPENSSL_UplinkTable \
+ _asm call OPENSSL_Uplink \
+ _asm add esp,8 \
+ _asm jmp OPENSSL_UplinkTable+4*i }
+
+#if APPLINK_MAX>25
+#error "Add more stubs..."
+#endif
+/* make some in advance... */
+LAZY(1) LAZY(2) LAZY(3) LAZY(4) LAZY(5)
+LAZY(6) LAZY(7) LAZY(8) LAZY(9) LAZY(10)
+LAZY(11) LAZY(12) LAZY(13) LAZY(14) LAZY(15)
+LAZY(16) LAZY(17) LAZY(18) LAZY(19) LAZY(20)
+LAZY(21) LAZY(22) LAZY(23) LAZY(24) LAZY(25)
+void *OPENSSL_UplinkTable[] = {
+ (void *)APPLINK_MAX,
+ lazy1, lazy2, lazy3, lazy4, lazy5,
+ lazy6, lazy7, lazy8, lazy9, lazy10,
+ lazy11,lazy12,lazy13,lazy14,lazy15,
+ lazy16,lazy17,lazy18,lazy19,lazy20,
+ lazy21,lazy22,lazy23,lazy24,lazy25,
+};
+#endif
+
+#ifdef SELFTEST
+main() { UP_fprintf(UP_stdout,"hello, world!\n"); }
+#endif
diff --git a/openssl/ms/uplink.h b/openssl/ms/uplink.h
new file mode 100644
index 000000000..a4a67d3c1
--- /dev/null
+++ b/openssl/ms/uplink.h
@@ -0,0 +1,29 @@
+#define APPMACROS_ONLY
+#include "applink.c"
+
+extern void *OPENSSL_UplinkTable[];
+
+#define UP_stdin (*(void *(*)(void))OPENSSL_UplinkTable[APPLINK_STDIN])()
+#define UP_stdout (*(void *(*)(void))OPENSSL_UplinkTable[APPLINK_STDOUT])()
+#define UP_stderr (*(void *(*)(void))OPENSSL_UplinkTable[APPLINK_STDERR])()
+#define UP_fprintf (*(int (*)(void *,const char *,...))OPENSSL_UplinkTable[APPLINK_FPRINTF])
+#define UP_fgets (*(char *(*)(char *,int,void *))OPENSSL_UplinkTable[APPLINK_FGETS])
+#define UP_fread (*(size_t (*)(void *,size_t,size_t,void *))OPENSSL_UplinkTable[APPLINK_FREAD])
+#define UP_fwrite (*(size_t (*)(const void *,size_t,size_t,void *))OPENSSL_UplinkTable[APPLINK_FWRITE])
+#define UP_fsetmod (*(int (*)(void *,char))OPENSSL_UplinkTable[APPLINK_FSETMOD])
+#define UP_feof (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FEOF])
+#define UP_fclose (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FCLOSE])
+
+#define UP_fopen (*(void *(*)(const char *,const char *))OPENSSL_UplinkTable[APPLINK_FOPEN])
+#define UP_fseek (*(int (*)(void *,long,int))OPENSSL_UplinkTable[APPLINK_FSEEK])
+#define UP_ftell (*(long (*)(void *))OPENSSL_UplinkTable[APPLINK_FTELL])
+#define UP_fflush (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FFLUSH])
+#define UP_ferror (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FERROR])
+#define UP_clearerr (*(void (*)(void *))OPENSSL_UplinkTable[APPLINK_CLEARERR])
+#define UP_fileno (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FILENO])
+
+#define UP_open (*(int (*)(const char *,int,...))OPENSSL_UplinkTable[APPLINK_OPEN])
+#define UP_read (*(ssize_t (*)(int,void *,size_t))OPENSSL_UplinkTable[APPLINK_READ])
+#define UP_write (*(ssize_t (*)(int,const void *,size_t))OPENSSL_UplinkTable[APPLINK_WRITE])
+#define UP_lseek (*(long (*)(int,long,int))OPENSSL_UplinkTable[APPLINK_LSEEK])
+#define UP_close (*(int (*)(int))OPENSSL_UplinkTable[APPLINK_CLOSE])
diff --git a/openssl/ms/uplink.pl b/openssl/ms/uplink.pl
new file mode 100644
index 000000000..102400e88
--- /dev/null
+++ b/openssl/ms/uplink.pl
@@ -0,0 +1,204 @@
+#!/usr/bin/env perl
+#
+# For Microsoft CL this is implemented as inline assembler. So that
+# even though this script can generate even Win32 code, we'll be
+# using it primarily to generate Win64 modules. Both IA-64 and AMD64
+# are supported...
+
+# 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...
+
+# 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;'...
+
+$arg = shift;
+#( defined shift || open STDOUT,">$arg" ) || die "can't open $arg: $!";
+
+if ($arg =~ /win32n/) { ia32nasm(); }
+elsif ($arg =~ /win32/) { ia32masm(); }
+elsif ($arg =~ /coff/) { ia32gas(); }
+elsif ($arg =~ /win64i/ or $arg =~ /ia64/) { ia64ias(); }
+elsif ($arg =~ /win64a/ or $arg =~ /amd64/) { amd64masm(); }
+else { die "nonsense $arg"; }
+
+sub ia32gas() {
+print <<___;
+.text
+___
+for ($i=1;$i<=$N;$i++) {
+print <<___;
+.def .Lazy$i; .scl 3; .type 32; .endef
+.align 4
+.Lazy$i:
+ pushl \$$i
+ pushl \$_OPENSSL_UplinkTable
+ call _OPENSSL_Uplink
+ addl \$8,%esp
+ jmp *(_OPENSSL_UplinkTable+4*$i)
+___
+}
+print <<___;
+.data
+.align 4
+.globl _OPENSSL_UplinkTable
+_OPENSSL_UplinkTable:
+ .long $N
+___
+for ($i=1;$i<=$N;$i++) { print " .long .Lazy$i\n"; }
+}
+
+sub ia32masm() {
+print <<___;
+.386P
+.model FLAT
+
+_DATA SEGMENT
+PUBLIC _OPENSSL_UplinkTable
+_OPENSSL_UplinkTable DD $N ; amount of following entries
+___
+for ($i=1;$i<=$N;$i++) { print " DD FLAT:\$lazy$i\n"; }
+print <<___;
+_DATA ENDS
+
+_TEXT SEGMENT
+EXTRN _OPENSSL_Uplink:NEAR
+___
+for ($i=1;$i<=$N;$i++) {
+print <<___;
+ALIGN 4
+\$lazy$i PROC NEAR
+ push $i
+ push OFFSET FLAT:_OPENSSL_UplinkTable
+ call _OPENSSL_Uplink
+ add esp,8
+ jmp DWORD PTR _OPENSSL_UplinkTable+4*$i
+\$lazy$i ENDP
+___
+}
+print <<___;
+ALIGN 4
+_TEXT ENDS
+END
+___
+}
+
+sub ia32nasm() {
+print <<___;
+SEGMENT .data
+GLOBAL _OPENSSL_UplinkTable
+_OPENSSL_UplinkTable DD $N ; amount of following entries
+___
+for ($i=1;$i<=$N;$i++) { print " DD \$lazy$i\n"; }
+print <<___;
+
+SEGMENT .text
+EXTERN _OPENSSL_Uplink
+___
+for ($i=1;$i<=$N;$i++) {
+print <<___;
+ALIGN 4
+\$lazy$i:
+ push $i
+ push _OPENSSL_UplinkTable
+ call _OPENSSL_Uplink
+ add esp,8
+ jmp [_OPENSSL_UplinkTable+4*$i]
+___
+}
+print <<___;
+ALIGN 4
+END
+___
+}
+
+sub ia64ias () {
+local $V=8; # max number of args uplink functions may accept...
+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#
+
+.text
+.global OPENSSL_Uplink#
+.type OPENSSL_Uplink#,\@function
+___
+for ($i=1;$i<=$N;$i++) {
+print <<___;
+.proc lazy$i
+lazy$i:
+{ .mii; alloc loc0=ar.pfs,$V,3,2,0
+ mov loc1=b0
+ addl loc2=\@ltoff(OPENSSL_UplinkTable#),gp };;
+{ .mmi; ld8 out0=[loc2]
+ mov out1=$i };;
+{ .mib; adds 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#
+___
+}
+}
+
+sub amd64masm() {
+print <<___;
+_DATA SEGMENT
+PUBLIC OPENSSL_UplinkTable
+OPENSSL_UplinkTable DQ $N
+___
+for ($i=1;$i<=$N;$i++) { print " DQ \$lazy$i\n"; }
+print <<___;
+_DATA ENDS
+
+_TEXT SEGMENT
+EXTERN OPENSSL_Uplink:PROC
+___
+for ($i=1;$i<=$N;$i++) {
+print <<___;
+ALIGN 4
+\$lazy$i PROC
+ push r9
+ push r8
+ push rdx
+ push rcx
+ sub rsp,40
+ lea rcx,OFFSET OPENSSL_UplinkTable
+ mov rdx,$i
+ call OPENSSL_Uplink
+ add rsp,40
+ pop rcx
+ pop rdx
+ pop r8
+ pop r9
+ jmp QWORD PTR OPENSSL_UplinkTable+8*$i
+\$lazy$i ENDP
+___
+}
+print <<___;
+_TEXT ENDS
+END
+___
+}
+
diff --git a/openssl/ms/x86asm.bat b/openssl/ms/x86asm.bat
new file mode 100644
index 000000000..ba2663781
--- /dev/null
+++ b/openssl/ms/x86asm.bat
@@ -0,0 +1,63 @@
+
+@echo off
+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
+cd ..\..\..
+
+echo DES
+cd crypto\des\asm
+perl des-586.pl %1 > d%2
+cd ..\..\..
+
+echo "crypt(3)"
+
+cd crypto\des\asm
+perl crypt586.pl %1 > y%2
+cd ..\..\..
+
+echo Blowfish
+
+cd crypto\bf\asm
+perl bf-586.pl %1 > b%2
+cd ..\..\..
+
+echo CAST5
+cd crypto\cast\asm
+perl cast-586.pl %1 > c%2
+cd ..\..\..
+
+echo RC4
+cd crypto\rc4\asm
+perl rc4-586.pl %1 > r4%2
+cd ..\..\..
+
+echo MD5
+cd crypto\md5\asm
+perl md5-586.pl %1 > m5%2
+cd ..\..\..
+
+echo SHA1
+cd crypto\sha\asm
+perl sha1-586.pl %1 > s1%2
+cd ..\..\..
+
+echo RIPEMD160
+cd crypto\ripemd\asm
+perl rmd-586.pl %1 > rm%2
+cd ..\..\..
+
+echo RC5\32
+cd crypto\rc5\asm
+perl rc5-586.pl %1 > r5%2
+cd ..\..\..
+
+echo CPUID
+cd crypto
+perl x86cpuid.pl %1 > x86cpuid%2
+cd ..\
+
+
+echo on