hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/** @file KeyApiStaDefs.h
 *
 *  @brief This file Contains data structures and defines related to key material.
 *
 * Copyright (C) 2014-2017, Marvell International Ltd.
 *
 * This software file (the "File") is distributed by Marvell International
 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
 * (the "License").  You may use, redistribute and/or modify this File in
 * accordance with the terms and conditions of the License, a copy of which
 * is available by writing to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
 *
 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
 * this warranty disclaimer.
 */
 
/******************************************************
Change log:
    03/07/2014: Initial version
******************************************************/
#ifndef _KEY_API_STA_DEFS_H
#define _KEY_API_STA_DEFS_H
/******************************************************************/
/*!
 *  \ingroup wpa_supplicant
 *  \file   keyApiStaDefs.h
 *  \brief  Contains data structures and defines related to key material
 *
 *******************************************************************/
 
/* Key Material for TKIP type key */
#define CRYPTO_TKIP_KEY_LEN_MAX     16
#define CRYPTO_KEY_LEN_MAX          16
#define MIC_KEY_LEN_MAX             8
 
/* Key Material for AES type key */
#define CRYPTO_AES_KEY_LEN_MAX      16
 
#define WAPI_KEY_LEN               16
#define WAPI_MIC_LEN               16
#define WAPI_PN_LEN                16
 
#define CRYPTO_AES_CMAC_KEY_LEN        16
#define CRYPTO_AES_CMAC_IPN_LEN        6
#define CRYPTO_WEP_KEY_LEN_MAX     13
 
/*
  WIN7 softAP (uAP) :
  BIT14 and BIT15 of keyInfo is used to pass keyID for broadcast frame
*/
 
#define KEYDATA_KEY_ID_MASK   (BIT14 | BIT15)
#define KEYDATA_KEY_ID_OFFSET 14
 
#define KEY_INFO_MULTICAST      0x1
#define KEY_INFO_UNICAST        0x2
#define KEY_INFO_ENABLED        0x4
#define KEY_INFO_DEFAULT        0x8
#define KEY_INFO_TX             0x10
#define KEY_INFO_RX             0x20
#define KEY_INFO_MULTICAST_IGTK    0x400
 
typedef MLAN_PACK_START struct {
   UINT8 key[CRYPTO_TKIP_KEY_LEN_MAX];
   UINT8 txMicKey[MIC_KEY_LEN_MAX];
   UINT8 rxMicKey[MIC_KEY_LEN_MAX];
} MLAN_PACK_END key_Type_TKIP_t;
 
/* This struct is used in ROM and existing fields should not be changed.
  * New fields can be added at the end.
  */
typedef MLAN_PACK_START struct {
   UINT8 keyIndex;
   UINT8 isDefaultTx;
   UINT8 key[CRYPTO_WEP_KEY_LEN_MAX];
} MLAN_PACK_END key_Type_WEP_t;
 
typedef MLAN_PACK_START struct {
   UINT8 key[CRYPTO_AES_KEY_LEN_MAX];
} MLAN_PACK_END key_Type_AES_t;
 
typedef MLAN_PACK_START struct {
   UINT8 keyIndex;
   UINT8 isDefKey;
   UINT8 key[WAPI_KEY_LEN];
   UINT8 mickey[WAPI_MIC_LEN];
   UINT8 rxPN[WAPI_PN_LEN];
} MLAN_PACK_END key_Type_WAPI_t;
 
typedef MLAN_PACK_START struct {
   UINT8 ipn[CRYPTO_AES_CMAC_IPN_LEN];
   UINT8 reserved[2];
   UINT8 key[CRYPTO_AES_CMAC_KEY_LEN];
} MLAN_PACK_END key_Type_AES_CMAC_t;
 
typedef MLAN_PACK_START struct {
   UINT16 keyType;
   UINT16 keyInfo;
   UINT16 keyLen;
   MLAN_PACK_START union {
       key_Type_TKIP_t TKIP;
       key_Type_AES_t AES;
       key_Type_WEP_t WEP;
 
//#if defined(WAPI_HW_SUPPORT) || defined(WAPI_FW_SUPPORT)
//        key_Type_WAPI_t     WAPI;
//#endif
       key_Type_AES_CMAC_t iGTK;
 
   } MLAN_PACK_END keyEncypt;
} MLAN_PACK_END key_MgtMaterial_t;
 
/* deprecated but still around for backwards compatibility */
#define KEY_INFO_TKIP_MULTICAST     0x1
#define KEY_INFO_TKIP_UNICAST       0x2
#define KEY_INFO_TKIP_ENABLED       0x4
 
#define KEY_INFO_AES_MULTICAST      0x1
#define KEY_INFO_AES_UNICAST        0x2
#define KEY_INFO_AES_ENABLED        0x4
 
#endif