aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/key.c')
-rw-r--r--drivers/net/wireless/ath/key.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c
index bd21a4d82085..5d465e5fcf24 100644
--- a/drivers/net/wireless/ath/key.c
+++ b/drivers/net/wireless/ath/key.c
@@ -20,7 +20,6 @@
20 20
21#include "ath.h" 21#include "ath.h"
22#include "reg.h" 22#include "reg.h"
23#include "debug.h"
24 23
25#define REG_READ (common->ops->read) 24#define REG_READ (common->ops->read)
26#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg) 25#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg)
@@ -37,8 +36,7 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry)
37 void *ah = common->ah; 36 void *ah = common->ah;
38 37
39 if (entry >= common->keymax) { 38 if (entry >= common->keymax) {
40 ath_print(common, ATH_DBG_FATAL, 39 ath_err(common, "keycache entry %u out of range\n", entry);
41 "keychache entry %u out of range\n", entry);
42 return false; 40 return false;
43 } 41 }
44 42
@@ -60,6 +58,8 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry)
60 REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0); 58 REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0);
61 REG_WRITE(ah, AR_KEYTABLE_KEY2(micentry), 0); 59 REG_WRITE(ah, AR_KEYTABLE_KEY2(micentry), 0);
62 REG_WRITE(ah, AR_KEYTABLE_KEY3(micentry), 0); 60 REG_WRITE(ah, AR_KEYTABLE_KEY3(micentry), 0);
61 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)
62 REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), 0);
63 63
64 } 64 }
65 65
@@ -67,15 +67,15 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry)
67} 67}
68EXPORT_SYMBOL(ath_hw_keyreset); 68EXPORT_SYMBOL(ath_hw_keyreset);
69 69
70bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac) 70static bool ath_hw_keysetmac(struct ath_common *common,
71 u16 entry, const u8 *mac)
71{ 72{
72 u32 macHi, macLo; 73 u32 macHi, macLo;
73 u32 unicast_flag = AR_KEYTABLE_VALID; 74 u32 unicast_flag = AR_KEYTABLE_VALID;
74 void *ah = common->ah; 75 void *ah = common->ah;
75 76
76 if (entry >= common->keymax) { 77 if (entry >= common->keymax) {
77 ath_print(common, ATH_DBG_FATAL, 78 ath_err(common, "keycache entry %u out of range\n", entry);
78 "keychache entry %u out of range\n", entry);
79 return false; 79 return false;
80 } 80 }
81 81
@@ -107,17 +107,16 @@ bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac)
107 return true; 107 return true;
108} 108}
109 109
110bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, 110static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
111 const struct ath_keyval *k, 111 const struct ath_keyval *k,
112 const u8 *mac) 112 const u8 *mac)
113{ 113{
114 void *ah = common->ah; 114 void *ah = common->ah;
115 u32 key0, key1, key2, key3, key4; 115 u32 key0, key1, key2, key3, key4;
116 u32 keyType; 116 u32 keyType;
117 117
118 if (entry >= common->keymax) { 118 if (entry >= common->keymax) {
119 ath_print(common, ATH_DBG_FATAL, 119 ath_err(common, "keycache entry %u out of range\n", entry);
120 "keycache entry %u out of range\n", entry);
121 return false; 120 return false;
122 } 121 }
123 122
@@ -127,8 +126,8 @@ bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
127 break; 126 break;
128 case ATH_CIPHER_AES_CCM: 127 case ATH_CIPHER_AES_CCM:
129 if (!(common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)) { 128 if (!(common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)) {
130 ath_print(common, ATH_DBG_ANY, 129 ath_dbg(common, ATH_DBG_ANY,
131 "AES-CCM not supported by this mac rev\n"); 130 "AES-CCM not supported by this mac rev\n");
132 return false; 131 return false;
133 } 132 }
134 keyType = AR_KEYTABLE_TYPE_CCM; 133 keyType = AR_KEYTABLE_TYPE_CCM;
@@ -136,15 +135,15 @@ bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
136 case ATH_CIPHER_TKIP: 135 case ATH_CIPHER_TKIP:
137 keyType = AR_KEYTABLE_TYPE_TKIP; 136 keyType = AR_KEYTABLE_TYPE_TKIP;
138 if (entry + 64 >= common->keymax) { 137 if (entry + 64 >= common->keymax) {
139 ath_print(common, ATH_DBG_ANY, 138 ath_dbg(common, ATH_DBG_ANY,
140 "entry %u inappropriate for TKIP\n", entry); 139 "entry %u inappropriate for TKIP\n", entry);
141 return false; 140 return false;
142 } 141 }
143 break; 142 break;
144 case ATH_CIPHER_WEP: 143 case ATH_CIPHER_WEP:
145 if (k->kv_len < WLAN_KEY_LEN_WEP40) { 144 if (k->kv_len < WLAN_KEY_LEN_WEP40) {
146 ath_print(common, ATH_DBG_ANY, 145 ath_dbg(common, ATH_DBG_ANY,
147 "WEP key length %u too small\n", k->kv_len); 146 "WEP key length %u too small\n", k->kv_len);
148 return false; 147 return false;
149 } 148 }
150 if (k->kv_len <= WLAN_KEY_LEN_WEP40) 149 if (k->kv_len <= WLAN_KEY_LEN_WEP40)
@@ -158,8 +157,7 @@ bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
158 keyType = AR_KEYTABLE_TYPE_CLR; 157 keyType = AR_KEYTABLE_TYPE_CLR;
159 break; 158 break;
160 default: 159 default:
161 ath_print(common, ATH_DBG_FATAL, 160 ath_err(common, "cipher %u not supported\n", k->kv_type);
162 "cipher %u not supported\n", k->kv_type);
163 return false; 161 return false;
164 } 162 }
165 163
@@ -340,8 +338,7 @@ static int ath_setkey_tkip(struct ath_common *common, u16 keyix, const u8 *key,
340 memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); 338 memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic));
341 if (!ath_hw_set_keycache_entry(common, keyix, hk, NULL)) { 339 if (!ath_hw_set_keycache_entry(common, keyix, hk, NULL)) {
342 /* TX MIC entry failed. No need to proceed further */ 340 /* TX MIC entry failed. No need to proceed further */
343 ath_print(common, ATH_DBG_FATAL, 341 ath_err(common, "Setting TX MIC Key Failed\n");
344 "Setting TX MIC Key Failed\n");
345 return 0; 342 return 0;
346 } 343 }
347 344