RustCrypto / elliptic-curves

Collection of pure Rust elliptic curve implementations: NIST P-224, P-256, P-384, P-521, secp256k1, SM2
624 stars 168 forks source link

p256::Scalar: implement Reduce<U512> #1042

Open survived opened 2 months ago

survived commented 2 months ago

I noticed that p256::Scalar does not implement Reduce<U512> trait. Other crates do have that: for instance, k256::Scalar does implement this trait. It makes it difficult to write generic code that uses this trait. Is there a reason for not implementing Reduce<U512> for p256::Scalar?

tarcieri commented 2 months ago

It's a missing feature: p256 lacks support for wide reductions.

crypto-bigint now contains a generic implementation of modular arithmetic which should make it somewhat straightforward to implement.