primefield+p384: upgrade to fiat-crypto v0.1.4#1157
Conversation
43254a1 to
a01568a
Compare
|
This saw similar speedups in scalar multiplication and inversion as were seen in Other operations were not impacted. |
| $add( | ||
| &mut out, | ||
| &$mont_type(self.0.to_words()), | ||
| &$mont_type(rhs.0.to_words()), | ||
| ); |
There was a problem hiding this comment.
The newtypes introduced in newer versions of fiat-crypto make these conversions somewhat annoying, and they're occurring wherever we invoke any generated code.
Fortunately sprinkling #[inline] on it seems to be sufficient to get the compiler to optimize them away, but it might make sense to support casting between generated field element types (which contain crypto-bigint::Uints) and references to their fiat-crypto generated newtypes.
The main thing that's missing right now is the fiat-crypto newtypes aren't annotated as #[repr(transparent)], as what's really needed here is a cast between the inner array type and the newtype. That shouldn't be too difficult to add in fiat-constify though.
Updates the field element type generating macros in the `primefield` crate to be compatible with the latest `fiat-crypto` code as postprocessed by `fiat-constify`, and regenerates the `p384` field impls using `fiat-crypto` v0.1.4. This update leverages `const_mut_refs` to be much closer to the upstream `fiat-crypto` output, while still providing `const fn` support. This change also starts extracting a `fiat` module within `primeorder` for macros that are specific to `fiat-crypto` output. With this upgrade in place, upgrading the rest of the curve crates should be comparatively straightforward.
a01568a to
c26d1cc
Compare
Updates the field element type generating macros in the
primefieldcrate to be compatible with the latestfiat-cryptocode as postprocessed byfiat-constify, and regenerates thep384field impls usingfiat-cryptov0.1.4.This update leverages
const_mut_refsto be much closer to the upstreamfiat-cryptooutput, while still providingconst fnsupport.This change also starts extracting a
fiatmodule withinprimeorderfor macros that are specific tofiat-cryptooutput.With this upgrade in place, upgrading the rest of the curve crates should be comparatively straightforward.