diff options
author | James Ketrenos <jketreno@linux.intel.com> | 2005-09-21 12:53:54 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-21 23:01:52 -0400 |
commit | f1bf6638af9e9bbbb6fb0b769054fb7db1ae652f (patch) | |
tree | 5cf2dca63f88c1709ae8ee9d913c7f819bfc6ce8 /net/ieee80211/ieee80211_wx.c | |
parent | 20d64713ae71c0b0aa06084acbef2244021baaca (diff) |
[PATCH] ieee80211: Hardware crypto and fragmentation offload support
tree 5322d496af90d03ffbec27292dc1a6268a746ede
parent 6c9364386ccb786e4a84427ab3ad712f0b7b8904
author James Ketrenos <jketreno@linux.intel.com> 1124432367 -0500
committer James Ketrenos <jketreno@linux.intel.com> 1127311810 -0500
Hardware crypto and fragmentation offload support added (Zhu Yi)
Signed-off-by: James Ketrenos <jketreno@linux.intel.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'net/ieee80211/ieee80211_wx.c')
-rw-r--r-- | net/ieee80211/ieee80211_wx.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index fc4e1377aba7..f88c8116a23c 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -278,6 +278,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
278 | }; | 278 | }; |
279 | int i, key, key_provided, len; | 279 | int i, key, key_provided, len; |
280 | struct ieee80211_crypt_data **crypt; | 280 | struct ieee80211_crypt_data **crypt; |
281 | int host_crypto = ieee->host_encrypt || ieee->host_decrypt; | ||
281 | 282 | ||
282 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); | 283 | IEEE80211_DEBUG_WX("SET_ENCODE\n"); |
283 | 284 | ||
@@ -318,6 +319,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
318 | 319 | ||
319 | if (i == WEP_KEYS) { | 320 | if (i == WEP_KEYS) { |
320 | sec.enabled = 0; | 321 | sec.enabled = 0; |
322 | sec.encrypt = 0; | ||
321 | sec.level = SEC_LEVEL_0; | 323 | sec.level = SEC_LEVEL_0; |
322 | sec.flags |= SEC_ENABLED | SEC_LEVEL; | 324 | sec.flags |= SEC_ENABLED | SEC_LEVEL; |
323 | } | 325 | } |
@@ -326,6 +328,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
326 | } | 328 | } |
327 | 329 | ||
328 | sec.enabled = 1; | 330 | sec.enabled = 1; |
331 | sec.encrypt = 1; | ||
329 | sec.flags |= SEC_ENABLED; | 332 | sec.flags |= SEC_ENABLED; |
330 | 333 | ||
331 | if (*crypt != NULL && (*crypt)->ops != NULL && | 334 | if (*crypt != NULL && (*crypt)->ops != NULL && |
@@ -335,7 +338,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
335 | ieee80211_crypt_delayed_deinit(ieee, crypt); | 338 | ieee80211_crypt_delayed_deinit(ieee, crypt); |
336 | } | 339 | } |
337 | 340 | ||
338 | if (*crypt == NULL) { | 341 | if (*crypt == NULL && host_crypto) { |
339 | struct ieee80211_crypt_data *new_crypt; | 342 | struct ieee80211_crypt_data *new_crypt; |
340 | 343 | ||
341 | /* take WEP into use */ | 344 | /* take WEP into use */ |
@@ -375,31 +378,34 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
375 | key, escape_essid(sec.keys[key], len), | 378 | key, escape_essid(sec.keys[key], len), |
376 | erq->length, len); | 379 | erq->length, len); |
377 | sec.key_sizes[key] = len; | 380 | sec.key_sizes[key] = len; |
378 | (*crypt)->ops->set_key(sec.keys[key], len, NULL, | 381 | if (*crypt) |
379 | (*crypt)->priv); | 382 | (*crypt)->ops->set_key(sec.keys[key], len, NULL, |
383 | (*crypt)->priv); | ||
380 | sec.flags |= (1 << key); | 384 | sec.flags |= (1 << key); |
381 | /* This ensures a key will be activated if no key is | 385 | /* This ensures a key will be activated if no key is |
382 | * explicitely set */ | 386 | * explicitely set */ |
383 | if (key == sec.active_key) | 387 | if (key == sec.active_key) |
384 | sec.flags |= SEC_ACTIVE_KEY; | 388 | sec.flags |= SEC_ACTIVE_KEY; |
389 | |||
385 | } else { | 390 | } else { |
386 | len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, | 391 | if (host_crypto) { |
387 | NULL, (*crypt)->priv); | 392 | len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, |
388 | if (len == 0) { | 393 | NULL, (*crypt)->priv); |
389 | /* Set a default key of all 0 */ | 394 | if (len == 0) { |
390 | IEEE80211_DEBUG_WX("Setting key %d to all zero.\n", | 395 | /* Set a default key of all 0 */ |
391 | key); | 396 | IEEE80211_DEBUG_WX("Setting key %d to all " |
392 | memset(sec.keys[key], 0, 13); | 397 | "zero.\n", key); |
393 | (*crypt)->ops->set_key(sec.keys[key], 13, NULL, | 398 | memset(sec.keys[key], 0, 13); |
394 | (*crypt)->priv); | 399 | (*crypt)->ops->set_key(sec.keys[key], 13, NULL, |
395 | sec.key_sizes[key] = 13; | 400 | (*crypt)->priv); |
396 | sec.flags |= (1 << key); | 401 | sec.key_sizes[key] = 13; |
402 | sec.flags |= (1 << key); | ||
403 | } | ||
397 | } | 404 | } |
398 | |||
399 | /* No key data - just set the default TX key index */ | 405 | /* No key data - just set the default TX key index */ |
400 | if (key_provided) { | 406 | if (key_provided) { |
401 | IEEE80211_DEBUG_WX | 407 | IEEE80211_DEBUG_WX("Setting key %d to default Tx " |
402 | ("Setting key %d to default Tx key.\n", key); | 408 | "key.\n", key); |
403 | ieee->tx_keyidx = key; | 409 | ieee->tx_keyidx = key; |
404 | sec.active_key = key; | 410 | sec.active_key = key; |
405 | sec.flags |= SEC_ACTIVE_KEY; | 411 | sec.flags |= SEC_ACTIVE_KEY; |
@@ -442,6 +448,7 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | |||
442 | struct iw_point *erq = &(wrqu->encoding); | 448 | struct iw_point *erq = &(wrqu->encoding); |
443 | int len, key; | 449 | int len, key; |
444 | struct ieee80211_crypt_data *crypt; | 450 | struct ieee80211_crypt_data *crypt; |
451 | struct ieee80211_security *sec = &ieee->sec; | ||
445 | 452 | ||
446 | IEEE80211_DEBUG_WX("GET_ENCODE\n"); | 453 | IEEE80211_DEBUG_WX("GET_ENCODE\n"); |
447 | 454 | ||
@@ -456,13 +463,13 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | |||
456 | crypt = ieee->crypt[key]; | 463 | crypt = ieee->crypt[key]; |
457 | erq->flags = key + 1; | 464 | erq->flags = key + 1; |
458 | 465 | ||
459 | if (crypt == NULL || crypt->ops == NULL) { | 466 | if (!sec->enabled) { |
460 | erq->length = 0; | 467 | erq->length = 0; |
461 | erq->flags |= IW_ENCODE_DISABLED; | 468 | erq->flags |= IW_ENCODE_DISABLED; |
462 | return 0; | 469 | return 0; |
463 | } | 470 | } |
464 | 471 | ||
465 | if (strcmp(crypt->ops->name, "WEP") != 0) { | 472 | if (sec->level != SEC_LEVEL_1) { |
466 | /* only WEP is supported with wireless extensions, so just | 473 | /* only WEP is supported with wireless extensions, so just |
467 | * report that encryption is used */ | 474 | * report that encryption is used */ |
468 | erq->length = 0; | 475 | erq->length = 0; |
@@ -470,9 +477,10 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | |||
470 | return 0; | 477 | return 0; |
471 | } | 478 | } |
472 | 479 | ||
473 | len = crypt->ops->get_key(keybuf, WEP_KEY_LEN, NULL, crypt->priv); | 480 | len = sec->key_sizes[key]; |
474 | erq->length = (len >= 0 ? len : 0); | 481 | memcpy(keybuf, sec->keys[key], len); |
475 | 482 | ||
483 | erq->length = (len >= 0 ? len : 0); | ||
476 | erq->flags |= IW_ENCODE_ENABLED; | 484 | erq->flags |= IW_ENCODE_ENABLED; |
477 | 485 | ||
478 | if (ieee->open_wep) | 486 | if (ieee->open_wep) |