Lines Matching defs: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_workaround_cred_key(struct wps_credential *cred)
212 if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK) &&
213 cred->key_len > 8 && cred->key_len < 64 &&
214 cred->key[cred->key_len - 1] == 0) {
219 cred->key, cred->key_len);
229 cred->key_len--;
237 struct wps_credential *cred)
242 if (wps_process_cred_network_idx(cred, attr->network_idx) ||
243 wps_process_cred_ssid(cred, attr->ssid, attr->ssid_len) ||
244 wps_process_cred_auth_type(cred, attr->auth_type) ||
245 wps_process_cred_encr_type(cred, attr->encr_type) ||
246 wps_process_cred_network_key_idx(cred, attr->network_key_idx) ||
247 wps_process_cred_network_key(cred, attr->network_key,
249 wps_process_cred_mac_addr(cred, attr->mac_addr))
252 return wps_workaround_cred_key(cred);
257 struct wps_credential *cred)
260 os_memset(cred, 0, sizeof(*cred));
262 if (wps_process_cred_ssid(cred, attr->ssid, attr->ssid_len) ||
263 wps_process_cred_auth_type(cred, attr->auth_type) ||
264 wps_process_cred_encr_type(cred, attr->encr_type) ||
265 wps_process_cred_network_key_idx(cred, attr->network_key_idx) ||
266 wps_process_cred_network_key(cred, attr->network_key,
268 wps_process_cred_mac_addr(cred, attr->mac_addr))
271 return wps_workaround_cred_key(cred);