RustCrypto / crypto-bigint

Cryptography-oriented big integer library with constant-time, stack-allocated (no_std-friendly) implementations of modern formulas
Apache License 2.0
193 stars 56 forks source link

Add support for computing `BoxedUint::gcd` with even modulus #618

Closed tarcieri closed 4 months ago

tarcieri commented 4 months ago

Edit: it works now! Uses an implementation similar to Uint::gcd as added in #617

Tests are currently failing due to the handling of zero as one of the values.

I'm thinking the return value of CtOption is largely a vestige of when even numbers weren't supported, and we can change it to be infallible now, similar to num-bigint.

I'm uncertain why we aren't seeing similar failures in the Uint::gcd proptests as I expect it to have a similar issue.

dignifiedquire commented 4 months ago

agreed on removing ctoption 👍

tarcieri commented 4 months ago

Opened #619 to make Uint::gcd infallible, then when that's merged I'll do a similar treatment here