]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Use crypto_ec_key_get_subject_public_key() when possible
authorCedric Izoard <cedric.izoard@laposte.net>
Mon, 28 Jun 2021 16:25:25 +0000 (18:25 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 27 Oct 2021 21:45:07 +0000 (00:45 +0300)
Keep the locally defined ASN.1 sequence DPP_BOOTSTRAPPING_KEY for now to
avoid losing a workaround for BoringSSL from commit 746c1792ac28 ("DPP:
Build bootstrapping key DER encoding using custom routine").

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
src/common/dpp.c

index e4a00aef4e5ac250d7dc6ecf92d3544a119c0375..63189c1697e95ecc86f165ff38185a0e597a0818 100644 (file)
@@ -2398,30 +2398,28 @@ fail:
 static void dpp_copy_csign(struct dpp_config_obj *conf,
                           struct crypto_ec_key *csign)
 {
-       unsigned char *der = NULL;
-       int der_len;
+       struct wpabuf *c_sign_key;
 
-       der_len = i2d_PUBKEY((EVP_PKEY *) csign, &der);
-       if (der_len <= 0)
+       c_sign_key = crypto_ec_key_get_subject_public_key(csign);
+       if (!c_sign_key)
                return;
+
        wpabuf_free(conf->c_sign_key);
-       conf->c_sign_key = wpabuf_alloc_copy(der, der_len);
-       OPENSSL_free(der);
+       conf->c_sign_key = c_sign_key;
 }
 
 
 static void dpp_copy_ppkey(struct dpp_config_obj *conf,
                           struct crypto_ec_key *ppkey)
 {
-       unsigned char *der = NULL;
-       int der_len;
+       struct wpabuf *pp_key;
 
-       der_len = i2d_PUBKEY((EVP_PKEY *) ppkey, &der);
-       if (der_len <= 0)
+       pp_key = crypto_ec_key_get_subject_public_key(ppkey);
+       if (!pp_key)
                return;
+
        wpabuf_free(conf->pp_key);
-       conf->pp_key = wpabuf_alloc_copy(der, der_len);
-       OPENSSL_free(der);
+       conf->pp_key = pp_key;
 }