Revision: 6125
Author: iratqq
Date: Fri Dec 25 08:58:38 2009
Log: * uim/openssl.c (c_SSL_connect):
  - Check random seed.

http://code.google.com/p/uim/source/detail?r=6125

Modified:
 /trunk/uim/openssl.c

=======================================
--- /trunk/uim/openssl.c        Tue Oct 20 09:48:29 2009
+++ /trunk/uim/openssl.c        Fri Dec 25 08:58:38 2009
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <openssl/crypto.h>
 #include <openssl/ssl.h>
+#include <openssl/rand.h>
 #include <openssl/err.h>

 #include "uim.h"
@@ -130,6 +131,15 @@
 static uim_lisp
 c_SSL_connect(uim_lisp s_)
 {
+
+  RAND_poll();
+  srand(time(NULL));
+
+  while (RAND_status() == 0) {
+    unsigned short seed = (unsigned short)rand();
+
+    RAND_seed(&seed, sizeof(seed));
+  }
   return MAKE_INT(SSL_connect(C_PTR(s_)));
 }

Reply via email to