[PATCH] libertas: harmonize key length defines (again)
Dan Williams
dcbw at redhat.com
Tue Oct 3 14:19:45 EDT 2006
This time, make the WEP key lengths consistent with the WPA ones.
Replace usage of MRVL_MAX_WPA_KEY_LENGTH with
MRVL_MAX_KEY_WPA_KEY_LENGTH because they are confusingly similar and do
the same thing anyway.
Signed-off-by: Dan Williams <dcbw at redhat.com>
diff --git a/drivers/net/wireless/libertas/wlan_cmd.c b/drivers/net/wireless/libertas/wlan_cmd.c
index 152c057..dc6f76b 100644
--- a/drivers/net/wireless/libertas/wlan_cmd.c
+++ b/drivers/net/wireless/libertas/wlan_cmd.c
@@ -440,7 +440,7 @@ static int wlan_cmd_802_11_key_material(
memset(&pKeyMaterial->KeyParamSet, 0,
sizeof(struct MrvlIEtype_KeyParamSet));
- if (pKey->KeyLength == WPA_AES_KEY_LEN) {
+ if (pKey->KeyLength == KEY_LEN_WPA_AES) {
PRINTM(INFO, "WPA_AES\n");
pKeyMaterial->KeyParamSet.KeyTypeId =
wlan_cpu_to_le16(KEY_TYPE_ID_AES);
@@ -458,7 +458,7 @@ static int wlan_cmd_802_11_key_material(
else //AES group key: multicast
pKeyMaterial->KeyParamSet.KeyInfo |=
wlan_cpu_to_le16(KEY_INFO_AES_MCAST);
- } else if (pKey->KeyLength == WPA_TKIP_KEY_LEN) {
+ } else if (pKey->KeyLength == KEY_LEN_WPA_TKIP) {
PRINTM(INFO, "WPA_TKIP\n");
pKeyMaterial->KeyParamSet.KeyTypeId =
wlan_cpu_to_le16(KEY_TYPE_ID_TKIP);
diff --git a/drivers/net/wireless/libertas/wlan_defs.h b/drivers/net/wireless/libertas/wlan_defs.h
index 8e7fb7a..b02980e 100644
--- a/drivers/net/wireless/libertas/wlan_defs.h
+++ b/drivers/net/wireless/libertas/wlan_defs.h
@@ -293,17 +293,12 @@ #define WLAN_802_11_AI_RESFI_ASSOCIATION
/** WPA Key LENGTH*/
/* Support 4 keys per key set */
#define MRVL_NUM_WPA_KEY_PER_SET 4
-#define MRVL_MAX_WPA_KEY_LENGTH 32
#define MRVL_MAX_KEY_WPA_KEY_LENGTH 32
-#define WPA_AES_KEY_LEN 16
-#define WPA_TKIP_KEY_LEN 32
-
-/* A few details needed for WEP (Wireless Equivalent Privacy) */
-/* 104 bits */
-#define MAX_WEP_KEY_SIZE 13
-/*40 bits RC4 - WEP*/
-#define MIN_WEP_KEY_SIZE 5
+#define KEY_LEN_WPA_AES 16
+#define KEY_LEN_WPA_TKIP 32
+#define KEY_LEN_WEP_104 13
+#define KEY_LEN_WEP_40 5
#define RF_ANTENNA_1 0x1
#define RF_ANTENNA_2 0x2
diff --git a/drivers/net/wireless/libertas/wlan_wext.c b/drivers/net/wireless/libertas/wlan_wext.c
index e03e57a..27886ff 100644
--- a/drivers/net/wireless/libertas/wlan_wext.c
+++ b/drivers/net/wireless/libertas/wlan_wext.c
@@ -331,7 +331,7 @@ static int wlan_set_encode_wpa(struct ne
HEXDUMP("KeyMaterial: ", (u8 *) pKey->KeyMaterial, pKey->KeyLength);
// current driver only supports key length of up to 32 bytes
- if (pKey->KeyLength > MRVL_MAX_WPA_KEY_LENGTH) {
+ if (pKey->KeyLength > MRVL_MAX_KEY_WPA_KEY_LENGTH) {
PRINTM(INFO, " Error in key length \n");
return WLAN_STATUS_FAILURE;
}
@@ -405,7 +405,7 @@ static int wlan_set_encode_nonwpa(struct
* Check the size of the key
*/
- if (dwrq->length > MAX_WEP_KEY_SIZE) {
+ if (dwrq->length > KEY_LEN_WEP_104) {
return -EINVAL;
}
@@ -429,11 +429,11 @@ static int wlan_set_encode_nonwpa(struct
memcpy(pWep->KeyMaterial, extra, dwrq->length);
/* Set the length */
- if (dwrq->length > MIN_WEP_KEY_SIZE) {
- pWep->KeyLength = MAX_WEP_KEY_SIZE;
+ if (dwrq->length > KEY_LEN_WEP_40) {
+ pWep->KeyLength = KEY_LEN_WEP_104;
} else {
if (dwrq->length > 0) {
- pWep->KeyLength = MIN_WEP_KEY_SIZE;
+ pWep->KeyLength = KEY_LEN_WEP_40;
} else {
/* Disable the key */
pWep->KeyLength = 0;
@@ -1129,7 +1129,7 @@ static int wlan_get_encode(struct net_de
if (adapter->EncryptionStatus == Wlan802_11Encryption2Enabled
&& !dwrq->length) {
- dwrq->length = MAX_WEP_KEY_SIZE;
+ dwrq->length = KEY_LEN_WEP_104;
}
PRINTM(INFO, "Return flags=0x%x\n", dwrq->flags);
@@ -2518,15 +2518,14 @@ int wlan_set_encode(struct net_device *d
struct iw_request_info *info,
struct iw_point *dwrq, char *extra)
{
-
struct WLAN_802_11_KEY *pKey = NULL;
ENTER();
- if (dwrq->length > MAX_WEP_KEY_SIZE) {
+ if (dwrq->length > KEY_LEN_WEP_104) {
pKey = (struct WLAN_802_11_KEY *)extra;
- if (pKey->KeyLength <= MAX_WEP_KEY_SIZE) {
+ if (pKey->KeyLength <= KEY_LEN_WEP_104) {
//dynamic WEP
dwrq->length = pKey->KeyLength;
dwrq->flags = pKey->KeyIndex + 1;
More information about the libertas-dev
mailing list