From 730c5a1d098dbdb5edb6c5a7ed5e6ba84503e94c Mon Sep 17 00:00:00 2001 From: Eliad Peller Date: Sun, 28 Jan 2018 14:45:32 +0200 Subject: [PATCH] nl80211: Support passing PSK on connect If the driver advertises WPA_DRIVER_FLAGS_4WAY_HANDSHAKE support, pass the PSK on connect. Signed-off-by: Eliad Peller --- src/drivers/driver_nl80211.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index dfa11834c..50c472de7 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -5347,6 +5347,14 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv, return -1; } + /* Add PSK in case of 4-way handshake offload */ + if (params->psk && + (drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE)) { + 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;