Skip to content

Commit 694590e

Browse files
authored
feat(tests): add test case for point doubling in P256 (#2218)
Synthesize the `p256verify` precompile inputs where `u1 == u2` in two variants: `Q == G` and `Q != G`. In the first variant the computation of `R` involves point doubling.
1 parent 7acf2ab commit 694590e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,25 @@ def test_wycheproof_extra(state_test: StateTestFiller, pre: Alloc, post: dict, t
156156
+ Y(0x99B7A386F1D07C29DBCC42A27B5F9449ABE3D50DE25178E8D7407A95E8B06C0B),
157157
id="x_0_y_negative",
158158
),
159+
# Test case for u1==u2 and Q==G.
160+
# This test case is important because u1*G + u2*Q is point doubling.
161+
pytest.param(
162+
H(0x7CF27B188D034F7E8A52380304B51AC3C08969E277F21B35A60B48FC47669978)
163+
+ R(0x7CF27B188D034F7E8A52380304B51AC3C08969E277F21B35A60B48FC47669978)
164+
+ S(0x830D84E672FCB08275ADC7FCFB4AE53BFC5D90CB2F25834F4DAE81C6B4FC8BD9)
165+
+ X(Spec.Gx)
166+
+ Y(Spec.Gy),
167+
id="u1_eq_u2_and_Q_eq_G",
168+
),
169+
# Test case for u1==u2 and Q!=G.
170+
pytest.param(
171+
H(0x65FB4407BCB2A33AE2E486366BAA79B3A8A17A83DDE0FED6F09014A8AC6F78A1)
172+
+ R(0x65FB4407BCB2A33AE2E486366BAA79B3A8A17A83DDE0FED6F09014A8AC6F78A1)
173+
+ S(0x65FB4407BCB2A33AE2E486366BAA79B3A8A17A83DDE0FED6F09014A8AC6F78A1)
174+
+ Spec.X0
175+
+ Spec.Y0,
176+
id="u1_eq_u2_and_Q_ne_G",
177+
),
159178
],
160179
)
161180
@pytest.mark.parametrize("expected_output", [Spec.SUCCESS_RETURN_VALUE], ids=[""])

0 commit comments

Comments
 (0)