Lines Matching refs:cred

83 static int wps_process_cred_network_idx(struct wps_credential *cred,
98 static int wps_process_cred_ssid(struct wps_credential *cred, const u8 *ssid,
112 if (ssid_len <= sizeof(cred->ssid)) {
113 os_memcpy(cred->ssid, ssid, ssid_len);
114 cred->ssid_len = ssid_len;
121 static int wps_process_cred_auth_type(struct wps_credential *cred,
130 cred->auth_type = WPA_GET_BE16(auth_type);
132 cred->auth_type);
138 static int wps_process_cred_encr_type(struct wps_credential *cred,
147 cred->encr_type = WPA_GET_BE16(encr_type);
149 cred->encr_type);
155 static int wps_process_cred_network_key_idx(struct wps_credential *cred,
162 cred->key_idx = *key_idx;
168 static int wps_process_cred_network_key(struct wps_credential *cred,
174 if (cred->auth_type == WPS_AUTH_OPEN &&
175 cred->encr_type == WPS_ENCR_NONE) {
185 if (key_len <= sizeof(cred->key)) {
186 os_memcpy(cred->key, key, key_len);
187 cred->key_len = key_len;
194 static int wps_process_cred_mac_addr(struct wps_credential *cred,
204 os_memcpy(cred->mac_addr, mac_addr, ETH_ALEN);
210 static int wps_process_cred_eap_type(struct wps_credential *cred,
222 static int wps_process_cred_eap_identity(struct wps_credential *cred,
236 static int wps_process_cred_key_prov_auto(struct wps_credential *cred,
249 static int wps_process_cred_802_1x_enabled(struct wps_credential *cred,
261 static int wps_workaround_cred_key(struct wps_credential *cred)
263 if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK) &&
264 cred->key_len > 8 && cred->key_len < 64 &&
265 cred->key[cred->key_len - 1] == 0) {
270 cred->key, cred->key_len);
280 cred->key_len--;
288 struct wps_credential *cred)
293 if (wps_process_cred_network_idx(cred, attr->network_idx) ||
294 wps_process_cred_ssid(cred, attr->ssid, attr->ssid_len) ||
295 wps_process_cred_auth_type(cred, attr->auth_type) ||
296 wps_process_cred_encr_type(cred, attr->encr_type) ||
297 wps_process_cred_network_key_idx(cred, attr->network_key_idx) ||
298 wps_process_cred_network_key(cred, attr->network_key,
300 wps_process_cred_mac_addr(cred, attr->mac_addr) ||
301 wps_process_cred_eap_type(cred, attr->eap_type,
303 wps_process_cred_eap_identity(cred, attr->eap_identity,
305 wps_process_cred_key_prov_auto(cred, attr->key_prov_auto) ||
306 wps_process_cred_802_1x_enabled(cred, attr->dot1x_enabled))
309 return wps_workaround_cred_key(cred);
314 struct wps_credential *cred)
317 os_memset(cred, 0, sizeof(*cred));
319 if (wps_process_cred_ssid(cred, attr->ssid, attr->ssid_len) ||
320 wps_process_cred_auth_type(cred, attr->auth_type) ||
321 wps_process_cred_encr_type(cred, attr->encr_type) ||
322 wps_process_cred_network_key_idx(cred, attr->network_key_idx) ||
323 wps_process_cred_network_key(cred, attr->network_key,
325 wps_process_cred_mac_addr(cred, attr->mac_addr))
328 return wps_workaround_cred_key(cred);