improve dependency handling, fix some package makefile bugs
[openwrt.git] / target / linux / package / ieee80211-dscape / src / ieee80211_key.h
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 /* ALG_TKIP
14  * struct ieee80211_key::key is encoded as a 256-bit (32 byte) data block:
15  * Temporal Encryption Key (128 bits)
16  * Temporal Authenticator Tx MIC Key (64 bits)
17  * Temporal Authenticator Rx MIC Key (64 bits)
18  */
19
20 #define WEP_IV_LEN 4
21 #define WEP_ICV_LEN 4
22
23 #define ALG_TKIP_KEY_LEN 32
24 /* Starting offsets for each key */
25 #define ALG_TKIP_TEMP_ENCR_KEY 0
26 #define ALG_TKIP_TEMP_AUTH_TX_MIC_KEY 16
27 #define ALG_TKIP_TEMP_AUTH_RX_MIC_KEY 24
28 #define TKIP_IV_LEN 8
29 #define TKIP_ICV_LEN 4
30
31 #define ALG_CCMP_KEY_LEN 16
32 #define CCMP_HDR_LEN 8
33 #define CCMP_MIC_LEN 8
34 #define CCMP_TK_LEN 16
35 #define CCMP_PN_LEN 6
36
37 #define NUM_RX_DATA_QUEUES 17
38
39 struct ieee80211_key {
40         int hw_key_idx; /* filled and used by low-level driver */
41         ieee80211_key_alg alg;
42         union {
43                 struct {
44                         /* last used TSC */
45                         u32 iv32;
46                         u16 iv16;
47                         u16 p1k[5];
48                         int tx_initialized;
49
50                         /* last received RSC */
51                         u32 iv32_rx[NUM_RX_DATA_QUEUES];
52                         u16 iv16_rx[NUM_RX_DATA_QUEUES];
53                         u16 p1k_rx[NUM_RX_DATA_QUEUES][5];
54                         int rx_initialized[NUM_RX_DATA_QUEUES];
55                 } tkip;
56                 struct {
57                         u8 tx_pn[6];
58                         /* TODO: for WME make this replay counter per AC */
59                         u8 rx_pn[NUM_RX_DATA_QUEUES][6];
60 #ifndef AES_STATE_LEN
61 #define AES_STATE_LEN 44
62 #endif
63                         u32 aes_state[AES_STATE_LEN];
64                         u32 replays; /* dot11RSNAStatsCCMPReplays */
65                 } ccmp;
66         } u;
67         int tx_rx_count; /* number of times this key has been used */
68         int keylen;
69
70         /* if the low level driver can provide hardware acceleration it should
71          * clear this flag */
72         int force_sw_encrypt:1;
73         int keyidx:8; /* WEP key index */
74         int default_tx_key:1; /* This key is the new default TX key
75                                * (used only for broadcast keys). */
76
77         u8 key[0];
78 };
79
80 #endif /* IEEE80211_KEY_H */