-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X25519 using fiat-crypto Curve25519 field arithmetic #197
Conversation
Looking through the code (in a cursory way), I'm glad that you went with auto-generated implementations of the low-level math. There's actually plenty of complexity left to take on by hand even using the generated, proven code. |
Indeed. The code on top of fiat's already requires plenty to review and test. |
…uring key-agreement
The following flags are present in Wycheproof test vectors, which need to be taken into account:
|
…ectly through fiat-crypto)
* Initial fuzzer setup for X25519 (see orion-rs/orion#197) * NIT * Update Cargo.toml
TODO:
Drop
impl forFieldElement
? ->FieldElement
does not hold any secret bytes directly fromScalar
so it seems fine to leave as-is.Neg
forFieldElement
is not used because it is really only used through the fiat-crypto provided, then remove it.FieldElement::as_bytes()
mask the MSB as is done infrom_bytes()
? -> No, the masking is only needed when decoding an arbitrary byte-array into aFieldElement
.as_bytes()
encoding is handeled by fiat-crypto.invert()
forFieldElement
-> Nothing convincing has come up so far. We leave this be for now, and can potentially re-investigate later on if it becomes an issue to review.MulAssign
forFieldElement
or not (what about other*Assign
ops?) -> Same argument as with finding a cleaner approach forinvert()
.Scalar
should not be exposed in the public API, but instead a mid-level type that is wrapped by aSecretKey
-like typeSharedSecret
newtype (can't use existing macro since aSharedSecret
should not have agenerate()
function (maybe take same approach as withconstruct_public
))