Check pbkdf2_sha1() result when generating PSK from PSK file
This function can fail in theory, so check the return value. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
e7d8842e6b
commit
f5da5810c9
1 changed files with 3 additions and 4 deletions
|
@ -379,11 +379,10 @@ static int hostapd_config_read_wpa_psk(const char *fname,
|
|||
len = os_strlen(pos);
|
||||
if (len == 64 && hexstr2bin(pos, psk->psk, PMK_LEN) == 0)
|
||||
ok = 1;
|
||||
else if (len >= 8 && len < 64) {
|
||||
pbkdf2_sha1(pos, ssid->ssid, ssid->ssid_len,
|
||||
4096, psk->psk, PMK_LEN);
|
||||
else if (len >= 8 && len < 64 &&
|
||||
pbkdf2_sha1(pos, ssid->ssid, ssid->ssid_len,
|
||||
4096, psk->psk, PMK_LEN) == 0)
|
||||
ok = 1;
|
||||
}
|
||||
if (!ok) {
|
||||
wpa_printf(MSG_ERROR, "Invalid PSK '%s' on line %d in "
|
||||
"'%s'", pos, line, fname);
|
||||
|
|
Loading…
Reference in a new issue