Lines Matching refs:cred
320 const struct wps_credential *cred) in hapd_wps_reconfig_in_memory() argument
327 if (cred->ssid_len <= HOSTAPD_MAX_SSID_LEN) { in hapd_wps_reconfig_in_memory()
328 os_memcpy(bss->ssid.ssid, cred->ssid, cred->ssid_len); in hapd_wps_reconfig_in_memory()
329 bss->ssid.ssid_len = cred->ssid_len; in hapd_wps_reconfig_in_memory()
333 if ((cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)) && in hapd_wps_reconfig_in_memory()
334 (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK))) in hapd_wps_reconfig_in_memory()
336 else if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)) in hapd_wps_reconfig_in_memory()
338 else if (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK)) in hapd_wps_reconfig_in_memory()
344 if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA)) in hapd_wps_reconfig_in_memory()
346 if (cred->auth_type & (WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK)) in hapd_wps_reconfig_in_memory()
350 if (cred->encr_type & WPS_ENCR_AES) in hapd_wps_reconfig_in_memory()
352 if (cred->encr_type & WPS_ENCR_TKIP) in hapd_wps_reconfig_in_memory()
359 if (cred->key_len >= 8 && cred->key_len < 64) { in hapd_wps_reconfig_in_memory()
361 bss->ssid.wpa_passphrase = os_zalloc(cred->key_len + 1); in hapd_wps_reconfig_in_memory()
363 os_memcpy(bss->ssid.wpa_passphrase, cred->key, in hapd_wps_reconfig_in_memory()
364 cred->key_len); in hapd_wps_reconfig_in_memory()
367 } else if (cred->key_len == 64) { in hapd_wps_reconfig_in_memory()
372 hexstr2bin((const char *) cred->key, in hapd_wps_reconfig_in_memory()
400 const struct wps_credential *cred = ctx; in hapd_wps_cred_cb() local
412 cred->cred_attr, cred->cred_attr_len); in hapd_wps_cred_cb()
415 wpa_hexdump_ascii(MSG_DEBUG, "WPS: SSID", cred->ssid, cred->ssid_len); in hapd_wps_cred_cb()
417 cred->auth_type); in hapd_wps_cred_cb()
418 wpa_printf(MSG_DEBUG, "WPS: Encryption Type 0x%x", cred->encr_type); in hapd_wps_cred_cb()
419 wpa_printf(MSG_DEBUG, "WPS: Network Key Index %d", cred->key_idx); in hapd_wps_cred_cb()
421 cred->key, cred->key_len); in hapd_wps_cred_cb()
423 MAC2STR(cred->mac_addr)); in hapd_wps_cred_cb()
426 hapd->conf->wps_cred_processing == 2) && cred->cred_attr) { in hapd_wps_cred_cb()
427 hapd_new_ap_event(hapd, cred->cred_attr, cred->cred_attr_len); in hapd_wps_cred_cb()
432 if (attr && wps_build_credential_wrap(attr, cred) == 0) in hapd_wps_cred_cb()
442 os_memcpy(hapd->wps->ssid, cred->ssid, cred->ssid_len); in hapd_wps_cred_cb()
443 hapd->wps->ssid_len = cred->ssid_len; in hapd_wps_cred_cb()
444 hapd->wps->encr_types = cred->encr_type; in hapd_wps_cred_cb()
445 hapd->wps->auth_types = cred->auth_type; in hapd_wps_cred_cb()
446 hapd->wps->ap_encr_type = cred->encr_type; in hapd_wps_cred_cb()
447 hapd->wps->ap_auth_type = cred->auth_type; in hapd_wps_cred_cb()
448 if (cred->key_len == 0) { in hapd_wps_cred_cb()
454 hapd->wps->network_key_len < cred->key_len) { in hapd_wps_cred_cb()
457 hapd->wps->network_key = os_malloc(cred->key_len); in hapd_wps_cred_cb()
461 hapd->wps->network_key_len = cred->key_len; in hapd_wps_cred_cb()
462 os_memcpy(hapd->wps->network_key, cred->key, cred->key_len); in hapd_wps_cred_cb()
467 return hapd_wps_reconfig_in_memory(hapd, cred); in hapd_wps_cred_cb()
495 if (is_hex(cred->ssid, cred->ssid_len)) { in hapd_wps_cred_cb()
497 for (i = 0; i < cred->ssid_len; i++) in hapd_wps_cred_cb()
498 fprintf(nconf, "%02x", cred->ssid[i]); in hapd_wps_cred_cb()
502 for (i = 0; i < cred->ssid_len; i++) in hapd_wps_cred_cb()
503 fputc(cred->ssid[i], nconf); in hapd_wps_cred_cb()
507 if ((cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)) && in hapd_wps_cred_cb()
508 (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK))) in hapd_wps_cred_cb()
510 else if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)) in hapd_wps_cred_cb()
512 else if (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK)) in hapd_wps_cred_cb()
523 if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA)) { in hapd_wps_cred_cb()
527 if (cred->auth_type & (WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK)) in hapd_wps_cred_cb()
533 if (cred->encr_type & WPS_ENCR_AES) { in hapd_wps_cred_cb()
537 if (cred->encr_type & WPS_ENCR_TKIP) { in hapd_wps_cred_cb()
542 if (cred->key_len >= 8 && cred->key_len < 64) { in hapd_wps_cred_cb()
544 for (i = 0; i < cred->key_len; i++) in hapd_wps_cred_cb()
545 fputc(cred->key[i], nconf); in hapd_wps_cred_cb()
547 } else if (cred->key_len == 64) { in hapd_wps_cred_cb()
549 for (i = 0; i < cred->key_len; i++) in hapd_wps_cred_cb()
550 fputc(cred->key[i], nconf); in hapd_wps_cred_cb()
555 (unsigned long) cred->key_len); in hapd_wps_cred_cb()
615 static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred) in hostapd_wps_cred_cb() argument
618 return hostapd_wps_for_each(hapd, hapd_wps_cred_cb, (void *) cred); in hostapd_wps_cred_cb()
1610 struct wps_credential cred; in hostapd_wps_config_ap() local
1613 os_memset(&cred, 0, sizeof(cred)); in hostapd_wps_config_ap()
1616 if ((len & 1) || len > 2 * sizeof(cred.ssid) || in hostapd_wps_config_ap()
1617 hexstr2bin(ssid, cred.ssid, len / 2)) in hostapd_wps_config_ap()
1619 cred.ssid_len = len / 2; in hostapd_wps_config_ap()
1622 cred.auth_type = WPS_AUTH_OPEN; in hostapd_wps_config_ap()
1624 cred.auth_type = WPS_AUTH_WPAPSK; in hostapd_wps_config_ap()
1626 cred.auth_type = WPS_AUTH_WPA2PSK; in hostapd_wps_config_ap()
1632 cred.encr_type = WPS_ENCR_NONE; in hostapd_wps_config_ap()
1634 cred.encr_type = WPS_ENCR_TKIP; in hostapd_wps_config_ap()
1636 cred.encr_type = WPS_ENCR_AES; in hostapd_wps_config_ap()
1640 cred.encr_type = WPS_ENCR_NONE; in hostapd_wps_config_ap()
1644 if ((len & 1) || len > 2 * sizeof(cred.key) || in hostapd_wps_config_ap()
1645 hexstr2bin(key, cred.key, len / 2)) in hostapd_wps_config_ap()
1647 cred.key_len = len / 2; in hostapd_wps_config_ap()
1650 return wps_registrar_config_ap(hapd->wps->registrar, &cred); in hostapd_wps_config_ap()