[PATCH 4/4] libertas: clarify key length defines

Dan Williams dcbw at redhat.com
Mon Aug 21 15:00:57 EDT 2006


The libertas driver supports TKIP too; therefore the WEP key size
defines are inappropriately general.  Make them more specific.

Signed-off-by: Dan Williams <dcbw at redhat.com>

diff --git a/drivers/net/wireless/libertas/wlan_defs.h b/drivers/net/wireless/libertas/wlan_defs.h
index d66185c..8e7fb7a 100644
--- a/drivers/net/wireless/libertas/wlan_defs.h
+++ b/drivers/net/wireless/libertas/wlan_defs.h
@@ -301,10 +301,9 @@ #define WPA_TKIP_KEY_LEN 		32
 
 /* A few details needed for WEP (Wireless Equivalent Privacy) */
 /* 104 bits */
-#define MAX_KEY_SIZE		13
+#define MAX_WEP_KEY_SIZE		13
 /*40 bits RC4 - WEP*/
-#define MIN_KEY_SIZE		5
-#define MAX_SIZE_ARRA		64
+#define MIN_WEP_KEY_SIZE		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 009a3d3..3586c3d 100644
--- a/drivers/net/wireless/libertas/wlan_wext.c
+++ b/drivers/net/wireless/libertas/wlan_wext.c
@@ -405,7 +405,7 @@ static int wlan_set_encode_nonwpa(struct
 		 * Check the size of the key 
 		 */
 
-		if (dwrq->length > MAX_KEY_SIZE) {
+		if (dwrq->length > MAX_WEP_KEY_SIZE) {
 			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_KEY_SIZE) {
-				pWep->KeyLength = MAX_KEY_SIZE;
+			if (dwrq->length > MIN_WEP_KEY_SIZE) {
+				pWep->KeyLength = MAX_WEP_KEY_SIZE;
 			} else {
 				if (dwrq->length > 0) {
-					pWep->KeyLength = MIN_KEY_SIZE;
+					pWep->KeyLength = MIN_WEP_KEY_SIZE;
 				} 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_KEY_SIZE;
+		dwrq->length = MAX_WEP_KEY_SIZE;
 	}
 
 	PRINTM(INFO, "Return flags=0x%x\n", dwrq->flags);
@@ -2528,10 +2528,10 @@ int wlan_set_encode(struct net_device *d
 
 	ENTER();
 
-	if (dwrq->length > MAX_KEY_SIZE) {
+	if (dwrq->length > MAX_WEP_KEY_SIZE) {
 		pKey = (struct WLAN_802_11_KEY *)extra;
 
-		if (pKey->KeyLength <= MAX_KEY_SIZE) {
+		if (pKey->KeyLength <= MAX_WEP_KEY_SIZE) {
 			//dynamic WEP
 			dwrq->length = pKey->KeyLength;
 			dwrq->flags = pKey->KeyIndex + 1;





More information about the libertas-dev mailing list