diff mbox

[RFC,2/3] driver_nl80211: support passing PSK on connect

Message ID 1488792862-23326-3-git-send-email-andrei.otcheretianski@intel.com
State RFC
Headers show

Commit Message

Andrei Otcheretianski March 6, 2017, 9:34 a.m. UTC
From: Eliad Peller <eliad@wizery.com>

If the driver advertises WPA_DRIVER_FLAGS_4WAY_HANDSHAKE
support, pass the psk on connect.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
---
 src/drivers/driver_nl80211.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index e9107b3..9603397 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5213,6 +5213,15 @@  static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
 			return -1;
 	}
 
+	/* add psk in case of 4way handshake offload */
+	if (params->psk &&
+	    (drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE)) {
+		wpa_printf(MSG_DEBUG, "Adding psk (len=32)");
+		wpa_hexdump_key(MSG_DEBUG, "PSK", params->psk, 32);
+		if (nla_put(msg, NL80211_ATTR_PMK, 32, params->psk))
+			return -1;
+	}
+
 	if (nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT))
 		return -1;