|
1 /* |
|
2 * ============================================================================ |
|
3 * Name : ./accesssec/eapol/eapol_framework/wapi_common/include/ec_cs_tlv.h |
|
4 * Part of : WAPI / WAPI *** Info from the SWAD |
|
5 * Description : WAPI authentication |
|
6 * Version : %version: 9 % << Don't touch! Updated by Synergy at check-out. |
|
7 * |
|
8 * Copyright © 2001-2009 Nokia. All rights reserved. |
|
9 * This material, including documentation and any related computer |
|
10 * programs, is protected by copyright controlled by Nokia. All |
|
11 * rights are reserved. Copying, including reproducing, storing, |
|
12 * adapting or translating, any or all of this material requires the |
|
13 * prior written consent of Nokia. This material also contains |
|
14 * confidential information which may not be disclosed to others |
|
15 * without the prior written consent of Nokia. |
|
16 * ============================================================================ |
|
17 * Template version: 4.2 |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #if !defined(_EC_CS_TLV_H_) |
|
23 #define _EC_CS_TLV_H_ |
|
24 |
|
25 #if defined(USE_WAPI_CORE) |
|
26 |
|
27 #include "eap_am_export.h" |
|
28 #include "eap_tools.h" |
|
29 #include "ec_cs_tlv_header.h" |
|
30 #include "ec_cs_types.h" |
|
31 |
|
32 |
|
33 /** @file */ |
|
34 |
|
35 class ec_cs_variable_data_c; |
|
36 class tls_extension_c; |
|
37 class ec_cs_tlv_payloads_c; |
|
38 class ec_cs_data_c; |
|
39 |
|
40 //---------------------------------------------------------------------------- |
|
41 |
|
42 |
|
43 /// This class defines EC CS TLV. |
|
44 /** |
|
45 * EC CS TLV is constructed with Attribute-Value Pairs. |
|
46 */ |
|
47 class EAP_EXPORT ec_cs_tlv_c |
|
48 { |
|
49 private: |
|
50 //-------------------------------------------------- |
|
51 |
|
52 /// This is pointer to the tools class. |
|
53 abs_eap_am_tools_c * const m_am_tools; |
|
54 |
|
55 ec_cs_tlv_payloads_c * m_payloads; |
|
56 |
|
57 bool m_is_client; |
|
58 |
|
59 bool m_is_valid; |
|
60 |
|
61 //-------------------------------------------------- |
|
62 |
|
63 eap_status_e create_MAC( |
|
64 eap_variable_data_c * const MAC, |
|
65 const eap_variable_data_c * const server_opaque_mac_key, |
|
66 const eap_variable_data_c * const protected_data); |
|
67 |
|
68 //-------------------------------------------------- |
|
69 public: |
|
70 //-------------------------------------------------- |
|
71 |
|
72 /** |
|
73 * The destructor of the ec_cs_tlv_c class does nothing. |
|
74 */ |
|
75 EAP_FUNC_IMPORT virtual ~ec_cs_tlv_c(); |
|
76 |
|
77 /** |
|
78 * The constructor of the ec_cs_tlv_c class simply initializes the attributes. |
|
79 */ |
|
80 EAP_FUNC_IMPORT ec_cs_tlv_c( |
|
81 abs_eap_am_tools_c * const tools, |
|
82 const bool true_when_is_client); |
|
83 |
|
84 |
|
85 EAP_FUNC_IMPORT const ec_cs_tlv_payloads_c * get_payloads() const; |
|
86 |
|
87 |
|
88 EAP_FUNC_IMPORT bool get_is_valid(); |
|
89 |
|
90 EAP_FUNC_IMPORT eap_status_e reset(); |
|
91 |
|
92 //-------------------------------------------------- |
|
93 |
|
94 EAP_FUNC_IMPORT eap_status_e generate_data_key( |
|
95 const bool in_true_when_encryption_key, |
|
96 const ec_cs_data_type_e in_data_type, |
|
97 eap_variable_data_c * const out_MAC_key, |
|
98 const eap_variable_data_c * const in_base_key, |
|
99 const eap_variable_data_c * const in_data_reference, |
|
100 const eap_variable_data_c * const in_CS_store_device_seed); |
|
101 |
|
102 /** |
|
103 * Function creates the Master key data block. |
|
104 * Parameter in_CS_master_key_or_null is optional. |
|
105 * Null parameter value generates a new Master key with random data. |
|
106 */ |
|
107 EAP_FUNC_IMPORT eap_status_e create_master_key_data( |
|
108 const eap_variable_data_c * const in_CS_password, |
|
109 const eap_variable_data_c * const in_CS_store_device_seed, |
|
110 const eap_variable_data_c * const in_CS_master_key_or_null, |
|
111 const eap_variable_data_c * const in_data_reference, |
|
112 eap_variable_data_c * const master_key_data); |
|
113 |
|
114 //-------------------------------------------------- |
|
115 |
|
116 EAP_FUNC_IMPORT eap_status_e create_tlv( |
|
117 ec_cs_variable_data_c *const new_tlv, |
|
118 const ec_cs_tlv_type_e type, |
|
119 const eap_variable_data_c * const pac_attributes); |
|
120 |
|
121 |
|
122 EAP_FUNC_IMPORT eap_status_e create_generic_tlv( |
|
123 ec_cs_variable_data_c * const new_tlv, |
|
124 const ec_cs_tlv_type_e type, |
|
125 const eap_variable_data_c * const payload); |
|
126 |
|
127 EAP_FUNC_IMPORT eap_status_e create_u32_t_tlv( |
|
128 ec_cs_variable_data_c * const new_tlv, |
|
129 const ec_cs_tlv_type_e type, |
|
130 const u32_t value); |
|
131 |
|
132 EAP_FUNC_IMPORT eap_status_e create_u16_t_tlv( |
|
133 ec_cs_variable_data_c * const new_tlv, |
|
134 const ec_cs_tlv_type_e type, |
|
135 const u16_t value); |
|
136 |
|
137 //-------------------------------------------------- |
|
138 |
|
139 EAP_FUNC_IMPORT eap_status_e read_generic_tlv( |
|
140 const ec_cs_variable_data_c * const tlv, |
|
141 const ec_cs_tlv_type_e type, |
|
142 eap_variable_data_c * const payload); |
|
143 |
|
144 EAP_FUNC_IMPORT eap_status_e read_u32_t_tlv( |
|
145 const ec_cs_variable_data_c * const tlv, |
|
146 const ec_cs_tlv_type_e type, |
|
147 u32_t * const value); |
|
148 |
|
149 EAP_FUNC_IMPORT eap_status_e read_u16_t_tlv( |
|
150 const ec_cs_variable_data_c * const tlv, |
|
151 const ec_cs_tlv_type_e type, |
|
152 u16_t * const value); |
|
153 |
|
154 //-------------------------------------------------- |
|
155 |
|
156 EAP_FUNC_IMPORT eap_status_e create_encrypted_tlv( |
|
157 const ec_cs_tlv_type_e in_TLV_Type, |
|
158 const eap_variable_data_c * const in_encryption_key, |
|
159 const ec_cs_variable_data_c * const in_plaintext_data_TLV, |
|
160 ec_cs_variable_data_c * const out_new_tlv); |
|
161 |
|
162 EAP_FUNC_IMPORT eap_status_e parse_encrypted_tlv( |
|
163 const eap_variable_data_c * const in_decryption_key, |
|
164 const ec_cs_variable_data_c * const in_encrypted_block_tlv, |
|
165 ec_cs_variable_data_c * const out_plain_text_tlv); |
|
166 |
|
167 EAP_FUNC_IMPORT eap_status_e create_data_with_MAC( |
|
168 const eap_variable_data_c * const MAC_key, |
|
169 const eap_variable_data_c * const in_data, |
|
170 eap_variable_data_c * const out_data_tlv); |
|
171 |
|
172 EAP_FUNC_IMPORT eap_status_e verify_data_with_MAC( |
|
173 const eap_variable_data_c * const in_base_key, |
|
174 const eap_variable_data_c * const in_CS_store_device_seed, |
|
175 const ec_cs_data_c * const in_CS_data_with_MAC); |
|
176 |
|
177 EAP_FUNC_IMPORT eap_status_e parse_data_with_MAC( |
|
178 const eap_variable_data_c * const in_MAC_key, |
|
179 const eap_variable_data_c * const in_CS_data_with_MAC); |
|
180 |
|
181 EAP_FUNC_IMPORT eap_status_e parse_cs_tlv( |
|
182 const ec_cs_variable_data_c * const in_PAC_tlv); |
|
183 |
|
184 EAP_FUNC_IMPORT eap_status_e parse_encrypted_tlv_with_MAC( |
|
185 const ec_cs_data_type_e in_data_type, |
|
186 const eap_variable_data_c * const in_base_key, |
|
187 const eap_variable_data_c * const in_data_reference, |
|
188 const eap_variable_data_c * const in_CS_store_device_seed, |
|
189 const eap_variable_data_c * const in_data_tlv, |
|
190 ec_cs_variable_data_c * const out_plain_text_tlv); |
|
191 |
|
192 //-------------------------------------------------- |
|
193 |
|
194 EAP_FUNC_IMPORT eap_status_e create_encrypted_certificate( |
|
195 const ec_cs_data_type_e in_data_type, |
|
196 const eap_variable_data_c * const in_base_key, |
|
197 const eap_variable_data_c * const in_data_reference, |
|
198 const eap_variable_data_c * const in_CS_store_device_seed, |
|
199 const eap_variable_data_c * const in_certificate_reference, |
|
200 const ec_cs_tlv_type_e in_certificate_tlv_type, |
|
201 const eap_variable_data_c * const in_certificate_data, |
|
202 eap_variable_data_c * const out_certificate_data_block); |
|
203 |
|
204 EAP_FUNC_IMPORT eap_status_e parse_encrypted_certificate( |
|
205 const ec_cs_data_type_e in_data_type, |
|
206 const eap_variable_data_c * const in_base_key, |
|
207 const eap_variable_data_c * const in_data_reference, |
|
208 const eap_variable_data_c * const in_CS_store_device_seed, |
|
209 const eap_variable_data_c * const in_certificate_data_block, |
|
210 eap_variable_data_c * const out_certificate_reference); |
|
211 |
|
212 //-------------------------------------------------- |
|
213 |
|
214 }; // class ec_cs_tlv_c |
|
215 |
|
216 |
|
217 #endif //#if defined(USE_WAPI_CORE) |
|
218 |
|
219 #endif //#if !defined(_EC_CS_TLV_H_) |
|
220 |
|
221 |
|
222 |
|
223 // End. |