viff

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 diff
     1.1 --- a/viff/aes.py	Fri Jan 30 14:50:47 2009 +0100
     1.2 +++ b/viff/aes.py	Thu Feb 12 20:05:39 2009 +0100
     1.3 @@ -23,7 +23,7 @@
     1.4  import time
     1.5  
     1.6  from viff.field import GF256
     1.7 -from viff.runtime import Share
     1.8 +from viff.runtime import Share, gather_shares
     1.9  from viff.matrix import Matrix
    1.10  
    1.11  
    1.12 @@ -131,7 +131,12 @@
    1.13                      c.callback(~c_opened)
    1.14  
    1.15              get_masked_byte(0, None, c, r, byte)
    1.16 -            return c * r - b
    1.17 +
    1.18 +            # necessary to avoid communication in multiplication
    1.19 +            # was: return c * r - b
    1.20 +            result = gather_shares([c, r, b])
    1.21 +            result.addCallback(lambda (c, r, b): c * r - b)
    1.22 +            return result
    1.23  
    1.24          def invert_by_exponentiation(byte):
    1.25              byte_2 = byte * byte