netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: netdev@vger.kernel.org
Cc: Jiri Benc <jbenc@suse.cz>,
	"John W. Linville" <linville@tuxdriver.com>,
	Simon Barber <simon@devicescape.com>,
	Jouni Malinen <jkm@devicescape.com>,
	Hong Liu <hong.liu@intel.com>,
	David Kimdon <david.kimdon@devicescape.com>,
	Michael Wu <flamingice@sourmilk.net>,
	Michael Buesch <mbuesch@freenet.de>,
	Ivo van Doorn <ivdoorn@gmail.com>
Subject: [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT
Date: Sun, 19 Nov 2006 00:53:00 +0100	[thread overview]
Message-ID: <1163893981.15473.3.camel@johannes.berg> (raw)
In-Reply-To: <1163802439.3392.47.camel@johannes.berg>

There's no point in trying to tell a driver globally whether sw or hw
crypto is used, if it's sw then we just don't give it keys...

Besides, these weren't ever used!
Remove IEEE80211_CONF_SW_DECRYPT and IEEE80211_CONF_SW_ENCRYPT.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
Some more absolutely useless code in d80211....

Patch applies after the other ones, it's now number 13 in my series.

 include/net/d80211.h         |    6 ++----
 net/d80211/ieee80211.c       |    9 +++------
 net/d80211/ieee80211_ioctl.c |    4 +---
 net/d80211/wpa.c             |   27 +++++++--------------------
 4 files changed, 13 insertions(+), 33 deletions(-)

--- wireless-dev.orig/include/net/d80211.h	2006-11-19 00:41:30.489520302 +0100
+++ wireless-dev/include/net/d80211.h	2006-11-19 00:41:46.509520302 +0100
@@ -244,11 +244,9 @@ struct ieee80211_conf {
 
         int beacon_int;
 
-#define IEEE80211_CONF_SW_ENCRYPT	(1<<0)
-#define IEEE80211_CONF_SW_DECRYPT	(1<<1)
-#define IEEE80211_CONF_SHORT_SLOT_TIME	(1<<2) /* use IEEE 802.11g Short Slot
+#define IEEE80211_CONF_SHORT_SLOT_TIME	(1<<0) /* use IEEE 802.11g Short Slot
 						* Time */
-#define IEEE80211_CONF_SSID_HIDDEN	(1<<3) /* do not broadcast the ssid */
+#define IEEE80211_CONF_SSID_HIDDEN	(1<<1) /* do not broadcast the ssid */
 	u32 flags;			/* configuration flags defined above */
 
         u8 power_level;			/* transmit power limit for current
--- wireless-dev.orig/net/d80211/ieee80211.c	2006-11-19 00:12:10.719520302 +0100
+++ wireless-dev/net/d80211/ieee80211.c	2006-11-19 00:43:28.799520302 +0100
@@ -516,8 +516,7 @@ ieee80211_tx_h_fragment(struct ieee80211
 
 static int wep_encrypt_skb(struct ieee80211_txrx_data *tx, struct sk_buff *skb)
 {
-	if (tx->key->force_sw_encrypt ||
-	    (tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT)) {
+	if (tx->key->force_sw_encrypt) {
 		if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
 			return -1;
 	} else {
@@ -3268,8 +3267,7 @@ ieee80211_rx_h_wep_weak_iv_detection(str
 
 	/* Check for weak IVs, if hwaccel did not remove IV from the frame */
 	if ((rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) ||
-	    rx->key->force_sw_encrypt ||
-	    (rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT)) {
+	    rx->key->force_sw_encrypt) {
 		u8 *iv = ieee80211_wep_is_weak_iv(rx->skb, rx->key);
 		if (iv) {
 			rx->sta->wep_weak_iv_count++;
@@ -3301,8 +3299,7 @@ ieee80211_rx_h_wep_decrypt(struct ieee80
 	}
 
 	if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) ||
-	    rx->key->force_sw_encrypt ||
-	    (rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
+	    rx->key->force_sw_encrypt) {
 		if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) {
 			printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
 			       "failed\n", rx->dev->name);
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c	2006-11-19 00:12:11.339520302 +0100
+++ wireless-dev/net/d80211/ieee80211_ioctl.c	2006-11-19 00:42:58.779520302 +0100
@@ -492,9 +492,7 @@ int ieee80211_set_hw_encryption(struct n
 		key->force_sw_encrypt = 1;
 
 	if (key && local->ops->set_key &&
-	    (!(local->wiphy.conf.flags & IEEE80211_CONF_SW_ENCRYPT) ||
-	     !(local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) &&
-	    (keyconf = ieee80211_key_data2conf(local, key)) != NULL) {
+	    (keyconf = ieee80211_key_data2conf(local, key))) {
 		if (local->ops->set_key(local_to_wiphy(local), SET_KEY, addr,
 				       keyconf, sta ? sta->aid : 0)) {
 			rc = HOSTAP_CRYPT_ERR_KEY_SET_FAILED;
--- wireless-dev.orig/net/d80211/wpa.c	2006-11-19 00:12:13.019520302 +0100
+++ wireless-dev/net/d80211/wpa.c	2006-11-19 00:45:16.999520302 +0100
@@ -104,7 +104,6 @@ ieee80211_tx_h_michael_mic_add(struct ie
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 	if (!tx->key->force_sw_encrypt &&
-	    !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) &&
 	    !tx->fragmented &&
 	    !(tx->local->wiphy.flags & IEEE80211_HW_TKIP_INCLUDE_MMIC) &&
 	    !wpa_test) {
@@ -186,8 +185,7 @@ ieee80211_rx_h_michael_mic_verify(struct
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
-	    !rx->key->force_sw_encrypt &&
-	    !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
+	    !rx->key->force_sw_encrypt) {
 		if (rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) {
 			if (skb->len < MICHAEL_MIC_LEN)
 				return TXRX_DROP;
@@ -297,9 +295,7 @@ static int tkip_encrypt_skb(struct ieee8
 	hdrlen = ieee80211_get_hdrlen(fc);
 	len = skb->len - hdrlen;
 
-	tailneed = (!tx->key->force_sw_encrypt &&
-		    !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT))
-		? 0 : TKIP_ICV_LEN;
+	tailneed = !tx->key->force_sw_encrypt ? 0 : TKIP_ICV_LEN;
 	if ((skb_headroom(skb) < TKIP_IV_LEN ||
 	     skb_tailroom(skb) < tailneed)) {
 		I802_DEBUG_INC(tx->local->tx_expand_skb_head);
@@ -331,8 +327,7 @@ iv_inc:
 skip_iv_inc:
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
-	if (!tx->key->force_sw_encrypt &&
-	    !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)
+	if (!tx->key->force_sw_encrypt
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
 	    && !tx->wpa_test
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
@@ -427,7 +422,6 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 	if (!tx->key->force_sw_encrypt &&
-	    !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) &&
 	    !(tx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV) &&
 	    !wpa_test) {
 		/* hwaccel - with no need for preallocated room for IV/ICV */
@@ -506,8 +500,7 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
-	    !rx->key->force_sw_encrypt &&
-	    !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
+	    !rx->key->force_sw_encrypt) {
 		if (!(rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV)) {
 			/* Hardware takes care of all processing, including
 			 * replay protection, so no need to continue here. */
@@ -651,9 +644,7 @@ static int ccmp_encrypt_skb(struct ieee8
 	hdrlen = ieee80211_get_hdrlen(fc);
 	len = skb->len - hdrlen;
 
-	tailneed = (!key->force_sw_encrypt &&
-		    !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT))
-		? 0 : CCMP_MIC_LEN;
+	tailneed = !key->force_sw_encrypt ? 0 : CCMP_MIC_LEN;
 
 	if ((skb_headroom(skb) < CCMP_HDR_LEN ||
 	     skb_tailroom(skb) < tailneed)) {
@@ -693,8 +684,7 @@ skip_pn_inc:
 
 	ccmp_pn2hdr(pos, pn, key->keyidx);
 
-	if (!key->force_sw_encrypt &&
-	    !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
+	if (!key->force_sw_encrypt) {
 		/* hwaccel - with preallocated room for CCMP header */
 		tx->u.tx.control->key_idx = key->hw_key_idx;
 		return 0;
@@ -749,7 +739,6 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8
 	ieee80211_tx_set_iswep(tx);
 
 	if (!tx->key->force_sw_encrypt &&
-	    !(tx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) &&
 	    !(tx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV)) {
 		/* hwaccel - with no need for preallocated room for CCMP "
 		 * header or MIC fields */
@@ -802,7 +791,6 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
 	    !key->force_sw_encrypt &&
-	    !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT) &&
 	    !(rx->local->wiphy.flags & IEEE80211_HW_WEP_INCLUDE_IV))
 		return TXRX_CONTINUE;
 
@@ -823,8 +811,7 @@ ieee80211_rx_h_ccmp_decrypt(struct ieee8
 	}
 
 	if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
-	    !key->force_sw_encrypt &&
-	    !(rx->local->wiphy.conf.flags & IEEE80211_CONF_SW_DECRYPT)) {
+	    !key->force_sw_encrypt) {
 		/* hwaccel has already decrypted frame and verified MIC */
 	} else {
 		u8 *scratch, *b_0, *aad;



  parent reply	other threads:[~2006-11-19  0:29 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-17 22:27 [PATCH 0/10] d80211: move away from wmaster towards wiphy Johannes Berg
2006-11-17 22:50 ` [PATCH] d80211: remove useless driver name field Johannes Berg
2006-11-20 18:32   ` Jouni Malinen
2006-11-20 18:40     ` Johannes Berg
2006-11-20 22:21       ` Christoph Hellwig
2006-11-20 22:33         ` Johannes Berg
2006-11-20 18:44     ` Michael Wu
2006-11-17 23:24 ` [PATCH 0/10] d80211: move away from wmaster towards wiphy Pavel Roskin
2006-11-18  0:16 ` Johannes Berg
2006-11-18 23:53 ` Johannes Berg [this message]
2006-11-19 16:16   ` [PATCH] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Michael Buesch
2006-11-19  0:04 ` [PATCH] d80211: remove calib_int Johannes Berg
2006-11-19  0:21 ` [PATCH] d80211: fix scan issues with new ops Johannes Berg
2006-11-19 15:56   ` David Kimdon
2006-11-19 16:34     ` Johannes Berg
2006-11-19 16:50       ` Johannes Berg
2006-11-19 16:55       ` David Kimdon
2006-11-19 16:57         ` Johannes Berg
2006-11-19 17:25           ` David Kimdon
2006-11-19 17:54             ` Johannes Berg
2006-11-19 16:15   ` Michael Buesch
2006-11-19 16:35     ` Johannes Berg
2006-11-19 19:18 ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg
2006-11-19 19:22   ` [PATCH 1/13] d80211: clean up some stupid list and loop code Johannes Berg
2006-11-20 11:01     ` Jiri Benc
2006-11-20 11:58       ` Johannes Berg
2006-11-20 18:55         ` Johannes Berg
2006-11-19 19:23   ` [PATCH 2/13] d80211: reduce mdev usage Johannes Berg
2006-11-19 19:23   ` [PATCH 3/13] " Johannes Berg
2006-11-19 19:26   ` [PATCH 4/13] d80211: reduce mdev usage, change ieee80211_rx_mgmt Johannes Berg
2006-11-20 12:08     ` Jiri Benc
2006-11-20 12:25       ` Johannes Berg
2006-11-19 19:27   ` [PATCH 5/13] d80211: reduce master ieee80211_ptr deref in scan routines Johannes Berg
2006-11-19 19:28   ` [PATCH 6/13] d80211: change the identifier netdev to ieee80211_hw Johannes Berg
2006-11-20 17:57     ` Jiri Benc
2006-11-20 18:04       ` Johannes Berg
2006-11-20 18:52       ` Johannes Berg
2006-11-20 22:45     ` Johannes Berg
2006-11-21 17:48       ` [PATCH] d80211: use ieee80211_hw.dev Johannes Berg
2006-11-19 19:29   ` [PATCH 7/13] d80211: add a perm_addr hardware property Johannes Berg
2006-11-19 23:20     ` Johannes Berg
2006-11-20 18:54       ` Johannes Berg
2006-11-19 19:29   ` [PATCH 8/13] d80211: introduce IEEE80211_HW_FRAG flag Johannes Berg
2006-11-19 19:30   ` [PATCH 9/13] d80211: remove useless driver name field Johannes Berg
2006-11-19 19:31   ` [PATCH 10/13] bcm43xx: update to new d80211 driver API Johannes Berg
2006-11-19 19:43     ` Michael Buesch
2006-11-19 19:52       ` Johannes Berg
2006-11-19 19:31   ` [PATCH 11/13] d80211: remove IEEE80211_CONF_SW_{EN,DE}CRYPT Johannes Berg
2006-11-19 19:32   ` [PATCH 12/13] d80211: remove calib_int Johannes Berg
2006-11-19 19:33   ` [PATCH 13/13] d80211: fix scan issues with new ops Johannes Berg
2006-11-19 23:32   ` [PATCH 0/13] move d80211 away from netdev towards wiphy Johannes Berg
2006-11-20 19:14     ` Jiri Benc
2006-11-22 19:18       ` [RFC 0/3] more power to cfg80211 Johannes Berg
2006-11-22 19:22         ` [RFC 1/3] cfg80211: handle wiphy, use wiphy in netdev, do wiphy sysfs Johannes Berg
2006-11-22 19:24         ` [RFC 2/3] d80211: use new wiphy stuff from cfg80211 Johannes Berg
2006-11-22 19:25         ` [RFC 3/3] bcm43xx: API update Johannes Berg
2006-12-11 13:03         ` [RFC 0/3] more power to cfg80211 Jiri Benc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1163893981.15473.3.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=david.kimdon@devicescape.com \
    --cc=flamingice@sourmilk.net \
    --cc=hong.liu@intel.com \
    --cc=ivdoorn@gmail.com \
    --cc=jbenc@suse.cz \
    --cc=jkm@devicescape.com \
    --cc=linville@tuxdriver.com \
    --cc=mbuesch@freenet.de \
    --cc=netdev@vger.kernel.org \
    --cc=simon@devicescape.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).