changeset 1132:87f37eb25159

Avoid unnecessary communication in invert_by_masking().
author Marcel Keller <mkeller@cs.au.dk>
date Thu, 12 Feb 2009 20:05:39 +0100
parents 50056a810951
children f24861244622
files viff/aes.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/viff/aes.py	Fri Jan 30 14:50:47 2009 +0100
+++ b/viff/aes.py	Thu Feb 12 20:05:39 2009 +0100
@@ -23,7 +23,7 @@
 import time
 
 from viff.field import GF256
-from viff.runtime import Share
+from viff.runtime import Share, gather_shares
 from viff.matrix import Matrix
 
 
@@ -131,7 +131,12 @@
                     c.callback(~c_opened)
 
             get_masked_byte(0, None, c, r, byte)
-            return c * r - b
+
+            # necessary to avoid communication in multiplication
+            # was: return c * r - b
+            result = gather_shares([c, r, b])
+            result.addCallback(lambda (c, r, b): c * r - b)
+            return result
 
         def invert_by_exponentiation(byte):
             byte_2 = byte * byte