$search
00001 /* 00002 * EAP server/peer: EAP-PAX shared routines 00003 * Copyright (c) 2005-2007, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef EAP_PAX_COMMON_H 00016 #define EAP_PAX_COMMON_H 00017 00018 #ifdef _MSC_VER 00019 #pragma pack(push, 1) 00020 #endif /* _MSC_VER */ 00021 00022 struct eap_pax_hdr { 00023 u8 op_code; 00024 u8 flags; 00025 u8 mac_id; 00026 u8 dh_group_id; 00027 u8 public_key_id; 00028 /* Followed by variable length payload and ICV */ 00029 } STRUCT_PACKED; 00030 00031 #ifdef _MSC_VER 00032 #pragma pack(pop) 00033 #endif /* _MSC_VER */ 00034 00035 00036 /* op_code: */ 00037 enum { 00038 EAP_PAX_OP_STD_1 = 0x01, 00039 EAP_PAX_OP_STD_2 = 0x02, 00040 EAP_PAX_OP_STD_3 = 0x03, 00041 EAP_PAX_OP_SEC_1 = 0x11, 00042 EAP_PAX_OP_SEC_2 = 0x12, 00043 EAP_PAX_OP_SEC_3 = 0x13, 00044 EAP_PAX_OP_SEC_4 = 0x14, 00045 EAP_PAX_OP_SEC_5 = 0x15, 00046 EAP_PAX_OP_ACK = 0x21 00047 }; 00048 00049 /* flags: */ 00050 #define EAP_PAX_FLAGS_MF 0x01 00051 #define EAP_PAX_FLAGS_CE 0x02 00052 #define EAP_PAX_FLAGS_AI 0x04 00053 00054 /* mac_id: */ 00055 #define EAP_PAX_MAC_HMAC_SHA1_128 0x01 00056 #define EAP_PAX_HMAC_SHA256_128 0x02 00057 00058 /* dh_group_id: */ 00059 #define EAP_PAX_DH_GROUP_NONE 0x00 00060 #define EAP_PAX_DH_GROUP_2048_MODP 0x01 00061 #define EAP_PAX_DH_GROUP_3072_MODP 0x02 00062 #define EAP_PAX_DH_GROUP_NIST_ECC_P_256 0x03 00063 00064 /* public_key_id: */ 00065 #define EAP_PAX_PUBLIC_KEY_NONE 0x00 00066 #define EAP_PAX_PUBLIC_KEY_RSAES_OAEP 0x01 00067 #define EAP_PAX_PUBLIC_KEY_RSA_PKCS1_V1_5 0x02 00068 #define EAP_PAX_PUBLIC_KEY_EL_GAMAL_NIST_ECC 0x03 00069 00070 /* ADE type: */ 00071 #define EAP_PAX_ADE_VENDOR_SPECIFIC 0x01 00072 #define EAP_PAX_ADE_CLIENT_CHANNEL_BINDING 0x02 00073 #define EAP_PAX_ADE_SERVER_CHANNEL_BINDING 0x03 00074 00075 00076 #define EAP_PAX_RAND_LEN 32 00077 #define EAP_PAX_MAC_LEN 16 00078 #define EAP_PAX_ICV_LEN 16 00079 #define EAP_PAX_AK_LEN 16 00080 #define EAP_PAX_MK_LEN 16 00081 #define EAP_PAX_CK_LEN 16 00082 #define EAP_PAX_ICK_LEN 16 00083 00084 00085 int eap_pax_kdf(u8 mac_id, const u8 *key, size_t key_len, 00086 const char *identifier, 00087 const u8 *entropy, size_t entropy_len, 00088 size_t output_len, u8 *output); 00089 int eap_pax_mac(u8 mac_id, const u8 *key, size_t key_len, 00090 const u8 *data1, size_t data1_len, 00091 const u8 *data2, size_t data2_len, 00092 const u8 *data3, size_t data3_len, 00093 u8 *mac); 00094 int eap_pax_initial_key_derivation(u8 mac_id, const u8 *ak, const u8 *e, 00095 u8 *mk, u8 *ck, u8 *ick); 00096 00097 #endif /* EAP_PAX_COMMON_H */