[PATCH] ieee80211: in-tree driver updates to sync with latest ieee80211 series
[linux-2.6/linux-loongson.git] / include / net / ieee80211_crypt.h
blob0c9d859d912edded9386a8c4448dcf3996609651
1 /*
2 * Original code based on Host AP (software wireless LAN access point) driver
3 * for Intersil Prism2/2.5/3.
5 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
6 * <jkmaline@cc.hut.fi>
7 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
9 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
10 * <jketreno@linux.intel.com>
12 * Copyright (c) 2004, Intel Corporation
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.
21 * This file defines the interface to the ieee80211 crypto module.
23 #ifndef IEEE80211_CRYPT_H
24 #define IEEE80211_CRYPT_H
26 #include <linux/skbuff.h>
28 enum {
29 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1<<0),
32 struct ieee80211_crypto_ops {
33 const char *name;
35 /* init new crypto context (e.g., allocate private data space,
36 * select IV, etc.); returns NULL on failure or pointer to allocated
37 * private data on success */
38 void *(*init) (int keyidx);
40 /* deinitialize crypto context and free allocated private data */
41 void (*deinit) (void *priv);
43 int (*build_iv) (struct sk_buff * skb, int hdr_len, void *priv);
45 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return
46 * value from decrypt_mpdu is passed as the keyidx value for
47 * decrypt_msdu. skb must have enough head and tail room for the
48 * encryption; if not, error will be returned; these functions are
49 * called for all MPDUs (i.e., fragments).
51 int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
52 int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv);
54 /* These functions are called for full MSDUs, i.e. full frames.
55 * These can be NULL if full MSDU operations are not needed. */
56 int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv);
57 int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len,
58 void *priv);
60 int (*set_key) (void *key, int len, u8 * seq, void *priv);
61 int (*get_key) (void *key, int len, u8 * seq, void *priv);
63 /* procfs handler for printing out key information and possible
64 * statistics */
65 char *(*print_stats) (char *p, void *priv);
67 /* Crypto specific flag get/set for configuration settings */
68 unsigned long (*get_flags)(void *priv);
69 unsigned long (*set_flags)(unsigned long flags, void *priv);
71 /* maximum number of bytes added by encryption; encrypt buf is
72 * allocated with extra_prefix_len bytes, copy of in_buf, and
73 * extra_postfix_len; encrypt need not use all this space, but
74 * the result must start at the beginning of the buffer and correct
75 * length must be returned */
76 int extra_mpdu_prefix_len, extra_mpdu_postfix_len;
77 int extra_msdu_prefix_len, extra_msdu_postfix_len;
79 struct module *owner;
82 struct ieee80211_crypt_data {
83 struct list_head list; /* delayed deletion list */
84 struct ieee80211_crypto_ops *ops;
85 void *priv;
86 atomic_t refcnt;
89 int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
90 int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
91 struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
92 void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
93 void ieee80211_crypt_deinit_handler(unsigned long);
94 void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
95 struct ieee80211_crypt_data **crypt);
96 void ieee80211_crypt_quiescing(struct ieee80211_device *ieee);
98 #endif