aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico2012-03-05 09:55:39 (GMT)
committerZac Medico2012-03-05 09:55:39 (GMT)
commit3596fc3822bb82dfe05a58fdb78220e399175a4d (patch)
tree2ea3f9698887608355990864cb1b78835868fe9a
parent32d19be14e22ada479963ba8627452f5f2d89b94 (diff)
downloadportage-3596fc3822bb82dfe05a58fdb78220e399175a4d.zip
portage-3596fc3822bb82dfe05a58fdb78220e399175a4d.tar.gz
portage-3596fc3822bb82dfe05a58fdb78220e399175a4d.tar.bz2
whirlpool.py: fix WhirlpoolAdd for bug #406407
This file is a python port of Whirlpool.c the reference implementation: http://www.larc.usp.br/~pbarreto/whirlpool.zip Comparison of both implementations reveals a difference in loop logic at the very beginning of the WhirlpoolAdd function, which is fixed now.
-rw-r--r--pym/portage/util/whirlpool.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py
index 8415e87..c696f6f 100644
--- a/pym/portage/util/whirlpool.py
+++ b/pym/portage/util/whirlpool.py
@@ -645,7 +645,7 @@ def WhirlpoolAdd(source, sourceBits, ctx):
carry = 0
value = sourceBits
i = 31
- while i >= 0 and value != 0:
+ while i >= 0 and (carry != 0 or value != 0):
carry += ctx.bitLength[i] + ((value % 0x100000000) & 0xff)
ctx.bitLength[i] = carry % 0x100
carry >>= 8