Hello!

The debdiff is attached. It's the minimum patch fixing these two nasty
bugs. :)


28.05.2013 3:27, Adam D. Barratt wrote:
> On Fri, 2013-05-24 at 15:08 +0700, Aleksey K. wrote:
>> Sorry, I've mean proposed-updates for a point release. I've already
>> contacted security team, and was forwarded here :)
> Okay.
>> There is a package (RHash 1.2.9-9) in Sid with these patches. It
>> should be easy to make debdiff. But since I have very little of free
>> time now, it can take several days :-/
> In case there was any confusion, I meant a debdiff between the current
> rhash package in wheezy and the package you'd like to upload containing
> the fixes (which would be 1.2.9-8+deb7u1). We can't simply copy the
> existing package from sid; the debdiff also has the advantage of meaning
> you've built (and preferably tested) the package at least once. :-)
>
> Regards,
>
> Adam
>

diff -Nru rhash-1.2.9/debian/changelog rhash-1.2.9/debian/changelog
--- rhash-1.2.9/debian/changelog        2012-11-28 23:39:41.000000000 +0700
+++ rhash-1.2.9/debian/changelog        2013-05-31 01:17:54.000000000 +0700
@@ -1,3 +1,11 @@
+rhash (1.2.9-8+deb7u1) stable; urgency=medium
+
+  * Backported two critical bug fixes from RHash 1.2.10
+    - fix incorrect SHA-512 for messages of certain size
+    - fix incorrect GOST hash on non-x86/amd64 CPUs
+
+ -- Aleksey Kravchenko <rhash.ad...@gmail.com>  Thu, 30 May 2013 22:34:57 +0700
+
 rhash (1.2.9-8) unstable; urgency=medium
 
   [ Aleksey Kravchenko ]
diff -Nru rhash-1.2.9/debian/patches/03_fix_sha512_and_gost.patch 
rhash-1.2.9/debian/patches/03_fix_sha512_and_gost.patch
--- rhash-1.2.9/debian/patches/03_fix_sha512_and_gost.patch     1970-01-01 
06:00:00.000000000 +0600
+++ rhash-1.2.9/debian/patches/03_fix_sha512_and_gost.patch     2013-05-31 
01:00:29.000000000 +0700
@@ -0,0 +1,45 @@
+Description: Fix calculation of SHA-512 and GOST hash
+ This patch backports two critical bug fixes from RHash 1.2.10.
+ SHA-512 was not correctly calculated for files with size
+   112 <= (file_size % 128) < 120.
+ The bug occurs only when several files are sequentually hashed.
+ .
+ Internal buffer of SHA-512 context was not fully cleared by zeroes,
+ when processing final block of data.
+ See also SF-Bug: https://sourceforge.net/p/rhash/bugs/31/
+ .
+ Also the GOST R 34.11-94 hash was broken on non x86 CPUs
+ on some messages containg sequences of words 0xFFFFFFFF.
+ The bug does not occur on x86 and x86-64, because
+ on these archs assembly code replaces C.
+
+Author: Aleksey Kravchenko <rhash.ad...@gmail.com>
+Origin: upstream
+Forwarded: not-needed
+Last-Update: 2013-05-31
+
+--- rhash-1.2.9.orig/librhash/sha512.c
++++ rhash-1.2.9/librhash/sha512.c
+@@ -238,6 +238,7 @@ void rhash_sha512_final(sha512_ctx *ctx,
+ 
+       /* if no room left in the message to store 64-bit message length */
+       if(index >= 15) {
++              if(index == 15) ctx->message[index] = 0;
+               rhash_sha512_process_block(ctx->hash, ctx->message);
+               index = 0;
+       }
+--- rhash-1.2.9.orig/librhash/gost.c
++++ rhash-1.2.9/librhash/gost.c
+@@ -321,10 +321,10 @@ static void rhash_gost_compute_sum_and_h
+ 
+       /* compute the 256-bit sum */
+       for(i = 0; i < 8; i++) {
+-              const unsigned old = ctx->sum[i];
+               LOAD_BLOCK_LE(i);
+               ctx->sum[i] += block_le[i] + carry;
+-              carry = (ctx->sum[i] < old || ctx->sum[i] < block_le[i] ? 1 : 
0);
++              carry = (ctx->sum[i] < block_le[i] ? 1 :
++                      ctx->sum[i] == block_le[i] ? carry : 0);
+       }
+ #endif /* USE_GCC_ASM_IA32 */
+ 
diff -Nru rhash-1.2.9/debian/patches/series rhash-1.2.9/debian/patches/series
--- rhash-1.2.9/debian/patches/series   2012-11-28 01:45:27.000000000 +0700
+++ rhash-1.2.9/debian/patches/series   2013-05-30 23:23:06.000000000 +0700
@@ -1,2 +1,3 @@
 01_configure-bindings.patch
 02_python_function_prototypes.patch
+03_fix_sha512_and_gost.patch

Reply via email to