-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Endomorphism acceleration for Scalar Multiplication #44
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…V-Based Scalar Multiplication" by Faz et al
…earing of the point)
mratsim
added
constant time ⏳
Enhancement is suitable for secret data
performance 🏁
labels
Jun 14, 2020
This was referenced Jun 14, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces constant-time GLV (Gallant-Lambert-Vanstone) acceleration for scalar multiplication.
Implementation follow closely Algorithm 1 and 2 from paper
Multiplication and their Implementation on GLV-GLS
Curves (Extended Version)
Armando Faz-Hernández, Patrick Longa, Ana H. Sánchez, 2013
https://eprint.iacr.org/2013/158.pdf
The Lattice decompositions for BN and BLS curve families follow chapter 6 from
Chapter 6: Scalar Multiplication and Exponentiation in Pairing Groups
Joppe Bos, Craig Costello, Michael Naehrig
Performance
vs MCL
As measured in status-im/nim-blscurve#47 we are now 2x slower on x86
This can be explained by 2 things:
vs Milagro
As measured in status-im/nim-blscurve#47 we are 3x faster than Milagro.
Note that we use the same complete projective formulas, however Constantine is constant-time from the ground up while Milagro has some non-constant-time field operations. Also Constantine uses uint128 where possible and is implemented with carry while Milagro uses lazy reductions.
PR future improvements
The acceleration is hardcoded for BN254 and BLS12-381 at the moment, several improvements are needed in subsequent PR:
1-u
is suitable (Wahby, Boneh, 2019, Fast and simple constant-time hashingto the BLS12-381 elliptic curve, https://eprint.iacr.org/2019/403.pdf)config
type SignedBigInt[bits] = BigInt[bits+1]
in particular, using 2 bits for encoding {-1, 0, 1} is unnecesary
constantine/constantine/elliptic/ec_endomorphism_accel.nim
Lines 108 to 131 in e9e84ab