Skip to content

Commit 00a5ccd

Browse files
bppp: Fix test for invalid sign byte
The test is supposed to create an invalid sign byte. Before this PR, the generated sign byte could in fact be valid due to an overflow. Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
1 parent 6ba4c8b commit 00a5ccd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/modules/bppp/tests_impl.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ static void test_serialize_two_points(void) {
256256
random_group_element_test(&X);
257257
random_group_element_test(&R);
258258
secp256k1_bppp_serialize_points(buf, &X, &R);
259-
buf[0] |= 4 + (unsigned char)secp256k1_testrandi64(4, 255);
259+
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+
260264
CHECK(!secp256k1_bppp_parse_one_of_points(&X_tmp, buf, 0));
261265
CHECK(!secp256k1_bppp_parse_one_of_points(&R_tmp, buf, 0));
262266
}

0 commit comments

Comments
 (0)