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)