WPS: Add a test mechanism for adding an extra credential into M8

This can be used to build a test version of ER that adds an extra
Credential attribute into M8.
This commit is contained in:
Jouni Malinen 2010-06-03 23:34:34 -07:00 committed by Jouni Malinen
parent 54f489be45
commit 4a34969824

View file

@ -1354,6 +1354,30 @@ int wps_build_cred(struct wps_data *wps, struct wpabuf *msg)
}
use_provided:
#ifdef CONFIG_WPS_TESTING_EXTRA_CRED
cred = wpabuf_alloc(200);
if (cred) {
struct wps_credential dummy;
wpa_printf(MSG_DEBUG, "WPS: Add dummy credential");
os_memset(&dummy, 0, sizeof(dummy));
os_memcpy(dummy.ssid, "dummy", 5);
dummy.ssid_len = 5;
dummy.auth_type = WPS_AUTH_WPA2PSK;
dummy.encr_type = WPS_ENCR_AES;
os_memcpy(dummy.key, "dummy psk", 9);
dummy.key_len = 9;
os_memcpy(dummy.mac_addr, wps->mac_addr_e, ETH_ALEN);
wps_build_credential(cred, &dummy);
wpa_hexdump_buf(MSG_DEBUG, "WPS: Dummy Credential", cred);
wpabuf_put_be16(msg, ATTR_CRED);
wpabuf_put_be16(msg, wpabuf_len(cred));
wpabuf_put_buf(msg, cred);
wpabuf_free(cred);
}
#endif /* CONFIG_WPS_TESTING_EXTRA_CRED */
cred = wpabuf_alloc(200);
if (cred == NULL)
return -1;