Merge elementsproject/secp256k1-zkp#303: ci: backport upstream string-initializer fixes and clean up related tests
7d779c6d9dexamples/musig: use brace-enclosed initializer for 32-byte msg (BEULAHEVANJALIN)53fd89b635musig/tests: initialize keypair (Jonas Nick)40bd8549ddmusig/test: Remove dead code (Tim Ruffing)c4570307ectest/fix: refactor unterminated string initializers to brace arrays - Mirror upstream fix (bitcoin-core/secp256k1fa67b675) - Convert tags, test vectors, and constants in -zkp-only modules (ecdsa_adaptor, ecdsa_s2c, musig, bppp, rangeproof, schnorrsig_halfagg) - Avoid -Wunterminated-string-initialization without changing behavior (BEULAHEVANJALIN)654a8c327crefactor: Use array initialization for unterminated strings (MarcoFalke) Pull request description: ACKs for top commit: real-or-random: utACK7d779c6d9dthanks! jonasnick: ACK7d779c6d9dTree-SHA512: edb9885a36eab499dee05e0c87a184f139ba6f68c01128ae692ab1195546ba8ff77d0c0b06faa22164fd89fd27935fd68b1e9c04a1fc9bcd0b7d6472515095dd
This commit is contained in:
@@ -169,7 +169,7 @@ static int sign(const secp256k1_context* ctx, struct signer_secrets *signer_secr
|
||||
const secp256k1_pubkey *pubkeys_ptr[N_SIGNERS];
|
||||
secp256k1_xonly_pubkey agg_pk;
|
||||
secp256k1_musig_keyagg_cache cache;
|
||||
unsigned char msg[32] = "this_could_be_the_hash_of_a_msg!";
|
||||
unsigned char msg[] = {'t', 'h', 'i', 's', '_', 'c', 'o', 'u', 'l', 'd', ' ', 'b', 'e', ' ', 't', 'h', 'e', '_', 'h', 'a', 's', 'h', '_', 'o', 'f', '_', 'a', '_', 'm', 's', 'g', '!'};
|
||||
unsigned char sig[64];
|
||||
|
||||
/* Create a secp256k1 context */
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include "examples_util.h"
|
||||
|
||||
int main(void) {
|
||||
unsigned char msg[12] = "Hello World!";
|
||||
unsigned char msg[] = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!'};
|
||||
unsigned char msg_hash[32];
|
||||
unsigned char tag[17] = "my_fancy_protocol";
|
||||
unsigned char tag[] = {'m', 'y', '_', 'f', 'a', 'n', 'c', 'y', '_', 'p', 'r', 'o', 't', 'o', 'c', 'o', 'l'};
|
||||
unsigned char seckey[32];
|
||||
unsigned char randomize[32];
|
||||
unsigned char auxiliary_rand[32];
|
||||
|
||||
@@ -103,7 +103,7 @@ static void test_bppp_generators_fixed(void) {
|
||||
}
|
||||
|
||||
static void test_bppp_tagged_hash(void) {
|
||||
unsigned char tag_data[29] = "Bulletproofs_pp/v0/commitment";
|
||||
unsigned char tag_data[] = {'B', 'u', 'l', 'l', 'e', 't', 'p', 'r', 'o', 'o', 'f', 's', '_', 'p', 'p', '/', 'v', '0', '/', 'c', 'o', 'm', 'm', 'i', 't', 'm', 'e', 'n', 't'};
|
||||
secp256k1_sha256 sha;
|
||||
secp256k1_sha256 sha_cached;
|
||||
unsigned char output[32];
|
||||
|
||||
@@ -18,7 +18,7 @@ static void secp256k1_nonce_function_dleq_sha256_tagged(secp256k1_sha256 *sha) {
|
||||
}
|
||||
|
||||
/* algo argument for nonce_function_ecdsa_adaptor to derive the nonce using a tagged hash function. */
|
||||
static const unsigned char dleq_algo[4] = "DLEQ";
|
||||
static const unsigned char dleq_algo[] = {'D','L','E','Q'};
|
||||
|
||||
static int secp256k1_dleq_hash_point(secp256k1_sha256 *sha, secp256k1_ge *p) {
|
||||
unsigned char buf[33];
|
||||
|
||||
@@ -98,7 +98,7 @@ static void secp256k1_nonce_function_ecdsa_adaptor_sha256_tagged_aux(secp256k1_s
|
||||
}
|
||||
|
||||
/* algo argument for nonce_function_ecdsa_adaptor to derive the nonce using a tagged hash function. */
|
||||
static const unsigned char ecdsa_adaptor_algo[16] = "ECDSAadaptor/non";
|
||||
static const unsigned char ecdsa_adaptor_algo[] = {'E', 'C', 'D', 'S', 'A', 'a', 'd', 'a', 'p', 't', 'o', 'r', '/', 'n', 'o', 'n'};
|
||||
|
||||
/* Modified BIP-340 nonce function */
|
||||
static int nonce_function_ecdsa_adaptor(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *pk33, const unsigned char *algo, size_t algolen, void *data) {
|
||||
|
||||
@@ -730,11 +730,11 @@ static void ecdsa_adaptor_test_sha256_eq(const secp256k1_sha256 *sha1, const sec
|
||||
}
|
||||
|
||||
static void run_nonce_function_ecdsa_adaptor_tests(void) {
|
||||
unsigned char tag[16] = "ECDSAadaptor/non";
|
||||
unsigned char aux_tag[16] = "ECDSAadaptor/aux";
|
||||
unsigned char algo[16] = "ECDSAadaptor/non";
|
||||
unsigned char tag[] = {'E', 'C', 'D', 'S', 'A', 'a', 'd', 'a', 'p', 't', 'o', 'r', '/', 'n', 'o', 'n'};
|
||||
unsigned char aux_tag[] = {'E', 'C', 'D', 'S', 'A', 'a', 'd', 'a', 'p', 't', 'o', 'r', '/', 'a', 'u', 'x'};
|
||||
unsigned char algo[] = {'E', 'C', 'D', 'S', 'A', 'a', 'd', 'a', 'p', 't', 'o', 'r', '/', 'n', 'o', 'n'};
|
||||
size_t algolen = sizeof(algo);
|
||||
unsigned char dleq_tag[4] = "DLEQ";
|
||||
unsigned char dleq_tag[] = {'D', 'L', 'E', 'Q'};
|
||||
secp256k1_sha256 sha;
|
||||
secp256k1_sha256 sha_optimized;
|
||||
unsigned char nonce[32];
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "../../../include/secp256k1_ecdsa_s2c.h"
|
||||
|
||||
static void test_ecdsa_s2c_tagged_hash(void) {
|
||||
unsigned char tag_data[14] = "s2c/ecdsa/data";
|
||||
unsigned char tag_point[15] = "s2c/ecdsa/point";
|
||||
unsigned char tag_data[] = {'s', '2', 'c', '/', 'e', 'c', 'd', 's', 'a', '/', 'd', 'a', 't', 'a'};
|
||||
unsigned char tag_point[] = {'s', '2', 'c', '/', 'e', 'c', 'd', 's', 'a', '/', 'p', 'o', 'i', 'n', 't'};
|
||||
secp256k1_sha256 sha;
|
||||
secp256k1_sha256 sha_optimized;
|
||||
unsigned char output[32];
|
||||
@@ -78,10 +78,10 @@ static void run_s2c_opening_test(void) {
|
||||
static void test_ecdsa_s2c_api(void) {
|
||||
secp256k1_ecdsa_s2c_opening s2c_opening;
|
||||
secp256k1_ecdsa_signature sig;
|
||||
const unsigned char msg[32] = "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm";
|
||||
const unsigned char sec[32] = "ssssssssssssssssssssssssssssssss";
|
||||
const unsigned char s2c_data[32] = "dddddddddddddddddddddddddddddddd";
|
||||
const unsigned char hostrand[32] = "hrhrhrhrhrhrhrhrhrhrhrhrhrhrhrhr";
|
||||
const unsigned char msg[] = {'m', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm', 'm'};
|
||||
const unsigned char sec[] = {'s', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's'};
|
||||
const unsigned char s2c_data[] = {'d', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd'};
|
||||
const unsigned char hostrand[] = {'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r', 'h', 'r'};
|
||||
unsigned char hostrand_commitment[32];
|
||||
secp256k1_pubkey pk;
|
||||
|
||||
@@ -148,14 +148,14 @@ typedef struct {
|
||||
|
||||
static ecdsa_s2c_test ecdsa_s2c_tests[] = {
|
||||
{
|
||||
"\x1b\xf6\xfb\x42\xf4\x1e\xb8\x76\xc4\xd7\xaa\x0d\x67\x24\x2b\x00\xba\xab\x99\xdc\x20\x84\x49\x3e\x4e\x63\x27\x7f\xa1\xf7\x7f\x22",
|
||||
"\x03\xf0\x30\xde\xf3\x18\x8c\x0f\x56\xfc\xea\x87\x43\x5b\x30\x76\x43\xf4\x5d\xaf\xe2\x2c\xbc\x82\xfd\x56\x03\x4f\xae\x97\x41\x7d\x3a",
|
||||
"\x02\xdf\x63\x75\x5d\x1f\x32\x92\xbf\xfe\xd8\x29\x86\xb1\x06\x49\x7c\x93\xb1\xf8\xbd\xc0\x45\x4b\x6b\x0b\x0a\x47\x79\xc0\xef\x71\x88",
|
||||
{0x1b, 0xf6, 0xfb, 0x42, 0xf4, 0x1e, 0xb8, 0x76, 0xc4, 0xd7, 0xaa, 0x0d, 0x67, 0x24, 0x2b, 0x00, 0xba, 0xab, 0x99, 0xdc, 0x20, 0x84, 0x49, 0x3e, 0x4e, 0x63, 0x27, 0x7f, 0xa1, 0xf7, 0x7f, 0x22},
|
||||
{0x03, 0xf0, 0x30, 0xde, 0xf3, 0x18, 0x8c, 0x0f, 0x56, 0xfc, 0xea, 0x87, 0x43, 0x5b, 0x30, 0x76, 0x43, 0xf4, 0x5d, 0xaf, 0xe2, 0x2c, 0xbc, 0x82, 0xfd, 0x56, 0x03, 0x4f, 0xae, 0x97, 0x41, 0x7d, 0x3a},
|
||||
{0x02, 0xdf, 0x63, 0x75, 0x5d, 0x1f, 0x32, 0x92, 0xbf, 0xfe, 0xd8, 0x29, 0x86, 0xb1, 0x06, 0x49, 0x7c, 0x93, 0xb1, 0xf8, 0xbd, 0xc0, 0x45, 0x4b, 0x6b, 0x0b, 0x0a, 0x47, 0x79, 0xc0, 0xef, 0x71, 0x88},
|
||||
},
|
||||
{
|
||||
"\x35\x19\x9a\x8f\xbf\x84\xad\x6e\xf6\x9a\x18\x4c\x1b\x19\x28\x5b\xef\xbe\x06\xe6\x0b\x62\x64\xe6\xd3\x73\x89\x3f\x68\x55\xe2\x4a",
|
||||
"\x03\x90\x17\x17\xce\x7c\x74\x84\xa2\xce\x1b\x7d\xc7\x40\x3b\x14\xe0\x35\x49\x71\x39\x3e\xc0\x92\xa7\xf3\xe0\xc8\xe4\xe2\xd2\x63\x9d",
|
||||
"\x02\xc0\x4a\xc7\xf7\x71\xe8\xeb\xdb\xf3\x15\xff\x5e\x58\xb7\xfe\x95\x16\x10\x21\x03\x50\x00\x66\x17\x2c\x4f\xac\x5b\x20\xf9\xe0\xea",
|
||||
{0x35, 0x19, 0x9a, 0x8f, 0xbf, 0x84, 0xad, 0x6e, 0xf6, 0x9a, 0x18, 0x4c, 0x1b, 0x19, 0x28, 0x5b, 0xef, 0xbe, 0x06, 0xe6, 0x0b, 0x62, 0x64, 0xe6, 0xd3, 0x73, 0x89, 0x3f, 0x68, 0x55, 0xe2, 0x4a},
|
||||
{0x03, 0x90, 0x17, 0x17, 0xce, 0x7c, 0x74, 0x84, 0xa2, 0xce, 0x1b, 0x7d, 0xc7, 0x40, 0x3b, 0x14, 0xe0, 0x35, 0x49, 0x71, 0x39, 0x3e, 0xc0, 0x92, 0xa7, 0xf3, 0xe0, 0xc8, 0xe4, 0xe2, 0xd2, 0x63, 0x9d},
|
||||
{0x02, 0xc0, 0x4a, 0xc7, 0xf7, 0x71, 0xe8, 0xeb, 0xdb, 0xf3, 0x15, 0xff, 0x5e, 0x58, 0xb7, 0xfe, 0x95, 0x16, 0x10, 0x21, 0x03, 0x50, 0x00, 0x66, 0x17, 0x2c, 0x4f, 0xac, 0x5b, 0x20, 0xf9, 0xe0, 0xea},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -207,7 +207,7 @@ static void test_ecdsa_s2c_sign_verify(void) {
|
||||
|
||||
{ /* invalid privkeys */
|
||||
unsigned char zero_privkey[32] = {0};
|
||||
unsigned char overflow_privkey[32] = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff";
|
||||
unsigned char overflow_privkey[32] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
CHECK(secp256k1_ecdsa_s2c_sign(CTX, &signature, NULL, message, zero_privkey, s2c_data) == 0);
|
||||
CHECK(secp256k1_ecdsa_s2c_sign(CTX, &signature, NULL, message, overflow_privkey, s2c_data) == 0);
|
||||
}
|
||||
|
||||
@@ -406,9 +406,9 @@ void run_ellswift_tests(void) {
|
||||
/* Test hash initializers. */
|
||||
{
|
||||
secp256k1_sha256 sha, sha_optimized;
|
||||
static const unsigned char encode_tag[25] = "secp256k1_ellswift_encode";
|
||||
static const unsigned char create_tag[25] = "secp256k1_ellswift_create";
|
||||
static const unsigned char bip324_tag[26] = "bip324_ellswift_xonly_ecdh";
|
||||
static const unsigned char encode_tag[] = {'s', 'e', 'c', 'p', '2', '5', '6', 'k', '1', '_', 'e', 'l', 'l', 's', 'w', 'i', 'f', 't', '_', 'e', 'n', 'c', 'o', 'd', 'e'};
|
||||
static const unsigned char create_tag[] = {'s', 'e', 'c', 'p', '2', '5', '6', 'k', '1', '_', 'e', 'l', 'l', 's', 'w', 'i', 'f', 't', '_', 'c', 'r', 'e', 'a', 't', 'e'};
|
||||
static const unsigned char bip324_tag[] = {'b', 'i', 'p', '3', '2', '4', '_', 'e', 'l', 'l', 's', 'w', 'i', 'f', 't', '_', 'x', 'o', 'n', 'l', 'y', '_', 'e', 'c', 'd', 'h'};
|
||||
|
||||
/* Check that hash initialized by
|
||||
* secp256k1_ellswift_sha256_init_encode has the expected
|
||||
|
||||
@@ -579,8 +579,8 @@ static void scriptless_atomic_swap(secp256k1_scratch_space *scratch) {
|
||||
int nonce_parity_b;
|
||||
unsigned char seed_a[2][32] = { "a0", "a1" };
|
||||
unsigned char seed_b[2][32] = { "b0", "b1" };
|
||||
const unsigned char msg32_a[32] = "this is the message blockchain a";
|
||||
const unsigned char msg32_b[32] = "this is the message blockchain b";
|
||||
const unsigned char msg32_a[32] = {'t', 'h', 'i', 's', ' ', 'i', 's', ' ', 't', 'h', 'e', ' ', 'm', 'e', 's', 's', 'a', 'g', 'e', ' ', 'b', 'l', 'o', 'c', 'k', 'c', 'h', 'a', 'i', 'n', ' ', 'a'};
|
||||
const unsigned char msg32_b[32] = {'t', 'h', 'i', 's', ' ', 'i', 's', ' ', 't', 'h', 'e', ' ', 'm', 'e', 's', 's', 'a', 'g', 'e', ' ', 'b', 'l', 'o', 'c', 'k', 'c', 'h', 'a', 'i', 'n', ' ', 'b'};
|
||||
int i;
|
||||
|
||||
/* Step 1: key setup */
|
||||
@@ -676,12 +676,12 @@ static void sha256_tag_test_internal(secp256k1_sha256 *sha_tagged, unsigned char
|
||||
static void sha256_tag_test(void) {
|
||||
secp256k1_sha256 sha_tagged;
|
||||
{
|
||||
char tag[11] = "KeyAgg list";
|
||||
char tag[] = {'K', 'e', 'y', 'A', 'g', 'g', ' ', 'l', 'i', 's', 't'};
|
||||
secp256k1_musig_keyagglist_sha256(&sha_tagged);
|
||||
sha256_tag_test_internal(&sha_tagged, (unsigned char*)tag, sizeof(tag));
|
||||
}
|
||||
{
|
||||
char tag[18] = "KeyAgg coefficient";
|
||||
char tag[] = {'K', 'e', 'y', 'A', 'g', 'g', ' ', 'c', 'o', 'e', 'f', 'f', 'i', 'c', 'i', 'e', 'n', 't'};
|
||||
secp256k1_musig_keyaggcoef_sha256(&sha_tagged);
|
||||
sha256_tag_test_internal(&sha_tagged, (unsigned char*)tag, sizeof(tag));
|
||||
}
|
||||
@@ -1013,6 +1013,8 @@ static void musig_test_vectors_signverify(void) {
|
||||
if (!expected) {
|
||||
continue;
|
||||
}
|
||||
CHECK(secp256k1_ec_pubkey_parse(CTX, &pubkey, vector->pubkeys[0], sizeof(vector->pubkeys[0])));
|
||||
CHECK(secp256k1_keypair_create(CTX, &keypair, vector->sk));
|
||||
|
||||
expected = c->error != MUSIG_AGGNONCE;
|
||||
CHECK(expected == secp256k1_musig_aggnonce_parse(CTX, &aggnonce, vector->aggnonces[c->aggnonce_index]));
|
||||
@@ -1022,13 +1024,10 @@ static void musig_test_vectors_signverify(void) {
|
||||
CHECK(secp256k1_musig_nonce_process(CTX, &session, &aggnonce, vector->msgs[c->msg_index], &keyagg_cache, NULL));
|
||||
|
||||
CHECK(secp256k1_ec_pubkey_parse(CTX, &pubkey, vector->pubkeys[0], sizeof(vector->pubkeys[0])));
|
||||
musig_test_set_secnonce(&secnonce, vector->secnonces[c->secnonce_index], &pubkey);
|
||||
expected = c->error != MUSIG_SECNONCE;
|
||||
if (expected) {
|
||||
CHECK(secp256k1_musig_partial_sign(CTX, &partial_sig, &secnonce, &keypair, &keyagg_cache, &session));
|
||||
} else {
|
||||
CHECK_ILLEGAL(CTX, secp256k1_musig_partial_sign(CTX, &partial_sig, &secnonce, &keypair, &keyagg_cache, &session));
|
||||
}
|
||||
CHECK(!expected);
|
||||
musig_test_set_secnonce(&secnonce, vector->secnonces[c->secnonce_index], &pubkey);
|
||||
CHECK_ILLEGAL(CTX, secp256k1_musig_partial_sign(CTX, &partial_sig, &secnonce, &keypair, &keyagg_cache, &session));
|
||||
}
|
||||
for (i = 0; i < sizeof(vector->verify_fail_case)/sizeof(vector->verify_fail_case[0]); i++) {
|
||||
const struct musig_verify_fail_error_case *c = &vector->verify_fail_case[i];
|
||||
|
||||
@@ -414,7 +414,7 @@ static void test_single_value_proof(uint64_t val) {
|
||||
unsigned char blind[32];
|
||||
unsigned char blind_out[32];
|
||||
unsigned char nonce[32];
|
||||
const unsigned char message[1] = " "; /* no message will fit into a single-value proof */
|
||||
const unsigned char message[] = { ' ' }; /* no message will fit into a single-value proof */
|
||||
unsigned char message_out[sizeof(proof)] = { 0 };
|
||||
size_t plen = sizeof(proof);
|
||||
uint64_t min_val_out = 0;
|
||||
|
||||
@@ -45,7 +45,7 @@ static void secp256k1_nonce_function_bip340_sha256_tagged_aux(secp256k1_sha256 *
|
||||
|
||||
/* algo argument for nonce_function_bip340 to derive the nonce exactly as stated in BIP-340
|
||||
* by using the correct tagged hash function. */
|
||||
static const unsigned char bip340_algo[13] = "BIP0340/nonce";
|
||||
static const unsigned char bip340_algo[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'n', 'o', 'n', 'c', 'e'};
|
||||
|
||||
static const unsigned char schnorrsig_extraparams_magic[4] = SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC;
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ static void nonce_function_bip340_bitflip(unsigned char **args, size_t n_flip, s
|
||||
}
|
||||
|
||||
static void run_nonce_function_bip340_tests(void) {
|
||||
unsigned char tag[13] = "BIP0340/nonce";
|
||||
unsigned char aux_tag[11] = "BIP0340/aux";
|
||||
unsigned char algo[13] = "BIP0340/nonce";
|
||||
unsigned char tag[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'n', 'o', 'n', 'c', 'e'};
|
||||
unsigned char aux_tag[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'a', 'u', 'x'};
|
||||
unsigned char algo[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'n', 'o', 'n', 'c', 'e'};
|
||||
size_t algolen = sizeof(algo);
|
||||
secp256k1_sha256 sha;
|
||||
secp256k1_sha256 sha_optimized;
|
||||
@@ -158,7 +158,7 @@ static void test_schnorrsig_api(void) {
|
||||
/* Checks that hash initialized by secp256k1_schnorrsig_sha256_tagged has the
|
||||
* expected state. */
|
||||
static void test_schnorrsig_sha256_tagged(void) {
|
||||
unsigned char tag[17] = "BIP0340/challenge";
|
||||
unsigned char tag[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'c', 'h', 'a', 'l', 'l', 'e', 'n', 'g', 'e'};
|
||||
secp256k1_sha256 sha;
|
||||
secp256k1_sha256 sha_optimized;
|
||||
|
||||
@@ -806,7 +806,7 @@ static void test_schnorrsig_sign(void) {
|
||||
unsigned char sk[32];
|
||||
secp256k1_xonly_pubkey pk;
|
||||
secp256k1_keypair keypair;
|
||||
const unsigned char msg[32] = "this is a msg for a schnorrsig..";
|
||||
const unsigned char msg[] = {'t', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 'm', 's', 'g', ' ', 'f', 'o', 'r', ' ', 'a', ' ', 's', 'c', 'h', 'n', 'o', 'r', 'r', 's', 'i', 'g', '.', '.'};
|
||||
unsigned char sig[64];
|
||||
unsigned char sig2[64];
|
||||
unsigned char zeros64[64] = { 0 };
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/* We test that the hash initialized by secp256k1_schnorrsig_sha256_tagged_aggregate
|
||||
* has the expected state. */
|
||||
void test_schnorrsig_sha256_tagged_aggregate(void) {
|
||||
unsigned char tag[18] = "HalfAgg/randomizer";
|
||||
unsigned char tag[] = {'H', 'a', 'l', 'f', 'A', 'g', 'g', '/', 'r', 'a', 'n', 'd', 'o', 'm', 'i', 'z', 'e', 'r'};
|
||||
secp256k1_sha256 sha;
|
||||
secp256k1_sha256 sha_optimized;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
static uint64_t secp256k1_test_state[4];
|
||||
|
||||
SECP256K1_INLINE static void secp256k1_testrand_seed(const unsigned char *seed16) {
|
||||
static const unsigned char PREFIX[19] = "secp256k1 test init";
|
||||
static const unsigned char PREFIX[] = {'s', 'e', 'c', 'p', '2', '5', '6', 'k', '1', ' ', 't', 'e', 's', 't', ' ', 'i', 'n', 'i', 't'};
|
||||
unsigned char out32[32];
|
||||
secp256k1_sha256 hash;
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user