Here's the patch from Bug #653072 that was merged with this bug. It includes the
same null pointer check for both whirlpool and snefru.

-- 
Kind regards,
Loong Jin
From 15813578f1915464be7a70c03f8f36d5e14b0de2 Mon Sep 17 00:00:00 2001
From: Chow Loong Jin <hyper...@debian.org>
Date: Mon, 9 Jan 2012 20:30:01 +0800
Subject: [PATCH] Fix mhash_deinit segfaults with snefru and whirlpool

---
 lib/snefru.c    |    3 +++
 lib/whirlpool.c |    4 ++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/snefru.c b/lib/snefru.c
index 6c10e22..e699c0e 100644
--- a/lib/snefru.c
+++ b/lib/snefru.c
@@ -859,6 +859,9 @@ static void snefru_digest(__const struct snefru_ctx *ctx, mutils_word8 *digest,
 {
 	mutils_word32 i;
 
+        if (!digest)
+            return;
+
 	for (i = 0; i < len; i++, digest += 4)
 	{
 		*(mutils_word32 *)digest = mutils_bend2sys32(ctx->hash[i]);
diff --git a/lib/whirlpool.c b/lib/whirlpool.c
index 36e36df..6eace51 100644
--- a/lib/whirlpool.c
+++ b/lib/whirlpool.c
@@ -970,6 +970,10 @@ void whirlpool_digest(__const struct whirlpool_ctx * ctx,
                     mutils_word8 * digest)
 {
    mutils_word32 i;
+
+   if (!digest)
+       return;
+
     /*
      * return the completed message digest:
      */
-- 
1.7.5.4

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to