secp256r1 is a widely used elliptic curve. Axiom's halo2-lib provides an implementation of secp256k1. At present, ec_double and check_is_on_curve in halo2-ecc ignore the ax term in y^2 = x^3 + ax + b because secp256k1 does not need this term. To make their implementation more generalized and support more curves such as secp256r1, this PR fixes ec_double and check_is_on_curve and adds an implementation of secp256r1.
Test
cargo test --package halo2-ecc --lib -- secp256r1::tests::ecdsa::test_secp256r1_ecdsa --exact --nocapture
Background
secp256r1
is a widely used elliptic curve. Axiom's halo2-lib provides an implementation ofsecp256k1
. At present,ec_double
andcheck_is_on_curve
inhalo2-ecc
ignore theax
term iny^2 = x^3 + ax + b
becausesecp256k1
does not need this term. To make their implementation more generalized and support more curves such assecp256r1
, this PR fixesec_double
andcheck_is_on_curve
and adds an implementation ofsecp256r1
.Test