2 * Copyright 2002-2004, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc.
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.
10 #ifndef IEEE80211_KEY_H
11 #define IEEE80211_KEY_H
13 #include <linux/types.h>
14 #include <linux/kref.h>
15 #include <linux/crypto.h>
16 #include <net/mac80211.h>
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)
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
34 #define TKIP_ICV_LEN 4
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
42 #define NUM_RX_DATA_QUEUES 17
44 struct ieee80211_key
{
47 int hw_key_idx
; /* filled and used by low-level driver */
48 ieee80211_key_alg alg
;
57 /* last received RSC */
58 u32 iv32_rx
[NUM_RX_DATA_QUEUES
];
59 u16 iv16_rx
[NUM_RX_DATA_QUEUES
];
60 u16 p1k_rx
[NUM_RX_DATA_QUEUES
][5];
61 int rx_initialized
[NUM_RX_DATA_QUEUES
];
65 u8 rx_pn
[NUM_RX_DATA_QUEUES
][6];
66 struct crypto_cipher
*tfm
;
67 u32 replays
; /* dot11RSNAStatsCCMPReplays */
68 /* scratch buffers for virt_to_page() (crypto API) */
70 #define AES_BLOCK_LEN 16
72 u8 tx_crypto_buf
[6 * AES_BLOCK_LEN
];
73 u8 rx_crypto_buf
[6 * AES_BLOCK_LEN
];
76 int tx_rx_count
; /* number of times this key has been used */
79 /* if the low level driver can provide hardware acceleration it should
81 unsigned int force_sw_encrypt
:1;
82 unsigned int default_tx_key
:1; /* This key is the new default TX key
83 * (used only for broadcast keys). */
84 s8 keyidx
; /* WEP key index */
86 #ifdef CONFIG_MAC80211_DEBUGFS
88 struct dentry
*stalink
;
90 struct dentry
*keylen
;
91 struct dentry
*force_sw_encrypt
;
92 struct dentry
*keyidx
;
93 struct dentry
*hw_key_idx
;
94 struct dentry
*tx_rx_count
;
95 struct dentry
*algorithm
;
96 struct dentry
*tx_spec
;
97 struct dentry
*rx_spec
;
98 struct dentry
*replays
;
106 #endif /* IEEE80211_KEY_H */