---
 .../wpa-supplicant/crypto_openssl.patch       | 127 ++++++++++++++++++
 1 file changed, 127 insertions(+)
 create mode 100644 
meta-arago-extras/recipes-connectivity/wpa-supplicant/wpa-supplicant/crypto_openssl.patch

diff --git 
a/meta-arago-extras/recipes-connectivity/wpa-supplicant/wpa-supplicant/crypto_openssl.patch
 
b/meta-arago-extras/recipes-connectivity/wpa-supplicant/wpa-supplicant/crypto_openssl.patch
new file mode 100644
index 00000000..650f5c19
--- /dev/null
+++ 
b/meta-arago-extras/recipes-connectivity/wpa-supplicant/wpa-supplicant/crypto_openssl.patch
@@ -0,0 +1,127 @@
+--- a/src/crypto/crypto_openssl.c      2019-11-09 06:46:42.112779317 -0600
++++ b/src/crypto/crypto_openssl.c.new  2019-11-09 13:16:57.560629882 -0600
+@@ -602,11 +602,15 @@
+ 
+ void * dh5_init(struct wpabuf **priv, struct wpabuf **publ)
+ {
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
++      (defined(LIBRESSL_VERSION_NUMBER) && \
++       LIBRESSL_VERSION_NUMBER < 0x20700000L)
+       DH *dh;
+       struct wpabuf *pubkey = NULL, *privkey = NULL;
+       size_t publen, privlen;
+ 
+       *priv = NULL;
++      wpabuf_free(*publ);
+       *publ = NULL;
+ 
+       dh = DH_new();
+@@ -645,11 +649,65 @@
+       wpabuf_clear_free(privkey);
+       DH_free(dh);
+       return NULL;
++#else
++      DH *dh;
++      struct wpabuf *pubkey = NULL, *privkey = NULL;
++      size_t publen, privlen;
++      BIGNUM *p = NULL, *g;
++      const BIGNUM *priv_key = NULL, *pub_key = NULL;
++
++      *priv = NULL;
++      wpabuf_free(*publ);
++      *publ = NULL;
++
++      dh = DH_new();
++      if (dh == NULL)
++              return NULL;
++
++      g = BN_new();
++      p = get_group5_prime();
++      if (!g || BN_set_word(g, 2) != 1 || !p ||
++          DH_set0_pqg(dh, p, NULL, g) != 1)
++              goto err;
++      p = NULL;
++      g = NULL;
++
++      if (DH_generate_key(dh) != 1)
++              goto err;
++
++      DH_get0_key(dh, &pub_key, &priv_key);
++      publen = BN_num_bytes(pub_key);
++      pubkey = wpabuf_alloc(publen);
++      if (!pubkey)
++              goto err;
++      privlen = BN_num_bytes(priv_key);
++      privkey = wpabuf_alloc(privlen);
++      if (!privkey)
++              goto err;
++
++      BN_bn2bin(pub_key, wpabuf_put(pubkey, publen));
++      BN_bn2bin(priv_key, wpabuf_put(privkey, privlen));
++
++      *priv = privkey;
++      *publ = pubkey;
++      return dh;
++
++err:
++      BN_free(p);
++      BN_free(g);
++      wpabuf_clear_free(pubkey);
++      wpabuf_clear_free(privkey);
++      DH_free(dh);
++      return NULL;
++#endif
+ }
+ 
+ 
+ void * dh5_init_fixed(const struct wpabuf *priv, const struct wpabuf *publ)
+ {
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
++      (defined(LIBRESSL_VERSION_NUMBER) && \
++       LIBRESSL_VERSION_NUMBER < 0x20700000L)
+       DH *dh;
+ 
+       dh = DH_new();
+@@ -680,6 +738,42 @@
+ err:
+       DH_free(dh);
+       return NULL;
++#else
++      DH *dh;
++      BIGNUM *p = NULL, *g, *priv_key = NULL, *pub_key = NULL;
++
++      dh = DH_new();
++      if (dh == NULL)
++              return NULL;
++
++      g = BN_new();
++      p = get_group5_prime();
++      if (!g || BN_set_word(g, 2) != 1 || !p ||
++          DH_set0_pqg(dh, p, NULL, g) != 1)
++              goto err;
++      p = NULL;
++      g = NULL;
++
++      priv_key = BN_bin2bn(wpabuf_head(priv), wpabuf_len(priv), NULL);
++      pub_key = BN_bin2bn(wpabuf_head(publ), wpabuf_len(publ), NULL);
++      if (!priv_key || !pub_key || DH_set0_key(dh, pub_key, priv_key) != 1)
++              goto err;
++      pub_key = NULL;
++      priv_key = NULL;
++
++      if (DH_generate_key(dh) != 1)
++              goto err;
++
++      return dh;
++
++err:
++      BN_free(p);
++      BN_free(g);
++      BN_free(pub_key);
++      BN_clear_free(priv_key);
++      DH_free(dh);
++      return NULL;
++#endif
+ }
+ 
+ 
-- 
2.17.1

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago

Reply via email to