aboutsummaryrefslogtreecommitdiffstats
path: root/src/wps
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2020-02-15 15:27:03 (GMT)
committerJouni Malinen <j@w1.fi>2020-02-15 15:27:52 (GMT)
commitb1977a652dffa4e4f6f01e93dac59f8f29f17b14 (patch)
tree829bb123d0e4c2ac7458a805d2978e1c34623001 /src/wps
parentb27ed050dbe5708cec05393336d62a60dcfb1a65 (diff)
downloadhostap-b1977a652dffa4e4f6f01e93dac59f8f29f17b14.zip
hostap-b1977a652dffa4e4f6f01e93dac59f8f29f17b14.tar.gz
hostap-b1977a652dffa4e4f6f01e93dac59f8f29f17b14.tar.bz2
WPS: Use PMK_LEN instead of hardcoded 32
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/wps')
-rw-r--r--src/wps/wps_registrar.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index da81d1a..c07d42b 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -17,6 +17,7 @@
#include "crypto/sha256.h"
#include "crypto/random.h"
#include "common/ieee802_11_defs.h"
+#include "common/wpa_common.h"
#include "wps_i.h"
#include "wps_dev_attr.h"
#include "wps_upnp.h"
@@ -1763,9 +1764,9 @@ int wps_build_cred(struct wps_data *wps, struct wpabuf *msg)
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;
+ wpa_snprintf_hex(hex, sizeof(hex), wps->wps->psk, PMK_LEN);
+ os_memcpy(wps->cred.key, hex, PMK_LEN * 2);
+ wps->cred.key_len = PMK_LEN * 2;
} else if (!wps->wps->registrar->force_per_enrollee_psk &&
wps->wps->network_key) {
os_memcpy(wps->cred.key, wps->wps->network_key,
@@ -1775,7 +1776,7 @@ int wps_build_cred(struct wps_data *wps, struct wpabuf *msg)
char hex[65];
/* Generate a random per-device PSK */
os_free(wps->new_psk);
- wps->new_psk_len = 32;
+ wps->new_psk_len = PMK_LEN;
wps->new_psk = os_malloc(wps->new_psk_len);
if (wps->new_psk == NULL)
return -1;