[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-committers
Subject:    [ProFTPD-committers] proftpd/contrib mod_tls.c,1.333,1.334
From:       TJ Saunders <castaglia () users ! sourceforge ! net>
Date:       2014-03-05 17:43:22
Message-ID: E1WLFql-00030H-Bz () sfs-ml-2 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/proftp/proftpd/contrib
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18327/contrib

Modified Files:
	mod_tls.c 
Log Message:

When seeding OpenSSL's PRNG manually, use gettimeofday(2) instead of time(3).


Index: mod_tls.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/contrib/mod_tls.c,v
retrieving revision 1.333
retrieving revision 1.334
diff -u -d -r1.333 -r1.334
--- mod_tls.c	28 Feb 2014 15:18:50 -0000	1.333
+++ mod_tls.c	5 Mar 2014 17:43:20 -0000	1.334
@@ -4908,8 +4908,7 @@
    */
   if (RAND_load_file(tls_rand_file, 1024) != 1024) {
 #endif
-
-    time_t now;
+    struct timeval tv;
     pid_t pid;
  
 #if OPENSSL_VERSION_NUMBER >= 0x00905100L
@@ -4921,8 +4920,9 @@
 #endif
  
     /* No random file found, create new seed. */
-    now = time(NULL);
-    RAND_seed(&now, sizeof(time_t));
+    gettimeofday(&tv, NULL);
+    RAND_seed(&(tv.tv_sec), sizeof(tv.tv_sec));
+    RAND_seed(&(tv.tv_usec), sizeof(tv.tv_usec));
 
     pid = getpid();
     RAND_seed(&pid, sizeof(pid_t));


------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
ProFTPD Committers Mailing List
proftpd-committers@proftpd.org
https://lists.sourceforge.net/lists/listinfo/proftp-committers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic