Skip to content

Commit

Permalink
FIX/Fix: SBox deterministic truncated constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoPez committed Oct 28, 2024
1 parent 6ae63d5 commit fafbd3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ def output_inverse_constraints(self, component):

return cp_declarations, cp_constraints

def propagate_deterministically(self, component, wordwise=False):
def propagate_deterministically(self, component, wordwise=False, inverse=False):
if not wordwise:
if component.type == SBOX:
variables, constraints, sbox_mant = component.cp_deterministic_truncated_xor_differential_trail_constraints(self.sbox_mant)
variables, constraints, sbox_mant = component.cp_deterministic_truncated_xor_differential_trail_constraints(self.sbox_mant, inverse)
self.sbox_mant = sbox_mant
else:
variables, constraints = component.cp_deterministic_truncated_xor_differential_trail_constraints()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def build_impossible_backward_model(self, backward_components, clean = True):
constant_components, constant_ids = self.extract_constants()
for component in backward_components:
if check_if_implemented_component(component):
variables, constraints = self.propagate_deterministically(component)
variables, constraints = self.propagate_deterministically(component, inverse=True)
inverse_variables.extend(variables)
inverse_constraints.extend(constraints)

Expand Down Expand Up @@ -924,4 +924,4 @@ def solve(self, model_type, solver_name=None, number_of_rounds=None, initial_rou
'impossible_xor_differential_one_solution']:
return solutions[0]
else:
return solutions
return solutions

0 comments on commit fafbd3a

Please sign in to comment.