viff

changeset 1363:73a40d45008f

aes: Simplified callbacks in masked exponentiation.
author Marcel Keller <mkeller@cs.au.dk>
date Wed, 28 Oct 2009 20:23:26 +0100
parents 361aeb2668fc
children f441d4776bcc
files viff/aes.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/viff/aes.py	Wed Oct 28 15:17:24 2009 +0100
     1.2 +++ b/viff/aes.py	Wed Oct 28 20:23:26 2009 +0100
     1.3 @@ -155,7 +155,8 @@
     1.4          return result
     1.5  
     1.6      def invert_by_masked_exponentiation(self, byte):
     1.7 -        def add_and_multiply(masked_powers, random_powers, prep):
     1.8 +        def add_and_multiply(masked_byte, random_powers, prep):
     1.9 +            masked_powers = self.runtime.powerchain(masked_byte, 7)
    1.10              byte_powers = map(operator.add, masked_powers, random_powers)[1:]
    1.11              if prep:
    1.12                  byte_powers = [Share(self.runtime, GF256, value)
    1.13 @@ -166,10 +167,8 @@
    1.14  
    1.15          random_powers, prep = self.runtime.prss_powerchain()
    1.16          masked_byte = self.runtime.open(byte + random_powers[0])
    1.17 -        masked_powers = self.runtime.schedule_callback(masked_byte,
    1.18 -            lambda masked_byte: self.runtime.powerchain(masked_byte, 7))
    1.19          return self.runtime.schedule_callback(
    1.20 -            masked_powers, add_and_multiply, random_powers, prep)
    1.21 +            masked_byte, add_and_multiply, random_powers, prep)
    1.22  
    1.23      def invert_by_exponentiation(self, byte):
    1.24          byte_2 = byte * byte