1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef LIB80211_H
25 #define LIB80211_H
26
27 #include <linux/types.h>
28 #include <linux/list.h>
29 #include <linux/atomic.h>
30 #include <linux/if.h>
31 #include <linux/skbuff.h>
32 #include <linux/ieee80211.h>
33 #include <linux/timer.h>
34 #include <linux/seq_file.h>
35
36 #define NUM_WEP_KEYS 4
37
38 enum {
39 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
40 };
41
42 struct module;
43
44 struct lib80211_crypto_ops {
45 const char *name;
46 struct list_head list;
47
48
49
50
51 void *(*init) (int keyidx);
52
53
54 void (*deinit) (void *priv);
55
56
57
58
59
60
61
62 int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
63 int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
64
65
66
67 int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv);
68 int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len,
69 void *priv);
70
71 int (*set_key) (void *key, int len, u8 * seq, void *priv);
72 int (*get_key) (void *key, int len, u8 * seq, void *priv);
73
74
75
76 void (*print_stats) (struct seq_file *m, void *priv);
77
78
79 unsigned long (*get_flags) (void *priv);
80 unsigned long (*set_flags) (unsigned long flags, void *priv);
81
82
83
84
85
86
87 int extra_mpdu_prefix_len, extra_mpdu_postfix_len;
88 int extra_msdu_prefix_len, extra_msdu_postfix_len;
89
90 struct module *owner;
91 };
92
93 struct lib80211_crypt_data {
94 struct list_head list;
95 struct lib80211_crypto_ops *ops;
96 void *priv;
97 atomic_t refcnt;
98 };
99
100 struct lib80211_crypt_info {
101 char *name;
102
103
104 spinlock_t *lock;
105
106 struct lib80211_crypt_data *crypt[NUM_WEP_KEYS];
107 int tx_keyidx;
108 struct list_head crypt_deinit_list;
109 struct timer_list crypt_deinit_timer;
110 int crypt_quiesced;
111 };
112
113 int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name,
114 spinlock_t *lock);
115 void lib80211_crypt_info_free(struct lib80211_crypt_info *info);
116 int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops);
117 int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
118 struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name);
119 void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info,
120 struct lib80211_crypt_data **crypt);
121
122 #endif