Skip to content

elliptic-curve: patterns for wrapping fiat-crypto-provided field implementations #1017

@tarcieri

Description

@tarcieri

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions