Changed external/libwally-core to test_build_fix

Combined with the following commit which is required to
update against changed libsecp256k1 APIs:

Updated deprecated function calls
This commit is contained in:
Michael Dance
2022-04-06 17:54:52 -06:00
committed by Rusty Russell
parent b359a24772
commit f067e8c909
10 changed files with 17 additions and 14 deletions

View File

@@ -35,6 +35,6 @@ bool blinding_next_privkey(const struct privkey *e,
struct privkey *next) struct privkey *next)
{ {
*next = *e; *next = *e;
return secp256k1_ec_privkey_tweak_mul(secp256k1_ctx, next->secret.data, return secp256k1_ec_seckey_tweak_mul(secp256k1_ctx, next->secret.data,
h->u.u8) == 1; h->u.u8) == 1;
} }

View File

@@ -83,6 +83,7 @@ bool bolt12_check_signature(const struct tlv_field *fields,
return secp256k1_schnorrsig_verify(secp256k1_ctx, return secp256k1_schnorrsig_verify(secp256k1_ctx,
sig->u8, sig->u8,
shash.u.u8, shash.u.u8,
sizeof(shash.u.u8),
&key->pubkey) == 1; &key->pubkey) == 1;
} }

View File

@@ -84,7 +84,7 @@ bool derive_simple_privkey(const struct secret *base_secret,
#endif #endif
key->secret = *base_secret; key->secret = *base_secret;
if (secp256k1_ec_privkey_tweak_add(secp256k1_ctx, key->secret.data, if (secp256k1_ec_seckey_tweak_add(secp256k1_ctx, key->secret.data,
sha.u.u8) != 1) sha.u.u8) != 1)
return false; return false;
#ifdef SUPERVERBOSE #ifdef SUPERVERBOSE
@@ -207,7 +207,7 @@ bool derive_revocation_privkey(const struct secret *base_secret,
#endif #endif
key->secret = *base_secret; key->secret = *base_secret;
if (secp256k1_ec_privkey_tweak_mul(secp256k1_ctx, key->secret.data, if (secp256k1_ec_seckey_tweak_mul(secp256k1_ctx, key->secret.data,
sha.u.u8) sha.u.u8)
!= 1) != 1)
return false; return false;
@@ -229,7 +229,7 @@ bool derive_revocation_privkey(const struct secret *base_secret,
#endif #endif
part2 = *per_commitment_secret; part2 = *per_commitment_secret;
if (secp256k1_ec_privkey_tweak_mul(secp256k1_ctx, part2.data, if (secp256k1_ec_seckey_tweak_mul(secp256k1_ctx, part2.data,
sha.u.u8) != 1) sha.u.u8) != 1)
return false; return false;
#ifdef SUPERVERBOSE #ifdef SUPERVERBOSE
@@ -239,7 +239,7 @@ bool derive_revocation_privkey(const struct secret *base_secret,
printf("# = 0x%s\n", tal_hexstr(tmpctx, &part2, sizeof(part2))); printf("# = 0x%s\n", tal_hexstr(tmpctx, &part2, sizeof(part2)));
#endif #endif
if (secp256k1_ec_privkey_tweak_add(secp256k1_ctx, key->secret.data, if (secp256k1_ec_seckey_tweak_add(secp256k1_ctx, key->secret.data,
part2.data) != 1) part2.data) != 1)
return false; return false;

View File

@@ -321,6 +321,7 @@ static bool print_signature(const char *messagename,
if (secp256k1_schnorrsig_verify(secp256k1_ctx, if (secp256k1_schnorrsig_verify(secp256k1_ctx,
sig->u8, sig->u8,
shash.u.u8, shash.u.u8,
sizeof(shash.u.u8),
&node_id->pubkey) != 1) { &node_id->pubkey) != 1) {
fprintf(stderr, "%s: INVALID\n", fieldname); fprintf(stderr, "%s: INVALID\n", fieldname);
return false; return false;

View File

@@ -635,10 +635,10 @@ static u8 *handle_sign_bolt12(struct hsmd_client *c, const u8 *msg_in)
} }
} }
if (!secp256k1_schnorrsig_sign(secp256k1_ctx, sig.u8, if (!secp256k1_schnorrsig_sign32(secp256k1_ctx, sig.u8,
sha.u.u8, sha.u.u8,
&kp, &kp,
NULL, NULL)) { NULL)) {
return hsmd_status_bad_request_fmt(c, msg_in, return hsmd_status_bad_request_fmt(c, msg_in,
"Failed to sign bolt12"); "Failed to sign bolt12");
} }

View File

@@ -77,7 +77,7 @@ static void hsm_sign_b12(struct lightningd *ld,
/* Now we sanity-check! */ /* Now we sanity-check! */
sighash_from_merkle(messagename, fieldname, merkle, &sighash); sighash_from_merkle(messagename, fieldname, merkle, &sighash);
if (secp256k1_schnorrsig_verify(secp256k1_ctx, sig->u8, if (secp256k1_schnorrsig_verify(secp256k1_ctx, sig->u8,
sighash.u.u8, &key->pubkey) != 1) sighash.u.u8, sizeof(sighash.u.u8), &key->pubkey) != 1)
fatal("HSM gave bad signature %s for pubkey %s", fatal("HSM gave bad signature %s for pubkey %s",
type_to_string(tmpctx, struct bip340sig, sig), type_to_string(tmpctx, struct bip340sig, sig),
type_to_string(tmpctx, struct point32, key)); type_to_string(tmpctx, struct point32, key));

View File

@@ -218,7 +218,7 @@ static struct command_result *handle_invreq_response(struct command *cmd,
if (!inv->signature if (!inv->signature
|| secp256k1_schnorrsig_verify(secp256k1_ctx, inv->signature->u8, || secp256k1_schnorrsig_verify(secp256k1_ctx, inv->signature->u8,
sighash.u.u8, &inv->node_id->pubkey) != 1) { sighash.u.u8, sizeof(sighash.u.u8), &inv->node_id->pubkey) != 1) {
badfield = "signature"; badfield = "signature";
goto badinv; goto badinv;
} }
@@ -1198,11 +1198,11 @@ force_payer_secret(struct command *cmd,
sighash_from_merkle("invoice_request", "signature", &merkle, &sha); sighash_from_merkle("invoice_request", "signature", &merkle, &sha);
sent->invreq->signature = tal(invreq, struct bip340sig); sent->invreq->signature = tal(invreq, struct bip340sig);
if (!secp256k1_schnorrsig_sign(secp256k1_ctx, if (!secp256k1_schnorrsig_sign32(secp256k1_ctx,
sent->invreq->signature->u8, sent->invreq->signature->u8,
sha.u.u8, sha.u.u8,
&kp, &kp,
NULL, NULL)) { NULL)) {
return command_fail(cmd, LIGHTNINGD, return command_fail(cmd, LIGHTNINGD,
"Failed to sign with payer_secret"); "Failed to sign with payer_secret");
} }

View File

@@ -387,6 +387,7 @@ struct command_result *handle_invoice(struct command *cmd,
if (secp256k1_schnorrsig_verify(secp256k1_ctx, if (secp256k1_schnorrsig_verify(secp256k1_ctx,
inv->inv->signature->u8, inv->inv->signature->u8,
shash.u.u8, shash.u.u8,
sizeof(shash.u.u8),
&inv->inv->node_id->pubkey) != 1) { &inv->inv->node_id->pubkey) != 1) {
return fail_inv(cmd, inv, "Bad signature"); return fail_inv(cmd, inv, "Bad signature");
} }

View File

@@ -433,7 +433,7 @@ static bool check_payer_sig(struct command *cmd,
if (secp256k1_schnorrsig_verify(secp256k1_ctx, if (secp256k1_schnorrsig_verify(secp256k1_ctx,
sig->u8, sig->u8,
sighash.u.u8, &payer_key->pubkey) == 1) sighash.u.u8, sizeof(sighash.u.u8), &payer_key->pubkey) == 1)
return true; return true;
if (!deprecated_apis) if (!deprecated_apis)
@@ -447,7 +447,7 @@ static bool check_payer_sig(struct command *cmd,
return secp256k1_schnorrsig_verify(secp256k1_ctx, return secp256k1_schnorrsig_verify(secp256k1_ctx,
sig->u8, sig->u8,
sighash.u.u8, &payer_key->pubkey) == 1; sighash.u.u8, sizeof(sighash.u.u8), &payer_key->pubkey) == 1;
} }
static struct command_result *invreq_amount_by_quantity(struct command *cmd, static struct command_result *invreq_amount_by_quantity(struct command *cmd,