diff -urN D:\TMP\unzip\openssl-0.9.6\Configure ./Configure
--- D:\TMP\unzip\openssl-0.9.6\Configure	Mon Sep 25 01:27:36 2000
+++ ./Configure	Thu Jan 11 00:39:58 2001
@@ -408,6 +408,9 @@
 ##### Sony NEWS-OS 4.x
 "newsos4-gcc","gcc:-O -DB_ENDIAN -DNEWS4::(unknown):-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
 
+# OS/2 EMX
+"EMX", "gcc:-DTERMIOS -DL_ENDIAN -DNO_SYSLOG -fomit-frame-pointer -O3 -m486 -Zmt -Wall:::-lsocket -Zexe -Zmtd:BN_LLONG $x86_gcc_des $x86_gcc_opts:",
+
 );
 
 my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
diff -urN D:\TMP\unzip\openssl-0.9.6\crypto/bio/bss_log.c ./crypto/bio/bss_log.c
--- D:\TMP\unzip\openssl-0.9.6\crypto/bio/bss_log.c	Mon Sep 11 22:42:16 2000
+++ ./crypto/bio/bss_log.c	Thu Oct  5 22:31:52 2000
@@ -75,7 +75,7 @@
 #  include <starlet.h>
 #elif defined(__ultrix)
 #  include <sys/syslog.h>
-#elif !defined(MSDOS) /* Unix */
+#elif !defined(MSDOS) && !defined(NO_SYSLOG) /* Unix */
 #  include <syslog.h>
 #endif
 
diff -urN D:\TMP\unzip\openssl-0.9.6\crypto/rand/rand_win.c ./crypto/rand/rand_win.c
--- D:\TMP\unzip\openssl-0.9.6\crypto/rand/rand_win.c	Thu Sep 21 19:23:42 2000
+++ ./crypto/rand/rand_win.c	Thu Jan 11 03:08:22 2001
@@ -684,6 +684,91 @@
   DeleteDC(hScrDC);
 }
 
+#elif defined(OS2)
+
+#define INCL_DOSPROCESS
+#define INCL_DOSPROFILE
+#define INCL_DOSMISC
+#define INCL_DOSMODULEMGR
+#include <os2.h>
+
+#define   CMD_KI_RDCNT    (0x63)
+ 
+typedef struct _CPUUTIL {
+  ULONG ulTimeLow;     /* Low 32 bits of time stamp      */
+  ULONG ulTimeHigh;    /* High 32 bits of time stamp     */
+  ULONG ulIdleLow;     /* Low 32 bits of idle time       */
+  ULONG ulIdleHigh;    /* High 32 bits of idle time      */
+  ULONG ulBusyLow;     /* Low 32 bits of busy time       */
+  ULONG ulBusyHigh;    /* High 32 bits of busy time      */
+  ULONG ulIntrLow;     /* Low 32 bits of interrupt time  */
+  ULONG ulIntrHigh;    /* High 32 bits of interrupt time */
+} CPUUTIL;
+
+APIRET APIENTRY (*DosPerfSysCall)(ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL;
+APIRET APIENTRY (*DosQuerySysState)(ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL;
+HMODULE hDoscalls = 0;
+
+int RAND_poll(void)
+{
+  char failed_module[20];
+  QWORD qwTime;
+  ULONG SysVars[QSV_FOREGROUND_PROCESS];
+
+  if ( hDoscalls == 0 ) {
+    ULONG rc = DosLoadModule( failed_module, sizeof( failed_module ), "DOSCALLS", &hDoscalls );
+
+    if ( rc == 0 ) {
+      rc = DosQueryProcAddr( hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall );
+
+      if ( rc )
+        DosPerfSysCall = NULL;
+
+      rc = DosQueryProcAddr( hDoscalls, 368, NULL, (PFN *)&DosQuerySysState );
+
+      if ( rc )
+        DosQuerySysState = NULL;
+    }
+  }
+
+/* Sample the hi-res timer, runs at around 1.1 MHz */
+  DosTmrQueryTime( &qwTime );
+  RAND_add( &qwTime, sizeof( qwTime ), 2 );
+
+/* Sample a bunch of system variables, includes various process & memory statistics */
+  DosQuerySysInfo( 1, QSV_FOREGROUND_PROCESS, SysVars, sizeof(SysVars) );
+  RAND_add( SysVars, sizeof( SysVars ), 4 );
+
+/* If available, sample CPU registers that count at CPU MHz 
+ * Only fairly new CPUs (PPro & K6 onwards) & OS/2 versions support this
+ */
+  if ( DosPerfSysCall ) {
+    CPUUTIL util;
+
+    if ( DosPerfSysCall( CMD_KI_RDCNT, (ULONG)&util, 0, 0 ) == 0 ) {
+      RAND_add( &util, sizeof( util ), 10 );
+    } else
+      DosPerfSysCall = NULL;
+  }
+
+/* DosQuerySysState() gives us a huge quantity of process, thread, memory & handle stats */
+  if ( DosQuerySysState ) {
+    char *buffer = OPENSSL_malloc(128*1024);
+
+    if ( DosQuerySysState( 0x1F, 0, 0, 0, buffer, 128*1024 ) == 0 ) {
+/* First 4 bytes in buffer is a pointer to the thread count 
+ * there should be at least 1 byte of entropy per thread 
+ */
+      RAND_add( buffer, 65536, **(ULONG **)buffer );
+    }
+
+    OPENSSL_free( buffer );
+    return 1;
+  }
+
+  return 0;
+}
+
 #else /* Unix version */
 
 #include <time.h>
diff -urN D:\TMP\unzip\openssl-0.9.6\os2/EMX.cmd ./os2/EMX.cmd
--- D:\TMP\unzip\openssl-0.9.6\os2/EMX.cmd	Thu Jan  1 00:00:00 1970
+++ ./os2/EMX.cmd	Thu Jan 11 00:26:34 2001
@@ -0,0 +1,5 @@
+perl Configure EMX
+perl util\mkfiles.pl > MINFO
+
+@rem create make file
+perl util\mk1mf.pl no-asm EMX > EMX.mak
diff -urN D:\TMP\unzip\openssl-0.9.6\util/mk1mf.pl ./util/mk1mf.pl
--- D:\TMP\unzip\openssl-0.9.6\util/mk1mf.pl	Mon Sep 25 01:28:28 2000
+++ ./util/mk1mf.pl	Thu Jan 11 00:42:38 2001
@@ -37,6 +37,7 @@
 	"linux-elf","Linux elf",
 	"ultrix-mips","DEC mips ultrix",
 	"FreeBSD","FreeBSD distribution",
+	"EMX", "EMX GCC OS/2",
 	"default","cc under unix",
 	);
 
@@ -182,6 +183,11 @@
 	require "unix.pl";
 	require "ultrix.pl";
 	$unix=1;
+	}
+elsif ($platform eq "EMX")
+	{
+	$wc=1;
+	require 'EMX.pl';
 	}
 else
 	{
diff -urN D:\TMP\unzip\openssl-0.9.6\util/pl/EMX.pl ./util/pl/EMX.pl
--- D:\TMP\unzip\openssl-0.9.6\util/pl/EMX.pl	Thu Jan  1 00:00:00 1970
+++ ./util/pl/EMX.pl	Thu Jan 11 03:03:04 2001
@@ -0,0 +1,130 @@
+#!/usr/local/bin/perl
+# EMX GCC
+#
+
+$o='\\';
+$cp='copy';
+$rm='del';
+
+# C compiler stuff
+$cc='gcc';
+$lflags="";
+$mlflags='';
+
+$lib_def="";
+$out_def="out2";
+$tmp_def="tmp2";
+$inc_def="include";
+#enable max error messages, disable most common warnings
+$cflags="-DOS2 -DTERMIOS -DL_ENDIAN -DNO_SYSLOG -fomit-frame-pointer -O3 -m486 -Zmt -Wall ";
+if ($debug)
+{
+    $cflags.="-g -D_DEBUG";
+    $mlflags.=' ';
+}
+else
+{
+    $cflags.="-O3";
+}
+
+$obj='.o';
+$ofile="-o ";
+
+# EXE linking stuff
+$link="gcc";
+$efile="";
+$exep='.exe';
+$ex_libs="-lsocket";
+
+# static library stuff
+$mklib='ar cr';
+$ranlib='ar s';
+$plib="";
+$libp=".a";
+$shlibp=($shlib)?".dll":".a";
+$lfile='';
+
+$shlib_ex_obj="";
+
+$asm='n_o_T_a_s_m';
+$asm.=" /Zi" if $debug;
+$afile='/Fo';
+
+$bn_mulw_obj='';
+$bn_mulw_src='';
+$des_enc_obj='';
+$des_enc_src='';
+$bf_enc_obj='';
+$bf_enc_src='';
+
+if (!$no_asm)
+	{
+	$bn_mulw_obj='crypto\bn\asm\bn-win32.obj';
+	$bn_mulw_src='crypto\bn\asm\bn-win32.asm';
+	$des_enc_obj='crypto\des\asm\d-win32.obj crypto\des\asm\y-win32.obj';
+	$des_enc_src='crypto\des\asm\d-win32.asm crypto\des\asm\y-win32.asm';
+	$bf_enc_obj='crypto\bf\asm\b-win32.obj';
+	$bf_enc_src='crypto\bf\asm\b-win32.asm';
+	$cast_enc_obj='crypto\cast\asm\c-win32.obj';
+	$cast_enc_src='crypto\cast\asm\c-win32.asm';
+	$rc4_enc_obj='crypto\rc4\asm\r4-win32.obj';
+	$rc4_enc_src='crypto\rc4\asm\r4-win32.asm';
+	$rc5_enc_obj='crypto\rc5\asm\r5-win32.obj';
+	$rc5_enc_src='crypto\rc5\asm\r5-win32.asm';
+	$md5_asm_obj='crypto\md5\asm\m5-win32.obj';
+	$md5_asm_src='crypto\md5\asm\m5-win32.asm';
+	$sha1_asm_obj='crypto\sha\asm\s1-win32.obj';
+	$sha1_asm_src='crypto\sha\asm\s1-win32.asm';
+	$rmd160_asm_obj='crypto\ripemd\asm\rm-win32.obj';
+	$rmd160_asm_src='crypto\ripemd\asm\rm-win32.asm';
+	$cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
+	}
+
+if ($shlib)
+	{
+	$mlflags.=" $lflags -Zdll";
+	$cflags.=" -Zdll";
+	$lib_cflag=" -D_DLL";
+	$out_def="out32dll";
+	$tmp_def="tmp32dll";
+	}
+
+sub do_lib_rule
+	{
+	local($objs,$target,$name,$shlib)=@_;
+	local($ret,$Name);
+
+	$taget =~ s/\//$o/g if $o ne '/';
+	($Name=$name) =~ tr/a-z/A-Z/;
+
+#	$target="\$(LIB_D)$o$target";
+	$ret.="$target: $objs\n";
+	if (!$shlib)
+		{
+		#		$ret.="\t\$(RM) \$(O_$Name)\n";
+		$ret.="\techo LIB $target\n";    
+                $ret.="\t\$(MKLIB) $lfile$target $objs\n";
+		}
+	else
+		{
+		local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
+		$ex.=' -lsocket';
+		$ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
+		}
+	$ret.="\n";
+	return($ret);
+	}
+
+sub do_link_rule
+	{
+	local($target,$files,$dep_libs,$libs)=@_;
+	local($ret,$_);
+	
+	$file =~ s/\//$o/g if $o ne '/';
+	$n=&bname($targer);
+	$ret.="$target: $files $dep_libs\n";
+	$ret.="\t\$(LINK) -o $target \$(LFLAGS) $files $libs\n\n";
+	return($ret);
+	}
+
+1;

