Skip to content
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

tests: Initialize random group elements fully #814

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static int secp256k1_ge_is_infinity(const secp256k1_ge *a);
/** Check whether a group element is valid (i.e., on the curve). */
static int secp256k1_ge_is_valid_var(const secp256k1_ge *a);

/** Set r equal to the inverse of a (i.e., mirrored around the X axis) */
static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a);

/** Set a group element equal to another which is given in jacobian coordinates */
Expand Down
1 change: 1 addition & 0 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void random_group_element_test(secp256k1_ge *ge) {
break;
}
} while(1);
ge->infinity = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, on a second thought, this is not just necessary. secp256k1_ge_set_xo_var (a few lines above) sets infinity to 0.

I was playing around with multiple additional VERIFY_CHECKs when reviewing the schnorrsig PR and I wrongly believed that I found this bug ...

Well whatever, the correct was correct before this PR and it's correct after this PR. If we want, we can reverse this commit in a later PR.

}

void random_group_element_jacobian_test(secp256k1_gej *gej, const secp256k1_ge *ge) {
Expand Down