eapol/eapol_framework/eapol_common/include/eapol_rsna_key_header.h
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  EAP and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #if !defined(_EAPOL_RSNA_KEY_HEADER_H_)
       
    22 #define _EAPOL_RSNA_KEY_HEADER_H_
       
    23 
       
    24 #include "eapol_header.h"
       
    25 #include "eap_general_header_base.h"
       
    26 #include "eapol_key_header.h"
       
    27 #include "eapol_key_types.h"
       
    28 #include "eap_am_export.h"
       
    29 
       
    30 
       
    31 //------------------------------------------------------
       
    32 
       
    33 /// This is base class of EAPOL RSNA key header.
       
    34 /**
       
    35  * @code
       
    36  *  0                   1                   2                   3
       
    37  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
       
    38  *                                                 +-+-+-+-+-+-+-+-+
       
    39  *                                                 | EAPOL Version |
       
    40  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    41  * |  EAPOL Type   |   EAPOL Packet Body Length    | Descriptor Ty.|
       
    42  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    43  * | Key Information               | Key Length                    |
       
    44  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    45  * | Key Replay Counter 8 octets                                   |
       
    46  * +-                                                             -+
       
    47  * |                                                               |
       
    48  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    49  * | Key Nonce 32 octets                                           |
       
    50  * +-                                                             -+
       
    51  * :                                                               :
       
    52  * +-                                                             -+
       
    53  * |                                                               |
       
    54  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    55  * | EAPOL-Key IV 16 octets                                        |
       
    56  * +-                                                             -+
       
    57  * :                                                               :
       
    58  * +-                                                             -+
       
    59  * |                                                               |
       
    60  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    61  * | Key RSC 8 octets                                              |
       
    62  * +-                                                             -+
       
    63  * |                                                               |
       
    64  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    65  * | STA MAC Address 6 octets                                      |
       
    66  * +-                             -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    67  * |                               | Reserved                      |
       
    68  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    69  * | Key MIC 16 octets                                             |
       
    70  * +-                                                             -+
       
    71  * :                                                               :
       
    72  * +-                                                             -+
       
    73  * |                                                               |
       
    74  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    75  * | Key Data Length (n) 2 octets                                  |
       
    76  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    77  * | Key Data n octets                                             |
       
    78  * +-                                                             -+
       
    79  * :                                                               :
       
    80  * +-                                                             -+
       
    81  * |                                                               |
       
    82  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       
    83  * @endcode
       
    84  */
       
    85 class EAP_EXPORT eapol_RSNA_key_header_c
       
    86 : public eap_general_header_base_c
       
    87 {
       
    88 private:
       
    89 	//--------------------------------------------------
       
    90 
       
    91 	/// This is pointer to the tools class.
       
    92 	abs_eap_am_tools_c * const m_am_tools;
       
    93 
       
    94 	/// This flag indicates whether the message is RSNA (true) or WPA (false).
       
    95 	bool m_is_RSNA_when_true;
       
    96 
       
    97 	/// This flag indicates whether the message is WPXM (true) or not (false).
       
    98 	bool m_is_WPXM_when_true;
       
    99 
       
   100 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   101 
       
   102 	/// This is enumeration of Key Information bit masks.
       
   103 	enum key_information_bit_masks_e
       
   104 	{
       
   105 		m_key_information_mask_key_descriptor_version  = 0x0007, ///< 3 bits wide
       
   106 		m_key_information_mask_key_type                = 0x0008, ///< 1 bits wide
       
   107 		m_key_information_mask_reserved_a_RSNA         = 0x0030, ///< 2 bits wide, this is RSNA specific.
       
   108 		m_key_information_mask_key_index_WPA           = 0x0030, ///< 2 bits wide, this is WPA specific.
       
   109 		m_key_information_mask_install                 = 0x0040, ///< 1 bit  wide
       
   110 		m_key_information_mask_key_ack                 = 0x0080, ///< 1 bit  wide
       
   111 		m_key_information_mask_key_MIC                 = 0x0100, ///< 1 bit  wide
       
   112 		m_key_information_mask_secure                  = 0x0200, ///< 1 bit  wide
       
   113 		m_key_information_mask_error                   = 0x0400, ///< 1 bit  wide
       
   114 		m_key_information_mask_request                 = 0x0800, ///< 1 bit  wide
       
   115 		m_key_information_mask_encrypted_key_data_RSNA = 0x1000, ///< 1 bit  wide, this is RSNA specific.
       
   116 		m_key_information_mask_reserved_b_RSNA         = 0xe000, ///< 3 bits wide, this is RSNA specific.
       
   117 		m_key_information_mask_reserved_b_WPA          = 0xf000, ///< 4 bits wide, this is WPA specific.
       
   118 	};
       
   119 
       
   120 	/// This is enumeration of Key Information bit masks.
       
   121 	enum key_information_bit_shifts_e
       
   122 	{
       
   123 		m_key_information_mask_key_descriptor_version_shift  =  0,
       
   124 		m_key_information_mask_key_type_shift                =  3,
       
   125 		m_key_information_mask_reserved_a_shift_RSNA         =  4, // this is RSNA specific.
       
   126 		m_key_information_mask_key_index_shift_WPA           =  4, // this is WPA specific.
       
   127 		m_key_information_mask_install_shift                 =  6,
       
   128 		m_key_information_mask_key_ack_shift                 =  7,
       
   129 		m_key_information_mask_key_MIC_shift                 =  8,
       
   130 		m_key_information_mask_secure_shift                  =  9,
       
   131 		m_key_information_mask_error_shift                   = 10,
       
   132 		m_key_information_mask_request_shift                 = 11,		
       
   133 		m_key_information_mask_encrypted_key_data_shift_RSNA = 12, // this is RSNA specific.
       
   134 		m_key_information_mask_reserved_b_shift_WPA          = 12, // this is WPA specific.
       
   135 		m_key_information_mask_reserved_b_shift_RSNA         = 13, // this is RSNA specific.
       
   136 	};
       
   137 
       
   138 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   139 
       
   140 	/// This function sets the Key Information field.
       
   141 	EAP_FUNC_IMPORT eap_status_e set_key_information(const u16_t info);
       
   142 	
       
   143 	//--------------------------------------------------
       
   144 public:
       
   145 	//--------------------------------------------------
       
   146 
       
   147 	enum key_descriptor_version_e
       
   148 	{
       
   149 		m_key_descriptor_version_none = 0,
       
   150 		m_key_descriptor_version_1 = 1,
       
   151 		m_key_descriptor_version_2 = 2,
       
   152 	};
       
   153 
       
   154 	enum eapol_RSNA_key_header_constants_e
       
   155 	{
       
   156 		EAPOL_RSNA_KEY_EAPOL_VERSION_SIZE       =   1ul,
       
   157 		EAPOL_RSNA_KEY_EAPOL_TYPE_SIZE          =   1ul,
       
   158 		EAPOL_RSNA_KEY_EAPOL_BODY_LENGTH_SIZE   =   2ul,
       
   159 
       
   160 		EAPOL_RSNA_KEY_DESCRIPTOR_TYPE_SIZE     =   1ul,
       
   161 		EAPOL_RSNA_KEY_KEY_INFORMATION_SIZE     =   2ul,
       
   162 		EAPOL_RSNA_KEY_KEY_LENGTH_SIZE          =   2ul,
       
   163 		EAPOL_RSNA_KEY_REPLY_COUNTER_SIZE       =   8ul,
       
   164 		EAPOL_RSNA_KEY_NONCE_SIZE               =  32ul,
       
   165 		EAPOL_RSNA_EAPOL_KEY_IV_SIZE            =  16ul,
       
   166 		EAPOL_RSNA_KEY_RSC_SIZE                 =   8ul,
       
   167 		EAPOL_RSNA_KEY_STA_MAC_ADDRESS_SIZE     =   6ul,
       
   168 		EAPOL_RSNA_KEY_RESERVED_SIZE            =   2ul,
       
   169 		EAPOL_RSNA_KEY_MIC_SIZE                 =  16ul,
       
   170 		EAPOL_RSNA_KEY_DATA_LENGTH_SIZE         =   2ul,
       
   171 
       
   172 		EAPOL_RSNA_KEY_DATA_PMKID_SIZE          =  16ul,
       
   173 		EAPOL_RSNA_KEY_DATA_MAXIMUM_RSN_IE_SIZE = 257ul,
       
   174 
       
   175 		EAPOL_RSNA_EAPOL_KEY_MAXIMUM_SIZE       = 0xffff,
       
   176 	};
       
   177 
       
   178 	//--------------------------------------------------
       
   179 protected:
       
   180 	//--------------------------------------------------
       
   181 
       
   182 	enum offsets_e
       
   183 	{
       
   184 		m_offset_eapol_version            = 0ul,
       
   185 		m_offset_eapol_type               = m_offset_eapol_version            + EAPOL_RSNA_KEY_EAPOL_VERSION_SIZE,
       
   186 		m_offset_eapol_packet_body_length = m_offset_eapol_type               + EAPOL_RSNA_KEY_EAPOL_TYPE_SIZE,
       
   187 		m_offset_key_descriptor_type      = m_offset_eapol_packet_body_length + EAPOL_RSNA_KEY_EAPOL_BODY_LENGTH_SIZE,
       
   188 		m_offset_key_information          = m_offset_key_descriptor_type      + EAPOL_RSNA_KEY_DESCRIPTOR_TYPE_SIZE,
       
   189 		m_offset_key_length               = m_offset_key_information          + EAPOL_RSNA_KEY_KEY_INFORMATION_SIZE,
       
   190 		m_offset_key_replay_counter       = m_offset_key_length               + EAPOL_RSNA_KEY_KEY_LENGTH_SIZE,
       
   191 		m_offset_key_NONCE                = m_offset_key_replay_counter       + EAPOL_RSNA_KEY_REPLY_COUNTER_SIZE,
       
   192 		m_offset_EAPOL_key_IV             = m_offset_key_NONCE                + EAPOL_RSNA_KEY_NONCE_SIZE,
       
   193 		m_offset_key_RSC                  = m_offset_EAPOL_key_IV             + EAPOL_RSNA_EAPOL_KEY_IV_SIZE,
       
   194 		m_offset_key_STA_MAC_address      = m_offset_key_RSC                  + EAPOL_RSNA_KEY_RSC_SIZE,
       
   195 		m_offset_key_reserved             = m_offset_key_STA_MAC_address      + EAPOL_RSNA_KEY_STA_MAC_ADDRESS_SIZE,
       
   196 		m_offset_key_MIC                  = m_offset_key_reserved             + EAPOL_RSNA_KEY_RESERVED_SIZE,
       
   197 		m_offset_key_data_length          = m_offset_key_MIC                  + EAPOL_RSNA_KEY_MIC_SIZE,
       
   198 		m_offset_key_data                 = m_offset_key_data_length          + EAPOL_RSNA_KEY_DATA_LENGTH_SIZE,
       
   199 	};
       
   200 
       
   201 	//--------------------------------------------------
       
   202 public:
       
   203 	//--------------------------------------------------
       
   204 
       
   205 	enum eapol_network_type_e
       
   206 	{
       
   207 		eapol_network_type_none,
       
   208 		eapol_network_type_RSN,
       
   209 		eapol_network_type_WPA,
       
   210 	};
       
   211 
       
   212 	enum eapol_RSNA_cipher_e
       
   213 	{
       
   214 		eapol_RSNA_cipher_none,
       
   215 		eapol_RSNA_cipher_CCMP,
       
   216 		eapol_RSNA_cipher_TKIP,
       
   217 		eapol_RSNA_cipher_WEP_40,
       
   218 		eapol_RSNA_cipher_WEP_104,
       
   219 		eapol_RSNA_cipher_SMS4,
       
   220 	};
       
   221 
       
   222 	enum eapol_RSNA_cipher_key_length_e
       
   223 	{
       
   224 		eapol_RSNA_cipher_key_length_none    = 0ul,
       
   225 		eapol_RSNA_cipher_key_length_CCMP    = 16ul,
       
   226 		eapol_RSNA_cipher_key_length_TKIP    = 32ul,
       
   227 		eapol_RSNA_cipher_key_length_WEP_40  = 5ul,
       
   228 		eapol_RSNA_cipher_key_length_WEP_104 = 13ul,
       
   229 	};
       
   230 
       
   231 	enum eapol_tkip_mic_failure_type_e
       
   232 	{
       
   233 		eapol_tkip_mic_failure_type_group_key,
       
   234 		eapol_tkip_mic_failure_type_pairwise_key,
       
   235 	};
       
   236 
       
   237 	enum eapol_RSNA_key_type_e
       
   238 	{
       
   239 		eapol_RSNA_key_type_none,
       
   240 		eapol_RSNA_key_type_EAPOL_Key_Confirmation_Key,
       
   241 		eapol_RSNA_key_type_EAPOL_Key_Encryption_Key,
       
   242 		eapol_RSNA_key_type_Pairwise_Transient_Key,
       
   243 		eapol_RSNA_key_type_RN,
       
   244 	};
       
   245 
       
   246 	//--------------------------------------------------
       
   247 
       
   248 	// 
       
   249 	EAP_FUNC_IMPORT virtual ~eapol_RSNA_key_header_c();
       
   250 
       
   251 	// 
       
   252 	EAP_FUNC_IMPORT eapol_RSNA_key_header_c(
       
   253 		abs_eap_am_tools_c * const tools,
       
   254 		const bool is_RSNA_when_true,
       
   255 		const bool is_WPXM_when_true,
       
   256 		void * const header_begin,
       
   257 		const u32_t header_buffer_length);
       
   258 
       
   259 	EAP_FUNC_IMPORT eapol_protocol_version_e get_eapol_protocol_version() const;
       
   260 
       
   261 	EAP_FUNC_IMPORT eapol_packet_type_e get_eapol_packet_type() const;
       
   262 
       
   263 	/// Function returns pcket body field of EAPOL packet. This field is two octets in length,
       
   264 	/// taken to represent an unsigned binary number. The value of this field defines the length
       
   265 	/// in octets of the Packet Body field. Value of 0 indicates that there is no Packet Body field present.
       
   266 	EAP_FUNC_IMPORT u16_t get_eapol_packet_body_length() const;
       
   267 
       
   268 	/// This function returns whole length of the EAPOL packet.
       
   269 	/// This includes EAPOL header and packet body.
       
   270 	EAP_FUNC_IMPORT u16_t get_eapol_packet_length() const;
       
   271 
       
   272 	EAP_FUNC_IMPORT eapol_key_descriptor_type_e get_key_descriptor_type() const;
       
   273 
       
   274 	/// Gets the Key Information field.
       
   275 	EAP_FUNC_IMPORT u16_t get_key_information() const;
       
   276 	
       
   277 	/**
       
   278 	 * This function returns the Key Descriptor Version bits of Key Information field.
       
   279 	 */
       
   280 	EAP_FUNC_IMPORT eapol_RSNA_key_header_c::key_descriptor_version_e get_key_information_key_descriptor_version() const;
       
   281 
       
   282 	/**
       
   283 	 * This function returns the Key Type bit of Key Information field.
       
   284 	 */
       
   285 	EAP_FUNC_IMPORT bool get_key_information_key_type() const;
       
   286 
       
   287 	/**
       
   288 	 * This function returns the Reserved A bits (higher ones) of Key Information field.
       
   289 	 * This is RSNA specific.
       
   290 	 */
       
   291 	EAP_FUNC_IMPORT u8_t get_key_information_reserved_a() const;
       
   292 
       
   293 	/**
       
   294 	 * This function returns the key index bits (higher ones) of Key Information field.
       
   295 	 * This is WPA specific.
       
   296 	 */
       
   297 	EAP_FUNC_IMPORT u8_t get_key_information_key_index() const;
       
   298 
       
   299 	/**
       
   300 	 * This function returns the Install bit of Key Information field.
       
   301 	 */
       
   302 	EAP_FUNC_IMPORT bool get_key_information_install() const;
       
   303 
       
   304 	/**
       
   305 	 * This function returns the Key Ack bit of Key Information field.
       
   306 	 */
       
   307 	EAP_FUNC_IMPORT bool get_key_information_key_ack() const;
       
   308 
       
   309 	/**
       
   310 	 * This function returns the Key MIC bit of Key Information field.
       
   311 	 */
       
   312 	EAP_FUNC_IMPORT bool get_key_information_key_MIC() const;
       
   313 
       
   314 	/**
       
   315 	 * This function returns the Secure bit of Key Information field.
       
   316 	 */
       
   317 	EAP_FUNC_IMPORT bool get_key_information_secure() const;
       
   318 
       
   319 	/**
       
   320 	 * This function returns the Error bit of Key Information field.
       
   321 	 */
       
   322 	EAP_FUNC_IMPORT bool get_key_information_error() const;
       
   323 
       
   324 	/**
       
   325 	 * This function returns the Request bit of Key Information field.
       
   326 	 */
       
   327 	EAP_FUNC_IMPORT bool get_key_information_request() const;
       
   328 
       
   329 	/**
       
   330 	 * This function returns the Encrypted Key Data bit of Key Information field.
       
   331 	 */
       
   332 	EAP_FUNC_IMPORT bool get_key_information_encrypted_key_data() const;
       
   333 
       
   334 
       
   335 	/**
       
   336 	 * This function returns the Reserved B bits (lower ones) of Key Information field.
       
   337 	 */
       
   338 	EAP_FUNC_IMPORT u8_t get_key_information_reserved_b() const;
       
   339 
       
   340 	/**
       
   341 	 * This function returns the Key Length field of the EAPOL-Key descriptor.
       
   342 	 */
       
   343 	EAP_FUNC_IMPORT u16_t get_key_length() const;
       
   344 	
       
   345 	/**
       
   346 	 * This function returns the Key Reply Counter field of the EAPOL-Key descriptor.
       
   347 	 */
       
   348 	EAP_FUNC_IMPORT u64_t get_key_replay_counter() const;
       
   349 	
       
   350 	EAP_FUNC_IMPORT u8_t * get_key_NONCE() const;
       
   351 	
       
   352 	EAP_FUNC_IMPORT u8_t * get_EAPOL_key_IV() const;
       
   353 
       
   354 	EAP_FUNC_IMPORT u8_t * get_key_RSC() const;
       
   355 	
       
   356 	EAP_FUNC_IMPORT u8_t * get_key_STA_MAC_address() const;
       
   357 	
       
   358 	EAP_FUNC_IMPORT u8_t * get_key_reserved() const;
       
   359 	
       
   360 	EAP_FUNC_IMPORT u8_t * get_key_MIC() const;
       
   361 	
       
   362 	/**
       
   363 	 * This function returns the Key Data Length field of the EAPOL-Key descriptor.
       
   364 	 */
       
   365 	EAP_FUNC_IMPORT u16_t get_key_data_length() const;
       
   366 
       
   367 	EAP_FUNC_IMPORT u8_t * get_key_data(const u32_t key_length) const;
       
   368 
       
   369 	EAP_FUNC_IMPORT u8_t * get_key_data_offset(const u32_t offset, const u32_t key_length) const;
       
   370 
       
   371 	EAP_FUNC_IMPORT static u16_t get_header_length();
       
   372 
       
   373 	EAP_FUNC_IMPORT eap_status_e set_eapol_protocol_version(const eapol_protocol_version_e version);
       
   374 
       
   375 	EAP_FUNC_IMPORT eap_status_e set_eapol_packet_type(const eapol_packet_type_e type);
       
   376 
       
   377 	EAP_FUNC_IMPORT eap_status_e set_eapol_packet_body_length(const u32_t eapol_length);
       
   378 
       
   379 	EAP_FUNC_IMPORT eap_status_e set_key_descriptor_type(const eapol_key_descriptor_type_e eapol_key_descriptor_type);
       
   380 
       
   381 	/**
       
   382 	 * This function sets the selected bits on.
       
   383 	 */
       
   384 	EAP_FUNC_IMPORT u16_t set_bits_on(
       
   385 		u16_t key_information,
       
   386 		const u16_t set_bits,
       
   387 		const u32_t mask,
       
   388 		const u32_t shift);
       
   389 
       
   390 	/**
       
   391 	 * This function sets the Key Descriptor Version bits of Key Information field.
       
   392 	 */
       
   393 	EAP_FUNC_IMPORT eap_status_e set_key_information_key_descriptor_version(const u8_t version);
       
   394 
       
   395 	/**
       
   396 	 * This function sets the Key Type bit of Key Information field.
       
   397 	 */
       
   398 	EAP_FUNC_IMPORT eap_status_e set_key_information_key_type(const bool key_type_bit_on_when_true);
       
   399 
       
   400 	/**
       
   401 	 * This function returns the key index bits (higher ones) of Key Information field.
       
   402 	 * This is WPA specific.
       
   403 	 */
       
   404 	EAP_FUNC_IMPORT eap_status_e set_key_information_key_index(const u8_t key_index);
       
   405 
       
   406 	/**
       
   407 	 * This function sets the Install bit of Key Information field.
       
   408 	 */
       
   409 	EAP_FUNC_IMPORT eap_status_e set_key_information_install(const bool install_bit_on_when_true);
       
   410 
       
   411 	/**
       
   412 	 * This function sets the Key Ack bit of Key Information field.
       
   413 	 */
       
   414 	EAP_FUNC_IMPORT eap_status_e set_key_information_key_ack(const bool key_ack_bit_on_when_true);
       
   415 
       
   416 	/**
       
   417 	 * This function sets the Key MIC bit of Key Information field.
       
   418 	 */
       
   419 	EAP_FUNC_IMPORT eap_status_e set_key_information_key_MIC(const bool key_MIC_bit_on_when_true);
       
   420 
       
   421 	/**
       
   422 	 * This function sets the Secure bit of Key Information field.
       
   423 	 */
       
   424 	EAP_FUNC_IMPORT eap_status_e set_key_information_secure(const bool secure_bit_on_when_true);
       
   425 
       
   426 	/**
       
   427 	 * This function sets the Error bit of Key Information field.
       
   428 	 */
       
   429 	EAP_FUNC_IMPORT eap_status_e set_key_information_error(const bool error_bit_on_when_true);
       
   430 
       
   431 	/**
       
   432 	 * This function sets the Request bit of Key Information field.
       
   433 	 */
       
   434 	EAP_FUNC_IMPORT eap_status_e set_key_information_request(const bool request_bit_is_on_when_true);
       
   435 
       
   436 	/**
       
   437 	 * This function sets the Encrypted Key Data bit of Key Information field.
       
   438 	 */
       
   439 	EAP_FUNC_IMPORT eap_status_e set_key_information_encrypted_key_data(const bool encrypted_key_data_bit_is_on_when_true);
       
   440 
       
   441 	/**
       
   442 	 * This function sets the Key Length field of the EAPOL-Key descriptor.
       
   443 	 */
       
   444 	EAP_FUNC_IMPORT eap_status_e set_key_length(const u16_t length);
       
   445 	
       
   446 	/**
       
   447 	 * This function sets the Key Reply Counter field of the EAPOL-Key descriptor.
       
   448 	 */
       
   449 	EAP_FUNC_IMPORT eap_status_e set_key_replay_counter(const u64_t reply_counter);
       
   450 
       
   451 	/**
       
   452 	 * This function sets the Key Data Length field of the EAPOL-Key descriptor.
       
   453 	 */
       
   454 	EAP_FUNC_IMPORT eap_status_e set_key_data_length(const u16_t key_data_length);
       
   455 
       
   456 	/**
       
   457 	 * This function zeroes the EAPOL header and EAPOL-Key descriptor header.
       
   458 	 */
       
   459 	EAP_FUNC_IMPORT eap_status_e zero_EAPOL_header_and_Key_descriptor(
       
   460 		abs_eap_am_tools_c * const tools
       
   461 		);
       
   462 
       
   463 	EAP_FUNC_IMPORT eap_status_e zero_key_MIC(
       
   464 		abs_eap_am_tools_c * const tools
       
   465 		);
       
   466 
       
   467 	EAP_FUNC_IMPORT eap_status_e zero_key_NONCE(
       
   468 		abs_eap_am_tools_c * const tools
       
   469 		);
       
   470 
       
   471 	EAP_FUNC_IMPORT eap_status_e zero_EAPOL_key_IV(
       
   472 		abs_eap_am_tools_c * const tools
       
   473 		);
       
   474 
       
   475 	EAP_FUNC_IMPORT eap_status_e zero_key_RSC(
       
   476 		abs_eap_am_tools_c * const tools
       
   477 		);
       
   478 
       
   479 	EAP_FUNC_IMPORT eap_status_e zero_key_STA_MAC_address(
       
   480 		abs_eap_am_tools_c * const tools
       
   481 		);
       
   482 
       
   483 	EAP_FUNC_IMPORT eap_status_e zero_key_reserved(
       
   484 		abs_eap_am_tools_c * const tools
       
   485 		);
       
   486 
       
   487 	EAP_FUNC_IMPORT eap_status_e check_header() const;
       
   488 	
       
   489 	EAP_FUNC_IMPORT eap_status_e reset_header(
       
   490 		const u8_t key_index,
       
   491 		const eapol_key_authentication_type_e authentication_type,
       
   492 		const eapol_RSNA_cipher_e eapol_pairwise_cipher,
       
   493 		const u64_t key_reply_counter,
       
   494 		const bool key_type_bit_on_when_true,
       
   495 		const bool install_bit_on_when_true,
       
   496 		const bool key_ack_bit_on_when_true,
       
   497 		const bool key_MIC_bit_on_when_true,
       
   498 		const bool secure_bit_on_when_true,
       
   499 		const bool error_bit_on_when_true,
       
   500 		const bool requst_bit_on_when_true,
       
   501 		const bool STAKey_bit_on_when_true,
       
   502 		const bool encrypted_key_data_bit_on_when_true,
       
   503 		const eapol_protocol_version_e received_eapol_version,
       
   504 		const eapol_key_descriptor_type_e received_key_descriptor_type);
       
   505 	
       
   506 	// 
       
   507 	//--------------------------------------------------
       
   508 }; // class eapol_RC4_key_header_c
       
   509 
       
   510 
       
   511 #endif //#if !defined(_EAPOL_KEY_H_)
       
   512 
       
   513 //------------------------------------------------------
       
   514 
       
   515 
       
   516 
       
   517 // End.