10/16/2012

Can not connection to Softap for security

Kernel : 2.6.37

WiFi module : WG7310 ( Inside WL127x )

在Android Jelly Bean 底下,當打開hostspot時,發現只能連接OPEN方式,任何加密都無法被連接上。

起初以為是自己從ICS移稙到JB時,Frameworks出了問題,結果不是。

底下是錯誤的log :

D/hostapd ( 2058): random: Got 5/20 bytes from /dev/random
I/hostapd ( 2058): random: Only 5/20 bytes of strong random data available from /dev/random
I/hostapd ( 2058): random: Not enough entropy pool available for secure operations
I/hostapd ( 2058): WPA: Not enough entropy in random pool for secure operations - update keys later when the first station connects
D/hostapd ( 2058): GMK - hexdump(len=32): [REMOVED]
D/hostapd ( 2058): Key Counter - hexdump(len=32): [REMOVED]
D/hostapd ( 2058): WPA: Delay group state machine start until Beacon frames have been configured
D/hostapd ( 2058): WPS: Building WPS IE for (Re)Association Response
D/hostapd ( 2058): WPS:  * Version (hardcoded 0x10)
D/hostapd ( 2058): WPS:  * Response Type (3)
D/hostapd ( 2058): WPS:  * Version2 (0x20)
D/hostapd ( 2058): nl80211: Set beacon (beacon_set=0)
D/hostapd ( 2058): WPA: Start group state machine to set initial keys
D/hostapd ( 2058): WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
D/hostapd ( 2058): GTK - hexdump(len=16): [REMOVED]
D/hostapd ( 2058): WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
D/hostapd ( 2058): wpa_driver_nl80211_set_key: ifindex=6 alg=3 addr=0x4006f0f1 key_idx=1 set_tx=1 seq_len=0 key_len=16
D/hostapd ( 2058):    broadcast key
D/hostapd ( 2058): nl80211: set_key failed; err=-2 No such file or directory)
D/hostapd ( 2058): wpa_driver_nl80211_set_operstate: operstate 0->1 (UP)

一直以為是TI的wpa_supplicant出了問題....結果竟然也不是 !

原來是kernel的某個config沒被打開,造成hostapd去產生一個隨機的dummy key時錯誤,wpa_supplicant去set key時自然會fail...

不清楚是不是所有的secure key都會通過 "/dev/random"  去對kernel做儲存,但就目前SoftAP而言,wpa_supplicant都是透過這種方式去儲存和產生所有的key number.  (STA就不知道了....)

在kernel config 把 "CONFIG_CRYPTO_ANSI_CPRNG" 打開就可以解決該問題了  !