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

Elliptic curve point multiplication is not constant time. #451

Open
satoshiotomakan opened this issue Aug 10, 2023 · 1 comment
Open

Elliptic curve point multiplication is not constant time. #451

satoshiotomakan opened this issue Aug 10, 2023 · 1 comment

Comments

@satoshiotomakan
Copy link

satoshiotomakan commented Aug 10, 2023

The scalar multiplication on elliptic curves is a fundamental operation in elliptic curve cryptography. For example, this operation multiplies a point on the curve (typically a base point) by an integer (often a private key). Due to its importance, how a scalar multiplication is implemented can make cryptographic systems robust or vulnerable.

The implementation of the scalar multiplication for elliptic curve points has a branching condition on the individual bits of the scalar. Different time of execution can be measured depending on the values of the individual bits. Although the loop goes through each bit in the scalar rhs, operations inside the loop are not consistent for every iteration. This inconsistency arises because the operations depend on the value of each bit in rhs.

Recommendation:
To protect against timing attacks in this scenario, it should be ensured that:
• Every iteration of the loop takes the same amount of time, regardless of whether *b is true or false.
• The presence or absence of the addition operation is masked, such that it is not discernible through timing.

Ref: https://link.springer.com/chapter/10.1007/978-3-540-28632-5_14

@xJonathanLEI
Copy link
Owner

This is a known issue:

FieldElement::from_bytes_be(&result).unwrap()

I will keep this issue open in case someone wants to contribute to add a constant-time version alongside the existing one.

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

No branches or pull requests

2 participants