gentleknife / rpms / libgcrypt

Forked from rpms/libgcrypt 4 years ago
Clone

Blame SOURCES/libgcrypt-1.5.3-whirlpool-bug.patch

88000a
diff -up libgcrypt-1.5.3/cipher/whirlpool.c.whirlpool-bug libgcrypt-1.5.3/cipher/whirlpool.c
88000a
--- libgcrypt-1.5.3/cipher/whirlpool.c.whirlpool-bug	2013-05-22 18:02:54.000000000 +0200
88000a
+++ libgcrypt-1.5.3/cipher/whirlpool.c	2014-01-21 15:45:51.308919415 +0100
88000a
@@ -56,6 +56,7 @@ typedef struct {
88000a
   unsigned char buffer[BLOCK_SIZE];
88000a
   size_t count;
88000a
   unsigned char length[32];
88000a
+  int bug;
88000a
 } whirlpool_context_t;
88000a
 
88000a
 
88000a
@@ -1185,6 +1186,7 @@ whirlpool_init (void *ctx)
88000a
   whirlpool_context_t *context = ctx;
88000a
 
88000a
   memset (context, 0, sizeof (*context));
88000a
+  context->bug = secure_getenv("GCRYPT_WHIRLPOOL_BUG") != NULL;
88000a
 }
88000a
 
88000a
 
88000a
@@ -1316,7 +1318,7 @@ whirlpool_add (whirlpool_context_t *cont
88000a
 	  buffer_n--;
88000a
 	}
88000a
       whirlpool_add (context, NULL, 0);
88000a
-      if (!buffer_n)
88000a
+      if (context->bug && !buffer_n)
88000a
 	/* Done.  */
88000a
         return;
88000a
     }