Skip to content

Commit e9f41e3

Browse files
committed
brcmfmac: cfg80211: Pass the PMK in binary instead of hex
Apparently the hex passphrase mechanism does not work on newer chips/firmware (e.g. BCM4387). It seems there was a simple way of passing it in binary all along, so use that and avoid the hexification. OpenBSD has been doing it like this from the beginning, so this should work on all chips. Also clear the structure before setting the PMK. This was leaking uninitialized stack contents to the device. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent 289c1cd commit e9f41e3

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,13 +1690,14 @@ static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
16901690
{
16911691
struct brcmf_pub *drvr = ifp->drvr;
16921692
struct brcmf_wsec_pmk_le pmk;
1693-
int i, err;
1693+
int err;
1694+
1695+
memset(&pmk, 0, sizeof(pmk));
16941696

1695-
/* convert to firmware key format */
1696-
pmk.key_len = cpu_to_le16(pmk_len << 1);
1697-
pmk.flags = cpu_to_le16(BRCMF_WSEC_PASSPHRASE);
1698-
for (i = 0; i < pmk_len; i++)
1699-
snprintf(&pmk.key[2 * i], 3, "%02x", pmk_data[i]);
1697+
/* pass pmk directly */
1698+
pmk.key_len = cpu_to_le16(pmk_len);
1699+
pmk.flags = cpu_to_le16(0);
1700+
memcpy(pmk.key, pmk_data, pmk_len);
17001701

17011702
/* store psk in firmware */
17021703
err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,

0 commit comments

Comments
 (0)