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