The p384 crate is using base field and scalar field implementations from the fiat-crypto project, which synthesizes formally verified field implementations in multiple languages.
It would probably make sense to use their field implementations in p256 as well, which could enable a proper 32-bit backend which is currently missing (the existing field implementation is based on 64-bit limbs only).
Given that, it would make sense to add something to the elliptic-curve crate, be it a trait or a macro, that provides a convention for consuming fiat-crypto field implementations for both (base) FieldElement and Scalar types.
I don't think this requires any direct integration with fiat-crypto, and currently we can't make use of the fiat-crypto crate itself because it doesn't yet contain the generated code for scalar fields and we might want to postprocess the output to enable const fn usage.
Instead we could have a trait "shaped" like the generated field implementations, or a macro which accepts a list of the fiat-crypto-provided function names as arguments, and use a little bit of boilerplate to wire things up using plain old Rust code (i.e. nothing more than functions which operate over arrays of word-sized integers).
The
p384crate is using base field and scalar field implementations from thefiat-cryptoproject, which synthesizes formally verified field implementations in multiple languages.It would probably make sense to use their field implementations in
p256as well, which could enable a proper 32-bit backend which is currently missing (the existing field implementation is based on 64-bit limbs only).Given that, it would make sense to add something to the
elliptic-curvecrate, be it a trait or a macro, that provides a convention for consumingfiat-cryptofield implementations for both (base)FieldElementandScalartypes.I don't think this requires any direct integration with
fiat-crypto, and currently we can't make use of thefiat-cryptocrate itself because it doesn't yet contain the generated code for scalar fields and we might want to postprocess the output to enableconst fnusage.Instead we could have a trait "shaped" like the generated field implementations, or a macro which accepts a list of the
fiat-crypto-provided function names as arguments, and use a little bit of boilerplate to wire things up using plain old Rust code (i.e. nothing more than functions which operate over arrays of word-sized integers).