-
Notifications
You must be signed in to change notification settings - Fork 1.1k
VERIFY_CHECK precondition for secp256k1_fe_set_int. #943
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,10 +227,11 @@ static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r) { | |
} | ||
|
||
SECP256K1_INLINE static void secp256k1_fe_set_int(secp256k1_fe *r, int a) { | ||
VERIFY_CHECK(0 <= a && a <= 0x7FFF); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does 0x7FFF come from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0x7FFF is the largest portable value of for an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, the smallest INT_MAX, I see. Would be better to add a note to the doc that the definition of small is <= 0x7FFF imo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
r->n[0] = a; | ||
r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0; | ||
#ifdef VERIFY | ||
r->magnitude = 1; | ||
r->magnitude = (a != 0); | ||
r->normalized = 1; | ||
secp256k1_fe_verify(r); | ||
#endif | ||
|
Uh oh!
There was an error while loading. Please reload this page.