svn rev #22049: trunk/src/lib/krb5/krb/

ghudson@MIT.EDU ghudson at MIT.EDU
Mon Feb 23 15:15:05 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22049
Commit By: ghudson
Log Message:
In krb5int_generate_and_save_subkey, check the return value of
krb5_crypto_us_timeofday.  It can't really fail in practice, but if it
did we'd be passing stack garbage to krb5_c_random_add_entropy.
That's harmless, but poor form.



Changed Files:
U   trunk/src/lib/krb5/krb/mk_req_ext.c
Modified: trunk/src/lib/krb5/krb/mk_req_ext.c
===================================================================
--- trunk/src/lib/krb5/krb/mk_req_ext.c	2009-02-23 19:56:52 UTC (rev 22048)
+++ trunk/src/lib/krb5/krb/mk_req_ext.c	2009-02-23 20:15:05 UTC (rev 22049)
@@ -94,10 +94,11 @@
     krb5_data d;
     krb5_error_code retval;
 
-    krb5_crypto_us_timeofday (&rnd_data.sec, &rnd_data.usec);
-    d.length = sizeof (rnd_data);
-    d.data = (char *) &rnd_data;
-    (void) krb5_c_random_add_entropy (context, KRB5_C_RANDSOURCE_TIMING, &d);
+    if (krb5_crypto_us_timeofday(&rnd_data.sec, &rnd_data.usec) == 0) {
+	d.length = sizeof(rnd_data);
+	d.data = (char *) &rnd_data;
+	krb5_c_random_add_entropy(context, KRB5_C_RANDSOURCE_TIMING, &d);
+    }
 
     if (auth_context->send_subkey)
 	krb5_free_keyblock(context, auth_context->send_subkey);




More information about the cvs-krb5 mailing list