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