Skip to content

Commit 89f2240

Browse files
committed
ci: Update for libsecp256k1-zkp API changes
1 parent 2a91951 commit 89f2240

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/blindpsbt.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ bool SubtractScalars(uint256& a, const uint256& b)
248248
}
249249

250250
uint256 sub(b);
251-
if (secp256k1_ec_privkey_negate(secp256k1_blind_context, sub.begin()) != 1) return false;
251+
if (secp256k1_ec_seckey_negate(secp256k1_blind_context, sub.begin()) != 1) return false;
252252

253253
// If a is 0, then the result of this subtraction is the negation of b (i.e. sub)
254254
if (a.IsNull()) {
@@ -257,7 +257,7 @@ bool SubtractScalars(uint256& a, const uint256& b)
257257
}
258258

259259
// Neither a nor b are null, do a = a - b
260-
if (secp256k1_ec_privkey_tweak_add(secp256k1_blind_context, a.begin(), sub.begin()) != 1) return false;
260+
if (secp256k1_ec_seckey_tweak_add(secp256k1_blind_context, a.begin(), sub.begin()) != 1) return false;
261261
return true;
262262
}
263263

@@ -278,7 +278,7 @@ bool CalculateScalarOffset(uint256& out, CAmount value, const uint256& asset_bli
278278
// We need to pack the 8 byte CAmount into a uint256 with the correct padding, so start it at 24 bytes from the front
279279
WriteBE64(val.begin() + 24, value);
280280
if (value > 0) {
281-
if (secp256k1_ec_privkey_tweak_mul(secp256k1_blind_context, out.begin(), val.begin()) != 1) return false;
281+
if (secp256k1_ec_seckey_tweak_mul(secp256k1_blind_context, out.begin(), val.begin()) != 1) return false;
282282
} else {
283283
out = value_blinder;
284284
return true;
@@ -288,12 +288,12 @@ bool CalculateScalarOffset(uint256& out, CAmount value, const uint256& asset_bli
288288
if (secp256k1_ec_seckey_negate(secp256k1_blind_context, value_negated.begin()) != 1) {
289289
return false;
290290
}
291-
// Special-case zero, which would otherwise cause `secp256k1_ec_privkey_tweak_add` to fail
291+
// Special-case zero, which would otherwise cause `secp256k1_ec_seckey_tweak_add` to fail
292292
if (value_negated == out) {
293293
out = uint256{};
294294
return true;
295295
}
296-
if (secp256k1_ec_privkey_tweak_add(secp256k1_blind_context, out.begin(), value_blinder.begin()) != 1) return false;
296+
if (secp256k1_ec_seckey_tweak_add(secp256k1_blind_context, out.begin(), value_blinder.begin()) != 1) return false;
297297
}
298298
return true;
299299
}
@@ -315,12 +315,12 @@ bool ComputeAndAddToScalarOffset(uint256& a, CAmount value, const uint256& asset
315315
if (secp256k1_ec_seckey_negate(secp256k1_blind_context, scalar_negated.begin()) != 1) {
316316
return false;
317317
}
318-
// Special-case zero, which would otherwise cause `secp256k1_ec_privkey_tweak_add` to fail
318+
// Special-case zero, which would otherwise cause `secp256k1_ec_seckey_tweak_add` to fail
319319
if (scalar_negated == a) {
320320
a = uint256{};
321321
} else {
322322
// If we have a, then add the scalar to it.
323-
if (secp256k1_ec_privkey_tweak_add(secp256k1_blind_context, a.begin(), scalar.begin()) != 1) return false;
323+
if (secp256k1_ec_seckey_tweak_add(secp256k1_blind_context, a.begin(), scalar.begin()) != 1) return false;
324324
}
325325
}
326326
return true;

src/key.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ bool CKey::SignSchnorr(const uint256& hash, Span<unsigned char> sig, const uint2
284284
uint256 tweak = XOnlyPubKey(pubkey_bytes).ComputeTapTweakHash(merkle_root->IsNull() ? nullptr : merkle_root);
285285
if (!secp256k1_keypair_xonly_tweak_add(GetVerifyContext(), &keypair, tweak.data())) return false;
286286
}
287-
bool ret = secp256k1_schnorrsig_sign(secp256k1_context_sign, sig.data(), hash.data(), &keypair, aux ? (unsigned char*)aux->data() : nullptr);
287+
bool ret = secp256k1_schnorrsig_sign32(secp256k1_context_sign, sig.data(), hash.data(), &keypair, aux ? (unsigned char*)aux->data() : nullptr);
288288
memory_cleanse(&keypair, sizeof(keypair));
289289
return ret;
290290
}

src/secp256k1/src/tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6259,7 +6259,7 @@ void test_ecdsa_end_to_end(void) {
62596259
ret1 = secp256k1_ec_seckey_tweak_add(ctx, privkey, rnd);
62606260
ret2 = secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, rnd);
62616261
/* Check that privkey alias gives same result */
6262-
ret3 = secp256k1_ec_privkey_tweak_add(ctx, privkey_tmp, rnd);
6262+
ret3 = secp256k1_ec_seckey_tweak_add(ctx, privkey_tmp, rnd);
62636263
CHECK(ret1 == ret2);
62646264
CHECK(ret2 == ret3);
62656265
if (ret1 == 0) {

src/wallet/rpcwallet.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5411,7 +5411,7 @@ bool DerivePubTweak(const std::vector<uint32_t>& vPath, const CPubKey& keyMaster
54115411
if (i == 0) {
54125412
tweakSum = tweak;
54135413
} else {
5414-
bool ret = secp256k1_ec_privkey_tweak_add(secp256k1_ctx, tweakSum.data(), tweak.data());
5414+
bool ret = secp256k1_ec_seckey_tweak_add(secp256k1_ctx, tweakSum.data(), tweak.data());
54155415
if (!ret) {
54165416
return false;
54175417
}
@@ -5877,7 +5877,7 @@ static RPCHelpMan sendtomainchain_pak()
58775877

58785878
//Create, verify whitelist proof
58795879
secp256k1_whitelist_signature sig;
5880-
if(secp256k1_whitelist_sign(secp256k1_ctx, &sig, &paklist.OnlineKeys()[0], &paklist.OfflineKeys()[0], paklist.size(), &btcpub_secp, masterOnlineKey.begin(), &tweakSum[0], whitelistindex, NULL, NULL) != 1) {
5880+
if(secp256k1_whitelist_sign(secp256k1_ctx, &sig, &paklist.OnlineKeys()[0], &paklist.OfflineKeys()[0], paklist.size(), &btcpub_secp, masterOnlineKey.begin(), &tweakSum[0], whitelistindex) != 1) {
58815881
throw JSONRPCError(RPC_WALLET_ERROR, "Pegout authorization proof signing failed");
58825882
}
58835883

@@ -6991,7 +6991,7 @@ static RPCHelpMan generatepegoutproof()
69916991

69926992
//Create, verify whitelist proof
69936993
secp256k1_whitelist_signature sig;
6994-
if(secp256k1_whitelist_sign(secp256k1_ctx, &sig, &paklist.OnlineKeys()[0], &paklist.OfflineKeys()[0], paklist.size(), &btcpubkey, masterOnlineKey.begin(), &sumprivkeybytes[0], whitelistindex, NULL, NULL) != 1)
6994+
if(secp256k1_whitelist_sign(secp256k1_ctx, &sig, &paklist.OnlineKeys()[0], &paklist.OfflineKeys()[0], paklist.size(), &btcpubkey, masterOnlineKey.begin(), &sumprivkeybytes[0], whitelistindex) != 1)
69956995
throw JSONRPCError(RPC_WALLET_ERROR, "Pegout authorization proof signing failed");
69966996

69976997
if (secp256k1_whitelist_verify(secp256k1_ctx, &sig, &paklist.OnlineKeys()[0], &paklist.OfflineKeys()[0], paklist.size(), &btcpubkey) != 1)
@@ -7072,7 +7072,7 @@ static RPCHelpMan getpegoutkeys()
70727072
std::vector<unsigned char> pegoutkeybytes(pegoutkey.begin(), pegoutkey.end());
70737073
std::vector<unsigned char> pegoutsubkeybytes(bitcoinkey.begin(), bitcoinkey.end());
70747074

7075-
if (!secp256k1_ec_privkey_tweak_add(secp256k1_ctx, &pegoutkeybytes[0], &pegoutsubkeybytes[0]))
7075+
if (!secp256k1_ec_seckey_tweak_add(secp256k1_ctx, &pegoutkeybytes[0], &pegoutsubkeybytes[0]))
70767076
throw JSONRPCError(RPC_WALLET_ERROR, "Summed key invalid");
70777077

70787078
CKey sumseckey;

0 commit comments

Comments
 (0)