Skip to content

Commit 13ed6f6

Browse files
committed
Merge #1593: Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases from API
37d2c60 Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases (Sebastian Falbesoner) Pull request description: ACKs for top commit: real-or-random: utACK 37d2c60 sipa: utACK 37d2c60 jonasnick: ACK 37d2c60 Tree-SHA512: 5d3c836c3c4d5cde143fe5b5235f9fc108174439b056f3418834f33d12ea28bdf09d11a81917d679b4b9a93da26304241c8fe389549e72796bbda116e9ff4945
2 parents 03bbe8c + 37d2c60 commit 13ed6f6

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
@@ -6272,11 +6272,6 @@ static void run_eckey_negate_test(void) {
62726272
CHECK(secp256k1_ec_seckey_negate(CTX, seckey) == 1);
62736273
CHECK(secp256k1_memcmp_var(seckey, seckey_tmp, 32) == 0);
62746274

6275-
/* Check that privkey alias gives same result */
6276-
CHECK(secp256k1_ec_seckey_negate(CTX, seckey) == 1);
6277-
CHECK(secp256k1_ec_privkey_negate(CTX, seckey_tmp) == 1);
6278-
CHECK(secp256k1_memcmp_var(seckey, seckey_tmp, 32) == 0);
6279-
62806275
/* Negating all 0s fails */
62816276
memset(seckey, 0, 32);
62826277
memset(seckey_tmp, 0, 32);
@@ -6437,22 +6432,15 @@ static void test_ecdsa_end_to_end(void) {
64376432
if (testrand_int(3) == 0) {
64386433
int ret1;
64396434
int ret2;
6440-
int ret3;
64416435
unsigned char rnd[32];
6442-
unsigned char privkey_tmp[32];
64436436
secp256k1_pubkey pubkey2;
64446437
testrand256_test(rnd);
6445-
memcpy(privkey_tmp, privkey, 32);
64466438
ret1 = secp256k1_ec_seckey_tweak_add(CTX, privkey, rnd);
64476439
ret2 = secp256k1_ec_pubkey_tweak_add(CTX, &pubkey, rnd);
6448-
/* Check that privkey alias gives same result */
6449-
ret3 = secp256k1_ec_privkey_tweak_add(CTX, privkey_tmp, rnd);
64506440
CHECK(ret1 == ret2);
6451-
CHECK(ret2 == ret3);
64526441
if (ret1 == 0) {
64536442
return;
64546443
}
6455-
CHECK(secp256k1_memcmp_var(privkey, privkey_tmp, 32) == 0);
64566444
CHECK(secp256k1_ec_pubkey_create(CTX, &pubkey2, privkey) == 1);
64576445
CHECK(secp256k1_memcmp_var(&pubkey, &pubkey2, sizeof(pubkey)) == 0);
64586446
}
@@ -6461,22 +6449,15 @@ static void test_ecdsa_end_to_end(void) {
64616449
if (testrand_int(3) == 0) {
64626450
int ret1;
64636451
int ret2;
6464-
int ret3;
64656452
unsigned char rnd[32];
6466-
unsigned char privkey_tmp[32];
64676453
secp256k1_pubkey pubkey2;
64686454
testrand256_test(rnd);
6469-
memcpy(privkey_tmp, privkey, 32);
64706455
ret1 = secp256k1_ec_seckey_tweak_mul(CTX, privkey, rnd);
64716456
ret2 = secp256k1_ec_pubkey_tweak_mul(CTX, &pubkey, rnd);
6472-
/* Check that privkey alias gives same result */
6473-
ret3 = secp256k1_ec_privkey_tweak_mul(CTX, privkey_tmp, rnd);
64746457
CHECK(ret1 == ret2);
6475-
CHECK(ret2 == ret3);
64766458
if (ret1 == 0) {
64776459
return;
64786460
}
6479-
CHECK(secp256k1_memcmp_var(privkey, privkey_tmp, 32) == 0);
64806461
CHECK(secp256k1_ec_pubkey_create(CTX, &pubkey2, privkey) == 1);
64816462
CHECK(secp256k1_memcmp_var(&pubkey, &pubkey2, sizeof(pubkey)) == 0);
64826463
}

0 commit comments

Comments
 (0)