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>
This commit is contained in:
Masashi Honma 2012-11-11 11:39:24 +02:00 committed by Jouni Malinen
parent 45ac5793fc
commit 30c371e8a5
3 changed files with 21 additions and 4 deletions

View file

@ -87,6 +87,16 @@ struct p2p_go_neg_results {
*/
size_t ssid_len;
/**
* psk - WPA pre-shared key (256 bits) (GO only)
*/
u8 psk[32];
/**
* psk_set - Whether PSK field is configured (GO only)
*/
int psk_set;
/**
* passphrase - WPA2-Personal passphrase for the group (GO only)
*/