Skip to content

Commit b911b3c

Browse files
Merge #265: bppp: Fix test for invalid sign byte again
5bf5759 bppp: Fix test for invalid sign byte again (Jonas Nick) Pull request description: 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. ACKs for top commit: real-or-random: utACK 5bf5759 Tree-SHA512: 4dcc83a03691b8cb0cbe39da6e34311bde518e09fb02fb8648557eba435031eaee8acef9dc762e24c7d106b935b725981dcdaadbd1a3801026ee2b7b9bc34951
2 parents b2ccc8d + 5bf5759 commit b911b3c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/modules/bppp/tests_impl.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,8 @@ static void test_serialize_two_points(void) {
257257
random_group_element_test(&R);
258258
secp256k1_bppp_serialize_points(buf, &X, &R);
259259

260-
buf[0] = 4 + (unsigned char)secp256k1_testrandi64(0, 253);
261-
/* Assert that buf[0] is actually invalid. */
262-
CHECK(buf[0] != 0x02 && buf[0] != 0x03);
263-
260+
/* buf is valid if 0 <= buf[0] < 4. */
261+
buf[0] = (unsigned char)secp256k1_testrandi64(4, 255);
264262
CHECK(!secp256k1_bppp_parse_one_of_points(&X_tmp, buf, 0));
265263
CHECK(!secp256k1_bppp_parse_one_of_points(&R_tmp, buf, 0));
266264
}

0 commit comments

Comments
 (0)