aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ap.c
diff options
context:
space:
mode:
authorMasashi Honma <masashi.honma@gmail.com>2012-11-11 09:39:24 (GMT)
committerJouni Malinen <j@w1.fi>2012-11-11 09:39:24 (GMT)
commit30c371e8a54c3b1bece6366ff0666da15d63e45e (patch)
tree2a820fc2eb7223b9d30b169bbc0efa0bf2b982bc /wpa_supplicant/ap.c
parent45ac5793fcbe3785282ebd190132dd59fb06c707 (diff)
downloadhostap-30c371e8a54c3b1bece6366ff0666da15d63e45e.zip
hostap-30c371e8a54c3b1bece6366ff0666da15d63e45e.tar.gz
hostap-30c371e8a54c3b1bece6366ff0666da15d63e45e.tar.bz2
P2P: Reduce redundant PSK generation for GO
The PSK generation done by pbkdf2_sha1() is one of the longest CPU time users according to our profiling from boot to GO started. So I have reduced some steps. I could boot a GO by this command sequence. ------------- add_net set_network 0 ssid '"DIRECT-XX"' set_network 0 psk '"123456789012345678901234567890123456789012345678901234567890123"' set_network 0 proto RSN set_network 0 key_mgmt WPA-PSK set_network 0 pairwise CCMP set_network 0 auth_alg OPEN set_network 0 mode 3 set_network 0 disabled 2 p2p_group_add persistent=0 freq=2412 ------------- By this sequence, pbkdf2_sha1() was called three times and the function calculates the same value each time. Reduce number of calls to pbkdf2_sha1() from 3 to 1 by caching the previous result. Signed-hostap: Masashi Honma <masashi.honma at gmail.com>
Diffstat (limited to 'wpa_supplicant/ap.c')
-rw-r--r--wpa_supplicant/ap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 088f57d..e261ef9 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -174,15 +174,15 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
bss->wpa = ssid->proto;
bss->wpa_key_mgmt = ssid->key_mgmt;
bss->wpa_pairwise = ssid->pairwise_cipher;
- if (ssid->passphrase) {
- bss->ssid.wpa_passphrase = os_strdup(ssid->passphrase);
- } else if (ssid->psk_set) {
+ if (ssid->psk_set) {
os_free(bss->ssid.wpa_psk);
bss->ssid.wpa_psk = os_zalloc(sizeof(struct hostapd_wpa_psk));
if (bss->ssid.wpa_psk == NULL)
return -1;
os_memcpy(bss->ssid.wpa_psk->psk, ssid->psk, PMK_LEN);
bss->ssid.wpa_psk->group = 1;
+ } else if (ssid->passphrase) {
+ bss->ssid.wpa_passphrase = os_strdup(ssid->passphrase);
} else if (ssid->wep_key_len[0] || ssid->wep_key_len[1] ||
ssid->wep_key_len[2] || ssid->wep_key_len[3]) {
struct hostapd_wep_keys *wep = &bss->ssid.wep;