rt2x00: clear up IV's on key removal
PATCH 1/1 rt2x00: clear up IV's on key removal
After looking at code I realized that my previous fix 95844124385e ("rt2x00: clear IV's on start to fix AP mode regression") was incomplete. We can still have wrong IV's after re-keyring. To fix that, clear up IV's also on key removal.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +12 -7
@@ -1654,13 +1654,18 @@ static void rt2800_config_wcid_attr_cipher(struct rt2x00_dev *rt2x00dev, offset =MAC_IVEIV_ENTRY (key->hw_key_idx); -rt2800_register_multiread (rt2x00dev, offset, - &iveiv_entry,sizeof (iveiv_entry)); -if ((crypto->cipher ==CIPHER_TKIP ) || - (crypto->cipher ==CIPHER_TKIP_NO_MIC ) || - (crypto->cipher ==CIPHER_AES )) - iveiv_entry.iv[3 ] |=0x20 ; - iveiv_entry.iv[3 ] |= key->keyidx <<6 ; +if (crypto->cmd ==SET_KEY ) { +rt2800_register_multiread (rt2x00dev, offset, + &iveiv_entry,sizeof (iveiv_entry)); +if ((crypto->cipher ==CIPHER_TKIP ) || + (crypto->cipher ==CIPHER_TKIP_NO_MIC ) || + (crypto->cipher ==CIPHER_AES )) + iveiv_entry.iv[3 ] |=0x20 ; + iveiv_entry.iv[3 ] |= key->keyidx <<6 ; + }else { +memset (&iveiv_entry,0 ,sizeof (iveiv_entry)); + } +rt2800_register_multiwrite (rt2x00dev, offset, &iveiv_entry,sizeof (iveiv_entry)); }
Signature · 1 line
1.9.3
Quoted 41 lines · On Fri, 23 Aug 2019 14:48:03 +0200 Stanislaw Gruszka <[email protected]>…
After looking at code I realized that my previous fix
95844124385e("rt2x00: clear IV's on start to fix AP mode regression") was incomplete. We can still have wrong IV's after re-keyring. To fix that, clear up IV's also on key removal.Fixes 710e6cc1595e ("rt2800: do not nullify initialization vectordata") Signed-off-by: Stanislaw Gruszka <[email protected]>
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 19++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
(quoted diff) +0
-0
b/drivers/net/wireless/ralink/rt2x00/rt2800lib.cindexecbe78b8027b..28e2de04834e100644 ---a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c+++b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c@@ -1654,13 +1654,18 @@ static void rt2800_config_wcid_attr_cipher(structrt2x00_dev*rt2x00dev, offset =MAC_IVEIV_ENTRY(key->hw_key_idx);drivers/net/wireless/ralink/rt2x00/rt2800lib.c +3
-7-rt2800_register_multiread (rt2x00dev, offset, - &iveiv_entry,sizeof (iveiv_entry)); -if ((crypto->cipher ==CIPHER_TKIP ) || - (crypto->cipher ==CIPHER_TKIP_NO_MIC ) || - (crypto->cipher ==CIPHER_AES )) - iveiv_entry.iv[3 ] |=0x20 ; - iveiv_entry.iv[3 ] |= key->keyidx <<6 ; +if (crypto->cmd ==SET_KEY ) { + rt2800_register_multiread(rt2x00dev, offset, + &iveiv_entry,
sizeof(iveiv_entry));drivers/net/wireless/ralink/rt2x00/rt2800lib.c +9
-0+if ((crypto->cipher ==CIPHER_TKIP ) || + (crypto->cipher ==CIPHER_TKIP_NO_MIC ) || + (crypto->cipher ==CIPHER_AES )) + iveiv_entry.iv[3 ] |=0x20 ; + iveiv_entry.iv[3 ] |= key->keyidx <<6 ; + }else { +memset (&iveiv_entry,0 ,sizeof (iveiv_entry)); + } + rt2800_register_multiwrite(rt2x00dev, offset, &iveiv_entry,
Quoted 1 line
sizeof(iveiv_entry)); }
Seems to work when used with the previous patch on top of 5.3-rc6
Quoted 8 lines · Stanislaw Gruszka
After looking at code I realized that my previous fix
95844124385e("rt2x00: clear IV's on start to fix AP mode regression") was incomplete. We can still have wrong IV's after re-keyring. To fix that, clear up IV's also on key removal.Fixes 710e6cc1595e ("rt2800: do not nullify initialization vector data")Signed-off-by Stanislaw Gruszka <[email protected]>Tested-by Emil Karlson <[email protected]>
Patch applied to wireless-drivers.git, thanks.
14d5e14c8a6c rt2x00: clear up IV's on key removal
Signature · 3 lines
https://patchwork.kernel.org/patch/11111605/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches