]>
Commit | Line | Data |
---|---|---|
f0706e82 JB |
1 | /* |
2 | * Copyright 2002-2004, Instant802 Networks, Inc. | |
3 | * Copyright 2005, Devicescape Software, Inc. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License version 2 as | |
7 | * published by the Free Software Foundation. | |
8 | */ | |
9 | ||
10 | #ifndef IEEE80211_KEY_H | |
11 | #define IEEE80211_KEY_H | |
12 | ||
13 | #include <linux/types.h> | |
8f37171a | 14 | #include <linux/list.h> |
f0706e82 JB |
15 | #include <linux/crypto.h> |
16 | #include <net/mac80211.h> | |
17 | ||
18 | /* ALG_TKIP | |
19 | * struct ieee80211_key::key is encoded as a 256-bit (32 byte) data block: | |
20 | * Temporal Encryption Key (128 bits) | |
21 | * Temporal Authenticator Tx MIC Key (64 bits) | |
22 | * Temporal Authenticator Rx MIC Key (64 bits) | |
23 | */ | |
24 | ||
25 | #define WEP_IV_LEN 4 | |
26 | #define WEP_ICV_LEN 4 | |
27 | ||
28 | #define ALG_TKIP_KEY_LEN 32 | |
29 | /* Starting offsets for each key */ | |
30 | #define ALG_TKIP_TEMP_ENCR_KEY 0 | |
31 | #define ALG_TKIP_TEMP_AUTH_TX_MIC_KEY 16 | |
32 | #define ALG_TKIP_TEMP_AUTH_RX_MIC_KEY 24 | |
33 | #define TKIP_IV_LEN 8 | |
34 | #define TKIP_ICV_LEN 4 | |
35 | ||
36 | #define ALG_CCMP_KEY_LEN 16 | |
37 | #define CCMP_HDR_LEN 8 | |
38 | #define CCMP_MIC_LEN 8 | |
39 | #define CCMP_TK_LEN 16 | |
40 | #define CCMP_PN_LEN 6 | |
41 | ||
42 | #define NUM_RX_DATA_QUEUES 17 | |
43 | ||
44 | struct ieee80211_key { | |
f0706e82 JB |
45 | union { |
46 | struct { | |
47 | /* last used TSC */ | |
48 | u32 iv32; | |
49 | u16 iv16; | |
50 | u16 p1k[5]; | |
51 | int tx_initialized; | |
52 | ||
53 | /* last received RSC */ | |
54 | u32 iv32_rx[NUM_RX_DATA_QUEUES]; | |
55 | u16 iv16_rx[NUM_RX_DATA_QUEUES]; | |
56 | u16 p1k_rx[NUM_RX_DATA_QUEUES][5]; | |
57 | int rx_initialized[NUM_RX_DATA_QUEUES]; | |
58 | } tkip; | |
59 | struct { | |
60 | u8 tx_pn[6]; | |
61 | u8 rx_pn[NUM_RX_DATA_QUEUES][6]; | |
62 | struct crypto_cipher *tfm; | |
63 | u32 replays; /* dot11RSNAStatsCCMPReplays */ | |
64 | /* scratch buffers for virt_to_page() (crypto API) */ | |
65 | #ifndef AES_BLOCK_LEN | |
66 | #define AES_BLOCK_LEN 16 | |
67 | #endif | |
68 | u8 tx_crypto_buf[6 * AES_BLOCK_LEN]; | |
69 | u8 rx_crypto_buf[6 * AES_BLOCK_LEN]; | |
70 | } ccmp; | |
71 | } u; | |
f0706e82 | 72 | |
8f20fc24 JB |
73 | /* number of times this key has been used */ |
74 | int tx_rx_count; | |
f0706e82 | 75 | |
e9f207f0 JB |
76 | #ifdef CONFIG_MAC80211_DEBUGFS |
77 | struct { | |
78 | struct dentry *stalink; | |
79 | struct dentry *dir; | |
80 | struct dentry *keylen; | |
8f20fc24 | 81 | struct dentry *flags; |
e9f207f0 JB |
82 | struct dentry *keyidx; |
83 | struct dentry *hw_key_idx; | |
84 | struct dentry *tx_rx_count; | |
85 | struct dentry *algorithm; | |
86 | struct dentry *tx_spec; | |
87 | struct dentry *rx_spec; | |
88 | struct dentry *replays; | |
89 | struct dentry *key; | |
90 | } debugfs; | |
91 | #endif | |
92 | ||
8f20fc24 JB |
93 | /* |
94 | * key config, must be last because it contains key | |
95 | * material as variable length member | |
96 | */ | |
97 | struct ieee80211_key_conf conf; | |
f0706e82 JB |
98 | }; |
99 | ||
100 | #endif /* IEEE80211_KEY_H */ |