aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca
diff options
context:
space:
mode:
authorJ08nY2023-11-08 14:34:11 +0100
committerJ08nY2023-11-10 12:21:27 +0100
commit90b8ad4626392a9b5d42955372ac38ed72dc0cba (patch)
tree3279a5d2997df099259a109499cb698999dbdf57 /pyecsca
parenta523a8874c8d13c0e6f64dbe4b3cea1bf0771688 (diff)
downloadpyecsca-90b8ad4626392a9b5d42955372ac38ed72dc0cba.tar.gz
pyecsca-90b8ad4626392a9b5d42955372ac38ed72dc0cba.tar.zst
pyecsca-90b8ad4626392a9b5d42955372ac38ed72dc0cba.zip
Add more formulas from BouncyCastle.
Diffstat (limited to 'pyecsca')
-rw-r--r--pyecsca/sca/re/structural.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/pyecsca/sca/re/structural.py b/pyecsca/sca/re/structural.py
index 4fa8508..1a8a200 100644
--- a/pyecsca/sca/re/structural.py
+++ b/pyecsca/sca/re/structural.py
@@ -43,16 +43,21 @@ def formula_similarity_fuzz(
output_matches = 0.0
iv_matches = 0.0
for _ in range(samples):
- P = curve.affine_random().to_model(one.coordinate_model, curve)
- Q = curve.affine_random().to_model(other.coordinate_model, curve)
+ Paff = curve.affine_random()
+ Qaff = curve.affine_random()
+ Raff = curve.affine_add(Paff, Qaff)
+ P = Paff.to_model(one.coordinate_model, curve)
+ Q = Qaff.to_model(one.coordinate_model, curve)
+ R = Raff.to_model(one.coordinate_model, curve)
+ inputs = (P, Q, R)[:one.num_inputs]
with local(DefaultContext()) as ctx:
- res_one = one(curve.prime, P, Q, **curve.parameters)
+ res_one = one(curve.prime, *inputs, **curve.parameters)
action_one = ctx.actions.get_by_index([0])
ivs_one = set(
map(attrgetter("value"), sum(action_one[0].intermediates.values(), []))
)
with local(DefaultContext()) as ctx:
- res_other = other(curve.prime, P, Q, **curve.parameters)
+ res_other = other(curve.prime, *inputs, **curve.parameters)
action_other = ctx.actions.get_by_index([0])
ivs_other = set(
map(attrgetter("value"), sum(action_other[0].intermediates.values(), []))