Skip to content

Commit

Permalink
bppp: Fix test for invalid sign byte again
Browse files Browse the repository at this point in the history
The first byte provided to secp256k1_bppp_parse_one_of_points is allowed to be
0, 1, 2, or 3 since it encodes the Y coordinate of two points. In a previous fix
we wrongly assumed it can only be 2 or 3.
  • Loading branch information
jonasnick committed Aug 5, 2023
1 parent b2ccc8d commit 5bf5759
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/modules/bppp/tests_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,8 @@ static void test_serialize_two_points(void) {
random_group_element_test(&R);
secp256k1_bppp_serialize_points(buf, &X, &R);

buf[0] = 4 + (unsigned char)secp256k1_testrandi64(0, 253);
/* Assert that buf[0] is actually invalid. */
CHECK(buf[0] != 0x02 && buf[0] != 0x03);

/* buf is valid if 0 <= buf[0] < 4. */
buf[0] = (unsigned char)secp256k1_testrandi64(4, 255);
CHECK(!secp256k1_bppp_parse_one_of_points(&X_tmp, buf, 0));
CHECK(!secp256k1_bppp_parse_one_of_points(&R_tmp, buf, 0));
}
Expand Down

0 comments on commit 5bf5759

Please sign in to comment.