gentleknife / rpms / libgcrypt

Forked from rpms/libgcrypt 4 years ago
Clone
Blob Blame History Raw
diff -up libgcrypt-1.5.3/random/drbg.c.drbg-init libgcrypt-1.5.3/random/drbg.c
--- libgcrypt-1.5.3/random/drbg.c.drbg-init	2017-02-28 14:28:55.000000000 +0100
+++ libgcrypt-1.5.3/random/drbg.c	2017-02-28 15:15:54.401291408 +0100
@@ -1820,12 +1820,16 @@ _gcry_drbg_randomize (void *buffer, size
 		      enum gcry_random_level level)
 {
   (void) level;
-  gcry_drbg_lock ();
   if (NULL == gcry_drbg)
     {
-      fips_signal_error ("DRBG is not initialized");
-      goto bailout;
+      _gcry_drbg_init(1);
+      if (NULL == gcry_drbg)
+        {
+          log_fatal ("DRBG is not initialized\n");
+          goto bailout;
+        }
     }
+  gcry_drbg_lock ();
 
   /* As reseeding changes the entire state of the DRBG, including any
    * key, either a re-init or a reseed is sufficient for a fork */