svn rev #25311: trunk/src/lib/crypto/krb/

hartmans@MIT.EDU hartmans at MIT.EDU
Wed Oct 5 17:30:55 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=25311
Commit By: hartmans
Log Message:
Don't need to check for fork on windows

Signed-off-by: Kevin Wasserman <kevin.wasserman at painless-security.com>


Changed Files:
U   trunk/src/lib/crypto/krb/prng_fortuna.c
Modified: trunk/src/lib/crypto/krb/prng_fortuna.c
===================================================================
--- trunk/src/lib/crypto/krb/prng_fortuna.c	2011-10-05 21:30:50 UTC (rev 25310)
+++ trunk/src/lib/crypto/krb/prng_fortuna.c	2011-10-05 21:30:55 UTC (rev 25311)
@@ -114,9 +114,6 @@
     unsigned int reseed_count;
     struct timeval last_reseed_time;
     unsigned int pool0_bytes;
-
-    /* Current pid as of last request, for fork safety. */
-    pid_t pid;
 };
 
 /*
@@ -346,7 +343,9 @@
 
 static k5_mutex_t fortuna_lock = K5_MUTEX_PARTIAL_INITIALIZER;
 static struct fortuna_state main_state;
+#ifndef _WIN32
 static pid_t last_pid;
+#endif
 static krb5_boolean have_entropy = FALSE;
 
 int
@@ -360,7 +359,9 @@
         return ret;
 
     init_state(&main_state);
+#ifndef _WIN32
     last_pid = getpid();
+#endif
     if (k5_get_os_entropy(osbuf, sizeof(osbuf))) {
         generator_reseed(&main_state, osbuf, sizeof(osbuf));
         have_entropy = TRUE;
@@ -410,8 +411,10 @@
 krb5_c_random_make_octets(krb5_context context, krb5_data *outdata)
 {
     krb5_error_code ret;
+#ifndef _WIN32
     pid_t pid = getpid();
     unsigned char pidbuf[4];
+#endif
 
     ret = k5_mutex_lock(&fortuna_lock);
     if (ret)
@@ -422,12 +425,14 @@
         return KRB5_CRYPTO_INTERNAL;
     }
 
+#ifndef _WIN32 /* no 'fork' on windows; does not apply */
     if (pid != last_pid) {
         /* We forked; make sure child's PRNG stream differs from parent's. */
         store_32_be(pid, pidbuf);
         generator_reseed(&main_state, pidbuf, 4);
         last_pid = pid;
     }
+#endif
 
     accumulator_output(&main_state, (unsigned char *)outdata->data,
                        outdata->length);




More information about the cvs-krb5 mailing list