Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 274bfb8d authored by John W. Linville's avatar John W. Linville
Browse files

lib80211: absorb crypto bits from net/ieee80211



These bits are shared already between ipw2x00 and hostap, and could
probably be shared both more cleanly and with other drivers.  This
commit simply relocates the code to lib80211 and adjusts the drivers
appropriately.

Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent dfe1bafd
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2,8 +2,10 @@ config HOSTAP
	tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)"
	depends on WLAN_80211
	select WIRELESS_EXT
	select IEEE80211
	select IEEE80211_CRYPT_WEP
	select LIB80211
	select LIB80211_CRYPT_WEP
	select LIB80211_CRYPT_TKIP
	select LIB80211_CRYPT_CCMP
	---help---
	Shared driver code for IEEE 802.11b wireless cards based on
	Intersil Prism2/2.5/3 chipset. This driver supports so called
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ void ap_control_flush_macs(struct mac_restrictions *mac_restrictions);
int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac);
void ap_control_kickall(struct ap_data *ap);
void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent,
			 struct ieee80211_crypt_data ***crypt);
			 struct lib80211_crypt_data ***crypt);
int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[],
			   struct iw_quality qual[], int buf_size,
			   int aplist);
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#define HOSTAP_80211_H

#include <linux/types.h>
#include <net/ieee80211_crypt.h>
#include <net/ieee80211.h>

struct hostap_ieee80211_mgmt {
	__le16 frame_control;
+5 −5
Original line number Diff line number Diff line
#include <linux/etherdevice.h>
#include <net/ieee80211_crypt.h>
#include <net/lib80211.h>

#include "hostap_80211.h"
#include "hostap.h"
@@ -649,7 +649,7 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb)
/* Called only as a tasklet (software IRQ) */
static int
hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
			struct ieee80211_crypt_data *crypt)
			struct lib80211_crypt_data *crypt)
{
	struct ieee80211_hdr_4addr *hdr;
	int res, hdrlen;
@@ -687,7 +687,7 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
/* Called only as a tasklet (software IRQ) */
static int
hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb,
			     int keyidx, struct ieee80211_crypt_data *crypt)
			     int keyidx, struct lib80211_crypt_data *crypt)
{
	struct ieee80211_hdr_4addr *hdr;
	int res, hdrlen;
@@ -733,7 +733,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
	int from_assoc_ap = 0;
	u8 dst[ETH_ALEN];
	u8 src[ETH_ALEN];
	struct ieee80211_crypt_data *crypt = NULL;
	struct lib80211_crypt_data *crypt = NULL;
	void *sta = NULL;
	int keyidx = 0;

@@ -785,7 +785,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
		int idx = 0;
		if (skb->len >= hdrlen + 3)
			idx = skb->data[hdrlen + 3] >> 6;
		crypt = local->crypt[idx];
		crypt = local->crypt_info.crypt[idx];
		sta = NULL;

		/* Use station specific key to override default keys if the
+5 −3
Original line number Diff line number Diff line
@@ -306,7 +306,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)

/* Called only from software IRQ */
static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
					  struct ieee80211_crypt_data *crypt)
					  struct lib80211_crypt_data *crypt)
{
	struct hostap_interface *iface;
	local_info_t *local;
@@ -405,7 +405,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
	if (local->host_encrypt) {
		/* Set crypt to default algorithm and key; will be replaced in
		 * AP code if STA has own alg/key */
		tx.crypt = local->crypt[local->tx_keyidx];
		tx.crypt = local->crypt_info.crypt[local->crypt_info.tx_keyidx];
		tx.host_encrypt = 1;
	} else {
		tx.crypt = NULL;
@@ -487,7 +487,9 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)

	if (tx.crypt && (!tx.crypt->ops || !tx.crypt->ops->encrypt_mpdu))
		tx.crypt = NULL;
	else if ((tx.crypt || local->crypt[local->tx_keyidx]) && !no_encrypt) {
	else if ((tx.crypt ||
		 local->crypt_info.crypt[local->crypt_info.tx_keyidx]) &&
		 !no_encrypt) {
		/* Add ISWEP flag both for firmware and host based encryption
		 */
		fc |= IEEE80211_FCTL_PROTECTED;
Loading