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

Non-Adjacent-Form-accelerated Scalar Multiplication #33

Closed
mratsim opened this issue Jun 4, 2020 · 3 comments
Closed

Non-Adjacent-Form-accelerated Scalar Multiplication #33

mratsim opened this issue Jun 4, 2020 · 3 comments
Labels
performance 🏁 variable time ⏰ ⚠️ Enhancement is only suitable for public data

Comments

@mratsim
Copy link
Owner

mratsim commented Jun 4, 2020

Currently scalar multiplication is using the raw canonical bigEndian representation of the scalar (a.k.a. octet string).
Depending on 0 or 1 bit, after the mandatory doubling, we either do nothing or add the original point.
On average, for scalars that are non-differentiable from a random oracle (which is the case for all private keys) we do an addition half the time.

Each integer has a unique Non-Adjacent-Form, that uses a ternary vase {-1 0 1} https://en.wikipedia.org/wiki/Non-adjacent_form with the interesting property that non-zero-values cannot be adjacent.

This form can be used to double and add-or-substract with an upper-bound of 1/3 addition/substraction.

The most interesting part for a constant-time implementation is that it allows using bigger window sizes for the same storage requirement as the binary representation since we have redundancy:

  • "-1 0 1 0" and "0 0 0 0" and "1 0 -1 0" ... can lookup in the same table slot

Current speed with window sizes effect:
image

@mratsim
Copy link
Owner Author

mratsim commented Jun 4, 2020

Alternatives representation include:

@mratsim
Copy link
Owner Author

mratsim commented Jun 5, 2020

In-depth analysis in the context of side-channel resistance (advanced side-channel attacks and fault analysis)

image

@mratsim mratsim added variable time ⏰ ⚠️ Enhancement is only suitable for public data performance 🏁 labels Jun 6, 2020
@mratsim
Copy link
Owner Author

mratsim commented Jun 14, 2020

Closed by #44, we use GLV-SAC (Sign-Aligned Column) representation

@mratsim mratsim closed this as completed Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance 🏁 variable time ⏰ ⚠️ Enhancement is only suitable for public data
Projects
None yet
Development

No branches or pull requests

1 participant