You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 text was updated successfully, but these errors were encountered:
This PR adds a impl_sec1_field_element! macro for this purpose, presently used inside the p384 crate to DRY out the implementations of FieldElement and Scalar:
The
p384
crate is using base field and scalar field implementations from thefiat-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 consumingfiat-crypto
field implementations for both (base)FieldElement
andScalar
types.I don't think this requires any direct integration with
fiat-crypto
, and currently we can't make use of thefiat-crypto
crate itself because it doesn't yet contain the generated code for scalar fields and we might want to postprocess the output to enableconst 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 text was updated successfully, but these errors were encountered: