diff --git a/claasp/components/modular_component.py b/claasp/components/modular_component.py index 2f03fea0..910881fe 100644 --- a/claasp/components/modular_component.py +++ b/claasp/components/modular_component.py @@ -467,6 +467,7 @@ def milp_bitwise_deterministic_truncated_xor_differential_constraints(self, mode sage: milp.init_model_in_sage_milp_class() sage: modadd_component = cipher.get_component_from_id("modadd_0_1") sage: variables, constraints = modadd_component.milp_bitwise_deterministic_truncated_xor_differential_constraints(milp) + ... sage: constraints [x_48 <= 15, 0 <= x_48, @@ -904,20 +905,22 @@ def extend_constraints_for_window_size_with_full_windows( hw_bit_ids[i: i + (model.window_size_weight_pr_vars + 1)])) component_round_number = model._cipher.get_round_from_component_id(self.id) - if model.window_size_by_round_values is not None: + from claasp.cipher_modules.models.sat.sat_models.sat_xor_differential_model import SatXorDifferentialModel + if type(model) == SatXorDifferentialModel and model.window_size_by_round_values is not None: window_size = model.window_size_by_round_values[component_round_number] extend_constraints_for_window_size(output_bit_len, window_size, input_bit_ids, output_bit_ids, constraints) - if model.window_size_by_component_id_values is not None: + if type(model) == SatXorDifferentialModel and model.window_size_by_component_id_values is not None: if self.id not in model.window_size_by_component_id_values: raise ValueError(f"component with id {self.id} is not in the list window_size_by_component_id") window_size = model.window_size_by_component_id_values[self.id] extend_constraints_for_window_size(output_bit_len, window_size, input_bit_ids, output_bit_ids, constraints) - if model.window_size_number_of_full_window is not None: - extend_constraints_for_window_size_with_full_windows( + if type(model) == SatXorDifferentialModel and model.window_size_number_of_full_window is not None: + if model.window_size_number_of_full_window is not None: + extend_constraints_for_window_size_with_full_windows( model, output_bit_len, window_size, input_bit_ids, output_bit_ids, constraints - ) + ) variables = output_bit_ids + dummy_bit_ids + hw_bit_ids