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
36
37const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
38#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused
39
40#define NUM_WEP_KEYS 4
41
42enum {
43 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
44};
45
46struct module;
47
48struct lib80211_crypto_ops {
49 const char *name;
50 struct list_head list;
51
52
53
54
55 void *(*init) (int keyidx);
56
57
58 void (*deinit) (void *priv);
59
60
61
62
63
64
65
66 int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
67 int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
68
69
70
71 int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv);
72 int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len,
73 void *priv);
74
75 int (*set_key) (void *key, int len, u8 * seq, void *priv);
76 int (*get_key) (void *key, int len, u8 * seq, void *priv);
77
78
79
80 void (*print_stats) (struct seq_file *m, void *priv);
81
82
83 unsigned long (*get_flags) (void *priv);
84 unsigned long (*set_flags) (unsigned long flags, void *priv);
85
86
87
88
89
90
91 int extra_mpdu_prefix_len, extra_mpdu_postfix_len;
92 int extra_msdu_prefix_len, extra_msdu_postfix_len;
93
94 struct module *owner;
95};
96
97struct lib80211_crypt_data {
98 struct list_head list;
99 struct lib80211_crypto_ops *ops;
100 void *priv;
101 atomic_t refcnt;
102};
103
104struct lib80211_crypt_info {
105 char *name;
106
107
108 spinlock_t *lock;
109
110 struct lib80211_crypt_data *crypt[NUM_WEP_KEYS];
111 int tx_keyidx;
112 struct list_head crypt_deinit_list;
113 struct timer_list crypt_deinit_timer;
114 int crypt_quiesced;
115};
116
117int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name,
118 spinlock_t *lock);
119void lib80211_crypt_info_free(struct lib80211_crypt_info *info);
120int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops);
121int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops);
122struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name);
123void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info,
124 struct lib80211_crypt_data **crypt);
125
126#endif
127