changeset 1454:5a762613a0fb

BeDOZa: Improved error reporting on invalid commitment.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 06 Jul 2010 10:52:50 +0200
parents 9e90b4355ef7
children 682f4b1d5f91
files viff/bedoza.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/viff/bedoza.py	Tue Jul 06 10:52:44 2010 +0200
+++ b/viff/bedoza.py	Tue Jul 06 10:52:50 2010 +0200
@@ -207,9 +207,9 @@
                 mi = shares_codes[n + inx]
                 beta = keys[inx]
                 x += xi
-                isOK = isOK and mi == self.MAC(alpha, beta, xi)
-            if not isOK:
-                raise BeDOZaException("Wrong commitment for value %s." % x)
+                mi_prime = self.MAC(alpha, beta, xi)
+                if not (isOK and mi == mi_prime):
+                    raise BeDOZaException("Wrong commitment, expected %s, got %s = %s*%s + %s." % (mi.value, mi_prime.value, alpha.value, xi.value, beta.value))
             return x
 
         def exchange((xi, keyList, codes), receivers):