Skip to content

Abstract out and merge all the magnitude/normalized logic#1066

Merged
sipa merged 29 commits intobitcoin-core:masterfrom
sipa:202201_uniform_fe_rules
May 11, 2023
Merged

Abstract out and merge all the magnitude/normalized logic#1066
sipa merged 29 commits intobitcoin-core:masterfrom
sipa:202201_uniform_fe_rules

Conversation

@sipa
Copy link
Copy Markdown
Contributor

@sipa sipa commented Jan 29, 2022

Right now, all the logic for propagating/computing the magnitude/normalized fields in secp256k1_fe (when VERIFY is defined) and the code for checking it, is duplicated across the two field implementations. I believe that is undesirable, as these properties should purely be a function of the performed fe_ functions, and not of the choice of field implementation. This becomes even uglier with #967, which would copy all that, and even needs an additional dimension that would then need to be added to the two other fields. It's also related to #1001, which I think will become easier if it doesn't need to be done/reasoned about separately for every field.

This PR moves all logic around these fields (collectively called field verification) to implementations in field_impl.h, which dispatch to renamed functions in field_*_impl.h for the actual implementation.

Fixes #1060.

Loading
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

Successfully merging this pull request may close these issues.

Separate magnitude/normalization/... checking/propagation from implementations

4 participants