1
0
Fork 0
mirror of https://github.com/eosswedenorg/libantelope synced 2026-06-16 03:34:56 +02:00

src/openssl/ec.cpp: simplify EC_POINT_point2oct() with a macro.

This commit is contained in:
Henrik Hautakoski 2023-03-22 13:59:14 +01:00
parent fe873c1df8
commit 7ead6f6bde

View file

@ -28,6 +28,9 @@
namespace libeosio {
#define EC_POINT_encode(group, point, buf, len, ctx) \
EC_POINT_point2oct((group), (point), POINT_CONVERSION_COMPRESSED, (buf), (len), (ctx))
BN_CTX *ctx = NULL;
EC_KEY *k = NULL;
@ -100,8 +103,7 @@ int calculate_pubkey(EC_KEY *ec_key, ec_pubkey_t *pub) {
rc = EC_POINT_mul(group, point, pk, NULL, NULL, ctx);
if (rc != 0) {
// Encode public key
rc = EC_POINT_point2oct(group, point, POINT_CONVERSION_COMPRESSED,
pub->data(), EC_PUBKEY_SIZE, ctx);
rc = EC_POINT_encode(group, point, pub->data(), EC_PUBKEY_SIZE, ctx);
}
EC_POINT_free(point);