mirror of
https://github.com/eosswedenorg/libantelope
synced 2026-07-04 07:23:39 +02:00
src/openssl/ec.cpp: simplify EC_POINT_point2oct() with a macro.
This commit is contained in:
parent
fe873c1df8
commit
7ead6f6bde
1 changed files with 4 additions and 2 deletions
|
|
@ -28,6 +28,9 @@
|
||||||
|
|
||||||
namespace libeosio {
|
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;
|
BN_CTX *ctx = NULL;
|
||||||
EC_KEY *k = 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);
|
rc = EC_POINT_mul(group, point, pk, NULL, NULL, ctx);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
// Encode public key
|
// Encode public key
|
||||||
rc = EC_POINT_point2oct(group, point, POINT_CONVERSION_COMPRESSED,
|
rc = EC_POINT_encode(group, point, pub->data(), EC_PUBKEY_SIZE, ctx);
|
||||||
pub->data(), EC_PUBKEY_SIZE, ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EC_POINT_free(point);
|
EC_POINT_free(point);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue