Skip to content

Commit 2697d8a

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 <[email protected]>
1 parent 58e27bc commit 2697d8a

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
@@ -257,7 +257,11 @@ void test_serialize_two_points(void) {
257257
random_group_element_test(&X);
258258
random_group_element_test(&R);
259259
secp256k1_bppp_serialize_points(buf, &X, &R);
260-
buf[0] |= 4 + (unsigned char)secp256k1_testrandi64(4, 255);
260+
261+
buf[0] = 4 + (unsigned char)secp256k1_testrandi64(0, 253);
262+
/* Assert that buf[0] is actually invalid. */
263+
CHECK(buf[0] != 0x02 && buf[0] != 0x03)
264+
261265
CHECK(!secp256k1_bppp_parse_one_of_points(&X_tmp, buf, 0));
262266
CHECK(!secp256k1_bppp_parse_one_of_points(&R_tmp, buf, 0));
263267
}

0 commit comments

Comments
 (0)