Skip to content
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

Missing key validations #77

Open
veorq opened this issue Jul 24, 2021 · 0 comments · May be fixed by #88
Open

Missing key validations #77

veorq opened this issue Jul 24, 2021 · 0 comments · May be fixed by #88

Comments

@veorq
Copy link

veorq commented Jul 24, 2021

Here the answer is yes :)

// TODO: do we have to clamp it here?

And here too:

sphinx/src/crypto/keys.rs

Lines 104 to 110 in b168f70

impl From<Scalar> for EphemeralSecret {
fn from(scalar: Scalar) -> EphemeralSecret {
// TODO: should we ensure it's a valid scalar by performing
// montgomery reduction and/or clamping?
PrivateKey(scalar)
}
}

This is because there is no guarantee that the received bytes or scalar are valid ones wrt Curve25519.

Also, public keys must be validated when instantiated, that is, From<[u8; PUBLIC_KEY_SIZE]> should verify that the point is not the point at infinity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant