Skip to content

Commit 37d2c60

Browse files
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 #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 #1089, commit fc94a2d), so it should be fine to just remove them by now. Co-authored-by: Tim Ruffing <[email protected]>
1 parent 1b1fc09 commit 37d2c60

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+
- Removed previously deprecated function aliases `secp256k1_ec_privkey_negate`, `secp256k1_ec_privkey_tweak_add` and
12+
`secp256k1_ec_privkey_tweak_mul`. Use `secp256k1_ec_seckey_negate`, `secp256k1_ec_seckey_tweak_add` and
13+
`secp256k1_ec_seckey_tweak_mul` instead.
14+
1015
## [0.6.0] - 2024-11-04
1116

1217
#### Added

include/secp256k1.h

-26
Original file line numberDiff line numberDiff line change
@@ -701,14 +701,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_negate(
701701
unsigned char *seckey
702702
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2);
703703

704-
/** Same as secp256k1_ec_seckey_negate, but DEPRECATED. Will be removed in
705-
* future versions. */
706-
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_negate(
707-
const secp256k1_context *ctx,
708-
unsigned char *seckey
709-
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
710-
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_negate instead");
711-
712704
/** Negates a public key in place.
713705
*
714706
* Returns: 1 always
@@ -741,15 +733,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_tweak_add(
741733
const unsigned char *tweak32
742734
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
743735

744-
/** Same as secp256k1_ec_seckey_tweak_add, but DEPRECATED. Will be removed in
745-
* future versions. */
746-
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add(
747-
const secp256k1_context *ctx,
748-
unsigned char *seckey,
749-
const unsigned char *tweak32
750-
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
751-
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_tweak_add instead");
752-
753736
/** Tweak a public key by adding tweak times the generator to it.
754737
*
755738
* 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(
788771
const unsigned char *tweak32
789772
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
790773

791-
/** Same as secp256k1_ec_seckey_tweak_mul, but DEPRECATED. Will be removed in
792-
* future versions. */
793-
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul(
794-
const secp256k1_context *ctx,
795-
unsigned char *seckey,
796-
const unsigned char *tweak32
797-
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
798-
SECP256K1_DEPRECATED("Use secp256k1_ec_seckey_tweak_mul instead");
799-
800774
/** Tweak a public key by multiplying it by a tweak value.
801775
*
802776
* Returns: 0 if the arguments are invalid. 1 otherwise.

src/secp256k1.c

-12
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,6 @@ int secp256k1_ec_seckey_negate(const secp256k1_context* ctx, unsigned char *seck
634634
return ret;
635635
}
636636

637-
int secp256k1_ec_privkey_negate(const secp256k1_context* ctx, unsigned char *seckey) {
638-
return secp256k1_ec_seckey_negate(ctx, seckey);
639-
}
640-
641637
int secp256k1_ec_pubkey_negate(const secp256k1_context* ctx, secp256k1_pubkey *pubkey) {
642638
int ret = 0;
643639
secp256k1_ge p;
@@ -681,10 +677,6 @@ int secp256k1_ec_seckey_tweak_add(const secp256k1_context* ctx, unsigned char *s
681677
return ret;
682678
}
683679

684-
int secp256k1_ec_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
685-
return secp256k1_ec_seckey_tweak_add(ctx, seckey, tweak32);
686-
}
687-
688680
static int secp256k1_ec_pubkey_tweak_add_helper(secp256k1_ge *p, const unsigned char *tweak32) {
689681
secp256k1_scalar term;
690682
int overflow = 0;
@@ -729,10 +721,6 @@ int secp256k1_ec_seckey_tweak_mul(const secp256k1_context* ctx, unsigned char *s
729721
return ret;
730722
}
731723

732-
int secp256k1_ec_privkey_tweak_mul(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak32) {
733-
return secp256k1_ec_seckey_tweak_mul(ctx, seckey, tweak32);
734-
}
735-
736724
int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak32) {
737725
secp256k1_ge p;
738726
secp256k1_scalar factor;

src/tests.c

-19
Original file line numberDiff line numberDiff line change
@@ -6248,11 +6248,6 @@ static void run_eckey_negate_test(void) {
62486248
CHECK(secp256k1_ec_seckey_negate(CTX, seckey) == 1);
62496249
CHECK(secp256k1_memcmp_var(seckey, seckey_tmp, 32) == 0);
62506250

6251-
/* Check that privkey alias gives same result */
6252-
CHECK(secp256k1_ec_seckey_negate(CTX, seckey) == 1);
6253-
CHECK(secp256k1_ec_privkey_negate(CTX, seckey_tmp) == 1);
6254-
CHECK(secp256k1_memcmp_var(seckey, seckey_tmp, 32) == 0);
6255-
62566251
/* Negating all 0s fails */
62576252
memset(seckey, 0, 32);
62586253
memset(seckey_tmp, 0, 32);
@@ -6413,22 +6408,15 @@ static void test_ecdsa_end_to_end(void) {
64136408
if (testrand_int(3) == 0) {
64146409
int ret1;
64156410
int ret2;
6416-
int ret3;
64176411
unsigned char rnd[32];
6418-
unsigned char privkey_tmp[32];
64196412
secp256k1_pubkey pubkey2;
64206413
testrand256_test(rnd);
6421-
memcpy(privkey_tmp, privkey, 32);
64226414
ret1 = secp256k1_ec_seckey_tweak_add(CTX, privkey, rnd);
64236415
ret2 = secp256k1_ec_pubkey_tweak_add(CTX, &pubkey, rnd);
6424-
/* Check that privkey alias gives same result */
6425-
ret3 = secp256k1_ec_privkey_tweak_add(CTX, privkey_tmp, rnd);
64266416
CHECK(ret1 == ret2);
6427-
CHECK(ret2 == ret3);
64286417
if (ret1 == 0) {
64296418
return;
64306419
}
6431-
CHECK(secp256k1_memcmp_var(privkey, privkey_tmp, 32) == 0);
64326420
CHECK(secp256k1_ec_pubkey_create(CTX, &pubkey2, privkey) == 1);
64336421
CHECK(secp256k1_memcmp_var(&pubkey, &pubkey2, sizeof(pubkey)) == 0);
64346422
}
@@ -6437,22 +6425,15 @@ static void test_ecdsa_end_to_end(void) {
64376425
if (testrand_int(3) == 0) {
64386426
int ret1;
64396427
int ret2;
6440-
int ret3;
64416428
unsigned char rnd[32];
6442-
unsigned char privkey_tmp[32];
64436429
secp256k1_pubkey pubkey2;
64446430
testrand256_test(rnd);
6445-
memcpy(privkey_tmp, privkey, 32);
64466431
ret1 = secp256k1_ec_seckey_tweak_mul(CTX, privkey, rnd);
64476432
ret2 = secp256k1_ec_pubkey_tweak_mul(CTX, &pubkey, rnd);
6448-
/* Check that privkey alias gives same result */
6449-
ret3 = secp256k1_ec_privkey_tweak_mul(CTX, privkey_tmp, rnd);
64506433
CHECK(ret1 == ret2);
6451-
CHECK(ret2 == ret3);
64526434
if (ret1 == 0) {
64536435
return;
64546436
}
6455-
CHECK(secp256k1_memcmp_var(privkey, privkey_tmp, 32) == 0);
64566437
CHECK(secp256k1_ec_pubkey_create(CTX, &pubkey2, privkey) == 1);
64576438
CHECK(secp256k1_memcmp_var(&pubkey, &pubkey2, sizeof(pubkey)) == 0);
64586439
}

0 commit comments

Comments
 (0)