File libgcrypt-fips_drbg_healthcheck_sanity_bug.patch of Package libgcrypt.7109

Index: libgcrypt-1.6.1/random/drbg.c
===================================================================
--- libgcrypt-1.6.1.orig/random/drbg.c	2017-07-13 13:36:36.125990958 +0200
+++ libgcrypt-1.6.1/random/drbg.c	2017-07-13 13:38:11.207539279 +0200
@@ -1319,7 +1319,7 @@ out:
  *	  as defined in SP800-90A. The additional input is mixed into
  *	  the state in addition to the pulled entropy.
  *
- * return: generated number of bytes
+ * return: 0 on success; > 0 on error
  */
 static gpg_err_code_t
 gcry_drbg_generate (struct gcry_drbg_state *drbg,
@@ -2206,13 +2206,13 @@ gcry_drbg_healthcheck_sanity (struct gcr
   max_request_bytes = gcry_drbg_max_request_bytes ();
   /* overflow addtllen with additonal info string */
   gcry_drbg_string_fill (&addtl, test->addtla, (max_addtllen + 1));
-  len = gcry_drbg_generate (drbg, buf, test->expectedlen, &addtl);
-  if (len)
+  tmpret = gcry_drbg_generate (drbg, buf, test->expectedlen, &addtl);
+  if (!tmpret)
     goto outbuf;
 
   /* overflow max_bits */
-  len = gcry_drbg_generate (drbg, buf, (max_request_bytes + 1), NULL);
-  if (len)
+  tmpret = gcry_drbg_generate (drbg, buf, (max_request_bytes + 1), NULL);
+  if (!tmpret)
     goto outbuf;
 
   /* test failing entropy source as defined in 11.3.2 */