|
@@ -1,6 +1,6 @@
|
|
|
/*
|
|
|
* Wi-Fi Protected Setup - Registrar
|
|
|
- * Copyright (c) 2008-2012, Jouni Malinen <j@w1.fi>
|
|
|
+ * Copyright (c) 2008-2013, Jouni Malinen <j@w1.fi>
|
|
|
*
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
* See README for more details.
|
|
@@ -171,6 +171,7 @@ struct wps_registrar {
|
|
|
int sel_reg_config_methods_override;
|
|
|
int static_wep_only;
|
|
|
int dualband;
|
|
|
+ int force_per_enrollee_psk;
|
|
|
|
|
|
struct wps_registrar_device *devices;
|
|
|
|
|
@@ -667,6 +668,7 @@ wps_registrar_init(struct wps_context *wps,
|
|
|
reg->sel_reg_config_methods_override = -1;
|
|
|
reg->static_wep_only = cfg->static_wep_only;
|
|
|
reg->dualband = cfg->dualband;
|
|
|
+ reg->force_per_enrollee_psk = cfg->force_per_enrollee_psk;
|
|
|
|
|
|
if (wps_set_ie(reg)) {
|
|
|
wps_registrar_deinit(reg);
|
|
@@ -1640,13 +1642,15 @@ int wps_build_cred(struct wps_data *wps, struct wpabuf *msg)
|
|
|
wps->new_psk, wps->new_psk_len);
|
|
|
os_memcpy(wps->cred.key, wps->new_psk, wps->new_psk_len);
|
|
|
wps->cred.key_len = wps->new_psk_len;
|
|
|
- } else if (wps->use_psk_key && wps->wps->psk_set) {
|
|
|
+ } else if (!wps->wps->registrar->force_per_enrollee_psk &&
|
|
|
+ wps->use_psk_key && wps->wps->psk_set) {
|
|
|
char hex[65];
|
|
|
wpa_printf(MSG_DEBUG, "WPS: Use PSK format for Network Key");
|
|
|
wpa_snprintf_hex(hex, sizeof(hex), wps->wps->psk, 32);
|
|
|
os_memcpy(wps->cred.key, hex, 32 * 2);
|
|
|
wps->cred.key_len = 32 * 2;
|
|
|
- } else if (wps->wps->network_key) {
|
|
|
+ } else if (!wps->wps->registrar->force_per_enrollee_psk &&
|
|
|
+ wps->wps->network_key) {
|
|
|
os_memcpy(wps->cred.key, wps->wps->network_key,
|
|
|
wps->wps->network_key_len);
|
|
|
wps->cred.key_len = wps->wps->network_key_len;
|