Skip to content

Commit dfce048

Browse files
committed
f remove xonly_pubkey_to_pubkey
1 parent 74bb3b4 commit dfce048

File tree

3 files changed

+1
-48
lines changed

3 files changed

+1
-48
lines changed

include/secp256k1.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -801,29 +801,6 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_xonly_pubkey_from_pubke
801801
const secp256k1_pubkey *pubkey
802802
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4);
803803

804-
/** Convert a secp256k1_xonly_pubkey into a secp256k1_pubkey. If this
805-
* function is used to invert secp256k1_xonly_pubkey_from_pubkey, the
806-
* sign bit must be set to the output of that function. If the sign bit
807-
* is 0 the output pubkey encodes a positive point (has a Y coordinate that is
808-
* square), otherwise it is negative.
809-
*
810-
* Returns: 1 if the public key was successfully converted
811-
* 0 otherwise
812-
*
813-
* Args: ctx: pointer to a context object
814-
* Out: pubkey: pointer to a public key object for placing the
815-
* converted public key (cannot be NULL)
816-
* In: xonly_pubkey: pointer to an x-only public key that is converted
817-
* (cannot be NULL)
818-
* sign: sign bit of the resulting public key (can be NULL)
819-
*/
820-
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_xonly_pubkey_to_pubkey(
821-
const secp256k1_context* ctx,
822-
secp256k1_pubkey *pubkey,
823-
const secp256k1_xonly_pubkey *xonly_pubkey,
824-
int sign
825-
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
826-
827804
/** Tweak the private key of an x-only pubkey by adding a tweak to it. The public
828805
* key of the resulting private key will be the same as the output of
829806
* secp256k1_xonly_pubkey_tweak_add called with the same tweak and corresponding

src/secp256k1.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -803,18 +803,6 @@ int secp256k1_xonly_pubkey_from_pubkey(const secp256k1_context* ctx, secp256k1_x
803803
return 1;
804804
}
805805

806-
int secp256k1_xonly_pubkey_to_pubkey(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const secp256k1_xonly_pubkey *xonly_pubkey, int sign) {
807-
VERIFY_CHECK(ctx != NULL);
808-
ARG_CHECK(pubkey != NULL);
809-
ARG_CHECK(xonly_pubkey != NULL);
810-
811-
*pubkey = *(const secp256k1_pubkey *) xonly_pubkey;
812-
if (sign) {
813-
return secp256k1_ec_pubkey_negate(ctx, pubkey);
814-
}
815-
return 1;
816-
}
817-
818806
int secp256k1_xonly_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *seckey32, const unsigned char *tweak32) {
819807
secp256k1_ge ge;
820808
secp256k1_pubkey pubkey;

src/tests.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,7 +4273,6 @@ void test_xonly_pubkey(void) {
42734273
unsigned char ones32[32];
42744274
unsigned char zeros64[64] = { 0 };
42754275
secp256k1_pubkey xy_pk;
4276-
secp256k1_pubkey xy_pk_tmp;
42774276
secp256k1_xonly_pubkey xonly_pk;
42784277
secp256k1_xonly_pubkey xonly_pk_tmp;
42794278
secp256k1_ge pk1;
@@ -4297,12 +4296,10 @@ void test_xonly_pubkey(void) {
42974296
secp256k1_fe_negate(&y, &pk2.y, 1);
42984297
CHECK(secp256k1_fe_equal(&pk1.y, &y) == 1);
42994298

4300-
/* Check from_pubkey and to_pubkey */
4299+
/* Test from_pubkey */
43014300
CHECK(secp256k1_xonly_pubkey_from_pubkey(ctx, &xonly_pk_tmp, &sign, &xy_pk) == 1);
43024301
CHECK(memcmp(&xonly_pk_tmp, &xonly_pk, sizeof(xonly_pk)) == 0);
43034302
CHECK(sign == 1);
4304-
CHECK(secp256k1_xonly_pubkey_to_pubkey(ctx, &xy_pk_tmp, &xonly_pk, sign) == 1);
4305-
CHECK(memcmp(&xy_pk_tmp, &xy_pk, sizeof(xy_pk)) == 0);
43064303

43074304
/* Serialization and parse roundtrip */
43084305
CHECK(secp256k1_xonly_pubkey_create(ctx, &xonly_pk, sk) == 1);
@@ -4421,15 +4418,6 @@ void test_xonly_pubkey_api(void) {
44214418
CHECK(secp256k1_xonly_pubkey_from_pubkey(none, &pk, &pk_is_positive, NULL) == 0);
44224419
CHECK(ecount == 2);
44234420

4424-
ecount = 0;
4425-
CHECK(secp256k1_xonly_pubkey_to_pubkey(none, &xy_pk, &pk, pk_is_positive) == 1);
4426-
CHECK(secp256k1_xonly_pubkey_to_pubkey(sign, &xy_pk, &pk, pk_is_positive) == 1);
4427-
CHECK(secp256k1_xonly_pubkey_to_pubkey(vrfy, &xy_pk, &pk, pk_is_positive) == 1);
4428-
CHECK(secp256k1_xonly_pubkey_to_pubkey(none, NULL, &pk, pk_is_positive) == 0);
4429-
CHECK(ecount == 1);
4430-
CHECK(secp256k1_xonly_pubkey_to_pubkey(none, &xy_pk, NULL, pk_is_positive) == 0);
4431-
CHECK(ecount == 2);
4432-
44334421
secp256k1_context_destroy(none);
44344422
secp256k1_context_destroy(sign);
44354423
secp256k1_context_destroy(vrfy);

0 commit comments

Comments
 (0)