Skip to content

Commit

Permalink
bppp: replace memcmp in tests with secp256k1_memcmp_var
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasnick committed Oct 12, 2023
1 parent 6a3aae8 commit b41caaa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/modules/bppp/tests_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ static void test_bppp_generators_fixed(void) {

len = 99;
CHECK(secp256k1_bppp_generators_serialize(CTX, gens, gens_ser, &len));
CHECK(memcmp(gens_ser, fixed_first_3, sizeof(fixed_first_3)) == 0);
CHECK(secp256k1_memcmp_var(gens_ser, fixed_first_3, sizeof(fixed_first_3)) == 0);

len = sizeof(gens_ser);
CHECK(secp256k1_bppp_generators_serialize(CTX, gens, gens_ser, &len));
CHECK(memcmp(gens_ser, fixed_first_3, sizeof(fixed_first_3)) == 0);
CHECK(secp256k1_memcmp_var(gens_ser, fixed_first_3, sizeof(fixed_first_3)) == 0);

secp256k1_bppp_generators_destroy(CTX, gens);
}
Expand All @@ -124,7 +124,7 @@ static void test_bppp_tagged_hash(void) {
secp256k1_bppp_sha256_tagged_commitment_init(&sha);
secp256k1_bppp_challenge_scalar(&s, &sha, 0);
secp256k1_scalar_get_b32(output, &s);
CHECK(memcmp(output, expected, sizeof(output)) == 0);
CHECK(secp256k1_memcmp_var(output, expected, sizeof(output)) == 0);
}

{
Expand All @@ -136,7 +136,7 @@ static void test_bppp_tagged_hash(void) {
secp256k1_sha256_write(&sha, tmp, sizeof(tmp));
secp256k1_bppp_challenge_scalar(&s, &sha, 0);
secp256k1_scalar_get_b32(output, &s);
CHECK(memcmp(output, expected, sizeof(output)) == 0);
CHECK(secp256k1_memcmp_var(output, expected, sizeof(output)) == 0);
}
}

Expand Down

0 comments on commit b41caaa

Please sign in to comment.