2 * Wi-Fi Protected Setup - Strict protocol validation routines
3 * Copyright (c) 2010, Atheros Communications, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #include "utils/includes.h"
17 #include "utils/common.h"
22 static int wps_validate_version(const u8 *version, int mandatory)
24 if (version == NULL) {
26 wpa_printf(MSG_INFO, "WPS-STRICT: Version attribute "
32 if (*version != 0x10) {
33 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Version attribute "
34 "value 0x%x", *version);
41 static int wps_validate_version2(const u8 *version2, int mandatory)
43 if (version2 == NULL) {
45 wpa_printf(MSG_INFO, "WPS-STRICT: Version2 attribute "
51 if (*version2 < 0x20) {
52 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Version2 attribute "
53 "value 0x%x", *version2);
60 static int wps_validate_request_type(const u8 *request_type, int mandatory)
62 if (request_type == NULL) {
64 wpa_printf(MSG_INFO, "WPS-STRICT: Request Type "
70 if (*request_type > 0x03) {
71 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Request Type "
72 "attribute value 0x%x", *request_type);
79 static int wps_validate_response_type(const u8 *response_type, int mandatory)
81 if (response_type == NULL) {
83 wpa_printf(MSG_INFO, "WPS-STRICT: Response Type "
89 if (*response_type > 0x03) {
90 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Response Type "
91 "attribute value 0x%x", *response_type);
98 static int valid_config_methods(u16 val, int wps2)
101 if ((val & 0x6000) && !(val & WPS_CONFIG_DISPLAY)) {
102 wpa_printf(MSG_INFO, "WPS-STRICT: Physical/Virtual "
103 "Display flag without old Display flag "
107 if (!(val & 0x6000) && (val & WPS_CONFIG_DISPLAY)) {
108 wpa_printf(MSG_INFO, "WPS-STRICT: Display flag "
109 "without Physical/Virtual Display flag");
112 if ((val & 0x0600) && !(val & WPS_CONFIG_PUSHBUTTON)) {
113 wpa_printf(MSG_INFO, "WPS-STRICT: Physical/Virtual "
114 "PushButton flag without old PushButton "
118 if (!(val & 0x0600) && (val & WPS_CONFIG_PUSHBUTTON)) {
119 wpa_printf(MSG_INFO, "WPS-STRICT: PushButton flag "
120 "without Physical/Virtual PushButton flag");
129 static int wps_validate_config_methods(const u8 *config_methods, int wps2,
134 if (config_methods == NULL) {
136 wpa_printf(MSG_INFO, "WPS-STRICT: Configuration "
137 "Methods attribute missing");
143 val = WPA_GET_BE16(config_methods);
144 if (!valid_config_methods(val, wps2)) {
145 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Configuration "
146 "Methods attribute value 0x%04x", val);
153 static int wps_validate_ap_config_methods(const u8 *config_methods, int wps2,
158 if (wps_validate_config_methods(config_methods, wps2, mandatory) < 0)
160 if (config_methods == NULL)
162 val = WPA_GET_BE16(config_methods);
163 if (val & WPS_CONFIG_PUSHBUTTON) {
164 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Configuration "
165 "Methods attribute value 0x%04x in AP info "
166 "(PushButton not allowed for registering new ER)",
174 static int wps_validate_uuid_e(const u8 *uuid_e, int mandatory)
176 if (uuid_e == NULL) {
178 wpa_printf(MSG_INFO, "WPS-STRICT: UUID-E "
179 "attribute missing");
188 static int wps_validate_uuid_r(const u8 *uuid_r, int mandatory)
190 if (uuid_r == NULL) {
192 wpa_printf(MSG_INFO, "WPS-STRICT: UUID-R "
193 "attribute missing");
202 static int wps_validate_primary_dev_type(const u8 *primary_dev_type,
205 if (primary_dev_type == NULL) {
207 wpa_printf(MSG_INFO, "WPS-STRICT: Primary Device Type "
208 "attribute missing");
217 static int wps_validate_rf_bands(const u8 *rf_bands, int mandatory)
219 if (rf_bands == NULL) {
221 wpa_printf(MSG_INFO, "WPS-STRICT: RF Bands "
222 "attribute missing");
227 if (*rf_bands != WPS_RF_24GHZ && *rf_bands != WPS_RF_50GHZ &&
228 *rf_bands != (WPS_RF_24GHZ | WPS_RF_50GHZ)) {
229 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Rf Bands "
230 "attribute value 0x%x", *rf_bands);
237 static int wps_validate_assoc_state(const u8 *assoc_state, int mandatory)
240 if (assoc_state == NULL) {
242 wpa_printf(MSG_INFO, "WPS-STRICT: Association State "
243 "attribute missing");
248 val = WPA_GET_BE16(assoc_state);
250 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Association State "
251 "attribute value 0x%04x", val);
258 static int wps_validate_config_error(const u8 *config_error, int mandatory)
262 if (config_error == NULL) {
264 wpa_printf(MSG_INFO, "WPS-STRICT: Configuration Error "
265 "attribute missing");
270 val = WPA_GET_BE16(config_error);
272 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Configuration Error "
273 "attribute value 0x%04x", val);
280 static int wps_validate_dev_password_id(const u8 *dev_password_id,
285 if (dev_password_id == NULL) {
287 wpa_printf(MSG_INFO, "WPS-STRICT: Device Password ID "
288 "attribute missing");
293 val = WPA_GET_BE16(dev_password_id);
294 if (val >= 0x0006 && val <= 0x000f) {
295 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Device Password ID "
296 "attribute value 0x%04x", val);
303 static int wps_validate_manufacturer(const u8 *manufacturer, size_t len,
306 if (manufacturer == NULL) {
308 wpa_printf(MSG_INFO, "WPS-STRICT: Manufacturer "
309 "attribute missing");
314 if (len > 0 && manufacturer[len - 1] == 0) {
315 wpa_hexdump_ascii(MSG_INFO, "WPS-STRICT: Invalid Manufacturer "
316 "attribute value", manufacturer, len);
323 static int wps_validate_model_name(const u8 *model_name, size_t len,
326 if (model_name == NULL) {
328 wpa_printf(MSG_INFO, "WPS-STRICT: Model Name "
329 "attribute missing");
334 if (len > 0 && model_name[len - 1] == 0) {
335 wpa_hexdump_ascii(MSG_INFO, "WPS-STRICT: Invalid Model Name "
336 "attribute value", model_name, len);
343 static int wps_validate_model_number(const u8 *model_number, size_t len,
346 if (model_number == NULL) {
348 wpa_printf(MSG_INFO, "WPS-STRICT: Model Number "
349 "attribute missing");
354 if (len > 0 && model_number[len - 1] == 0) {
355 wpa_hexdump_ascii(MSG_INFO, "WPS-STRICT: Invalid Model Number "
356 "attribute value", model_number, len);
363 static int wps_validate_serial_number(const u8 *serial_number, size_t len,
366 if (serial_number == NULL) {
368 wpa_printf(MSG_INFO, "WPS-STRICT: Serial Number "
369 "attribute missing");
374 if (len > 0 && serial_number[len - 1] == 0) {
375 wpa_hexdump_ascii(MSG_INFO, "WPS-STRICT: Invalid Serial "
376 "Number attribute value",
384 static int wps_validate_dev_name(const u8 *dev_name, size_t len,
387 if (dev_name == NULL) {
389 wpa_printf(MSG_INFO, "WPS-STRICT: Device Name "
390 "attribute missing");
395 if (len > 0 && dev_name[len - 1] == 0) {
396 wpa_hexdump_ascii(MSG_INFO, "WPS-STRICT: Invalid Device Name "
397 "attribute value", dev_name, len);
404 static int wps_validate_request_to_enroll(const u8 *request_to_enroll,
407 if (request_to_enroll == NULL) {
409 wpa_printf(MSG_INFO, "WPS-STRICT: Request to Enroll "
410 "attribute missing");
415 if (*request_to_enroll > 0x01) {
416 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Request to Enroll "
417 "attribute value 0x%x", *request_to_enroll);
424 static int wps_validate_req_dev_type(const u8 *req_dev_type[], size_t num,
429 wpa_printf(MSG_INFO, "WPS-STRICT: Requested Device "
430 "Type attribute missing");
439 static int wps_validate_wps_state(const u8 *wps_state, int mandatory)
441 if (wps_state == NULL) {
443 wpa_printf(MSG_INFO, "WPS-STRICT: Wi-Fi Protected "
444 "Setup State attribute missing");
449 if (*wps_state != WPS_STATE_NOT_CONFIGURED &&
450 *wps_state != WPS_STATE_CONFIGURED) {
451 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Wi-Fi Protected "
452 "Setup State attribute value 0x%x", *wps_state);
459 static int wps_validate_ap_setup_locked(const u8 *ap_setup_locked,
462 if (ap_setup_locked == NULL) {
464 wpa_printf(MSG_INFO, "WPS-STRICT: AP Setup Locked "
465 "attribute missing");
470 if (*ap_setup_locked > 1) {
471 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid AP Setup Locked "
472 "attribute value 0x%x", *ap_setup_locked);
479 static int wps_validate_selected_registrar(const u8 *selected_registrar,
482 if (selected_registrar == NULL) {
484 wpa_printf(MSG_INFO, "WPS-STRICT: Selected Registrar "
485 "attribute missing");
490 if (*selected_registrar > 1) {
491 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Selected Registrar "
492 "attribute value 0x%x", *selected_registrar);
499 static int wps_validate_sel_reg_config_methods(const u8 *config_methods,
500 int wps2, int mandatory)
504 if (config_methods == NULL) {
506 wpa_printf(MSG_INFO, "WPS-STRICT: Selected Registrar "
507 "Configuration Methods attribute missing");
513 val = WPA_GET_BE16(config_methods);
514 if (!valid_config_methods(val, wps2)) {
515 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Selected Registrar "
516 "Configuration Methods attribute value 0x%04x",
524 static int wps_validate_authorized_macs(const u8 *authorized_macs, size_t len,
527 if (authorized_macs == NULL) {
529 wpa_printf(MSG_INFO, "WPS-STRICT: Authorized MACs "
530 "attribute missing");
535 if (len > 30 && (len % ETH_ALEN) != 0) {
536 wpa_hexdump(MSG_INFO, "WPS-STRICT: Invalid Authorized "
537 "MACs attribute value", authorized_macs, len);
544 static int wps_validate_msg_type(const u8 *msg_type, int mandatory)
546 if (msg_type == NULL) {
548 wpa_printf(MSG_INFO, "WPS-STRICT: Message Type "
549 "attribute missing");
554 if (*msg_type < WPS_Beacon || *msg_type > WPS_WSC_DONE) {
555 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Message Type "
556 "attribute value 0x%x", *msg_type);
563 static int wps_validate_mac_addr(const u8 *mac_addr, int mandatory)
565 if (mac_addr == NULL) {
567 wpa_printf(MSG_INFO, "WPS-STRICT: MAC Address "
568 "attribute missing");
573 if (mac_addr[0] & 0x01) {
574 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid MAC Address "
575 "attribute value " MACSTR, MAC2STR(mac_addr));
582 static int wps_validate_enrollee_nonce(const u8 *enrollee_nonce, int mandatory)
584 if (enrollee_nonce == NULL) {
586 wpa_printf(MSG_INFO, "WPS-STRICT: Enrollee Nonce "
587 "attribute missing");
596 static int wps_validate_registrar_nonce(const u8 *registrar_nonce,
599 if (registrar_nonce == NULL) {
601 wpa_printf(MSG_INFO, "WPS-STRICT: Registrar Nonce "
602 "attribute missing");
611 static int wps_validate_public_key(const u8 *public_key, size_t len,
614 if (public_key == NULL) {
616 wpa_printf(MSG_INFO, "WPS-STRICT: Public Key "
617 "attribute missing");
623 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Public Key "
624 "attribute length %d", (int) len);
631 static int num_bits_set(u16 val)
634 for (c = 0; val; c++)
640 static int wps_validate_auth_type_flags(const u8 *flags, int mandatory)
646 wpa_printf(MSG_INFO, "WPS-STRICT: Authentication Type "
647 "Flags attribute missing");
652 val = WPA_GET_BE16(flags);
653 if ((val & ~WPS_AUTH_TYPES) || !(val & WPS_AUTH_WPA2PSK)) {
654 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Authentication Type "
655 "Flags attribute value 0x%04x", val);
662 static int wps_validate_auth_type(const u8 *type, int mandatory)
668 wpa_printf(MSG_INFO, "WPS-STRICT: Authentication Type "
669 "attribute missing");
674 val = WPA_GET_BE16(type);
675 if ((val & ~WPS_AUTH_TYPES) || val == 0 ||
676 (num_bits_set(val) > 1 &&
677 val != (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK))) {
678 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Authentication Type "
679 "attribute value 0x%04x", val);
686 static int wps_validate_encr_type_flags(const u8 *flags, int mandatory)
692 wpa_printf(MSG_INFO, "WPS-STRICT: Encryption Type "
693 "Flags attribute missing");
698 val = WPA_GET_BE16(flags);
699 if ((val & ~WPS_ENCR_TYPES) || !(val & WPS_ENCR_AES)) {
700 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Encryption Type "
701 "Flags attribute value 0x%04x", val);
708 static int wps_validate_encr_type(const u8 *type, int mandatory)
714 wpa_printf(MSG_INFO, "WPS-STRICT: Encryption Type "
715 "attribute missing");
720 val = WPA_GET_BE16(type);
721 if ((val & ~WPS_ENCR_TYPES) || val == 0 ||
722 (num_bits_set(val) > 1 && val != (WPS_ENCR_TKIP | WPS_ENCR_AES))) {
723 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Encryption Type "
724 "attribute value 0x%04x", val);
731 static int wps_validate_conn_type_flags(const u8 *flags, int mandatory)
735 wpa_printf(MSG_INFO, "WPS-STRICT: Connection Type "
736 "Flags attribute missing");
741 if ((*flags & ~(WPS_CONN_ESS | WPS_CONN_IBSS)) ||
742 !(*flags & WPS_CONN_ESS)) {
743 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Connection Type "
744 "Flags attribute value 0x%02x", *flags);
751 static int wps_validate_os_version(const u8 *os_version, int mandatory)
753 if (os_version == NULL) {
755 wpa_printf(MSG_INFO, "WPS-STRICT: OS Version "
756 "attribute missing");
765 static int wps_validate_authenticator(const u8 *authenticator, int mandatory)
767 if (authenticator == NULL) {
769 wpa_printf(MSG_INFO, "WPS-STRICT: Authenticator "
770 "attribute missing");
779 static int wps_validate_e_hash1(const u8 *hash, int mandatory)
783 wpa_printf(MSG_INFO, "WPS-STRICT: E-Hash1 "
784 "attribute missing");
793 static int wps_validate_e_hash2(const u8 *hash, int mandatory)
797 wpa_printf(MSG_INFO, "WPS-STRICT: E-Hash2 "
798 "attribute missing");
807 static int wps_validate_r_hash1(const u8 *hash, int mandatory)
811 wpa_printf(MSG_INFO, "WPS-STRICT: R-Hash1 "
812 "attribute missing");
821 static int wps_validate_r_hash2(const u8 *hash, int mandatory)
825 wpa_printf(MSG_INFO, "WPS-STRICT: R-Hash2 "
826 "attribute missing");
835 static int wps_validate_encr_settings(const u8 *encr_settings, size_t len,
838 if (encr_settings == NULL) {
840 wpa_printf(MSG_INFO, "WPS-STRICT: Encrypted Settings "
841 "attribute missing");
847 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Encrypted Settings "
848 "attribute length %d", (int) len);
855 static int wps_validate_settings_delay_time(const u8 *delay, int mandatory)
859 wpa_printf(MSG_INFO, "WPS-STRICT: Settings Delay Time "
860 "attribute missing");
869 static int wps_validate_r_snonce1(const u8 *nonce, int mandatory)
873 wpa_printf(MSG_INFO, "WPS-STRICT: R-SNonce1 "
874 "attribute missing");
883 static int wps_validate_r_snonce2(const u8 *nonce, int mandatory)
887 wpa_printf(MSG_INFO, "WPS-STRICT: R-SNonce2 "
888 "attribute missing");
897 static int wps_validate_e_snonce1(const u8 *nonce, int mandatory)
901 wpa_printf(MSG_INFO, "WPS-STRICT: E-SNonce1 "
902 "attribute missing");
911 static int wps_validate_e_snonce2(const u8 *nonce, int mandatory)
915 wpa_printf(MSG_INFO, "WPS-STRICT: E-SNonce2 "
916 "attribute missing");
925 static int wps_validate_key_wrap_auth(const u8 *auth, int mandatory)
929 wpa_printf(MSG_INFO, "WPS-STRICT: Key Wrap "
930 "Authenticator attribute missing");
939 static int wps_validate_ssid(const u8 *ssid, size_t ssid_len, int mandatory)
943 wpa_printf(MSG_INFO, "WPS-STRICT: SSID "
944 "attribute missing");
949 if (ssid_len == 0 || ssid[ssid_len - 1] == 0) {
950 wpa_hexdump_ascii(MSG_INFO, "WPS-STRICT: Invalid SSID "
951 "attribute value", ssid, ssid_len);
958 static int wps_validate_network_key_index(const u8 *idx, int mandatory)
962 wpa_printf(MSG_INFO, "WPS-STRICT: Network Key Index "
963 "attribute missing");
972 static int wps_validate_network_idx(const u8 *idx, int mandatory)
976 wpa_printf(MSG_INFO, "WPS-STRICT: Network Index "
977 "attribute missing");
986 static int wps_validate_network_key(const u8 *key, size_t key_len,
987 const u8 *encr_type, int mandatory)
991 wpa_printf(MSG_INFO, "WPS-STRICT: Network Key "
992 "attribute missing");
997 if (((encr_type == NULL || WPA_GET_BE16(encr_type) != WPS_ENCR_WEP) &&
998 key_len > 8 && key_len < 64 && key[key_len - 1] == 0) ||
1000 wpa_hexdump_ascii_key(MSG_INFO, "WPS-STRICT: Invalid Network "
1001 "Key attribute value", key, key_len);
1008 static int wps_validate_network_key_shareable(const u8 *val, int mandatory)
1012 wpa_printf(MSG_INFO, "WPS-STRICT: Network Key "
1013 "Shareable attribute missing");
1019 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Network Key "
1020 "Shareable attribute value 0x%x", *val);
1027 static int wps_validate_cred(const u8 *cred, size_t len)
1029 struct wps_parse_attr attr;
1034 wpabuf_set(&buf, cred, len);
1035 if (wps_parse_msg(&buf, &attr) < 0) {
1036 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse Credential");
1040 if (wps_validate_network_idx(attr.network_idx, 0) ||
1041 wps_validate_ssid(attr.ssid, attr.ssid_len, 1) ||
1042 wps_validate_auth_type(attr.auth_type, 1) ||
1043 wps_validate_encr_type(attr.encr_type, 1) ||
1044 wps_validate_network_key_index(attr.network_key_idx, 0) ||
1045 wps_validate_network_key(attr.network_key, attr.network_key_len,
1046 attr.encr_type, 1) ||
1047 wps_validate_mac_addr(attr.mac_addr, 1) ||
1048 wps_validate_network_key_shareable(attr.network_key_shareable, 0))
1050 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Credential");
1059 static int wps_validate_credential(const u8 *cred[], size_t len[], size_t num,
1066 wpa_printf(MSG_INFO, "WPS-STRICT: Credential "
1067 "attribute missing");
1073 for (i = 0; i < num; i++) {
1074 if (wps_validate_cred(cred[i], len[i]) < 0)
1082 int wps_validate_beacon(const struct wpabuf *wps_ie)
1084 struct wps_parse_attr attr;
1087 if (wps_ie == NULL) {
1088 wpa_printf(MSG_INFO, "WPS-STRICT: No WPS IE in Beacon frame");
1091 if (wps_parse_msg(wps_ie, &attr) < 0) {
1092 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse WPS IE in "
1097 wps2 = attr.version2 != NULL;
1098 sel_reg = attr.selected_registrar != NULL &&
1099 *attr.selected_registrar != 0;
1100 if (wps_validate_version(attr.version, 1) ||
1101 wps_validate_wps_state(attr.wps_state, 1) ||
1102 wps_validate_ap_setup_locked(attr.ap_setup_locked, 0) ||
1103 wps_validate_selected_registrar(attr.selected_registrar, 0) ||
1104 wps_validate_dev_password_id(attr.dev_password_id, sel_reg) ||
1105 wps_validate_sel_reg_config_methods(attr.sel_reg_config_methods,
1107 wps_validate_uuid_e(attr.uuid_e, 0) ||
1108 wps_validate_rf_bands(attr.rf_bands, 0) ||
1109 wps_validate_version2(attr.version2, wps2) ||
1110 wps_validate_authorized_macs(attr.authorized_macs,
1111 attr.authorized_macs_len, 0)) {
1112 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Beacon frame");
1120 int wps_validate_beacon_probe_resp(const struct wpabuf *wps_ie, int probe)
1122 struct wps_parse_attr attr;
1125 if (wps_ie == NULL) {
1126 wpa_printf(MSG_INFO, "WPS-STRICT: No WPS IE in "
1127 "%sProbe Response frame", probe ? "" : "Beacon/");
1130 if (wps_parse_msg(wps_ie, &attr) < 0) {
1131 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse WPS IE in "
1132 "%sProbe Response frame", probe ? "" : "Beacon/");
1136 wps2 = attr.version2 != NULL;
1137 sel_reg = attr.selected_registrar != NULL &&
1138 *attr.selected_registrar != 0;
1139 if (wps_validate_version(attr.version, 1) ||
1140 wps_validate_wps_state(attr.wps_state, 1) ||
1141 wps_validate_ap_setup_locked(attr.ap_setup_locked, 0) ||
1142 wps_validate_selected_registrar(attr.selected_registrar, 0) ||
1143 wps_validate_dev_password_id(attr.dev_password_id, sel_reg) ||
1144 wps_validate_sel_reg_config_methods(attr.sel_reg_config_methods,
1146 wps_validate_response_type(attr.response_type, probe) ||
1147 wps_validate_uuid_e(attr.uuid_e, probe) ||
1148 wps_validate_manufacturer(attr.manufacturer, attr.manufacturer_len,
1150 wps_validate_model_name(attr.model_name, attr.model_name_len,
1152 wps_validate_model_number(attr.model_number, attr.model_number_len,
1154 wps_validate_serial_number(attr.serial_number,
1155 attr.serial_number_len, probe) ||
1156 wps_validate_primary_dev_type(attr.primary_dev_type, probe) ||
1157 wps_validate_dev_name(attr.dev_name, attr.dev_name_len, probe) ||
1158 wps_validate_ap_config_methods(attr.config_methods, wps2, probe) ||
1159 wps_validate_rf_bands(attr.rf_bands, 0) ||
1160 wps_validate_version2(attr.version2, wps2) ||
1161 wps_validate_authorized_macs(attr.authorized_macs,
1162 attr.authorized_macs_len, 0)) {
1163 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid %sProbe Response "
1164 "frame", probe ? "" : "Beacon/");
1172 int wps_validate_probe_req(const struct wpabuf *wps_ie)
1174 struct wps_parse_attr attr;
1177 if (wps_ie == NULL) {
1178 wpa_printf(MSG_INFO, "WPS-STRICT: No WPS IE in "
1179 "Probe Request frame");
1182 if (wps_parse_msg(wps_ie, &attr) < 0) {
1183 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse WPS IE in "
1184 "Probe Request frame");
1188 wps2 = attr.version2 != NULL;
1189 if (wps_validate_version(attr.version, 1) ||
1190 wps_validate_request_type(attr.request_type, 1) ||
1191 wps_validate_config_methods(attr.config_methods, wps2, 1) ||
1192 wps_validate_uuid_e(attr.uuid_e, attr.uuid_r == NULL) ||
1193 wps_validate_uuid_r(attr.uuid_r, attr.uuid_e == NULL) ||
1194 wps_validate_primary_dev_type(attr.primary_dev_type, 1) ||
1195 wps_validate_rf_bands(attr.rf_bands, 1) ||
1196 wps_validate_assoc_state(attr.assoc_state, 1) ||
1197 wps_validate_config_error(attr.config_error, 1) ||
1198 wps_validate_dev_password_id(attr.dev_password_id, 1) ||
1199 wps_validate_version2(attr.version2, wps2) ||
1200 wps_validate_manufacturer(attr.manufacturer, attr.manufacturer_len,
1202 wps_validate_model_name(attr.model_name, attr.model_name_len,
1204 wps_validate_model_number(attr.model_number, attr.model_number_len,
1206 wps_validate_dev_name(attr.dev_name, attr.dev_name_len, wps2) ||
1207 wps_validate_request_to_enroll(attr.request_to_enroll, 0) ||
1208 wps_validate_req_dev_type(attr.req_dev_type, attr.num_req_dev_type,
1210 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid Probe Request "
1219 int wps_validate_assoc_req(const struct wpabuf *wps_ie)
1221 struct wps_parse_attr attr;
1224 if (wps_ie == NULL) {
1225 wpa_printf(MSG_INFO, "WPS-STRICT: No WPS IE in "
1226 "(Re)Association Request frame");
1229 if (wps_parse_msg(wps_ie, &attr) < 0) {
1230 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse WPS IE in "
1231 "(Re)Association Request frame");
1235 wps2 = attr.version2 != NULL;
1236 if (wps_validate_version(attr.version, 1) ||
1237 wps_validate_request_type(attr.request_type, 1) ||
1238 wps_validate_version2(attr.version2, wps2)) {
1239 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid (Re)Association "
1248 int wps_validate_assoc_resp(const struct wpabuf *wps_ie)
1250 struct wps_parse_attr attr;
1253 if (wps_ie == NULL) {
1254 wpa_printf(MSG_INFO, "WPS-STRICT: No WPS IE in "
1255 "(Re)Association Response frame");
1258 if (wps_parse_msg(wps_ie, &attr) < 0) {
1259 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse WPS IE in "
1260 "(Re)Association Response frame");
1264 wps2 = attr.version2 != NULL;
1265 if (wps_validate_version(attr.version, 1) ||
1266 wps_validate_request_type(attr.request_type, 1) ||
1267 wps_validate_version2(attr.version2, wps2)) {
1268 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid (Re)Association "
1277 int wps_validate_m1(const struct wpabuf *tlvs)
1279 struct wps_parse_attr attr;
1283 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M1");
1286 if (wps_parse_msg(tlvs, &attr) < 0) {
1287 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1292 wps2 = attr.version2 != NULL;
1293 if (wps_validate_version(attr.version, 1) ||
1294 wps_validate_msg_type(attr.msg_type, 1) ||
1295 wps_validate_uuid_e(attr.uuid_e, 1) ||
1296 wps_validate_mac_addr(attr.mac_addr, 1) ||
1297 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1298 wps_validate_public_key(attr.public_key, attr.public_key_len, 1) ||
1299 wps_validate_auth_type_flags(attr.auth_type_flags, 1) ||
1300 wps_validate_encr_type_flags(attr.encr_type_flags, 1) ||
1301 wps_validate_conn_type_flags(attr.conn_type_flags, 1) ||
1302 wps_validate_config_methods(attr.config_methods, wps2, 1) ||
1303 wps_validate_wps_state(attr.wps_state, 1) ||
1304 wps_validate_manufacturer(attr.manufacturer, attr.manufacturer_len,
1306 wps_validate_model_name(attr.model_name, attr.model_name_len, 1) ||
1307 wps_validate_model_number(attr.model_number, attr.model_number_len,
1309 wps_validate_serial_number(attr.serial_number,
1310 attr.serial_number_len, 1) ||
1311 wps_validate_primary_dev_type(attr.primary_dev_type, 1) ||
1312 wps_validate_dev_name(attr.dev_name, attr.dev_name_len, 1) ||
1313 wps_validate_rf_bands(attr.rf_bands, 1) ||
1314 wps_validate_assoc_state(attr.assoc_state, 1) ||
1315 wps_validate_dev_password_id(attr.dev_password_id, 1) ||
1316 wps_validate_config_error(attr.config_error, 1) ||
1317 wps_validate_os_version(attr.os_version, 1) ||
1318 wps_validate_version2(attr.version2, wps2) ||
1319 wps_validate_request_to_enroll(attr.request_to_enroll, 0)) {
1320 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M1");
1328 int wps_validate_m2(const struct wpabuf *tlvs)
1330 struct wps_parse_attr attr;
1334 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M2");
1337 if (wps_parse_msg(tlvs, &attr) < 0) {
1338 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1343 wps2 = attr.version2 != NULL;
1344 if (wps_validate_version(attr.version, 1) ||
1345 wps_validate_msg_type(attr.msg_type, 1) ||
1346 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1347 wps_validate_registrar_nonce(attr.registrar_nonce, 1) ||
1348 wps_validate_uuid_r(attr.uuid_r, 1) ||
1349 wps_validate_public_key(attr.public_key, attr.public_key_len, 1) ||
1350 wps_validate_auth_type_flags(attr.auth_type_flags, 1) ||
1351 wps_validate_encr_type_flags(attr.encr_type_flags, 1) ||
1352 wps_validate_conn_type_flags(attr.conn_type_flags, 1) ||
1353 wps_validate_config_methods(attr.config_methods, wps2, 1) ||
1354 wps_validate_manufacturer(attr.manufacturer, attr.manufacturer_len,
1356 wps_validate_model_name(attr.model_name, attr.model_name_len, 1) ||
1357 wps_validate_model_number(attr.model_number, attr.model_number_len,
1359 wps_validate_serial_number(attr.serial_number,
1360 attr.serial_number_len, 1) ||
1361 wps_validate_primary_dev_type(attr.primary_dev_type, 1) ||
1362 wps_validate_dev_name(attr.dev_name, attr.dev_name_len, 1) ||
1363 wps_validate_rf_bands(attr.rf_bands, 1) ||
1364 wps_validate_assoc_state(attr.assoc_state, 1) ||
1365 wps_validate_config_error(attr.config_error, 1) ||
1366 wps_validate_dev_password_id(attr.dev_password_id, 1) ||
1367 wps_validate_os_version(attr.os_version, 1) ||
1368 wps_validate_version2(attr.version2, wps2) ||
1369 wps_validate_authenticator(attr.authenticator, 1)) {
1370 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M2");
1378 int wps_validate_m2d(const struct wpabuf *tlvs)
1380 struct wps_parse_attr attr;
1384 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M2D");
1387 if (wps_parse_msg(tlvs, &attr) < 0) {
1388 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1393 wps2 = attr.version2 != NULL;
1394 if (wps_validate_version(attr.version, 1) ||
1395 wps_validate_msg_type(attr.msg_type, 1) ||
1396 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1397 wps_validate_registrar_nonce(attr.registrar_nonce, 1) ||
1398 wps_validate_uuid_r(attr.uuid_r, 1) ||
1399 wps_validate_auth_type_flags(attr.auth_type_flags, 1) ||
1400 wps_validate_encr_type_flags(attr.encr_type_flags, 1) ||
1401 wps_validate_conn_type_flags(attr.conn_type_flags, 1) ||
1402 wps_validate_config_methods(attr.config_methods, wps2, 1) ||
1403 wps_validate_manufacturer(attr.manufacturer, attr.manufacturer_len,
1405 wps_validate_model_name(attr.model_name, attr.model_name_len, 1) ||
1406 wps_validate_model_number(attr.model_number, attr.model_number_len,
1408 wps_validate_serial_number(attr.serial_number,
1409 attr.serial_number_len, 1) ||
1410 wps_validate_primary_dev_type(attr.primary_dev_type, 1) ||
1411 wps_validate_dev_name(attr.dev_name, attr.dev_name_len, 1) ||
1412 wps_validate_rf_bands(attr.rf_bands, 1) ||
1413 wps_validate_assoc_state(attr.assoc_state, 1) ||
1414 wps_validate_config_error(attr.config_error, 1) ||
1415 wps_validate_os_version(attr.os_version, 1) ||
1416 wps_validate_version2(attr.version2, wps2)) {
1417 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M2D");
1425 int wps_validate_m3(const struct wpabuf *tlvs)
1427 struct wps_parse_attr attr;
1431 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M3");
1434 if (wps_parse_msg(tlvs, &attr) < 0) {
1435 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1440 wps2 = attr.version2 != NULL;
1441 if (wps_validate_version(attr.version, 1) ||
1442 wps_validate_msg_type(attr.msg_type, 1) ||
1443 wps_validate_registrar_nonce(attr.registrar_nonce, 1) ||
1444 wps_validate_e_hash1(attr.e_hash1, 1) ||
1445 wps_validate_e_hash2(attr.e_hash2, 1) ||
1446 wps_validate_version2(attr.version2, wps2) ||
1447 wps_validate_authenticator(attr.authenticator, 1)) {
1448 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M3");
1456 int wps_validate_m4(const struct wpabuf *tlvs)
1458 struct wps_parse_attr attr;
1462 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M4");
1465 if (wps_parse_msg(tlvs, &attr) < 0) {
1466 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1471 wps2 = attr.version2 != NULL;
1472 if (wps_validate_version(attr.version, 1) ||
1473 wps_validate_msg_type(attr.msg_type, 1) ||
1474 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1475 wps_validate_r_hash1(attr.r_hash1, 1) ||
1476 wps_validate_r_hash2(attr.r_hash2, 1) ||
1477 wps_validate_encr_settings(attr.encr_settings,
1478 attr.encr_settings_len, 1) ||
1479 wps_validate_version2(attr.version2, wps2) ||
1480 wps_validate_authenticator(attr.authenticator, 1)) {
1481 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M4");
1489 int wps_validate_m4_encr(const struct wpabuf *tlvs)
1491 struct wps_parse_attr attr;
1495 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M4 encrypted "
1499 if (wps_parse_msg(tlvs, &attr) < 0) {
1500 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1501 "in M4 encrypted settings");
1505 wps2 = attr.version2 != NULL;
1506 if (wps_validate_r_snonce1(attr.r_snonce1, 1) ||
1507 wps_validate_key_wrap_auth(attr.key_wrap_auth, 1)) {
1508 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M4 encrypted "
1517 int wps_validate_m5(const struct wpabuf *tlvs)
1519 struct wps_parse_attr attr;
1523 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M5");
1526 if (wps_parse_msg(tlvs, &attr) < 0) {
1527 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1532 wps2 = attr.version2 != NULL;
1533 if (wps_validate_version(attr.version, 1) ||
1534 wps_validate_msg_type(attr.msg_type, 1) ||
1535 wps_validate_registrar_nonce(attr.registrar_nonce, 1) ||
1536 wps_validate_encr_settings(attr.encr_settings,
1537 attr.encr_settings_len, 1) ||
1538 wps_validate_version2(attr.version2, wps2) ||
1539 wps_validate_authenticator(attr.authenticator, 1)) {
1540 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M5");
1548 int wps_validate_m5_encr(const struct wpabuf *tlvs)
1550 struct wps_parse_attr attr;
1554 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M5 encrypted "
1558 if (wps_parse_msg(tlvs, &attr) < 0) {
1559 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1560 "in M5 encrypted settings");
1564 wps2 = attr.version2 != NULL;
1565 if (wps_validate_e_snonce1(attr.e_snonce1, 1) ||
1566 wps_validate_key_wrap_auth(attr.key_wrap_auth, 1)) {
1567 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M5 encrypted "
1576 int wps_validate_m6(const struct wpabuf *tlvs)
1578 struct wps_parse_attr attr;
1582 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M6");
1585 if (wps_parse_msg(tlvs, &attr) < 0) {
1586 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1591 wps2 = attr.version2 != NULL;
1592 if (wps_validate_version(attr.version, 1) ||
1593 wps_validate_msg_type(attr.msg_type, 1) ||
1594 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1595 wps_validate_encr_settings(attr.encr_settings,
1596 attr.encr_settings_len, 1) ||
1597 wps_validate_version2(attr.version2, wps2) ||
1598 wps_validate_authenticator(attr.authenticator, 1)) {
1599 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M6");
1607 int wps_validate_m6_encr(const struct wpabuf *tlvs)
1609 struct wps_parse_attr attr;
1613 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M6 encrypted "
1617 if (wps_parse_msg(tlvs, &attr) < 0) {
1618 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1619 "in M6 encrypted settings");
1623 wps2 = attr.version2 != NULL;
1624 if (wps_validate_r_snonce2(attr.r_snonce2, 1) ||
1625 wps_validate_key_wrap_auth(attr.key_wrap_auth, 1)) {
1626 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M6 encrypted "
1635 int wps_validate_m7(const struct wpabuf *tlvs)
1637 struct wps_parse_attr attr;
1641 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M7");
1644 if (wps_parse_msg(tlvs, &attr) < 0) {
1645 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1650 wps2 = attr.version2 != NULL;
1651 if (wps_validate_version(attr.version, 1) ||
1652 wps_validate_msg_type(attr.msg_type, 1) ||
1653 wps_validate_registrar_nonce(attr.registrar_nonce, 1) ||
1654 wps_validate_encr_settings(attr.encr_settings,
1655 attr.encr_settings_len, 1) ||
1656 wps_validate_settings_delay_time(attr.settings_delay_time, 0) ||
1657 wps_validate_version2(attr.version2, wps2) ||
1658 wps_validate_authenticator(attr.authenticator, 1)) {
1659 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M7");
1667 int wps_validate_m7_encr(const struct wpabuf *tlvs, int ap)
1669 struct wps_parse_attr attr;
1673 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M7 encrypted "
1677 if (wps_parse_msg(tlvs, &attr) < 0) {
1678 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1679 "in M7 encrypted settings");
1683 wps2 = attr.version2 != NULL;
1684 if (wps_validate_e_snonce2(attr.e_snonce2, 1) ||
1685 wps_validate_ssid(attr.ssid, attr.ssid_len, !ap) ||
1686 wps_validate_mac_addr(attr.mac_addr, !ap) ||
1687 wps_validate_auth_type(attr.auth_type, !ap) ||
1688 wps_validate_encr_type(attr.encr_type, !ap) ||
1689 wps_validate_network_key_index(attr.network_key_idx, 0) ||
1690 wps_validate_network_key(attr.network_key, attr.network_key_len,
1691 attr.encr_type, !ap) ||
1692 wps_validate_key_wrap_auth(attr.key_wrap_auth, 1)) {
1693 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M7 encrypted "
1702 int wps_validate_m8(const struct wpabuf *tlvs)
1704 struct wps_parse_attr attr;
1708 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M8");
1711 if (wps_parse_msg(tlvs, &attr) < 0) {
1712 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1717 wps2 = attr.version2 != NULL;
1718 if (wps_validate_version(attr.version, 1) ||
1719 wps_validate_msg_type(attr.msg_type, 1) ||
1720 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1721 wps_validate_encr_settings(attr.encr_settings,
1722 attr.encr_settings_len, 1) ||
1723 wps_validate_version2(attr.version2, wps2) ||
1724 wps_validate_authenticator(attr.authenticator, 1)) {
1725 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M8");
1733 int wps_validate_m8_encr(const struct wpabuf *tlvs, int ap)
1735 struct wps_parse_attr attr;
1739 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in M8 encrypted "
1743 if (wps_parse_msg(tlvs, &attr) < 0) {
1744 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1745 "in M8 encrypted settings");
1749 wps2 = attr.version2 != NULL;
1750 if (wps_validate_ssid(attr.ssid, attr.ssid_len, ap) ||
1751 wps_validate_auth_type(attr.auth_type, ap) ||
1752 wps_validate_encr_type(attr.encr_type, ap) ||
1753 wps_validate_network_key_index(attr.network_key_idx, 0) ||
1754 wps_validate_mac_addr(attr.mac_addr, ap) ||
1755 wps_validate_credential(attr.cred, attr.cred_len, attr.num_cred,
1757 wps_validate_key_wrap_auth(attr.key_wrap_auth, 1)) {
1758 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid M8 encrypted "
1767 int wps_validate_wsc_ack(const struct wpabuf *tlvs)
1769 struct wps_parse_attr attr;
1773 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in WSC_ACK");
1776 if (wps_parse_msg(tlvs, &attr) < 0) {
1777 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1782 wps2 = attr.version2 != NULL;
1783 if (wps_validate_version(attr.version, 1) ||
1784 wps_validate_msg_type(attr.msg_type, 1) ||
1785 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1786 wps_validate_registrar_nonce(attr.registrar_nonce, 1) ||
1787 wps_validate_version2(attr.version2, wps2)) {
1788 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid WSC_ACK");
1796 int wps_validate_wsc_nack(const struct wpabuf *tlvs)
1798 struct wps_parse_attr attr;
1802 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in WSC_NACK");
1805 if (wps_parse_msg(tlvs, &attr) < 0) {
1806 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1811 wps2 = attr.version2 != NULL;
1812 if (wps_validate_version(attr.version, 1) ||
1813 wps_validate_msg_type(attr.msg_type, 1) ||
1814 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1815 wps_validate_registrar_nonce(attr.registrar_nonce, 1) ||
1816 wps_validate_config_error(attr.config_error, 1) ||
1817 wps_validate_version2(attr.version2, wps2)) {
1818 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid WSC_NACK");
1826 int wps_validate_wsc_done(const struct wpabuf *tlvs)
1828 struct wps_parse_attr attr;
1832 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in WSC_Done");
1835 if (wps_parse_msg(tlvs, &attr) < 0) {
1836 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1841 wps2 = attr.version2 != NULL;
1842 if (wps_validate_version(attr.version, 1) ||
1843 wps_validate_msg_type(attr.msg_type, 1) ||
1844 wps_validate_enrollee_nonce(attr.enrollee_nonce, 1) ||
1845 wps_validate_registrar_nonce(attr.registrar_nonce, 1) ||
1846 wps_validate_version2(attr.version2, wps2)) {
1847 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid WSC_Done");
1855 int wps_validate_upnp_set_selected_registrar(const struct wpabuf *tlvs)
1857 struct wps_parse_attr attr;
1862 wpa_printf(MSG_INFO, "WPS-STRICT: No TLVs in "
1863 "SetSelectedRegistrar");
1866 if (wps_parse_msg(tlvs, &attr) < 0) {
1867 wpa_printf(MSG_INFO, "WPS-STRICT: Failed to parse attributes "
1868 "in SetSelectedRegistrar");
1872 wps2 = attr.version2 != NULL;
1873 sel_reg = attr.selected_registrar != NULL &&
1874 *attr.selected_registrar != 0;
1875 if (wps_validate_version(attr.version, 1) ||
1876 wps_validate_dev_password_id(attr.dev_password_id, sel_reg) ||
1877 wps_validate_sel_reg_config_methods(attr.sel_reg_config_methods,
1879 wps_validate_version2(attr.version2, wps2) ||
1880 wps_validate_authorized_macs(attr.authorized_macs,
1881 attr.authorized_macs_len, wps2) ||
1882 wps_validate_uuid_r(attr.uuid_r, wps2)) {
1883 wpa_printf(MSG_INFO, "WPS-STRICT: Invalid "
1884 "SetSelectedRegistrar");