From 63bf3d25ab0d0aff9a352f566e142f3942715393 Mon Sep 17 00:00:00 2001 From: Cedric Izoard Date: Mon, 28 Jun 2021 18:25:21 +0200 Subject: [PATCH] OpenSSL: Mark crypto_ec_key_gen() key compressed Signed-off-by: Cedric Izoard --- src/crypto/crypto_openssl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c index 9ba7fc50c..dd70ffc9a 100644 --- a/src/crypto/crypto_openssl.c +++ b/src/crypto/crypto_openssl.c @@ -2245,7 +2245,7 @@ fail: struct crypto_ec_key * crypto_ec_key_gen(int group) { EVP_PKEY_CTX *kctx = NULL; - EC_KEY *ec_params = NULL; + EC_KEY *ec_params = NULL, *eckey; EVP_PKEY *params = NULL, *key = NULL; int nid; @@ -2278,6 +2278,13 @@ struct crypto_ec_key * crypto_ec_key_gen(int group) goto fail; } + eckey = EVP_PKEY_get0_EC_KEY(key); + if (!eckey) { + key = NULL; + goto fail; + } + EC_KEY_set_conv_form(eckey, POINT_CONVERSION_COMPRESSED); + fail: EC_KEY_free(ec_params); EVP_PKEY_free(params);