Exemple #1
0
class split(base.Instruction):
    code = opcodes['SPLIT']
    arg_format = tools.chain(['int', 's'], tools.cycle(['sbw']))

    def __init__(self, *args, **kwargs):
        super(split_class, self).__init__(*args, **kwargs)
        assert (len(args) - 2) % args[0] == 0
Exemple #2
0
 def merge(self, other):
     if self.get_size() != other.get_size():
         # merge as non-vector instruction
         self.args = self.expand_vector_args() + other.expand_vector_args()
         if self.is_vec():
             self.size = 1
     else:
         self.args += other.args
         self.arg_format = tools.chain(self.arg_format, other.arg_format)
class bitdecc(NonVectorInstruction, base.VarArgsInstruction):
    """ Secret bit register decomposition.

    :param: number of arguments to follow / number of bits plus one (int)
    :param: source (sbit)
    :param: destination for least significant bit (sbit)
    :param: (destination for one bit higher)...
    """
    code = opcodes['BITDECC']
    arg_format = tools.chain(['cb'], itertools.repeat('cbw'))
class convcintvec(base.Instruction):
    """ Copy clear register vector by bit to clear bit register
    vectors. This means that the first destination will hold the least
    significant bits of all inputs etc.

    :param: number of arguments to follow / number of bits plus one (int)
    :param: source (cint)
    :param: destination for least significant bits (sbit)
    :param: (destination for bits one step higher)...
    """
    code = opcodes['CONVCINTVEC']
    arg_format = tools.chain(['c'], tools.cycle(['cbw']))
class split(base.Instruction):
    """ Local share conversion. This instruction use the vector length in the
    instruction code field.

    :param: number of arguments to follow (number of bits times number of additive shares plus one)
    :param: source (sint)
    :param: first share of least significant bit
    :param: second share of least significant bit
    :param: (remaining share of least significant bit)...
    :param: (repeat from first share for bit one step higher)...
    """
    code = opcodes['SPLIT']
    arg_format = tools.chain(['int','s'], tools.cycle(['sbw']))
    def __init__(self, *args, **kwargs):
        super(split_class, self).__init__(*args, **kwargs)
        assert (len(args) - 2) % args[0] == 0
Exemple #6
0
class convcintvec(base.Instruction):
    code = opcodes['CONVCINTVEC']
    arg_format = tools.chain(['c'], tools.cycle(['cbw']))
Exemple #7
0
class bitdecc(NonVectorInstruction, base.VarArgsInstruction):
    code = opcodes['BITDECC']
    arg_format = tools.chain(['cb'], itertools.repeat('cbw'))
Exemple #8
0
class bitcoms(NonVectorInstruction, base.VarArgsInstruction):
    code = opcodes['BITCOMS']
    arg_format = tools.chain(['sbw'], itertools.repeat('sb'))
Exemple #9
0
class bitdecs(base.VarArgsInstruction):
    code = opcodes['BITDECS']
    arg_format = tools.chain(['sb'], itertools.repeat('sbw'))
Exemple #10
0
 def __init__(self, *args, **kwargs):
     self.arg_format = tools.chain(['int'], ['int'], ['sbw'],
                                   ['sb'] * args[0])
     super().__init__(*args, **kwargs)