RustCrypto / crypto-bigint

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

Support for creating `BoxedMontyParams` from `ConstMontyParams` #593

Closed jjteo74 closed 1 week ago

jjteo74 commented 5 months ago

Version: 0.6.0-pre.12.

I am trying to define pre-computed SSH DH groups 1 and 14-18 parameters using ConstMontyParams because groups 15-18 take a long time to compute--more than 5s (debug) for group 18 with modulus U8192 on my laptop. And to do DH shared secret computation in BoxedUint for good hygiene.

However, there doesn't seem to be a way to create BoxedMontyParams from either MontyParams or ConstMontyParams so the current way forward is to use OnceLock<Arc<BoxedMontyParams>>, but this is not ideal.

Is there a way to pre-compute BoxedMontyParams?

tarcieri commented 4 months ago

We don't yet have an easy From conversion for this but it should be easy to add

jjteo74 commented 4 months ago

Thanks for the reply.

tarcieri commented 4 months ago

Reopened this so we can track adding an appropriate From impl