mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 19:45:06 +08:00
1264fc0498
tree 8428e9f510e6ad6c77baec89cb57374842abf733 parent d78bfd3ddae9c422dd350159110f9c4d7cfc50de author Liu Hong <hong.liu@intel.com> 1124446520 -0500 committer James Ketrenos <jketreno@linux.intel.com> 1127313183 -0500 Fix TKIP, repeated fragmentation problem, and payload_size reporting 1. TKIP encryption Originally, TKIP encryption issues msdu + mpdu encryption on every fragment. Change the behavior to msdu encryption on the whole packet, then mpdu encryption on every fragment. 2. Avoid repeated fragmentation when !host_encrypt. We only need do fragmentation when using host encryption. Otherwise we only need pass the whole packet to driver, letting driver do the fragmentation. 3. change the txb->payload_size to correct value FW will use this value to determine whether to do fragmentation. If we pass the wrong value, fw may cut on the wrong bound which will make decryption fail when we do host encryption. NOTE: This requires changing drivers (hostap) that have extra_prefix_len used within them (structure member name change). Signed-off-by: Hong Liu <liu.hong@intel.com> Signed-off-by: James Ketrenos <jketreno@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
89 lines
3.2 KiB
C
89 lines
3.2 KiB
C
/*
|
|
* Original code based on Host AP (software wireless LAN access point) driver
|
|
* for Intersil Prism2/2.5/3.
|
|
*
|
|
* Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
|
|
* <jkmaline@cc.hut.fi>
|
|
* Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
|
|
*
|
|
* Adaption to a generic IEEE 802.11 stack by James Ketrenos
|
|
* <jketreno@linux.intel.com>
|
|
*
|
|
* Copyright (c) 2004, Intel Corporation
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation. See README and COPYING for
|
|
* more details.
|
|
*/
|
|
|
|
/*
|
|
* This file defines the interface to the ieee80211 crypto module.
|
|
*/
|
|
#ifndef IEEE80211_CRYPT_H
|
|
#define IEEE80211_CRYPT_H
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
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);
|
|
|
|
/* deinitialize crypto context and free allocated private data */
|
|
void (*deinit) (void *priv);
|
|
|
|
/* encrypt/decrypt return < 0 on error or >= 0 on success. The return
|
|
* value from decrypt_mpdu is passed as the keyidx value for
|
|
* decrypt_msdu. skb must have enough head and tail room for the
|
|
* encryption; if not, error will be returned; these functions are
|
|
* called for all MPDUs (i.e., fragments).
|
|
*/
|
|
int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
|
|
int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
|
|
|
|
/* These functions are called for full MSDUs, i.e. full frames.
|
|
* These can be NULL if full MSDU operations are not needed. */
|
|
int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv);
|
|
int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len,
|
|
void *priv);
|
|
|
|
int (*set_key) (void *key, int len, u8 * seq, void *priv);
|
|
int (*get_key) (void *key, int len, u8 * seq, void *priv);
|
|
|
|
/* procfs handler for printing out key information and possible
|
|
* statistics */
|
|
char *(*print_stats) (char *p, 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
|
|
* the result must start at the beginning of the buffer and correct
|
|
* length must be returned */
|
|
int extra_mpdu_prefix_len, extra_mpdu_postfix_len;
|
|
int extra_msdu_prefix_len, extra_msdu_postfix_len;
|
|
|
|
struct module *owner;
|
|
};
|
|
|
|
struct ieee80211_crypt_data {
|
|
struct list_head list; /* delayed deletion list */
|
|
struct ieee80211_crypto_ops *ops;
|
|
void *priv;
|
|
atomic_t refcnt;
|
|
};
|
|
|
|
int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
|
|
int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
|
|
struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
|
|
void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
|
|
void ieee80211_crypt_deinit_handler(unsigned long);
|
|
void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
|
|
struct ieee80211_crypt_data **crypt);
|
|
void ieee80211_crypt_quiescing(struct ieee80211_device *ieee);
|
|
|
|
#endif
|