Home | History | Annotate | Download | only in ap

Lines Matching refs:cred

290 				       const struct wps_credential *cred)
297 if (cred->ssid_len <= HOSTAPD_MAX_SSID_LEN) {
298 os_memcpy(bss->ssid.ssid, cred->ssid, cred->ssid_len);
299 bss->ssid.ssid_len = cred->ssid_len;
303 if ((cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)) &&
304 (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK)))
306 else if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK))
308 else if (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK))
314 if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA))
316 if (cred->auth_type & (WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK))
320 if (cred->encr_type & WPS_ENCR_AES)
322 if (cred->encr_type & WPS_ENCR_TKIP)
329 if (cred->key_len >= 8 && cred->key_len < 64) {
331 bss->ssid.wpa_passphrase = os_zalloc(cred->key_len + 1);
333 os_memcpy(bss->ssid.wpa_passphrase, cred->key,
334 cred->key_len);
337 } else if (cred->key_len == 64) {
342 hexstr2bin((const char *) cred->key,
351 if ((cred->auth_type & WPS_AUTH_OPEN) &&
352 (cred->auth_type & WPS_AUTH_SHARED))
354 else if (cred->auth_type & WPS_AUTH_SHARED)
358 if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx > 0 &&
359 cred->key_idx <= 4) {
361 int idx = cred->key_idx;
365 if (cred->key_len == 10 || cred->key_len == 26) {
367 wep->key[idx] = os_malloc(cred->key_len / 2);
369 hexstr2bin((const char *) cred->key,
371 cred->key_len / 2))
373 wep->len[idx] = cred->key_len / 2;
376 wep->key[idx] = os_malloc(cred->key_len);
379 os_memcpy(wep->key[idx], cred->key,
380 cred->key_len);
381 wep->len[idx] = cred->key_len;
399 const struct wps_credential *cred = ctx;
411 cred->cred_attr, cred->cred_attr_len);
414 wpa_hexdump_ascii(MSG_DEBUG, "WPS: SSID", cred->ssid, cred->ssid_len);
416 cred->auth_type);
417 wpa_printf(MSG_DEBUG, "WPS: Encryption Type 0x%x", cred->encr_type);
418 wpa_printf(MSG_DEBUG, "WPS: Network Key Index %d", cred->key_idx);
420 cred->key, cred->key_len);
422 MAC2STR(cred->mac_addr));
425 hapd->conf->wps_cred_processing == 2) && cred->cred_attr) {
426 hapd_new_ap_event(hapd, cred->cred_attr, cred->cred_attr_len);
431 if (attr && wps_build_credential_wrap(attr, cred) == 0)
441 os_memcpy(hapd->wps->ssid, cred->ssid, cred->ssid_len);
442 hapd->wps->ssid_len = cred->ssid_len;
443 hapd->wps->encr_types = cred->encr_type;
444 hapd->wps->auth_types = cred->auth_type;
445 if (cred->key_len == 0) {
451 hapd->wps->network_key_len < cred->key_len) {
454 hapd->wps->network_key = os_malloc(cred->key_len);
458 hapd->wps->network_key_len = cred->key_len;
459 os_memcpy(hapd->wps->network_key, cred->key, cred->key_len);
464 return hapd_wps_reconfig_in_memory(hapd, cred);
492 if (is_hex(cred->ssid, cred->ssid_len)) {
494 for (i = 0; i < cred->ssid_len; i++)
495 fprintf(nconf, "%02x", cred->ssid[i]);
499 for (i = 0; i < cred->ssid_len; i++)
500 fputc(cred->ssid[i], nconf);
504 if ((cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)) &&
505 (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK)))
507 else if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK))
509 else if (cred->auth_type & (WPS_AUTH_WPA | WPS_AUTH_WPAPSK))
520 if (cred->auth_type & (WPS_AUTH_WPA2 | WPS_AUTH_WPA)) {
524 if (cred->auth_type & (WPS_AUTH_WPA2PSK | WPS_AUTH_WPAPSK))
530 if (cred->encr_type & WPS_ENCR_AES) {
534 if (cred->encr_type & WPS_ENCR_TKIP) {
539 if (cred->key_len >= 8 && cred->key_len < 64) {
541 for (i = 0; i < cred->key_len; i++)
542 fputc(cred->key[i], nconf);
544 } else if (cred->key_len == 64) {
546 for (i = 0; i < cred->key_len; i++)
547 fputc(cred->key[i], nconf);
552 (unsigned long) cred->key_len);
557 if ((cred->auth_type & WPS_AUTH_OPEN) &&
558 (cred->auth_type & WPS_AUTH_SHARED))
560 else if (cred->auth_type & WPS_AUTH_SHARED)
565 if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx <= 4) {
566 int key_idx = cred->key_idx;
571 if (cred->key_len == 10 || cred->key_len == 26) {
573 for (i = 0; i < cred->key_len; i++)
574 fputc(cred->key[i], nconf);
577 for (i = 0; i < cred->key_len; i++)
578 fprintf(nconf, "%02x", cred->key[i]);
632 static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
635 return hostapd_wps_for_each(hapd, hapd_wps_cred_cb, (void *) cred);
1551 struct wps_credential cred;
1554 os_memset(&cred, 0, sizeof(cred));
1557 if ((len & 1) || len > 2 * sizeof(cred.ssid) ||
1558 hexstr2bin(ssid, cred.ssid, len / 2))
1560 cred.ssid_len = len / 2;
1563 cred.auth_type = WPS_AUTH_OPEN;
1565 cred.auth_type = WPS_AUTH_WPAPSK;
1567 cred.auth_type = WPS_AUTH_WPA2PSK;
1573 cred.encr_type = WPS_ENCR_NONE;
1575 cred.encr_type = WPS_ENCR_WEP;
1577 cred.encr_type = WPS_ENCR_TKIP;
1579 cred.encr_type = WPS_ENCR_AES;
1583 cred.encr_type = WPS_ENCR_NONE;
1587 if ((len & 1) || len > 2 * sizeof(cred.key) ||
1588 hexstr2bin(key, cred.key, len / 2))
1590 cred.key_len = len / 2;
1593 return wps_registrar_config_ap(hapd->wps->registrar, &cred);