diff options
| author | deepsource-autofix[bot] | 2022-03-01 11:15:51 +0000 |
|---|---|---|
| committer | GitHub | 2022-03-01 11:15:51 +0000 |
| commit | 2a24fc04260e949f66bd0ea328ec99493ceeda6c (patch) | |
| tree | 2bfb693ef398be8339e3866af2800677f10c2079 /pyecsca/ec | |
| parent | 760a7afd6e97f9c75513af3def66cdac386bec69 (diff) | |
| download | pyecsca-2a24fc04260e949f66bd0ea328ec99493ceeda6c.tar.gz pyecsca-2a24fc04260e949f66bd0ea328ec99493ceeda6c.tar.zst pyecsca-2a24fc04260e949f66bd0ea328ec99493ceeda6c.zip | |
Merge collapsible `if` statements
Diffstat (limited to 'pyecsca/ec')
| -rw-r--r-- | pyecsca/ec/configuration.py | 10 | ||||
| -rw-r--r-- | pyecsca/ec/mult.py | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/pyecsca/ec/configuration.py b/pyecsca/ec/configuration.py index 714f9b1..04ee41c 100644 --- a/pyecsca/ec/configuration.py +++ b/pyecsca/ec/configuration.py @@ -220,13 +220,11 @@ def all_configurations(**kwargs) -> Generator[Configuration, Configuration, None for model_cls in leaf_subclasses(CurveModel): model = model_cls() - if "model" in kwargs: - if model != kwargs["model"]: - continue + if "model" in kwargs and model != kwargs["model"]: + continue for coords in model.coordinates.values(): - if "coords" in kwargs: - if coords != kwargs["coords"]: - continue + if "coords" in kwargs and coords != kwargs["coords"]: + continue coords_formulas = coords.formulas.values() mult_classes = leaf_subclasses(ScalarMultiplier) if "scalarmult" in kwargs: diff --git a/pyecsca/ec/mult.py b/pyecsca/ec/mult.py index 0841dc4..47c36b1 100644 --- a/pyecsca/ec/mult.py +++ b/pyecsca/ec/mult.py @@ -101,9 +101,11 @@ class ScalarMultiplier(ABC): def _dbl(self, point: Point) -> Point: if "dbl" not in self.formulas: raise NotImplementedError - if self.short_circuit: - if point == self._params.curve.neutral: - return copy(point) + if ( + self.short_circuit + and point == self._params.curve.neutral + ): + return copy(point) return self.formulas["dbl"]( self._params.curve.prime, point, **self._params.curve.parameters )[0] |
