| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Original code based on Host AP (software wireless LAN access point) driver | 
					
						
							|  |  |  |  * for Intersil Prism2/2.5/3. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | 
					
						
							| 
									
										
										
										
											2007-03-24 17:15:30 -07:00
										 |  |  |  * <j@w1.fi> | 
					
						
							|  |  |  |  * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi> | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Adaption to a generic IEEE 802.11 stack by James Ketrenos | 
					
						
							|  |  |  |  * <jketreno@linux.intel.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (c) 2004, Intel Corporation | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU General Public License version 2 as | 
					
						
							|  |  |  |  * published by the Free Software Foundation. See README and COPYING for | 
					
						
							|  |  |  |  * more details. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * This file defines the interface to the ieee80211 crypto module. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #ifndef IEEE80211_CRYPT_H
 | 
					
						
							|  |  |  | #define IEEE80211_CRYPT_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-27 02:43:12 -02:00
										 |  |  | #include <linux/types.h>
 | 
					
						
							|  |  |  | #include <linux/list.h>
 | 
					
						
							| 
									
										
										
										
											2006-01-14 03:09:34 +01:00
										 |  |  | #include <net/ieee80211.h>
 | 
					
						
							| 
									
										
										
										
											2005-12-27 02:43:12 -02:00
										 |  |  | #include <asm/atomic.h>
 | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-22 10:34:15 +00:00
										 |  |  | enum { | 
					
						
							| 
									
										
										
										
											2005-10-03 10:23:42 -05:00
										 |  |  | 	IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), | 
					
						
							| 
									
										
										
										
											2005-09-22 10:34:15 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-27 02:43:12 -02:00
										 |  |  | struct sk_buff; | 
					
						
							|  |  |  | struct module; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | struct ieee80211_crypto_ops { | 
					
						
							|  |  |  | 	const char *name; | 
					
						
							| 
									
										
										
										
											2005-11-09 01:01:04 -05:00
										 |  |  | 	struct list_head list; | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* init new crypto context (e.g., allocate private data space,
 | 
					
						
							|  |  |  | 	 * select IV, etc.); returns NULL on failure or pointer to allocated | 
					
						
							|  |  |  | 	 * private data on success */ | 
					
						
							| 
									
										
										
										
											2005-09-22 10:34:15 +00:00
										 |  |  | 	void *(*init) (int keyidx); | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* deinitialize crypto context and free allocated private data */ | 
					
						
							| 
									
										
										
										
											2005-09-13 17:35:21 -05:00
										 |  |  | 	void (*deinit) (void *priv); | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-19 16:22:32 +08:00
										 |  |  | 	int (*build_iv) (struct sk_buff * skb, int hdr_len, | 
					
						
							|  |  |  | 			 u8 *key, int keylen, void *priv); | 
					
						
							| 
									
										
										
										
											2005-09-21 11:58:49 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 	/* encrypt/decrypt return < 0 on error or >= 0 on success. The return
 | 
					
						
							|  |  |  | 	 * value from decrypt_mpdu is passed as the keyidx value for | 
					
						
							|  |  |  | 	 * decrypt_msdu. skb must have enough head and tail room for the | 
					
						
							|  |  |  | 	 * encryption; if not, error will be returned; these functions are | 
					
						
							|  |  |  | 	 * called for all MPDUs (i.e., fragments). | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2005-09-13 17:35:21 -05:00
										 |  |  | 	int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); | 
					
						
							|  |  |  | 	int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* These functions are called for full MSDUs, i.e. full frames.
 | 
					
						
							|  |  |  | 	 * These can be NULL if full MSDU operations are not needed. */ | 
					
						
							| 
									
										
										
										
											2005-09-13 17:35:21 -05:00
										 |  |  | 	int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv); | 
					
						
							|  |  |  | 	int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len, | 
					
						
							|  |  |  | 			     void *priv); | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-13 17:35:21 -05:00
										 |  |  | 	int (*set_key) (void *key, int len, u8 * seq, void *priv); | 
					
						
							|  |  |  | 	int (*get_key) (void *key, int len, u8 * seq, void *priv); | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* procfs handler for printing out key information and possible
 | 
					
						
							|  |  |  | 	 * statistics */ | 
					
						
							| 
									
										
										
										
											2005-09-13 17:35:21 -05:00
										 |  |  | 	char *(*print_stats) (char *p, void *priv); | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-22 10:34:15 +00:00
										 |  |  | 	/* Crypto specific flag get/set for configuration settings */ | 
					
						
							| 
									
										
										
										
											2005-10-03 10:23:42 -05:00
										 |  |  | 	unsigned long (*get_flags) (void *priv); | 
					
						
							|  |  |  | 	unsigned long (*set_flags) (unsigned long flags, void *priv); | 
					
						
							| 
									
										
										
										
											2005-09-22 10:34:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 	/* maximum number of bytes added by encryption; encrypt buf is
 | 
					
						
							|  |  |  | 	 * allocated with extra_prefix_len bytes, copy of in_buf, and | 
					
						
							|  |  |  | 	 * extra_postfix_len; encrypt need not use all this space, but | 
					
						
							|  |  |  | 	 * the result must start at the beginning of the buffer and correct | 
					
						
							|  |  |  | 	 * length must be returned */ | 
					
						
							| 
									
										
										
										
											2005-09-21 11:54:53 -05:00
										 |  |  | 	int extra_mpdu_prefix_len, extra_mpdu_postfix_len; | 
					
						
							|  |  |  | 	int extra_msdu_prefix_len, extra_msdu_postfix_len; | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct module *owner; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct ieee80211_crypt_data { | 
					
						
							| 
									
										
										
										
											2005-09-13 17:35:21 -05:00
										 |  |  | 	struct list_head list;	/* delayed deletion list */ | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 	struct ieee80211_crypto_ops *ops; | 
					
						
							|  |  |  | 	void *priv; | 
					
						
							|  |  |  | 	atomic_t refcnt; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-27 02:43:12 -02:00
										 |  |  | struct ieee80211_device; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); | 
					
						
							|  |  |  | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); | 
					
						
							| 
									
										
										
										
											2005-09-13 17:35:21 -05:00
										 |  |  | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); | 
					
						
							|  |  |  | void ieee80211_crypt_deinit_handler(unsigned long); | 
					
						
							|  |  |  | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | 
					
						
							|  |  |  | 				    struct ieee80211_crypt_data **crypt); | 
					
						
							| 
									
										
										
										
											2005-09-21 11:54:15 -05:00
										 |  |  | void ieee80211_crypt_quiescing(struct ieee80211_device *ieee); | 
					
						
							| 
									
										
										
										
											2005-05-12 22:48:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif
 |