From 217fe59bbf61bc0a4fb737aa81a4bcf448b3a5e3 Mon Sep 17 00:00:00 2001 From: mllwchrry Date: Fri, 3 Jul 2026 15:17:36 +0300 Subject: [PATCH] tests: register run_util_tests and run_ec_commit, remove dead print_vector --- src/modules/rangeproof/tests_impl.h | 35 ----------------------------- src/tests.c | 2 ++ 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/modules/rangeproof/tests_impl.h b/src/modules/rangeproof/tests_impl.h index 5025c624..85c97c54 100644 --- a/src/modules/rangeproof/tests_impl.h +++ b/src/modules/rangeproof/tests_impl.h @@ -811,35 +811,6 @@ static void test_rangeproof_fixed_vectors(void) { } } -static void print_vector_helper(unsigned char *buf, size_t buf_len) { - size_t j; - printf(" "); - for (j = 0; j < buf_len; j++) { - printf("0x%02x", buf[j]); - if (j == buf_len-1) { - printf(",\n"); - } else if ((j+1) % 16 != 0) { - printf(", "); - } else { - printf(",\n"); - printf(" "); - } - } - printf("};\n"); -} - -static void print_vector(int i, unsigned char *proof, size_t p_len, secp256k1_pedersen_commitment *commit) { - unsigned char commit_output[33]; - - printf("unsigned char vector_%d[] = {\n", i); - print_vector_helper(proof, p_len); - - CHECK(secp256k1_pedersen_commitment_serialize(CTX, commit_output, commit)); - printf("unsigned char commit_%d[] = {\n", i); - print_vector_helper(commit_output, sizeof(commit_output)); -} - - /* Use same nonce and blinding value for all "reproducible" test vectors */ static unsigned char vector_blind[] = { 0x48, 0x26, 0xad, 0x41, 0x37, 0x4c, 0x25, 0x62, 0x52, 0x14, 0x78, 0x82, 0x89, 0x9c, 0x86, 0x27, @@ -1233,8 +1204,6 @@ static void test_rangeproof_fixed_vectors_reproducible(void) { CHECK(secp256k1_rangeproof_sign(CTX, proof, &p_len, min_value, &pc, vector_blind, vector_nonce, exp, min_bits, value, message, m_len, NULL, 0, secp256k1_generator_h)); CHECK(p_len <= secp256k1_rangeproof_max_size(CTX, value, min_bits)); CHECK(p_len == sizeof(proof)); - /* Uncomment the next line to print the test vector */ - /* print_vector(0, proof, p_len, &pc); */ CHECK(p_len == sizeof(vector_0)); CHECK(secp256k1_memcmp_var(proof, vector_0, p_len) == 0); @@ -1287,8 +1256,6 @@ static void test_rangeproof_fixed_vectors_reproducible(void) { CHECK(secp256k1_rangeproof_sign(CTX, proof, &p_len, min_value, &pc, vector_blind, vector_nonce, exp, min_bits, value, message, m_len, NULL, 0, secp256k1_generator_h)); CHECK(p_len <= secp256k1_rangeproof_max_size(CTX, value, min_bits)); CHECK(p_len == sizeof(proof)); - /* Uncomment the next line to print the test vector */ - /* print_vector(1, proof, p_len, &pc); */ CHECK(p_len == sizeof(vector_1)); CHECK(secp256k1_memcmp_var(proof, vector_1, p_len) == 0); @@ -1333,8 +1300,6 @@ static void test_rangeproof_fixed_vectors_reproducible(void) { CHECK(secp256k1_rangeproof_sign(CTX, proof, &p_len, min_value, &pc, vector_blind, vector_nonce, exp, min_bits, value, message, m_len, NULL, 0, secp256k1_generator_h)); CHECK(p_len <= secp256k1_rangeproof_max_size(CTX, value, min_bits)); CHECK(p_len == sizeof(proof)); - /* Uncomment the next line to print the test vector */ - /* print_vector(2, proof, p_len, &pc); */ CHECK(p_len == sizeof(vector_2)); CHECK(secp256k1_memcmp_var(proof, vector_2, p_len) == 0); diff --git a/src/tests.c b/src/tests.c index 7f8dbe34..ebc49c41 100644 --- a/src/tests.c +++ b/src/tests.c @@ -8208,6 +8208,7 @@ static const struct tf_test_entry tests_ec[] = { CASE(ec_pubkey_parse_test), CASE(eckey_edge_case_test), CASE(eckey_negate_test), + CASE(ec_commit), }; static const struct tf_test_entry tests_ecdsa[] = { @@ -8229,6 +8230,7 @@ static const struct tf_test_entry tests_utils[] = { CASE(secp256k1_is_zero_array_test), CASE(secp256k1_byteorder_tests), CASE(cmov_tests), + CASE(util_tests), }; /* Register test modules */