Lines Matching refs:cred

284 	const struct wps_credential *cred = ctx;
296 cred->cred_attr, cred->cred_attr_len);
299 wpa_hexdump_ascii(MSG_DEBUG, "WPS: SSID", cred->ssid, cred->ssid_len);
301 cred->auth_type);
302 wpa_printf(MSG_DEBUG, "WPS: Encryption Type 0x%x", cred->encr_type);
303 wpa_printf(MSG_DEBUG, "WPS: Network Key Index %d", cred->key_idx);
305 cred->key, cred->key_len);
307 MAC2STR(cred->mac_addr));
310 hapd->conf->wps_cred_processing == 2) && cred->cred_attr) {
311 hapd_new_ap_event(hapd, cred->cred_attr, cred->cred_attr_len);
316 if (attr && wps_build_credential_wrap(attr, cred) == 0)
326 os_memcpy(hapd->wps->ssid, cred->ssid, cred->ssid_len);
327 hapd->wps->ssid_len = cred->ssid_len;
328 hapd->wps->encr_types = cred->encr_type;
329 hapd->wps->auth_types = cred->auth_type;
330 if (cred->key_len == 0) {
336 hapd->wps->network_key_len < cred->key_len) {
339 hapd->wps->network_key = os_malloc(cred->key_len);
343 hapd->wps->network_key_len = cred->key_len;
344 os_memcpy(hapd->wps->network_key, cred->key, cred->key_len);
377 if (is_hex(cred->ssid, cred->ssid_len)) {
379 for (i = 0; i < cred->ssid_len; i++)
380 fprintf(nconf, "%02x", cred->ssid[i]);
384 for (i = 0; i < cred->ssid_len; i++)
385 fputc(cred->ssid[i], nconf);
389 if ((cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)) &&
390 (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK)))
392 else if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK))
394 else if (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK))
405 if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA)) {
409 if (cred->auth_type & (WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK))
415 if (cred->encr_type & WPS_ENCR_AES) {
419 if (cred->encr_type & WPS_ENCR_TKIP) {
424 if (cred->key_len >= 8 && cred->key_len < 64) {
426 for (i = 0; i < cred->key_len; i++)
427 fputc(cred->key[i], nconf);
429 } else if (cred->key_len == 64) {
431 for (i = 0; i < cred->key_len; i++)
432 fputc(cred->key[i], nconf);
437 (unsigned long) cred->key_len);
442 if ((cred->auth_type & WPS_AUTH_OPEN) &&
443 (cred->auth_type & WPS_AUTH_SHARED))
445 else if (cred->auth_type & WPS_AUTH_SHARED)
450 if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx <= 4) {
451 int key_idx = cred->key_idx;
456 if (cred->key_len == 10 || cred->key_len == 26) {
458 for (i = 0; i < cred->key_len; i++)
459 fputc(cred->key[i], nconf);
462 for (i = 0; i < cred->key_len; i++)
463 fprintf(nconf, "%02x", cred->key[i]);
517 static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
520 return hostapd_wps_for_each(hapd, hapd_wps_cred_cb, (void *) cred);
1488 struct wps_credential cred;
1491 os_memset(&cred, 0, sizeof(cred));
1494 if ((len & 1) || len > 2 * sizeof(cred.ssid) ||
1495 hexstr2bin(ssid, cred.ssid, len / 2))
1497 cred.ssid_len = len / 2;
1500 cred.auth_type = WPS_AUTH_OPEN;
1502 cred.auth_type = WPS_AUTH_WPAPSK;
1504 cred.auth_type = WPS_AUTH_WPA2PSK;
1510 cred.encr_type = WPS_ENCR_NONE;
1512 cred.encr_type = WPS_ENCR_WEP;
1514 cred.encr_type = WPS_ENCR_TKIP;
1516 cred.encr_type = WPS_ENCR_AES;
1520 cred.encr_type = WPS_ENCR_NONE;
1524 if ((len & 1) || len > 2 * sizeof(cred.key) ||
1525 hexstr2bin(key, cred.key, len / 2))
1527 cred.key_len = len / 2;
1530 return wps_registrar_config_ap(hapd->wps->registrar, &cred);