aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 002db646ae0b..963238c89080 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -347,6 +347,7 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
347{ 347{
348 u32 mask; 348 u32 mask;
349 u16 reg; 349 u16 reg;
350 enum cipher curr_cipher;
350 351
351 if (crypto->cmd == SET_KEY) { 352 if (crypto->cmd == SET_KEY) {
352 /* 353 /*
@@ -357,6 +358,7 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
357 mask = TXRX_CSR0_KEY_ID.bit_mask; 358 mask = TXRX_CSR0_KEY_ID.bit_mask;
358 359
359 rt2500usb_register_read(rt2x00dev, TXRX_CSR0, &reg); 360 rt2500usb_register_read(rt2x00dev, TXRX_CSR0, &reg);
361 curr_cipher = rt2x00_get_field16(reg, TXRX_CSR0_ALGORITHM);
360 reg &= mask; 362 reg &= mask;
361 363
362 if (reg && reg == mask) 364 if (reg && reg == mask)
@@ -365,6 +367,14 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
365 reg = rt2x00_get_field16(reg, TXRX_CSR0_KEY_ID); 367 reg = rt2x00_get_field16(reg, TXRX_CSR0_KEY_ID);
366 368
367 key->hw_key_idx += reg ? ffz(reg) : 0; 369 key->hw_key_idx += reg ? ffz(reg) : 0;
370 /*
371 * Hardware requires that all keys use the same cipher
372 * (e.g. TKIP-only, AES-only, but not TKIP+AES).
373 * If this is not the first key, compare the cipher with the
374 * first one and fall back to SW crypto if not the same.
375 */
376 if (key->hw_key_idx > 0 && crypto->cipher != curr_cipher)
377 return -EOPNOTSUPP;
368 378
369 rt2500usb_register_multiwrite(rt2x00dev, reg, 379 rt2500usb_register_multiwrite(rt2x00dev, reg,
370 crypto->key, sizeof(crypto->key)); 380 crypto->key, sizeof(crypto->key));