0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef LIB80211_H
0025 #define LIB80211_H
0026
0027 #include <linux/types.h>
0028 #include <linux/list.h>
0029 #include <linux/atomic.h>
0030 #include <linux/if.h>
0031 #include <linux/skbuff.h>
0032 #include <linux/ieee80211.h>
0033 #include <linux/timer.h>
0034 #include <linux/seq_file.h>
0035
0036 #define NUM_WEP_KEYS 4
0037
0038 enum {
0039 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
0040 };
0041
0042 struct module;
0043
0044 struct lib80211_crypto_ops {
0045 const char *name;
0046 struct list_head list;
0047
0048
0049
0050
0051 void *(*init) (int keyidx);
0052
0053
0054 void (*deinit) (void *priv);
0055
0056
0057
0058
0059
0060
0061
0062 int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
0063 int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
0064
0065
0066
0067 int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv);
0068 int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len,
0069 void *priv);
0070
0071 int (*set_key) (void *key, int len, u8 * seq, void *priv);
0072 int (*get_key) (void *key, int len, u8 * seq, void *priv);
0073
0074
0075
0076 void (*print_stats) (struct seq_file *m, void *priv);
0077
0078
0079 unsigned long (*get_flags) (void *priv);
0080 unsigned long (*set_flags) (unsigned long flags, void *priv);
0081
0082
0083
0084
0085
0086
0087 int extra_mpdu_prefix_len, extra_mpdu_postfix_len;
0088 int extra_msdu_prefix_len, extra_msdu_postfix_len;
0089
0090 struct module *owner;
0091 };
0092
0093 struct lib80211_crypt_data {
0094 struct list_head list;
0095 struct lib80211_crypto_ops *ops;
0096 void *priv;
0097 atomic_t refcnt;
0098 };
0099
0100 struct lib80211_crypt_info {
0101 char *name;
0102
0103
0104 spinlock_t *lock;
0105
0106 struct lib80211_crypt_data *crypt[NUM_WEP_KEYS];
0107 int tx_keyidx;
0108 struct list_head crypt_deinit_list;
0109 struct timer_list crypt_deinit_timer;
0110 int crypt_quiesced;
0111 };
0112
0113 int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name,
0114 spinlock_t *lock);
0115 void lib80211_crypt_info_free(struct lib80211_crypt_info *info);
0116 int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops);
0117 int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
0118 struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name);
0119 void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info,
0120 struct lib80211_crypt_data **crypt);
0121
0122 #endif