dignifiedquire / num-bigint

Big integer types for Rust
Apache License 2.0
12 stars 26 forks source link

Consider upstreaming ModInverse trait into num-traits crate #21

Open BlackHoleFox opened 4 years ago

BlackHoleFox commented 4 years ago

Currently the rsa crate from RustCrypto uses this forks BigUint so it can perform the needed operations when calculating values and the like. Due to this, yubikey-piv.rs is currently needing to import both this crate and the original, because some X509 certificates use BigUints as well.

Is there anything preventing the ModInverse trait and its functions from being upstreamed via a PR to num-traits?

dignifiedquire commented 4 years ago

There is more in this crate (support for memory zeroing, smallvec backend) and last time I attempted to upstream all features it was both slow and not fully successfull, though the u64 limbs eventually made it.

There is also the need to allow minimal work involved copy from and to the internal memory of the numbers, which directly opposes the api design rules of the original crate.

So I fear that for rsa it is quite unlikely that we will be able to switch any time soon. I honestly would try to switch to this crate if you wang to reduce dependencies and try to use the shared num traits for interfaces if possible.

BlackHoleFox commented 4 years ago

Using the shared traits worked out pretty well, at the cost of once allocation which is negligible. Thanks for the pointer. Do you want me to close this issue?