r->x
and r->y
values in the case where infinity is passed in.
r->x
and r->y
values in the case where infinity is passed in.
Previous behaviour would not initialize r->x and r->y values in the case where infinity is passed in.
Concept ACK
Unless I’m mistaken, I think VG_UNDEF
s here would be helpful. See #889 (comment).
This function exits without leaving anything uninitialized, so nothing to vg_undef here. Aside, in the past I hadn’t UNDEFed anywhere in the codebase itself, only in the tests to avoid injecting vg instrumentation in the production binary.. but we do that now for the CT tests and I think were were satisfied it was benign enough.
edit: oh I see, the set infinity could be undefing x/y. I suppose it could be. But that should be a separate PR if it gets done.
edit: oh I see, the set infinity could be undefing x/y. I suppose it could be.
Right, that’s what I had in mind.
But that should be a separate PR if it gets done.
Fair point.
Previous behaviour would not initialize r->x and r->y values in the case where infinity is passed in.
Previous behaviour would not initialize r->y values in the case where infinity is passed in.
Furthermore, the previous behaviour wouldn't initialize anything in the case where all inputs were infinity.
@roconnor-blockstream You could cherry pick the top two commits from https://github.com/real-or-random/secp256k1/commits/20210504_ge_set_gej_var
edit: I have verified that the new test fails on master.
3105 random_group_element_test(&ge[i]);
3106+ odd = secp256k1_fe_is_odd(&ge[i].x);
3107+ CHECK(odd == 0 || odd == 1);
3108 /* randomly set half the points to infinity */
3109- if(secp256k1_fe_is_odd(&ge[i].x)) {
3110+ if (odd == i % 2) {
% 2
seems superfluous here.
Ah I guess it depends on the thing you want to test.
Before the change, the input consisted of some infinity points and some affine points with even x coordinate. After the change, the input consists of some infinity points and some (arbitrary) affine points.
CHECK(odd == 0 || odd == 1);
. The % 2
is guaranteed to not have any effect.
if (odd % 2) {
.