P2P: Reduce redundant PSK generation for GO
authorMasashi Honma <masashi.honma@gmail.com>
Sun, 11 Nov 2012 09:39:24 +0000 (11:39 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 11 Nov 2012 09:39:24 +0000 (11:39 +0200)
commit30c371e8a54c3b1bece6366ff0666da15d63e45e
tree2a820fc2eb7223b9d30b169bbc0efa0bf2b982bc
parent45ac5793fcbe3785282ebd190132dd59fb06c707
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>
src/p2p/p2p.h
wpa_supplicant/ap.c
wpa_supplicant/p2p_supplicant.c