Skip to content

Commit adb76f8

Browse files
committed
use new _eckey_pubkey_serialize{33,65} functions in public API
1 parent fc7458c commit adb76f8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/secp256k1.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,14 @@ int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *o
280280
ARG_CHECK(pubkey != NULL);
281281
ARG_CHECK((flags & SECP256K1_FLAGS_TYPE_MASK) == SECP256K1_FLAGS_TYPE_COMPRESSION);
282282
if (secp256k1_pubkey_load(ctx, &Q, pubkey)) {
283-
ret = secp256k1_eckey_pubkey_serialize(&Q, output, &len, !!(flags & SECP256K1_FLAGS_BIT_COMPRESSION));
284-
if (ret) {
285-
*outputlen = len;
283+
if (flags & SECP256K1_FLAGS_BIT_COMPRESSION) {
284+
secp256k1_eckey_pubkey_serialize33(&Q, output);
285+
*outputlen = 33;
286+
} else {
287+
secp256k1_eckey_pubkey_serialize65(&Q, output);
288+
*outputlen = 65;
286289
}
290+
ret = 1;
287291
}
288292
return ret;
289293
}

0 commit comments

Comments
 (0)