[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]
[Description]
Refactor and sync kernel/wifi from Openwrt
[Release-log]
N/A
diff --git a/recipes-wifi/hostapd/files/patches/160-dpp_pkex-EC-point-mul-w-value-prime.patch b/recipes-wifi/hostapd/files/patches/160-dpp_pkex-EC-point-mul-w-value-prime.patch
new file mode 100644
index 0000000..56ae8d0
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches/160-dpp_pkex-EC-point-mul-w-value-prime.patch
@@ -0,0 +1,26 @@
+From 54211caa2e0e5163aefef390daf88a971367a702 Mon Sep 17 00:00:00 2001
+From: Glenn Strauss <gstrauss@gluelogic.com>
+Date: Tue, 4 Oct 2022 17:09:24 -0400
+Subject: [PATCH 6/7] dpp_pkex: EC point mul w/ value < prime
+
+crypto_ec_point_mul() with mbedtls requires point
+be multiplied by a multiplicand with value < prime
+
+Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
+---
+ src/common/dpp_crypto.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/src/common/dpp_crypto.c
++++ b/src/common/dpp_crypto.c
+@@ -1567,7 +1567,9 @@ dpp_pkex_derive_Qr(const struct dpp_curv
+ Pr = crypto_ec_key_get_public_key(Pr_key);
+ Qr = crypto_ec_point_init(ec);
+ hash_bn = crypto_bignum_init_set(hash, curve->hash_len);
+- if (!Pr || !Qr || !hash_bn || crypto_ec_point_mul(ec, Pr, hash_bn, Qr))
++ if (!Pr || !Qr || !hash_bn ||
++ crypto_bignum_mod(hash_bn, crypto_ec_get_prime(ec), hash_bn) ||
++ crypto_ec_point_mul(ec, Pr, hash_bn, Qr))
+ goto fail;
+
+ if (crypto_ec_point_is_at_infinity(ec, Qr)) {