Skip to content

Commit 5ce9b57

Browse files
committed
Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases
These function aliases have been described as DEPRECATED in the public API docs already many years ago (see bitcoin-core#701, commit 41fc785), and in addition explicit deprecation warnings are shown by the compiler at least since the first official release 0.2.0 (see PR bitcoin-core#1089, commit fc94a2d), so it should be fine to just remove them by now.
1 parent 1988855 commit 5ce9b57

File tree

4 files changed

+5
-57
lines changed

4 files changed

+5
-57
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
#### Removed
11+
- The previously deprecated function aliases `secp256k1_ec_privkey_negate`, `secp256k1_ec_privkey_tweak_add` and
12+
`secp256k1_ec_privkey_tweak_mul` were removed. The corresponding replacements `secp256k1_ec_seckey_negate`,
13+
`secp256k1_ec_seckey_tweak_add` and `secp256k1_ec_seckey_tweak_mul` have to be used instead.
14+
1015
## [0.5.1] - 2024-08-01
1116

1217
#### Added

include/secp256k1.h

-26
Original file line numberDiff line numberDiff line change
@@ -725,14 +725,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_negate(
725725
unsigned char *seckey
726726
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2);
727727

728-
/** Same as secp256k1_ec_seckey_negate, but DEPRECATED. Will be removed in
729-
* future versions. */
730-
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_negate(
731-
const secp256k1_context *ctx,
732-
unsigned char *seckey
733-
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
734-
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_negate instead");
735-
736728
/** Negates a public key in place.
737729
*
738730
* Returns: 1 always
@@ -765,15 +757,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_add(
765757
const unsigned char *tweak32
766758
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
767759

768-
/** Same as secp256k1_ec_seckey_tweak_add, but DEPRECATED. Will be removed in
769-
* future versions. */
770-
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add(
771-
const secp256k1_context *ctx,
772-
unsigned char *seckey,
773-
const unsigned char *tweak32
774-
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
775-
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_tweak_add instead");
776-
777760
/** Tweak a public key by adding tweak times the generator to it.
778761
*
779762
* Returns: 0 if the arguments are invalid or the resulting public key would be
@@ -812,15 +795,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_mul(
812795
const unsigned char *tweak32
813796
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
814797

815-
/** Same as secp256k1_ec_seckey_tweak_mul, but DEPRECATED. Will be removed in
816-
* future versions. */
817-
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul(
818-
const secp256k1_context *ctx,
819-
unsigned char *seckey,
820-
const unsigned char *tweak32
821-
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
822-
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_tweak_mul instead");
823-
824798
/** Tweak a public key by multiplying it by a tweak value.
825799
*
826800
* Returns: 0 if the arguments are invalid. 1 otherwise.

src/secp256k1.c

-12
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,6 @@ int secp256k1_ec_seckey_negate(const secp256k1_context* ctx, unsigned char *seck
643643
return ret;
644644
}
645645

646-
int secp256k1_ec_privkey_negate(const secp256k1_context* ctx, unsigned char *seckey) {
647-
return secp256k1_ec_seckey_negate(ctx, seckey);
648-
}
649-
650646
int secp256k1_ec_pubkey_negate(const secp256k1_context* ctx, secp256k1_pubkey *pubkey) {
651647
int ret = 0;
652648
secp256k1_ge p;
@@ -690,10 +686,6 @@ int secp256k1_ec_seckey_tweak_add(const secp256k1_context* ctx, unsigned char *s
690686
return ret;
691687
}
692688

693-
int secp256k1_ec_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
694-
return secp256k1_ec_seckey_tweak_add(ctx, seckey, tweak32);
695-
}
696-
697689
static int secp256k1_ec_pubkey_tweak_add_helper(secp256k1_ge *p, const unsigned char *tweak32) {
698690
secp256k1_scalar term;
699691
int overflow = 0;
@@ -738,10 +730,6 @@ int secp256k1_ec_seckey_tweak_mul(const secp256k1_context* ctx, unsigned char *s
738730
return ret;
739731
}
740732

741-
int secp256k1_ec_privkey_tweak_mul(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
742-
return secp256k1_ec_seckey_tweak_mul(ctx, seckey, tweak32);
743-
}
744-
745733
int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak32) {
746734
secp256k1_ge p;
747735
secp256k1_scalar factor;

src/tests.c

-19
Original file line numberDiff line numberDiff line change
@@ -6220,11 +6220,6 @@ static void run_eckey_negate_test(void) {
62206220
CHECK(secp256k1_ec_seckey_negate(CTX, seckey) == 1);
62216221
CHECK(secp256k1_memcmp_var(seckey, seckey_tmp, 32) == 0);
62226222

6223-
/* Check that privkey alias gives same result */
6224-
CHECK(secp256k1_ec_seckey_negate(CTX, seckey) == 1);
6225-
CHECK(secp256k1_ec_privkey_negate(CTX, seckey_tmp) == 1);
6226-
CHECK(secp256k1_memcmp_var(seckey, seckey_tmp, 32) == 0);
6227-
62286223
/* Negating all 0s fails */
62296224
memset(seckey, 0, 32);
62306225
memset(seckey_tmp, 0, 32);
@@ -6385,22 +6380,15 @@ static void test_ecdsa_end_to_end(void) {
63856380
if (testrand_int(3) == 0) {
63866381
int ret1;
63876382
int ret2;
6388-
int ret3;
63896383
unsigned char rnd[32];
6390-
unsigned char privkey_tmp[32];
63916384
secp256k1_pubkey pubkey2;
63926385
testrand256_test(rnd);
6393-
memcpy(privkey_tmp, privkey, 32);
63946386
ret1 = secp256k1_ec_seckey_tweak_add(CTX, privkey, rnd);
63956387
ret2 = secp256k1_ec_pubkey_tweak_add(CTX, &pubkey, rnd);
6396-
/* Check that privkey alias gives same result */
6397-
ret3 = secp256k1_ec_privkey_tweak_add(CTX, privkey_tmp, rnd);
63986388
CHECK(ret1 == ret2);
6399-
CHECK(ret2 == ret3);
64006389
if (ret1 == 0) {
64016390
return;
64026391
}
6403-
CHECK(secp256k1_memcmp_var(privkey, privkey_tmp, 32) == 0);
64046392
CHECK(secp256k1_ec_pubkey_create(CTX, &pubkey2, privkey) == 1);
64056393
CHECK(secp256k1_memcmp_var(&pubkey, &pubkey2, sizeof(pubkey)) == 0);
64066394
}
@@ -6409,22 +6397,15 @@ static void test_ecdsa_end_to_end(void) {
64096397
if (testrand_int(3) == 0) {
64106398
int ret1;
64116399
int ret2;
6412-
int ret3;
64136400
unsigned char rnd[32];
6414-
unsigned char privkey_tmp[32];
64156401
secp256k1_pubkey pubkey2;
64166402
testrand256_test(rnd);
6417-
memcpy(privkey_tmp, privkey, 32);
64186403
ret1 = secp256k1_ec_seckey_tweak_mul(CTX, privkey, rnd);
64196404
ret2 = secp256k1_ec_pubkey_tweak_mul(CTX, &pubkey, rnd);
6420-
/* Check that privkey alias gives same result */
6421-
ret3 = secp256k1_ec_privkey_tweak_mul(CTX, privkey_tmp, rnd);
64226405
CHECK(ret1 == ret2);
6423-
CHECK(ret2 == ret3);
64246406
if (ret1 == 0) {
64256407
return;
64266408
}
6427-
CHECK(secp256k1_memcmp_var(privkey, privkey_tmp, 32) == 0);
64286409
CHECK(secp256k1_ec_pubkey_create(CTX, &pubkey2, privkey) == 1);
64296410
CHECK(secp256k1_memcmp_var(&pubkey, &pubkey2, sizeof(pubkey)) == 0);
64306411
}

0 commit comments

Comments
 (0)