Impl ConditionallySelectable and ConstantTimeEq for DynResidue#167
Closed
haslersn wants to merge 1 commit into
Closed
Impl ConditionallySelectable and ConstantTimeEq for DynResidue#167haslersn wants to merge 1 commit into
ConditionallySelectable and ConstantTimeEq for DynResidue#167haslersn wants to merge 1 commit into
Conversation
tarcieri
reviewed
Jan 17, 2023
|
|
||
| impl<const LIMBS: usize> ConditionallySelectable for DynResidue<LIMBS> { | ||
| fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self { | ||
| debug_assert_eq!(a.residue_params, b.residue_params); |
Member
There was a problem hiding this comment.
Hmm, this seems tricky to deal with but also not a great solution...
They were already implemented for `Residue`.
c1b9c7f to
521cc84
Compare
tarcieri
reviewed
Jan 23, 2023
| &b.montgomery_form, | ||
| choice, | ||
| ), | ||
| residue_params: a.residue_params, |
Member
There was a problem hiding this comment.
Namely if residue params aren't the same, in a release build this may result in selecting b's montgomery_form with a's residue_params
Contributor
Author
There was a problem hiding this comment.
I actually just created this PR for consistency, but I don't use DynResidue in my application. So feel free to close this PR if the solution is not acceptable.
Member
There was a problem hiding this comment.
Okay, I think some more work is needed here.
Namely this probably needs a fallible inherent method for conditional selection which returns an error in the event the residue params mismatch.
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.
They were already implemented for
Residue.