/* WPA data */
int wpa_enabled;
int drop_unencrypted;
- int tkip_countermeasures;
int privacy_invoked;
size_t wpa_ie_len;
u8 *wpa_ie;
#include <linux/skbuff.h>
+enum {
+ IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1<<0),
+};
+
struct ieee80211_crypto_ops {
const char *name;
/* init new crypto context (e.g., allocate private data space,
* select IV, etc.); returns NULL on failure or pointer to allocated
* private data on success */
- void *(*init) (struct ieee80211_device * ieee, int keyidx);
+ void *(*init) (int keyidx);
/* deinitialize crypto context and free allocated private data */
void (*deinit) (void *priv);
* statistics */
char *(*print_stats) (char *p, void *priv);
+ /* Crypto specific flag get/set for configuration settings */
+ unsigned long (*get_flags)(void *priv);
+ unsigned long (*set_flags)(unsigned long flags, void *priv);
+
/* maximum number of bytes added by encryption; encrypt buf is
* allocated with extra_prefix_len bytes, copy of in_buf, and
* extra_postfix_len; encrypt need not use all this space, but
return NULL;
}
-static void *ieee80211_crypt_null_init(struct ieee80211_device *ieee,
- int keyidx)
+static void *ieee80211_crypt_null_init(int keyidx)
{
return (void *)1;
}
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
-static void *ieee80211_ccmp_init(struct ieee80211_device *ieee, int key_idx)
+static void *ieee80211_ccmp_init(int key_idx)
{
struct ieee80211_ccmp_data *priv;
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
- struct ieee80211_device *ieee;
+ unsigned long flags;
};
-static void *ieee80211_tkip_init(struct ieee80211_device *ieee, int key_idx)
+static unsigned long ieee80211_tkip_set_flags(unsigned long flags, void *priv)
+{
+ struct ieee80211_tkip_data *_priv = priv;
+ unsigned long old_flags = _priv->flags;
+ _priv->flags = flags;
+ return old_flags;
+}
+
+static unsigned long ieee80211_tkip_get_flags(void *priv)
+{
+ struct ieee80211_tkip_data *_priv = priv;
+ return _priv->flags;
+}
+
+static void *ieee80211_tkip_init(int key_idx)
{
struct ieee80211_tkip_data *priv;
goto fail;
memset(priv, 0, sizeof(*priv));
- priv->ieee = ieee;
-
priv->key_idx = key_idx;
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
u8 *pos;
struct scatterlist sg;
- if (tkey->ieee->tkip_countermeasures) {
+ if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
if (net_ratelimit()) {
struct ieee80211_hdr_4addr *hdr =
(struct ieee80211_hdr_4addr *)skb->data;
- printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
+ printk(KERN_DEBUG "TKIP countermeasures: dropped "
"TX packet to " MAC_FMT "\n",
- tkey->ieee->dev->name, MAC_ARG(hdr->addr1));
+ MAC_ARG(hdr->addr1));
}
return -1;
}
hdr = (struct ieee80211_hdr_4addr *)skb->data;
- if (tkey->ieee->tkip_countermeasures) {
+ if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
if (net_ratelimit()) {
- printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
+ printk(KERN_DEBUG "TKIP countermeasures: dropped "
"received packet from " MAC_FMT "\n",
- tkey->ieee->dev->name, MAC_ARG(hdr->addr2));
+ MAC_ARG(hdr->addr2));
}
return -1;
}
.extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_mpdu_postfix_len = 4, /* ICV */
.extra_msdu_postfix_len = 8, /* MIC */
+ .get_flags = ieee80211_tkip_get_flags,
+ .set_flags = ieee80211_tkip_set_flags,
.owner = THIS_MODULE,
};
struct crypto_tfm *tfm;
};
-static void *prism2_wep_init(struct ieee80211_device *ieee, int keyidx)
+static void *prism2_wep_init(int keyidx)
{
struct prism2_wep_data *priv;
spin_lock_init(&ieee->lock);
ieee->wpa_enabled = 0;
- ieee->tkip_countermeasures = 0;
ieee->drop_unencrypted = 0;
ieee->privacy_invoked = 0;
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
- new_crypt->priv = new_crypt->ops->init(ieee, key);
+ new_crypt->priv = new_crypt->ops->init(key);
if (!new_crypt->ops || !new_crypt->priv) {
kfree(new_crypt);
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
new_crypt->ops = ops;
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
- new_crypt->priv = new_crypt->ops->init(ieee, idx);
+ new_crypt->priv = new_crypt->ops->init(idx);
if (new_crypt->priv == NULL) {
kfree(new_crypt);
ret = -EINVAL;