aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2017-09-15 14:54:31 (GMT)
committerJouni Malinen <j@w1.fi>2017-09-15 14:54:31 (GMT)
commit5030d7d9fde000d29d204d8c57153dc46827baca (patch)
treeeae05736dba597443efaec54edd52d20e0fcbba3 /wpa_supplicant
parent039ab15fdf4a3d1c0d72798c3d21f46d4d30fe5c (diff)
downloadhostap-5030d7d9fde000d29d204d8c57153dc46827baca.zip
hostap-5030d7d9fde000d29d204d8c57153dc46827baca.tar.gz
hostap-5030d7d9fde000d29d204d8c57153dc46827baca.tar.bz2
DPP: Allow raw hex PSK to be used for legacy configuration
The new psk=<hexdump> can be used as an alternative to pass=<passphrase> when configuring the DPP Configurator with a legacy network parameters. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/dpp_supplicant.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c
index f5d1409..44178f9 100644
--- a/wpa_supplicant/dpp_supplicant.c
+++ b/wpa_supplicant/dpp_supplicant.c
@@ -387,6 +387,8 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
size_t ssid_len = 4;
char pass[64] = { };
size_t pass_len = 0;
+ u8 psk[PMK_LEN];
+ int psk_set = 0;
if (!cmd)
return;
@@ -414,6 +416,14 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
goto fail;
}
+ pos = os_strstr(cmd, " psk=");
+ if (pos) {
+ pos += 5;
+ if (hexstr2bin(pos, psk, PMK_LEN) < 0)
+ goto fail;
+ psk_set = 1;
+ }
+
if (os_strstr(cmd, " conf=sta-")) {
conf_sta = os_zalloc(sizeof(struct dpp_configuration));
if (!conf_sta)
@@ -422,9 +432,13 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
conf_sta->ssid_len = ssid_len;
if (os_strstr(cmd, " conf=sta-psk")) {
conf_sta->dpp = 0;
- conf_sta->passphrase = os_strdup(pass);
- if (!conf_sta->passphrase)
- goto fail;
+ if (psk_set) {
+ os_memcpy(conf_sta->psk, psk, PMK_LEN);
+ } else {
+ conf_sta->passphrase = os_strdup(pass);
+ if (!conf_sta->passphrase)
+ goto fail;
+ }
} else if (os_strstr(cmd, " conf=sta-dpp")) {
conf_sta->dpp = 1;
} else {
@@ -440,9 +454,13 @@ static void wpas_dpp_set_configurator(struct wpa_supplicant *wpa_s,
conf_ap->ssid_len = ssid_len;
if (os_strstr(cmd, " conf=ap-psk")) {
conf_ap->dpp = 0;
- conf_ap->passphrase = os_strdup(pass);
- if (!conf_ap->passphrase)
- goto fail;
+ if (psk_set) {
+ os_memcpy(conf_ap->psk, psk, PMK_LEN);
+ } else {
+ conf_ap->passphrase = os_strdup(pass);
+ if (!conf_ap->passphrase)
+ goto fail;
+ }
} else if (os_strstr(cmd, " conf=ap-dpp")) {
conf_ap->dpp = 1;
} else {