Cumulative patch from commit 7ae7a84eefd43ed9385e2f8f520a918468f87178
7ae7a84 NFC: Workaround nfcpy message debug exception
6ceb95c Avoid NULL dereference in ieee802_1x_get_mib_sta() printf
97efe70 wpa_supplicant: Fix NULL dereference in tls_verify_cb()
c0c11af wpa_supplicant: Fix NULL dereference in eap_fast_parse_end()
93a1cae Remove unnecessary NULL check
1e2ffc6 Fix theoretical NULL dereference in debug printf
cbf21c7 P2P: Avoid compiler warning in p2p_supplicant.c
5479ff9 DFS: Avoid compiler warnings in src/ap/dfs.c
5e6aa04 wpa_supplicant: Fix memory leak in wfd_subelems error path
88853ae Fix CONFIG_WPS_NFC=y build without CONFIG_P2P=y
7ac7fd4 Add bssid/freq hint for driver-based BSS selection
92484e2 Start using unodified Developer Certificate of Origin v1.1
56ec49c Sync with wireless-testing.git include/uapi/linux/nl80211.h
b64afe2 Fix SAE state validation on AP
d6bfaaa NFC: Add summary and success file options for nfcpy scripts
25cfc6f P2P NFC: Add p2p-nfc.py --handover-only option
7bea076 P2P NFC: Clean up p2p-nfc.py error handling
b0d18bc WPS: Make UUID-from-MAC Address easily available
825fb6b P2P: Do not indicate P2P_FIND failure if p2p_scan is in progress
8c18fcc WPS: Add more debug information to M7 AP Settings
d7a15d5 WPS: Indicate current AP settings in M7 in unconfigurated state
d55fc03 P2P: Handle unexpected GO Neg Req reject message more cleanly
062a7c0 Fix persistent P2P connection failure in case channel list changes
Change-Id: I5c400a6503f9f00d259ff225999593958322a1ba
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/src/wps/wps_enrollee.c b/src/wps/wps_enrollee.c
index 9d48ca5..70d6a17 100644
--- a/src/wps/wps_enrollee.c
+++ b/src/wps/wps_enrollee.c
@@ -243,54 +243,30 @@
static int wps_build_cred_auth_type(struct wps_data *wps, struct wpabuf *msg)
{
- u16 auth_type = wps->wps->auth_types;
-
- /* Select the best authentication type */
- if (auth_type & WPS_AUTH_WPA2PSK)
- auth_type = WPS_AUTH_WPA2PSK;
- else if (auth_type & WPS_AUTH_WPAPSK)
- auth_type = WPS_AUTH_WPAPSK;
- else if (auth_type & WPS_AUTH_OPEN)
- auth_type = WPS_AUTH_OPEN;
- else if (auth_type & WPS_AUTH_SHARED)
- auth_type = WPS_AUTH_SHARED;
-
- wpa_printf(MSG_DEBUG, "WPS: * Authentication Type (0x%x)", auth_type);
+ wpa_printf(MSG_DEBUG, "WPS: * Authentication Type (0x%x)",
+ wps->wps->ap_auth_type);
wpabuf_put_be16(msg, ATTR_AUTH_TYPE);
wpabuf_put_be16(msg, 2);
- wpabuf_put_be16(msg, auth_type);
+ wpabuf_put_be16(msg, wps->wps->ap_auth_type);
return 0;
}
static int wps_build_cred_encr_type(struct wps_data *wps, struct wpabuf *msg)
{
- u16 encr_type = wps->wps->encr_types;
-
- /* Select the best encryption type */
- if (wps->wps->auth_types & (WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK)) {
- if (encr_type & WPS_ENCR_AES)
- encr_type = WPS_ENCR_AES;
- else if (encr_type & WPS_ENCR_TKIP)
- encr_type = WPS_ENCR_TKIP;
- } else {
- if (encr_type & WPS_ENCR_WEP)
- encr_type = WPS_ENCR_WEP;
- else if (encr_type & WPS_ENCR_NONE)
- encr_type = WPS_ENCR_NONE;
- }
-
- wpa_printf(MSG_DEBUG, "WPS: * Encryption Type (0x%x)", encr_type);
+ wpa_printf(MSG_DEBUG, "WPS: * Encryption Type (0x%x)",
+ wps->wps->ap_encr_type);
wpabuf_put_be16(msg, ATTR_ENCR_TYPE);
wpabuf_put_be16(msg, 2);
- wpabuf_put_be16(msg, encr_type);
+ wpabuf_put_be16(msg, wps->wps->ap_encr_type);
return 0;
}
static int wps_build_cred_network_key(struct wps_data *wps, struct wpabuf *msg)
{
- wpa_printf(MSG_DEBUG, "WPS: * Network Key");
+ wpa_printf(MSG_DEBUG, "WPS: * Network Key (len=%u)",
+ (unsigned int) wps->wps->network_key_len);
wpabuf_put_be16(msg, ATTR_NETWORK_KEY);
wpabuf_put_be16(msg, wps->wps->network_key_len);
wpabuf_put_data(msg, wps->wps->network_key, wps->wps->network_key_len);
@@ -310,6 +286,9 @@
static int wps_build_ap_settings(struct wps_data *wps, struct wpabuf *plain)
{
+ const u8 *start, *end;
+ int ret;
+
if (wps->wps->ap_settings) {
wpa_printf(MSG_DEBUG, "WPS: * AP Settings (pre-configured)");
wpabuf_put_data(plain, wps->wps->ap_settings,
@@ -317,11 +296,19 @@
return 0;
}
- return wps_build_cred_ssid(wps, plain) ||
+ wpa_printf(MSG_DEBUG, "WPS: * AP Settings based on current configuration");
+ start = wpabuf_put(plain, 0);
+ ret = wps_build_cred_ssid(wps, plain) ||
wps_build_cred_mac_addr(wps, plain) ||
wps_build_cred_auth_type(wps, plain) ||
wps_build_cred_encr_type(wps, plain) ||
wps_build_cred_network_key(wps, plain);
+ end = wpabuf_put(plain, 0);
+
+ wpa_hexdump_key(MSG_DEBUG, "WPS: Plaintext AP Settings",
+ start, end - start);
+
+ return ret;
}