[crypto] Standardize file header format for cryptolib and related files#239
Open
[crypto] Standardize file header format for cryptolib and related files#239
Conversation
Adds point doubling and a test. The routine is currently unused, but will later help speed up scalarmult. Signed-off-by: Jade Philipoom <jadep@zerorisc.com>
While working on the constant-time checker I took a close look at the P-384 scalarmult code and noticed it could use some attention from both performance and readability perspectives. This commit is a collection of interrelated improvements to make the code simpler and faster. - adjust proj_add to take one input in registers to reduce loads/stores - use specialized point doubling to accelerate scalarmult/verify - improve randomization techniques and better mask MSBs - use dedicated buffers instead of scratchpad offsets - remove some unused constants and stale comments - rename mod_inv_n_p384 to mod_inv_p384, since it is also used for p Overall, this resulted in about a 20% speed improvement across top-level P-384 operations. Full printout from bench/analyze_stats.py, only 1 test each: Measurement | Baseline | New | Percentage change p384_ecdsa_sign avg_cycles | 1683063 | 1338539 | -20.47 p384_ecdsa_verify avg_cycles | 1161878 | 930596 | -19.91 p384_scalar_mult avg_cycles | 1612992 | 1268470 | -21.36 Signed-off-by: Jade Philipoom <jadep@zerorisc.com>
This makes the code a little more readable and less fragile. Also changes some mistaken .data to .bss. Signed-off-by: Jade Philipoom <jadep@zerorisc.com>
Pass-through after code review. Signed-off-by: Jade Philipoom <jadep@zerorisc.com>
bfce9dd to
9990849
Compare
Contributor
Author
9990849 to
f45c5c0
Compare
Signed-off-by: Kat Fox <kat@zerorisc.com>
f45c5c0 to
070594d
Compare
This file contains hidden or 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
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 standardizes the file header format for cryptolib, cryptolib tests and related harnesses, and ACC assembly to match the remainder of the repository.