diff options
author | Dan Williams <dcbw@redhat.com> | 2007-08-02 10:45:55 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:38 -0400 |
commit | 1443b6530d8db779082dc9fabbd894e2b551b101 (patch) | |
tree | 076a7d53d86b829ac1087df4a2f23b252c6648f3 /drivers/net | |
parent | 0c9ca690e0117e1bf415d5f3e392e27c0c472c68 (diff) |
[PATCH] libertas: rename WLAN_802_11_KEY to enc_key and clean up usage
It doesn't touch hardware and therefore doesn't need endian notations
either.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/defs.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/fw.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/hostcmd.h | 16 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/wext.c | 14 |
8 files changed, 37 insertions, 44 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index afd5617dd92b..307ebcb94b18 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -307,7 +307,7 @@ static int assoc_helper_wep_keys(wlan_private *priv, | |||
307 | /* Copy WEP keys into adapter wep key fields */ | 307 | /* Copy WEP keys into adapter wep key fields */ |
308 | for (i = 0; i < 4; i++) { | 308 | for (i = 0; i < 4; i++) { |
309 | memcpy(&adapter->wep_keys[i], &assoc_req->wep_keys[i], | 309 | memcpy(&adapter->wep_keys[i], &assoc_req->wep_keys[i], |
310 | sizeof(struct WLAN_802_11_KEY)); | 310 | sizeof(struct enc_key)); |
311 | } | 311 | } |
312 | adapter->wep_tx_keyidx = assoc_req->wep_tx_keyidx; | 312 | adapter->wep_tx_keyidx = assoc_req->wep_tx_keyidx; |
313 | 313 | ||
@@ -703,7 +703,7 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) | |||
703 | int i; | 703 | int i; |
704 | for (i = 0; i < 4; i++) { | 704 | for (i = 0; i < 4; i++) { |
705 | memcpy(&assoc_req->wep_keys[i], &adapter->wep_keys[i], | 705 | memcpy(&assoc_req->wep_keys[i], &adapter->wep_keys[i], |
706 | sizeof(struct WLAN_802_11_KEY)); | 706 | sizeof(struct enc_key)); |
707 | } | 707 | } |
708 | } | 708 | } |
709 | 709 | ||
@@ -712,12 +712,12 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter) | |||
712 | 712 | ||
713 | if (!test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) { | 713 | if (!test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) { |
714 | memcpy(&assoc_req->wpa_mcast_key, &adapter->wpa_mcast_key, | 714 | memcpy(&assoc_req->wpa_mcast_key, &adapter->wpa_mcast_key, |
715 | sizeof(struct WLAN_802_11_KEY)); | 715 | sizeof(struct enc_key)); |
716 | } | 716 | } |
717 | 717 | ||
718 | if (!test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { | 718 | if (!test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { |
719 | memcpy(&assoc_req->wpa_unicast_key, &adapter->wpa_unicast_key, | 719 | memcpy(&assoc_req->wpa_unicast_key, &adapter->wpa_unicast_key, |
720 | sizeof(struct WLAN_802_11_KEY)); | 720 | sizeof(struct enc_key)); |
721 | } | 721 | } |
722 | 722 | ||
723 | if (!test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { | 723 | if (!test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 4a8f5dc70239..355a3960323b 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -181,7 +181,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
181 | 181 | ||
182 | /* Copy key types and material to host command structure */ | 182 | /* Copy key types and material to host command structure */ |
183 | for (i = 0; i < 4; i++) { | 183 | for (i = 0; i < 4; i++) { |
184 | struct WLAN_802_11_KEY * pkey = &assoc_req->wep_keys[i]; | 184 | struct enc_key * pkey = &assoc_req->wep_keys[i]; |
185 | 185 | ||
186 | switch (pkey->len) { | 186 | switch (pkey->len) { |
187 | case KEY_LEN_WEP_40: | 187 | case KEY_LEN_WEP_40: |
@@ -249,10 +249,8 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, | |||
249 | 249 | ||
250 | 250 | ||
251 | static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, | 251 | static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, |
252 | struct WLAN_802_11_KEY * pkey) | 252 | struct enc_key * pkey) |
253 | { | 253 | { |
254 | pkeyparamset->keytypeid = cpu_to_le16(pkey->type); | ||
255 | |||
256 | if (pkey->flags & KEY_INFO_WPA_ENABLED) { | 254 | if (pkey->flags & KEY_INFO_WPA_ENABLED) { |
257 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED); | 255 | pkeyparamset->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED); |
258 | } | 256 | } |
@@ -264,6 +262,7 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, | |||
264 | } | 262 | } |
265 | 263 | ||
266 | pkeyparamset->type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL); | 264 | pkeyparamset->type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL); |
265 | pkeyparamset->keytypeid = cpu_to_le16(pkey->type); | ||
267 | pkeyparamset->keylen = cpu_to_le16(pkey->len); | 266 | pkeyparamset->keylen = cpu_to_le16(pkey->len); |
268 | memcpy(pkeyparamset->key, pkey->key, pkey->len); | 267 | memcpy(pkeyparamset->key, pkey->key, pkey->len); |
269 | pkeyparamset->length = cpu_to_le16( sizeof(pkeyparamset->keytypeid) | 268 | pkeyparamset->length = cpu_to_le16( sizeof(pkeyparamset->keytypeid) |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 6ac0d4752fa4..89bd43c2efa3 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -321,11 +321,12 @@ static int wlan_ret_802_11_key_material(wlan_private * priv, | |||
321 | while (buf_ptr < resp_end) { | 321 | while (buf_ptr < resp_end) { |
322 | struct MrvlIEtype_keyParamSet * pkeyparamset = | 322 | struct MrvlIEtype_keyParamSet * pkeyparamset = |
323 | (struct MrvlIEtype_keyParamSet *) buf_ptr; | 323 | (struct MrvlIEtype_keyParamSet *) buf_ptr; |
324 | struct WLAN_802_11_KEY * pkey; | 324 | struct enc_key * pkey; |
325 | u16 key_info = le16_to_cpu(pkeyparamset->keyinfo); | ||
326 | u16 param_set_len = le16_to_cpu(pkeyparamset->length); | 325 | u16 param_set_len = le16_to_cpu(pkeyparamset->length); |
327 | u8 * end; | ||
328 | u16 key_len = le16_to_cpu(pkeyparamset->keylen); | 326 | u16 key_len = le16_to_cpu(pkeyparamset->keylen); |
327 | u16 key_flags = le16_to_cpu(pkeyparamset->keyinfo); | ||
328 | u16 key_type = le16_to_cpu(pkeyparamset->keytypeid); | ||
329 | u8 * end; | ||
329 | 330 | ||
330 | end = (u8 *) pkeyparamset + sizeof (pkeyparamset->type) | 331 | end = (u8 *) pkeyparamset + sizeof (pkeyparamset->type) |
331 | + sizeof (pkeyparamset->length) | 332 | + sizeof (pkeyparamset->length) |
@@ -334,20 +335,20 @@ static int wlan_ret_802_11_key_material(wlan_private * priv, | |||
334 | if (end > resp_end) | 335 | if (end > resp_end) |
335 | break; | 336 | break; |
336 | 337 | ||
337 | if (key_info & KEY_INFO_WPA_UNICAST) | 338 | if (key_flags & KEY_INFO_WPA_UNICAST) |
338 | pkey = &adapter->wpa_unicast_key; | 339 | pkey = &adapter->wpa_unicast_key; |
339 | else if (key_info & KEY_INFO_WPA_MCAST) | 340 | else if (key_flags & KEY_INFO_WPA_MCAST) |
340 | pkey = &adapter->wpa_mcast_key; | 341 | pkey = &adapter->wpa_mcast_key; |
341 | else | 342 | else |
342 | break; | 343 | break; |
343 | 344 | ||
344 | /* Copy returned key into driver */ | 345 | /* Copy returned key into driver */ |
345 | memset(pkey, 0, sizeof(struct WLAN_802_11_KEY)); | 346 | memset(pkey, 0, sizeof(struct enc_key)); |
346 | if (key_len > sizeof(pkey->key)) | 347 | if (key_len > sizeof(pkey->key)) |
347 | break; | 348 | break; |
348 | pkey->type = le16_to_cpu(pkeyparamset->keytypeid); | 349 | pkey->type = key_type; |
349 | pkey->flags = le16_to_cpu(pkeyparamset->keyinfo); | 350 | pkey->flags = key_flags; |
350 | pkey->len = le16_to_cpu(pkeyparamset->keylen); | 351 | pkey->len = key_len; |
351 | memcpy(pkey->key, pkeyparamset->key, pkey->len); | 352 | memcpy(pkey->key, pkeyparamset->key, pkey->len); |
352 | 353 | ||
353 | buf_ptr = end + 1; | 354 | buf_ptr = end + 1; |
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 4dd43e59bda0..de0756ee15ad 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -218,9 +218,6 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) | |||
218 | #define CMD_F_HOSTCMD (1 << 0) | 218 | #define CMD_F_HOSTCMD (1 << 0) |
219 | #define FW_CAPINFO_WPA (1 << 0) | 219 | #define FW_CAPINFO_WPA (1 << 0) |
220 | 220 | ||
221 | /** WPA key LENGTH*/ | ||
222 | #define MRVL_MAX_KEY_WPA_KEY_LENGTH 32 | ||
223 | |||
224 | #define KEY_LEN_WPA_AES 16 | 221 | #define KEY_LEN_WPA_AES 16 |
225 | #define KEY_LEN_WPA_TKIP 32 | 222 | #define KEY_LEN_WPA_TKIP 32 |
226 | #define KEY_LEN_WEP_104 13 | 223 | #define KEY_LEN_WEP_104 13 |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 675c65dbc070..184eee548572 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -188,12 +188,12 @@ struct assoc_request { | |||
188 | u8 bssid[ETH_ALEN]; | 188 | u8 bssid[ETH_ALEN]; |
189 | 189 | ||
190 | /** WEP keys */ | 190 | /** WEP keys */ |
191 | struct WLAN_802_11_KEY wep_keys[4]; | 191 | struct enc_key wep_keys[4]; |
192 | u16 wep_tx_keyidx; | 192 | u16 wep_tx_keyidx; |
193 | 193 | ||
194 | /** WPA keys */ | 194 | /** WPA keys */ |
195 | struct WLAN_802_11_KEY wpa_mcast_key; | 195 | struct enc_key wpa_mcast_key; |
196 | struct WLAN_802_11_KEY wpa_unicast_key; | 196 | struct enc_key wpa_unicast_key; |
197 | 197 | ||
198 | struct wlan_802_11_security secinfo; | 198 | struct wlan_802_11_security secinfo; |
199 | 199 | ||
@@ -335,12 +335,12 @@ struct _wlan_adapter { | |||
335 | struct wlan_802_11_security secinfo; | 335 | struct wlan_802_11_security secinfo; |
336 | 336 | ||
337 | /** WEP keys */ | 337 | /** WEP keys */ |
338 | struct WLAN_802_11_KEY wep_keys[4]; | 338 | struct enc_key wep_keys[4]; |
339 | u16 wep_tx_keyidx; | 339 | u16 wep_tx_keyidx; |
340 | 340 | ||
341 | /** WPA keys */ | 341 | /** WPA keys */ |
342 | struct WLAN_802_11_KEY wpa_mcast_key; | 342 | struct enc_key wpa_mcast_key; |
343 | struct WLAN_802_11_KEY wpa_unicast_key; | 343 | struct enc_key wpa_unicast_key; |
344 | 344 | ||
345 | /** WPA Information Elements*/ | 345 | /** WPA Information Elements*/ |
346 | u8 wpa_ie[MAX_WPA_IE_LEN]; | 346 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c index 6c2b3c25b821..288e47c33555 100644 --- a/drivers/net/wireless/libertas/fw.c +++ b/drivers/net/wireless/libertas/fw.c | |||
@@ -181,7 +181,7 @@ static void wlan_init_adapter(wlan_private * priv) | |||
181 | adapter->secinfo.wep_enabled = 0; | 181 | adapter->secinfo.wep_enabled = 0; |
182 | for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]); | 182 | for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]); |
183 | i++) | 183 | i++) |
184 | memset(&adapter->wep_keys[i], 0, sizeof(struct WLAN_802_11_KEY)); | 184 | memset(&adapter->wep_keys[i], 0, sizeof(struct enc_key)); |
185 | adapter->wep_tx_keyidx = 0; | 185 | adapter->wep_tx_keyidx = 0; |
186 | adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; | 186 | adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; |
187 | adapter->mode = IW_MODE_INFRA; | 187 | adapter->mode = IW_MODE_INFRA; |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 1322552fa6c9..01a97d0fa98a 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -83,16 +83,12 @@ struct cmd_ctrl_node { | |||
83 | wait_queue_head_t cmdwait_q; | 83 | wait_queue_head_t cmdwait_q; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | /* WLAN_802_11_KEY | 86 | /* Generic structure to hold all key types. */ |
87 | * | 87 | struct enc_key { |
88 | * Generic structure to hold all key types. key type (WEP40, WEP104, TKIP, AES) | 88 | u16 len; |
89 | * is determined from the keylength field. | 89 | u16 flags; /* KEY_INFO_* from wlan_defs.h */ |
90 | */ | 90 | u16 type; /* KEY_TYPE_* from wlan_defs.h */ |
91 | struct WLAN_802_11_KEY { | 91 | u8 key[32]; |
92 | __le32 len; | ||
93 | __le32 flags; /* KEY_INFO_* from wlan_defs.h */ | ||
94 | u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH]; | ||
95 | __le16 type; /* KEY_TYPE_* from wlan_defs.h */ | ||
96 | }; | 92 | }; |
97 | 93 | ||
98 | struct IE_WPA { | 94 | struct IE_WPA { |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index 2fcc3bf21081..f7df8c71a544 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -1325,7 +1325,7 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req, | |||
1325 | int set_tx_key) | 1325 | int set_tx_key) |
1326 | { | 1326 | { |
1327 | int ret = 0; | 1327 | int ret = 0; |
1328 | struct WLAN_802_11_KEY *pkey; | 1328 | struct enc_key *pkey; |
1329 | 1329 | ||
1330 | lbs_deb_enter(LBS_DEB_WEXT); | 1330 | lbs_deb_enter(LBS_DEB_WEXT); |
1331 | 1331 | ||
@@ -1344,7 +1344,7 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req, | |||
1344 | pkey = &assoc_req->wep_keys[index]; | 1344 | pkey = &assoc_req->wep_keys[index]; |
1345 | 1345 | ||
1346 | if (key_length > 0) { | 1346 | if (key_length > 0) { |
1347 | memset(pkey, 0, sizeof(struct WLAN_802_11_KEY)); | 1347 | memset(pkey, 0, sizeof(struct enc_key)); |
1348 | pkey->type = KEY_TYPE_ID_WEP; | 1348 | pkey->type = KEY_TYPE_ID_WEP; |
1349 | 1349 | ||
1350 | /* Standardize the key length */ | 1350 | /* Standardize the key length */ |
@@ -1412,11 +1412,11 @@ static void disable_wpa(struct assoc_request *assoc_req) | |||
1412 | { | 1412 | { |
1413 | lbs_deb_enter(LBS_DEB_WEXT); | 1413 | lbs_deb_enter(LBS_DEB_WEXT); |
1414 | 1414 | ||
1415 | memset(&assoc_req->wpa_mcast_key, 0, sizeof (struct WLAN_802_11_KEY)); | 1415 | memset(&assoc_req->wpa_mcast_key, 0, sizeof (struct enc_key)); |
1416 | assoc_req->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST; | 1416 | assoc_req->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST; |
1417 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); | 1417 | set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); |
1418 | 1418 | ||
1419 | memset(&assoc_req->wpa_unicast_key, 0, sizeof (struct WLAN_802_11_KEY)); | 1419 | memset(&assoc_req->wpa_unicast_key, 0, sizeof (struct enc_key)); |
1420 | assoc_req->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST; | 1420 | assoc_req->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST; |
1421 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | 1421 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); |
1422 | 1422 | ||
@@ -1567,7 +1567,7 @@ static int wlan_get_encodeext(struct net_device *dev, | |||
1567 | && (adapter->secinfo.WPAenabled || | 1567 | && (adapter->secinfo.WPAenabled || |
1568 | adapter->secinfo.WPA2enabled)) { | 1568 | adapter->secinfo.WPA2enabled)) { |
1569 | /* WPA */ | 1569 | /* WPA */ |
1570 | struct WLAN_802_11_KEY * pkey = NULL; | 1570 | struct enc_key * pkey = NULL; |
1571 | 1571 | ||
1572 | if ( adapter->wpa_mcast_key.len | 1572 | if ( adapter->wpa_mcast_key.len |
1573 | && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) | 1573 | && (adapter->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) |
@@ -1679,7 +1679,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1679 | if (set_tx_key) | 1679 | if (set_tx_key) |
1680 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); | 1680 | set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); |
1681 | } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { | 1681 | } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { |
1682 | struct WLAN_802_11_KEY * pkey; | 1682 | struct enc_key * pkey; |
1683 | 1683 | ||
1684 | /* validate key length */ | 1684 | /* validate key length */ |
1685 | if (((alg == IW_ENCODE_ALG_TKIP) | 1685 | if (((alg == IW_ENCODE_ALG_TKIP) |
@@ -1702,7 +1702,7 @@ static int wlan_set_encodeext(struct net_device *dev, | |||
1702 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); | 1702 | set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); |
1703 | } | 1703 | } |
1704 | 1704 | ||
1705 | memset(pkey, 0, sizeof (struct WLAN_802_11_KEY)); | 1705 | memset(pkey, 0, sizeof (struct enc_key)); |
1706 | memcpy(pkey->key, ext->key, ext->key_len); | 1706 | memcpy(pkey->key, ext->key, ext->key_len); |
1707 | pkey->len = ext->key_len; | 1707 | pkey->len = ext->key_len; |
1708 | if (pkey->len) | 1708 | if (pkey->len) |