]>
Commit | Line | Data |
---|---|---|
b453872c JG |
1 | /* |
2 | * Original code based on Host AP (software wireless LAN access point) driver | |
3 | * for Intersil Prism2/2.5/3. | |
4 | * | |
5 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | |
85d32e7b JM |
6 | * <[email protected]> |
7 | * Copyright (c) 2002-2003, Jouni Malinen <[email protected]> | |
b453872c JG |
8 | * |
9 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos | |
10 | * <[email protected]> | |
11 | * | |
12 | * Copyright (c) 2004, Intel Corporation | |
13 | * | |
14 | * This program is free software; you can redistribute it and/or modify | |
15 | * it under the terms of the GNU General Public License version 2 as | |
16 | * published by the Free Software Foundation. See README and COPYING for | |
17 | * more details. | |
18 | */ | |
19 | ||
20 | /* | |
21 | * This file defines the interface to the ieee80211 crypto module. | |
22 | */ | |
23 | #ifndef IEEE80211_CRYPT_H | |
24 | #define IEEE80211_CRYPT_H | |
25 | ||
14c85021 ACM |
26 | #include <linux/types.h> |
27 | #include <linux/list.h> | |
5fad5a2e | 28 | #include <net/ieee80211.h> |
14c85021 | 29 | #include <asm/atomic.h> |
b453872c | 30 | |
6eb6edf0 | 31 | enum { |
ff0037b2 | 32 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), |
6eb6edf0 JK |
33 | }; |
34 | ||
14c85021 ACM |
35 | struct sk_buff; |
36 | struct module; | |
37 | ||
b453872c JG |
38 | struct ieee80211_crypto_ops { |
39 | const char *name; | |
e3305626 | 40 | struct list_head list; |
b453872c JG |
41 | |
42 | /* init new crypto context (e.g., allocate private data space, | |
43 | * select IV, etc.); returns NULL on failure or pointer to allocated | |
44 | * private data on success */ | |
6eb6edf0 | 45 | void *(*init) (int keyidx); |
b453872c JG |
46 | |
47 | /* deinitialize crypto context and free allocated private data */ | |
74079fdc | 48 | void (*deinit) (void *priv); |
b453872c | 49 | |
9184d934 ZY |
50 | int (*build_iv) (struct sk_buff * skb, int hdr_len, |
51 | u8 *key, int keylen, void *priv); | |
31b59eae | 52 | |
b453872c JG |
53 | /* encrypt/decrypt return < 0 on error or >= 0 on success. The return |
54 | * value from decrypt_mpdu is passed as the keyidx value for | |
55 | * decrypt_msdu. skb must have enough head and tail room for the | |
56 | * encryption; if not, error will be returned; these functions are | |
57 | * called for all MPDUs (i.e., fragments). | |
58 | */ | |
74079fdc JK |
59 | int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); |
60 | int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); | |
b453872c JG |
61 | |
62 | /* These functions are called for full MSDUs, i.e. full frames. | |
63 | * These can be NULL if full MSDU operations are not needed. */ | |
74079fdc JK |
64 | int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv); |
65 | int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len, | |
66 | void *priv); | |
b453872c | 67 | |
74079fdc JK |
68 | int (*set_key) (void *key, int len, u8 * seq, void *priv); |
69 | int (*get_key) (void *key, int len, u8 * seq, void *priv); | |
b453872c JG |
70 | |
71 | /* procfs handler for printing out key information and possible | |
72 | * statistics */ | |
74079fdc | 73 | char *(*print_stats) (char *p, void *priv); |
b453872c | 74 | |
6eb6edf0 | 75 | /* Crypto specific flag get/set for configuration settings */ |
ff0037b2 JK |
76 | unsigned long (*get_flags) (void *priv); |
77 | unsigned long (*set_flags) (unsigned long flags, void *priv); | |
6eb6edf0 | 78 | |
b453872c JG |
79 | /* maximum number of bytes added by encryption; encrypt buf is |
80 | * allocated with extra_prefix_len bytes, copy of in_buf, and | |
81 | * extra_postfix_len; encrypt need not use all this space, but | |
82 | * the result must start at the beginning of the buffer and correct | |
83 | * length must be returned */ | |
1264fc04 JK |
84 | int extra_mpdu_prefix_len, extra_mpdu_postfix_len; |
85 | int extra_msdu_prefix_len, extra_msdu_postfix_len; | |
b453872c JG |
86 | |
87 | struct module *owner; | |
88 | }; | |
89 | ||
90 | struct ieee80211_crypt_data { | |
74079fdc | 91 | struct list_head list; /* delayed deletion list */ |
b453872c JG |
92 | struct ieee80211_crypto_ops *ops; |
93 | void *priv; | |
94 | atomic_t refcnt; | |
95 | }; | |
96 | ||
14c85021 ACM |
97 | struct ieee80211_device; |
98 | ||
b453872c JG |
99 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); |
100 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); | |
74079fdc | 101 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); |
b453872c JG |
102 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); |
103 | void ieee80211_crypt_deinit_handler(unsigned long); | |
104 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | |
105 | struct ieee80211_crypt_data **crypt); | |
0ad0c3c6 | 106 | void ieee80211_crypt_quiescing(struct ieee80211_device *ieee); |
b453872c JG |
107 | |
108 | #endif |