mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
network: Be extra pedantic in network_get_psk
Check that the passphrase to PSK conversion actually succeeds.
This commit is contained in:
parent
a043f26134
commit
5dbccee798
@ -253,14 +253,15 @@ const uint8_t *network_get_psk(struct network *network)
|
||||
if (network->psk)
|
||||
return network->psk;
|
||||
|
||||
if (!network->passphrase)
|
||||
return NULL;
|
||||
|
||||
network->psk = l_malloc(32);
|
||||
|
||||
crypto_psk_from_passphrase(network->passphrase,
|
||||
if (crypto_psk_from_passphrase(network->passphrase,
|
||||
(unsigned char *)network->ssid,
|
||||
strlen(network->ssid), network->psk);
|
||||
strlen(network->ssid),
|
||||
network->psk) < 0) {
|
||||
l_free(network->psk);
|
||||
network->psk = NULL;
|
||||
}
|
||||
|
||||
return network->psk;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user