Andrew Poelstra 20b8877be1 Add exhaustive test for group functions on a low-order subgroup
We observe that when changing the b-value in the elliptic curve formula
`y^2 = x^3 + ax + b`, the group law is unchanged. Therefore our functions
for secp256k1 will be correct if and only if they are correct when applied
to the curve defined by `y^2 = x^3 + 4` defined over the same field. This
curve has a point P of order 199.

This commit adds a test which computes the subgroup generated by P and
exhaustively checks that addition of every pair of points gives the correct
result.

Unfortunately we cannot test const-time scalar multiplication by the same
mechanism. The reason is that these ecmult functions both compute a wNAF
representation of the scalar, and this representation is tied to the order
of the group.

Testing with the incomplete version of gej_add_ge (found in 5de4c5dff^)
shows that this detects the incompleteness when adding P - 106P, which
is exactly what we expected since 106 is a cube root of 1 mod 199.
2016-11-25 20:45:29 +00:00
..
2016-11-17 18:55:06 -08:00
2016-11-17 18:55:06 -08:00
2015-10-31 08:31:15 +00:00
2015-10-24 19:47:13 +02:00
2015-10-24 19:47:13 +02:00
2015-09-21 21:03:37 +02:00
2016-05-21 10:18:57 +03:00
2016-05-21 10:17:06 +03:00
2016-07-04 13:16:35 +02:00
2014-12-01 12:38:38 +01:00
2016-07-04 13:16:35 +02:00
2016-10-09 00:16:50 +03:00
2015-09-21 21:03:37 +02:00
2016-10-21 03:50:10 -07:00
2015-09-21 21:03:37 +02:00