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