From: Jouni Malinen Date: Wed, 27 Jun 2012 18:15:29 +0000 (+0300) Subject: WPS: Fix OOB Device Password use for EAP-WSC peer X-Git-Tag: hostap_2_0~589 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0965813640dadd233e0c35e1f5b48c05397b61f0;p=thirdparty%2Fhostap.git WPS: Fix OOB Device Password use for EAP-WSC peer The OOB Device Password is passed in as a hexdump of the real Device Password (16..32 octets of arbitrary binary data). The hexdump needs to be converted to binary form before passing it for WPS processing. Signed-hostap: Jouni Malinen --- diff --git a/src/eap_peer/eap_wsc.c b/src/eap_peer/eap_wsc.c index 4473b9069..2c948a046 100644 --- a/src/eap_peer/eap_wsc.c +++ b/src/eap_peer/eap_wsc.c @@ -1,6 +1,6 @@ /* * EAP-WSC peer for Wi-Fi Protected Setup - * Copyright (c) 2007-2009, Jouni Malinen + * Copyright (c) 2007-2009, 2012, Jouni Malinen * * This software may be distributed under the terms of the BSD license. * See README for more details. @@ -137,6 +137,7 @@ static void * eap_wsc_init(struct eap_sm *sm) struct wps_context *wps; struct wps_credential new_ap_settings; int res; + u8 dev_pw[WPS_OOB_DEVICE_PASSWORD_LEN]; wps = sm->wps; if (wps == NULL) { @@ -184,6 +185,14 @@ static void * eap_wsc_init(struct eap_sm *sm) while (*pos != '\0' && *pos != ' ') pos++; cfg.pin_len = pos - (const char *) cfg.pin; + if (cfg.pin_len >= WPS_OOB_DEVICE_PASSWORD_MIN_LEN * 2 && + cfg.pin_len <= WPS_OOB_DEVICE_PASSWORD_LEN * 2 && + hexstr2bin((const char *) cfg.pin, dev_pw, + cfg.pin_len / 2) == 0) { + /* Convert OOB Device Password to binary */ + cfg.pin = dev_pw; + cfg.pin_len /= 2; + } } else { pos = os_strstr(phase1, "pbc=1"); if (pos)