Merge bitcoin-core/secp256k1#1593: Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases from API
37d2c60becRemove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases (Sebastian Falbesoner) Pull request description: ACKs for top commit: real-or-random: utACK37d2c60becsipa: utACK37d2c60becjonasnick: ACK37d2c60becTree-SHA512: 5d3c836c3c4d5cde143fe5b5235f9fc108174439b056f3418834f33d12ea28bdf09d11a81917d679b4b9a93da26304241c8fe389549e72796bbda116e9ff4945
This commit is contained in:
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
#### Removed
|
||||
- Removed previously deprecated function aliases `secp256k1_ec_privkey_negate`, `secp256k1_ec_privkey_tweak_add` and
|
||||
`secp256k1_ec_privkey_tweak_mul`. Use `secp256k1_ec_seckey_negate`, `secp256k1_ec_seckey_tweak_add` and
|
||||
`secp256k1_ec_seckey_tweak_mul` instead.
|
||||
|
||||
## [0.6.0] - 2024-11-04
|
||||
|
||||
#### Added
|
||||
|
||||
@@ -701,14 +701,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_negate(
|
||||
unsigned char *seckey
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2);
|
||||
|
||||
/** Same as secp256k1_ec_seckey_negate, but DEPRECATED. Will be removed in
|
||||
* future versions. */
|
||||
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_negate(
|
||||
const secp256k1_context *ctx,
|
||||
unsigned char *seckey
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
|
||||
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_negate instead");
|
||||
|
||||
/** Negates a public key in place.
|
||||
*
|
||||
* Returns: 1 always
|
||||
@@ -741,15 +733,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_add(
|
||||
const unsigned char *tweak32
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
|
||||
|
||||
/** Same as secp256k1_ec_seckey_tweak_add, but DEPRECATED. Will be removed in
|
||||
* future versions. */
|
||||
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add(
|
||||
const secp256k1_context *ctx,
|
||||
unsigned char *seckey,
|
||||
const unsigned char *tweak32
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
|
||||
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_tweak_add instead");
|
||||
|
||||
/** Tweak a public key by adding tweak times the generator to it.
|
||||
*
|
||||
* Returns: 0 if the arguments are invalid or the resulting public key would be
|
||||
@@ -788,15 +771,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_mul(
|
||||
const unsigned char *tweak32
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
|
||||
|
||||
/** Same as secp256k1_ec_seckey_tweak_mul, but DEPRECATED. Will be removed in
|
||||
* future versions. */
|
||||
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul(
|
||||
const secp256k1_context *ctx,
|
||||
unsigned char *seckey,
|
||||
const unsigned char *tweak32
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
|
||||
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_tweak_mul instead");
|
||||
|
||||
/** Tweak a public key by multiplying it by a tweak value.
|
||||
*
|
||||
* Returns: 0 if the arguments are invalid. 1 otherwise.
|
||||
|
||||
@@ -634,10 +634,6 @@ int secp256k1_ec_seckey_negate(const secp256k1_context* ctx, unsigned char *seck
|
||||
return ret;
|
||||
}
|
||||
|
||||
int secp256k1_ec_privkey_negate(const secp256k1_context* ctx, unsigned char *seckey) {
|
||||
return secp256k1_ec_seckey_negate(ctx, seckey);
|
||||
}
|
||||
|
||||
int secp256k1_ec_pubkey_negate(const secp256k1_context* ctx, secp256k1_pubkey *pubkey) {
|
||||
int ret = 0;
|
||||
secp256k1_ge p;
|
||||
@@ -681,10 +677,6 @@ int secp256k1_ec_seckey_tweak_add(const secp256k1_context* ctx, unsigned char *s
|
||||
return ret;
|
||||
}
|
||||
|
||||
int secp256k1_ec_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
|
||||
return secp256k1_ec_seckey_tweak_add(ctx, seckey, tweak32);
|
||||
}
|
||||
|
||||
static int secp256k1_ec_pubkey_tweak_add_helper(secp256k1_ge *p, const unsigned char *tweak32) {
|
||||
secp256k1_scalar term;
|
||||
int overflow = 0;
|
||||
@@ -729,10 +721,6 @@ int secp256k1_ec_seckey_tweak_mul(const secp256k1_context* ctx, unsigned char *s
|
||||
return ret;
|
||||
}
|
||||
|
||||
int secp256k1_ec_privkey_tweak_mul(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
|
||||
return secp256k1_ec_seckey_tweak_mul(ctx, seckey, tweak32);
|
||||
}
|
||||
|
||||
int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak32) {
|
||||
secp256k1_ge p;
|
||||
secp256k1_scalar factor;
|
||||
|
||||
19
src/tests.c
19
src/tests.c
@@ -6272,11 +6272,6 @@ static void run_eckey_negate_test(void) {
|
||||
CHECK(secp256k1_ec_seckey_negate(CTX, seckey) == 1);
|
||||
CHECK(secp256k1_memcmp_var(seckey, seckey_tmp, 32) == 0);
|
||||
|
||||
/* Check that privkey alias gives same result */
|
||||
CHECK(secp256k1_ec_seckey_negate(CTX, seckey) == 1);
|
||||
CHECK(secp256k1_ec_privkey_negate(CTX, seckey_tmp) == 1);
|
||||
CHECK(secp256k1_memcmp_var(seckey, seckey_tmp, 32) == 0);
|
||||
|
||||
/* Negating all 0s fails */
|
||||
memset(seckey, 0, 32);
|
||||
memset(seckey_tmp, 0, 32);
|
||||
@@ -6437,22 +6432,15 @@ static void test_ecdsa_end_to_end(void) {
|
||||
if (testrand_int(3) == 0) {
|
||||
int ret1;
|
||||
int ret2;
|
||||
int ret3;
|
||||
unsigned char rnd[32];
|
||||
unsigned char privkey_tmp[32];
|
||||
secp256k1_pubkey pubkey2;
|
||||
testrand256_test(rnd);
|
||||
memcpy(privkey_tmp, privkey, 32);
|
||||
ret1 = secp256k1_ec_seckey_tweak_add(CTX, privkey, rnd);
|
||||
ret2 = secp256k1_ec_pubkey_tweak_add(CTX, &pubkey, rnd);
|
||||
/* Check that privkey alias gives same result */
|
||||
ret3 = secp256k1_ec_privkey_tweak_add(CTX, privkey_tmp, rnd);
|
||||
CHECK(ret1 == ret2);
|
||||
CHECK(ret2 == ret3);
|
||||
if (ret1 == 0) {
|
||||
return;
|
||||
}
|
||||
CHECK(secp256k1_memcmp_var(privkey, privkey_tmp, 32) == 0);
|
||||
CHECK(secp256k1_ec_pubkey_create(CTX, &pubkey2, privkey) == 1);
|
||||
CHECK(secp256k1_memcmp_var(&pubkey, &pubkey2, sizeof(pubkey)) == 0);
|
||||
}
|
||||
@@ -6461,22 +6449,15 @@ static void test_ecdsa_end_to_end(void) {
|
||||
if (testrand_int(3) == 0) {
|
||||
int ret1;
|
||||
int ret2;
|
||||
int ret3;
|
||||
unsigned char rnd[32];
|
||||
unsigned char privkey_tmp[32];
|
||||
secp256k1_pubkey pubkey2;
|
||||
testrand256_test(rnd);
|
||||
memcpy(privkey_tmp, privkey, 32);
|
||||
ret1 = secp256k1_ec_seckey_tweak_mul(CTX, privkey, rnd);
|
||||
ret2 = secp256k1_ec_pubkey_tweak_mul(CTX, &pubkey, rnd);
|
||||
/* Check that privkey alias gives same result */
|
||||
ret3 = secp256k1_ec_privkey_tweak_mul(CTX, privkey_tmp, rnd);
|
||||
CHECK(ret1 == ret2);
|
||||
CHECK(ret2 == ret3);
|
||||
if (ret1 == 0) {
|
||||
return;
|
||||
}
|
||||
CHECK(secp256k1_memcmp_var(privkey, privkey_tmp, 32) == 0);
|
||||
CHECK(secp256k1_ec_pubkey_create(CTX, &pubkey2, privkey) == 1);
|
||||
CHECK(secp256k1_memcmp_var(&pubkey, &pubkey2, sizeof(pubkey)) == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user