This adds a SAGE script for verifying the implemented group laws.
The output should be:
0Formula secp256k1_gej_add_var:
1 add_infinite_ab:
2 branch 0: OK
3 double:
4 branch 2: OK
5 add:
6 branch 4: OK
7 add_infinite_b:
8 branch 1: OK
9 add_infinite_a:
10 branch 0: OK
11 add_opposite:
12 branch 3: OK
13
14Formula secp256k1_gej_add_ge_var:
15 add_infinite_ab:
16 branch 0: OK (assuming Bz - 1 = 0 [b.z=1])
17 double:
18 branch 2: OK (assuming Bz - 1 = 0 [b.z=1])
19 add:
20 branch 4: OK (assuming Bz - 1 = 0 [b.z=1])
21 add_infinite_b:
22 branch 1: OK (assuming Bz - 1 = 0 [b.z=1])
23 add_infinite_a:
24 branch 0: OK (assuming Bz - 1 = 0 [b.z=1])
25 add_opposite:
26 branch 3: OK (assuming Bz - 1 = 0 [b.z=1])
27
28Formula secp256k1_gej_add_zinv_var:
29 add_infinite_ab:
30 branch 0: OK
31 double:
32 branch 2: OK
33 add:
34 branch 4: OK
35 add_infinite_b:
36 branch 0: OK
37 add_infinite_a:
38 branch 1: OK
39 add_opposite:
40 branch 3: OK
41
42Formula secp256k1_gej_add_ge:
43 add_infinite_ab:
44 double:
45 branch 0: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
46 add:
47 branch 0: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
48 branch 2: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
49 branch 3: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
50 add_infinite_b:
51 add_infinite_a:
52 branch 4: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
53 branch 6: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
54 branch 7: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
55 branch 13: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
56 add_opposite:
57 branch 9: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
58
59Formula secp256k1_gej_add_ge_old [should fail]:
60 add_infinite_ab:
61 double:
62 branch 0: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
63 add:
64 branch 0: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
65 branch 2: FAIL, ['on_curve', 'finite_point', 'colinear_2', 'colinear_1', 'colinear_3'] fails (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
66 add_infinite_b:
67 add_infinite_a:
68 branch 1: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])
69 add_opposite:
70 branch 2: OK (assuming Bz - 1 = 0 [b.z=1], Bi = 0 [b_finite])