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