diff options
author | Daniel Drake <dsd@gentoo.org> | 2006-06-01 10:34:26 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-06-05 15:51:29 -0400 |
commit | 76ea4c7f4cd319dee35934ecab57745feae58fa5 (patch) | |
tree | 6151f9d89084a1e96f216a182ed3fc265dffd429 /net/ieee80211/softmac/ieee80211softmac_io.c | |
parent | 47fbe1bf3980b41d2e18e3774e8e1094f716d2d1 (diff) |
[PATCH] softmac: complete shared key authentication
This patch finishes of the partially-complete shared key authentication
implementation in softmac.
The complication here is that we need to encrypt a management frame during
the authentication process. I don't think there are any other scenarios where
this would have to happen.
To get around this without causing too many headaches, we decided to just use
software encryption for this frame. The softmac config option now selects
IEEE80211_CRYPT_WEP so that we can ensure this available. This also involved
a modification to some otherwise unused ieee80211 API.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/ieee80211/softmac/ieee80211softmac_io.c')
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_io.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c index 7b9e78d39598..44f51175a2fc 100644 --- a/net/ieee80211/softmac/ieee80211softmac_io.c +++ b/net/ieee80211/softmac/ieee80211softmac_io.c | |||
@@ -268,26 +268,27 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt, | |||
268 | static u32 | 268 | static u32 |
269 | ieee80211softmac_auth(struct ieee80211_auth **pkt, | 269 | ieee80211softmac_auth(struct ieee80211_auth **pkt, |
270 | struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, | 270 | struct ieee80211softmac_device *mac, struct ieee80211softmac_network *net, |
271 | u16 transaction, u16 status) | 271 | u16 transaction, u16 status, int *encrypt_mpdu) |
272 | { | 272 | { |
273 | u8 *data; | 273 | u8 *data; |
274 | int auth_mode = mac->ieee->sec.auth_mode; | ||
275 | int is_shared_response = (auth_mode == WLAN_AUTH_SHARED_KEY | ||
276 | && transaction == IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE); | ||
277 | |||
274 | /* Allocate Packet */ | 278 | /* Allocate Packet */ |
275 | (*pkt) = (struct ieee80211_auth *)ieee80211softmac_alloc_mgt( | 279 | (*pkt) = (struct ieee80211_auth *)ieee80211softmac_alloc_mgt( |
276 | 2 + /* Auth Algorithm */ | 280 | 2 + /* Auth Algorithm */ |
277 | 2 + /* Auth Transaction Seq */ | 281 | 2 + /* Auth Transaction Seq */ |
278 | 2 + /* Status Code */ | 282 | 2 + /* Status Code */ |
279 | /* Challenge Text IE */ | 283 | /* Challenge Text IE */ |
280 | mac->ieee->open_wep ? 0 : | 284 | is_shared_response ? 0 : 1 + 1 + net->challenge_len |
281 | 1 + 1 + WLAN_AUTH_CHALLENGE_LEN | 285 | ); |
282 | ); | ||
283 | if (unlikely((*pkt) == NULL)) | 286 | if (unlikely((*pkt) == NULL)) |
284 | return 0; | 287 | return 0; |
285 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid); | 288 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_AUTH, net->bssid, net->bssid); |
286 | 289 | ||
287 | /* Algorithm */ | 290 | /* Algorithm */ |
288 | (*pkt)->algorithm = mac->ieee->open_wep ? | 291 | (*pkt)->algorithm = cpu_to_le16(auth_mode); |
289 | cpu_to_le16(WLAN_AUTH_OPEN) : | ||
290 | cpu_to_le16(WLAN_AUTH_SHARED_KEY); | ||
291 | /* Transaction */ | 292 | /* Transaction */ |
292 | (*pkt)->transaction = cpu_to_le16(transaction); | 293 | (*pkt)->transaction = cpu_to_le16(transaction); |
293 | /* Status */ | 294 | /* Status */ |
@@ -295,18 +296,20 @@ ieee80211softmac_auth(struct ieee80211_auth **pkt, | |||
295 | 296 | ||
296 | data = (u8 *)(*pkt)->info_element; | 297 | data = (u8 *)(*pkt)->info_element; |
297 | /* Challenge Text */ | 298 | /* Challenge Text */ |
298 | if(!mac->ieee->open_wep){ | 299 | if (is_shared_response) { |
299 | *data = MFIE_TYPE_CHALLENGE; | 300 | *data = MFIE_TYPE_CHALLENGE; |
300 | data++; | 301 | data++; |
301 | 302 | ||
302 | /* Copy the challenge in */ | 303 | /* Copy the challenge in */ |
303 | // *data = challenge length | 304 | *data = net->challenge_len; |
304 | // data += sizeof(u16); | 305 | data++; |
305 | // memcpy(data, challenge, challenge length); | 306 | memcpy(data, net->challenge, net->challenge_len); |
306 | // data += challenge length; | 307 | data += net->challenge_len; |
307 | 308 | ||
308 | /* Add the full size to the packet length */ | 309 | /* Make sure this frame gets encrypted with the shared key */ |
309 | } | 310 | *encrypt_mpdu = 1; |
311 | } else | ||
312 | *encrypt_mpdu = 0; | ||
310 | 313 | ||
311 | /* Return the packet size */ | 314 | /* Return the packet size */ |
312 | return (data - (u8 *)(*pkt)); | 315 | return (data - (u8 *)(*pkt)); |
@@ -396,6 +399,7 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | |||
396 | { | 399 | { |
397 | void *pkt = NULL; | 400 | void *pkt = NULL; |
398 | u32 pkt_size = 0; | 401 | u32 pkt_size = 0; |
402 | int encrypt_mpdu = 0; | ||
399 | 403 | ||
400 | switch(type) { | 404 | switch(type) { |
401 | case IEEE80211_STYPE_ASSOC_REQ: | 405 | case IEEE80211_STYPE_ASSOC_REQ: |
@@ -405,7 +409,7 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | |||
405 | pkt_size = ieee80211softmac_reassoc_req((struct ieee80211_reassoc_request **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg); | 409 | pkt_size = ieee80211softmac_reassoc_req((struct ieee80211_reassoc_request **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg); |
406 | break; | 410 | break; |
407 | case IEEE80211_STYPE_AUTH: | 411 | case IEEE80211_STYPE_AUTH: |
408 | pkt_size = ieee80211softmac_auth((struct ieee80211_auth **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg, (u16)(arg & 0xFFFF), (u16) (arg >> 16)); | 412 | pkt_size = ieee80211softmac_auth((struct ieee80211_auth **)(&pkt), mac, (struct ieee80211softmac_network *)ptrarg, (u16)(arg & 0xFFFF), (u16) (arg >> 16), &encrypt_mpdu); |
409 | break; | 413 | break; |
410 | case IEEE80211_STYPE_DISASSOC: | 414 | case IEEE80211_STYPE_DISASSOC: |
411 | case IEEE80211_STYPE_DEAUTH: | 415 | case IEEE80211_STYPE_DEAUTH: |
@@ -434,7 +438,8 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | |||
434 | * or get rid of it alltogether? | 438 | * or get rid of it alltogether? |
435 | * Does this work for you now? | 439 | * Does this work for you now? |
436 | */ | 440 | */ |
437 | ieee80211_tx_frame(mac->ieee, (struct ieee80211_hdr *)pkt, pkt_size); | 441 | ieee80211_tx_frame(mac->ieee, (struct ieee80211_hdr *)pkt, |
442 | IEEE80211_3ADDR_LEN, pkt_size, encrypt_mpdu); | ||
438 | 443 | ||
439 | kfree(pkt); | 444 | kfree(pkt); |
440 | return 0; | 445 | return 0; |