home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / openssl.zip / openssl-emx.patch < prev    next >
Text File  |  2001-05-06  |  8KB  |  287 lines

  1. diff -urN D:\TMP\unzip\openssl-0.9.6\Configure ./Configure
  2. --- D:\TMP\unzip\openssl-0.9.6\Configure    Mon Sep 25 01:27:36 2000
  3. +++ ./Configure    Thu Jan 11 00:39:58 2001
  4. @@ -408,6 +408,9 @@
  5.  ##### Sony NEWS-OS 4.x
  6.  "newsos4-gcc","gcc:-O -DB_ENDIAN -DNEWS4::(unknown):-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
  7.  
  8. +# OS/2 EMX
  9. +"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:",
  10. +
  11.  );
  12.  
  13.  my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
  14. diff -urN D:\TMP\unzip\openssl-0.9.6\crypto/bio/bss_log.c ./crypto/bio/bss_log.c
  15. --- D:\TMP\unzip\openssl-0.9.6\crypto/bio/bss_log.c    Mon Sep 11 22:42:16 2000
  16. +++ ./crypto/bio/bss_log.c    Thu Oct  5 22:31:52 2000
  17. @@ -75,7 +75,7 @@
  18.  #  include <starlet.h>
  19.  #elif defined(__ultrix)
  20.  #  include <sys/syslog.h>
  21. -#elif !defined(MSDOS) /* Unix */
  22. +#elif !defined(MSDOS) && !defined(NO_SYSLOG) /* Unix */
  23.  #  include <syslog.h>
  24.  #endif
  25.  
  26. diff -urN D:\TMP\unzip\openssl-0.9.6\crypto/rand/rand_win.c ./crypto/rand/rand_win.c
  27. --- D:\TMP\unzip\openssl-0.9.6\crypto/rand/rand_win.c    Thu Sep 21 19:23:42 2000
  28. +++ ./crypto/rand/rand_win.c    Thu Jan 11 03:08:22 2001
  29. @@ -684,6 +684,91 @@
  30.    DeleteDC(hScrDC);
  31.  }
  32.  
  33. +#elif defined(OS2)
  34. +
  35. +#define INCL_DOSPROCESS
  36. +#define INCL_DOSPROFILE
  37. +#define INCL_DOSMISC
  38. +#define INCL_DOSMODULEMGR
  39. +#include <os2.h>
  40. +
  41. +#define   CMD_KI_RDCNT    (0x63)
  42. +typedef struct _CPUUTIL {
  43. +  ULONG ulTimeLow;     /* Low 32 bits of time stamp      */
  44. +  ULONG ulTimeHigh;    /* High 32 bits of time stamp     */
  45. +  ULONG ulIdleLow;     /* Low 32 bits of idle time       */
  46. +  ULONG ulIdleHigh;    /* High 32 bits of idle time      */
  47. +  ULONG ulBusyLow;     /* Low 32 bits of busy time       */
  48. +  ULONG ulBusyHigh;    /* High 32 bits of busy time      */
  49. +  ULONG ulIntrLow;     /* Low 32 bits of interrupt time  */
  50. +  ULONG ulIntrHigh;    /* High 32 bits of interrupt time */
  51. +} CPUUTIL;
  52. +
  53. +APIRET APIENTRY (*DosPerfSysCall)(ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL;
  54. +APIRET APIENTRY (*DosQuerySysState)(ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL;
  55. +HMODULE hDoscalls = 0;
  56. +
  57. +int RAND_poll(void)
  58. +{
  59. +  char failed_module[20];
  60. +  QWORD qwTime;
  61. +  ULONG SysVars[QSV_FOREGROUND_PROCESS];
  62. +
  63. +  if ( hDoscalls == 0 ) {
  64. +    ULONG rc = DosLoadModule( failed_module, sizeof( failed_module ), "DOSCALLS", &hDoscalls );
  65. +
  66. +    if ( rc == 0 ) {
  67. +      rc = DosQueryProcAddr( hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall );
  68. +
  69. +      if ( rc )
  70. +        DosPerfSysCall = NULL;
  71. +
  72. +      rc = DosQueryProcAddr( hDoscalls, 368, NULL, (PFN *)&DosQuerySysState );
  73. +
  74. +      if ( rc )
  75. +        DosQuerySysState = NULL;
  76. +    }
  77. +  }
  78. +
  79. +/* Sample the hi-res timer, runs at around 1.1 MHz */
  80. +  DosTmrQueryTime( &qwTime );
  81. +  RAND_add( &qwTime, sizeof( qwTime ), 2 );
  82. +
  83. +/* Sample a bunch of system variables, includes various process & memory statistics */
  84. +  DosQuerySysInfo( 1, QSV_FOREGROUND_PROCESS, SysVars, sizeof(SysVars) );
  85. +  RAND_add( SysVars, sizeof( SysVars ), 4 );
  86. +
  87. +/* If available, sample CPU registers that count at CPU MHz 
  88. + * Only fairly new CPUs (PPro & K6 onwards) & OS/2 versions support this
  89. + */
  90. +  if ( DosPerfSysCall ) {
  91. +    CPUUTIL util;
  92. +
  93. +    if ( DosPerfSysCall( CMD_KI_RDCNT, (ULONG)&util, 0, 0 ) == 0 ) {
  94. +      RAND_add( &util, sizeof( util ), 10 );
  95. +    } else
  96. +      DosPerfSysCall = NULL;
  97. +  }
  98. +
  99. +/* DosQuerySysState() gives us a huge quantity of process, thread, memory & handle stats */
  100. +  if ( DosQuerySysState ) {
  101. +    char *buffer = OPENSSL_malloc(128*1024);
  102. +
  103. +    if ( DosQuerySysState( 0x1F, 0, 0, 0, buffer, 128*1024 ) == 0 ) {
  104. +/* First 4 bytes in buffer is a pointer to the thread count 
  105. + * there should be at least 1 byte of entropy per thread 
  106. + */
  107. +      RAND_add( buffer, 65536, **(ULONG **)buffer );
  108. +    }
  109. +
  110. +    OPENSSL_free( buffer );
  111. +    return 1;
  112. +  }
  113. +
  114. +  return 0;
  115. +}
  116. +
  117.  #else /* Unix version */
  118.  
  119.  #include <time.h>
  120. diff -urN D:\TMP\unzip\openssl-0.9.6\os2/EMX.cmd ./os2/EMX.cmd
  121. --- D:\TMP\unzip\openssl-0.9.6\os2/EMX.cmd    Thu Jan  1 00:00:00 1970
  122. +++ ./os2/EMX.cmd    Thu Jan 11 00:26:34 2001
  123. @@ -0,0 +1,5 @@
  124. +perl Configure EMX
  125. +perl util\mkfiles.pl > MINFO
  126. +
  127. +@rem create make file
  128. +perl util\mk1mf.pl no-asm EMX > EMX.mak
  129. diff -urN D:\TMP\unzip\openssl-0.9.6\util/mk1mf.pl ./util/mk1mf.pl
  130. --- D:\TMP\unzip\openssl-0.9.6\util/mk1mf.pl    Mon Sep 25 01:28:28 2000
  131. +++ ./util/mk1mf.pl    Thu Jan 11 00:42:38 2001
  132. @@ -37,6 +37,7 @@
  133.      "linux-elf","Linux elf",
  134.      "ultrix-mips","DEC mips ultrix",
  135.      "FreeBSD","FreeBSD distribution",
  136. +    "EMX", "EMX GCC OS/2",
  137.      "default","cc under unix",
  138.      );
  139.  
  140. @@ -182,6 +183,11 @@
  141.      require "unix.pl";
  142.      require "ultrix.pl";
  143.      $unix=1;
  144. +    }
  145. +elsif ($platform eq "EMX")
  146. +    {
  147. +    $wc=1;
  148. +    require 'EMX.pl';
  149.      }
  150.  else
  151.      {
  152. diff -urN D:\TMP\unzip\openssl-0.9.6\util/pl/EMX.pl ./util/pl/EMX.pl
  153. --- D:\TMP\unzip\openssl-0.9.6\util/pl/EMX.pl    Thu Jan  1 00:00:00 1970
  154. +++ ./util/pl/EMX.pl    Thu Jan 11 03:03:04 2001
  155. @@ -0,0 +1,130 @@
  156. +#!/usr/local/bin/perl
  157. +# EMX GCC
  158. +#
  159. +
  160. +$o='\\';
  161. +$cp='copy';
  162. +$rm='del';
  163. +
  164. +# C compiler stuff
  165. +$cc='gcc';
  166. +$lflags="";
  167. +$mlflags='';
  168. +
  169. +$lib_def="";
  170. +$out_def="out2";
  171. +$tmp_def="tmp2";
  172. +$inc_def="include";
  173. +#enable max error messages, disable most common warnings
  174. +$cflags="-DOS2 -DTERMIOS -DL_ENDIAN -DNO_SYSLOG -fomit-frame-pointer -O3 -m486 -Zmt -Wall ";
  175. +if ($debug)
  176. +{
  177. +    $cflags.="-g -D_DEBUG";
  178. +    $mlflags.=' ';
  179. +}
  180. +else
  181. +{
  182. +    $cflags.="-O3";
  183. +}
  184. +
  185. +$obj='.o';
  186. +$ofile="-o ";
  187. +
  188. +# EXE linking stuff
  189. +$link="gcc";
  190. +$efile="";
  191. +$exep='.exe';
  192. +$ex_libs="-lsocket";
  193. +
  194. +# static library stuff
  195. +$mklib='ar cr';
  196. +$ranlib='ar s';
  197. +$plib="";
  198. +$libp=".a";
  199. +$shlibp=($shlib)?".dll":".a";
  200. +$lfile='';
  201. +
  202. +$shlib_ex_obj="";
  203. +
  204. +$asm='n_o_T_a_s_m';
  205. +$asm.=" /Zi" if $debug;
  206. +$afile='/Fo';
  207. +
  208. +$bn_mulw_obj='';
  209. +$bn_mulw_src='';
  210. +$des_enc_obj='';
  211. +$des_enc_src='';
  212. +$bf_enc_obj='';
  213. +$bf_enc_src='';
  214. +
  215. +if (!$no_asm)
  216. +    {
  217. +    $bn_mulw_obj='crypto\bn\asm\bn-win32.obj';
  218. +    $bn_mulw_src='crypto\bn\asm\bn-win32.asm';
  219. +    $des_enc_obj='crypto\des\asm\d-win32.obj crypto\des\asm\y-win32.obj';
  220. +    $des_enc_src='crypto\des\asm\d-win32.asm crypto\des\asm\y-win32.asm';
  221. +    $bf_enc_obj='crypto\bf\asm\b-win32.obj';
  222. +    $bf_enc_src='crypto\bf\asm\b-win32.asm';
  223. +    $cast_enc_obj='crypto\cast\asm\c-win32.obj';
  224. +    $cast_enc_src='crypto\cast\asm\c-win32.asm';
  225. +    $rc4_enc_obj='crypto\rc4\asm\r4-win32.obj';
  226. +    $rc4_enc_src='crypto\rc4\asm\r4-win32.asm';
  227. +    $rc5_enc_obj='crypto\rc5\asm\r5-win32.obj';
  228. +    $rc5_enc_src='crypto\rc5\asm\r5-win32.asm';
  229. +    $md5_asm_obj='crypto\md5\asm\m5-win32.obj';
  230. +    $md5_asm_src='crypto\md5\asm\m5-win32.asm';
  231. +    $sha1_asm_obj='crypto\sha\asm\s1-win32.obj';
  232. +    $sha1_asm_src='crypto\sha\asm\s1-win32.asm';
  233. +    $rmd160_asm_obj='crypto\ripemd\asm\rm-win32.obj';
  234. +    $rmd160_asm_src='crypto\ripemd\asm\rm-win32.asm';
  235. +    $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
  236. +    }
  237. +
  238. +if ($shlib)
  239. +    {
  240. +    $mlflags.=" $lflags -Zdll";
  241. +    $cflags.=" -Zdll";
  242. +    $lib_cflag=" -D_DLL";
  243. +    $out_def="out32dll";
  244. +    $tmp_def="tmp32dll";
  245. +    }
  246. +
  247. +sub do_lib_rule
  248. +    {
  249. +    local($objs,$target,$name,$shlib)=@_;
  250. +    local($ret,$Name);
  251. +
  252. +    $taget =~ s/\//$o/g if $o ne '/';
  253. +    ($Name=$name) =~ tr/a-z/A-Z/;
  254. +
  255. +#    $target="\$(LIB_D)$o$target";
  256. +    $ret.="$target: $objs\n";
  257. +    if (!$shlib)
  258. +        {
  259. +        #        $ret.="\t\$(RM) \$(O_$Name)\n";
  260. +        $ret.="\techo LIB $target\n";    
  261. +                $ret.="\t\$(MKLIB) $lfile$target $objs\n";
  262. +        }
  263. +    else
  264. +        {
  265. +        local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
  266. +        $ex.=' -lsocket';
  267. +        $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
  268. +        }
  269. +    $ret.="\n";
  270. +    return($ret);
  271. +    }
  272. +
  273. +sub do_link_rule
  274. +    {
  275. +    local($target,$files,$dep_libs,$libs)=@_;
  276. +    local($ret,$_);
  277. +    
  278. +    $file =~ s/\//$o/g if $o ne '/';
  279. +    $n=&bname($targer);
  280. +    $ret.="$target: $files $dep_libs\n";
  281. +    $ret.="\t\$(LINK) -o $target \$(LFLAGS) $files $libs\n\n";
  282. +    return($ret);
  283. +    }
  284. +
  285. +1;
  286.