crypto: Share the seed addchain between the point and Fq12 powers - #1640
Draft
chfast wants to merge 1 commit into
Draft
crypto: Share the seed addchain between the point and Fq12 powers#1640chfast wants to merge 1 commit into
chfast wants to merge 1 commit into
Conversation
mul_by_X and cyclotomic_pow_to_X were the same 30-step addchain for the curve seed X written twice, once over points and once over Fq12, with identical temporaries and schedule — checked to agree step for step including operand order. Express it once as pow_by_X parameterised by the squaring and the multiplication, with n_sqr replacing the parallel n_dbl and n_cyclotomic_square. Costs about 0.02% in instructions, which is the price of the indirection.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1640 +/- ##
==========================================
- Coverage 97.71% 97.71% -0.01%
==========================================
Files 171 171
Lines 15607 15578 -29
Branches 3610 3609 -1
==========================================
- Hits 15251 15222 -29
Misses 269 269
Partials 87 87
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
mul_by_X and cyclotomic_pow_to_X were the same 30-step addchain for the
curve seed X written twice, once over points and once over Fq12, with
identical temporaries and schedule. Express it once as pow_by_X,
parameterised by the squaring and the multiplication, with n_sqr replacing
the parallel n_dbl and n_cyclotomic_square.
The two chains agree step for step including operand order, and the shared
version was generated from mul_by_X's body so the steps could not drift.
Draft because it costs about 0.02%, the price of the indirection. The case
for taking it anyway is that an addchain is where a transcription slip is
invisible, and this code has already had one: #1636 fixed a term that #1542
had substituted in the sibling function and missed here. The case against
is trading concrete code for a generic template, where the names mul_by_X
and cyclotomic_pow_to_X document intent better than pow_by_X and lambdas.
🤖 Generated with Claude Code