]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
BoringSSL: Use EC_KEY_new_by_curve_name() to simplify implementation
authorJouni Malinen <j@w1.fi>
Sun, 10 Dec 2017 21:41:29 +0000 (23:41 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 10 Dec 2017 21:41:29 +0000 (23:41 +0200)
There is no need to go through EC_GROUP_new_by_curve_name(),
EC_KEY_new(), and EC_KEY_set_group() when a single call to
EC_KEY_new_by_curve_name() takes care of all that.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/common/dpp.c
src/crypto/crypto_openssl.c

index 17ef2168b914f4d3436b2b280ed7aec7c7f61055..b7475af58c677d75735e31d7217ce65901113971 100644 (file)
@@ -1068,7 +1068,6 @@ static EVP_PKEY * dpp_gen_keypair(const struct dpp_curve_params *curve)
 {
 #ifdef OPENSSL_IS_BORINGSSL
        EVP_PKEY_CTX *kctx = NULL;
-       const EC_GROUP *group;
        EC_KEY *ec_params;
 #else
        EVP_PKEY_CTX *pctx, *kctx = NULL;
@@ -1084,9 +1083,8 @@ static EVP_PKEY * dpp_gen_keypair(const struct dpp_curve_params *curve)
                return NULL;
        }
 #ifdef OPENSSL_IS_BORINGSSL
-       group = EC_GROUP_new_by_curve_name(nid);
-       ec_params = EC_KEY_new();
-       if (!ec_params || EC_KEY_set_group(ec_params, group) != 1) {
+       ec_params = EC_KEY_new_by_curve_name(nid);
+       if (!ec_params) {
                wpa_printf(MSG_ERROR,
                           "DPP: Failed to generate EC_KEY parameters");
                goto fail;
index 193b5f084f762efae6f53572d3260ad4eba8b19f..616968f4c26a677e423d4fc63fe2411cc0cb1384 100644 (file)
@@ -1706,7 +1706,6 @@ struct crypto_ecdh * crypto_ecdh_init(int group)
        struct crypto_ecdh *ecdh;
        EVP_PKEY *params = NULL;
 #ifdef OPENSSL_IS_BORINGSSL
-       const EC_GROUP *ec_group;
        EC_KEY *ec_params;
 #else /* OPENSSL_IS_BORINGSSL */
        EVP_PKEY_CTX *pctx = NULL;
@@ -1722,9 +1721,8 @@ struct crypto_ecdh * crypto_ecdh_init(int group)
                goto fail;
 
 #ifdef OPENSSL_IS_BORINGSSL
-       ec_group = EC_GROUP_new_by_curve_name(ecdh->ec->nid);
-       ec_params = EC_KEY_new();
-       if (!ec_params || EC_KEY_set_group(ec_params, ec_group) != 1) {
+       ec_params = EC_KEY_new_by_curve_name(ecdh->ec->nid);
+       if (!ec_params) {
                wpa_printf(MSG_ERROR,
                           "BoringSSL: Failed to generate EC_KEY parameters");
                goto fail;