$search
00001 /* 00002 * EAP-FAST definitions (RFC 4851) 00003 * Copyright (c) 2004-2008, 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_FAST_H 00016 #define EAP_FAST_H 00017 00018 #define EAP_FAST_VERSION 1 00019 #define EAP_FAST_KEY_LEN 64 00020 #define EAP_FAST_SIMCK_LEN 40 00021 #define EAP_FAST_SKS_LEN 40 00022 #define EAP_FAST_CMK_LEN 20 00023 00024 #define TLS_EXT_PAC_OPAQUE 35 00025 00026 /* 00027 * RFC 5422: Section 4.2.1 - Formats for PAC TLV Attributes / Type Field 00028 * Note: bit 0x8000 (Mandatory) and bit 0x4000 (Reserved) are also defined 00029 * in the general PAC TLV format (Section 4.2). 00030 */ 00031 #define PAC_TYPE_PAC_KEY 1 00032 #define PAC_TYPE_PAC_OPAQUE 2 00033 #define PAC_TYPE_CRED_LIFETIME 3 00034 #define PAC_TYPE_A_ID 4 00035 #define PAC_TYPE_I_ID 5 00036 /* 00037 * 6 was previous assigned for SERVER_PROTECTED_DATA, but 00038 * draft-cam-winget-eap-fast-provisioning-02.txt changed this to Reserved. 00039 */ 00040 #define PAC_TYPE_A_ID_INFO 7 00041 #define PAC_TYPE_PAC_ACKNOWLEDGEMENT 8 00042 #define PAC_TYPE_PAC_INFO 9 00043 #define PAC_TYPE_PAC_TYPE 10 00044 00045 #ifdef _MSC_VER 00046 #pragma pack(push, 1) 00047 #endif /* _MSC_VER */ 00048 00049 struct pac_tlv_hdr { 00050 be16 type; 00051 be16 len; 00052 } STRUCT_PACKED; 00053 00054 #ifdef _MSC_VER 00055 #pragma pack(pop) 00056 #endif /* _MSC_VER */ 00057 00058 00059 #define EAP_FAST_PAC_KEY_LEN 32 00060 00061 /* RFC 5422: 4.2.6 PAC-Type TLV */ 00062 #define PAC_TYPE_TUNNEL_PAC 1 00063 /* Application Specific Short Lived PACs (only in volatile storage) */ 00064 /* User Authorization PAC */ 00065 #define PAC_TYPE_USER_AUTHORIZATION 3 00066 /* Application Specific Long Lived PACs */ 00067 /* Machine Authentication PAC */ 00068 #define PAC_TYPE_MACHINE_AUTHENTICATION 2 00069 00070 00071 /* 00072 * RFC 5422: 00073 * Section 3.3 - Key Derivations Used in the EAP-FAST Provisioning Exchange 00074 */ 00075 struct eap_fast_key_block_provisioning { 00076 /* Extra key material after TLS key_block */ 00077 u8 session_key_seed[EAP_FAST_SKS_LEN]; 00078 u8 server_challenge[16]; /* MSCHAPv2 ServerChallenge */ 00079 u8 client_challenge[16]; /* MSCHAPv2 ClientChallenge */ 00080 }; 00081 00082 00083 struct wpabuf; 00084 struct tls_connection; 00085 00086 struct eap_fast_tlv_parse { 00087 u8 *eap_payload_tlv; 00088 size_t eap_payload_tlv_len; 00089 struct eap_tlv_crypto_binding_tlv *crypto_binding; 00090 size_t crypto_binding_len; 00091 int iresult; 00092 int result; 00093 int request_action; 00094 u8 *pac; 00095 size_t pac_len; 00096 }; 00097 00098 void eap_fast_put_tlv_hdr(struct wpabuf *buf, u16 type, u16 len); 00099 void eap_fast_put_tlv(struct wpabuf *buf, u16 type, const void *data, 00100 u16 len); 00101 void eap_fast_put_tlv_buf(struct wpabuf *buf, u16 type, 00102 const struct wpabuf *data); 00103 struct wpabuf * eap_fast_tlv_eap_payload(struct wpabuf *buf); 00104 void eap_fast_derive_master_secret(const u8 *pac_key, const u8 *server_random, 00105 const u8 *client_random, u8 *master_secret); 00106 u8 * eap_fast_derive_key(void *ssl_ctx, struct tls_connection *conn, 00107 const char *label, size_t len); 00108 void eap_fast_derive_eap_msk(const u8 *simck, u8 *msk); 00109 void eap_fast_derive_eap_emsk(const u8 *simck, u8 *emsk); 00110 int eap_fast_parse_tlv(struct eap_fast_tlv_parse *tlv, 00111 int tlv_type, u8 *pos, int len); 00112 00113 #endif /* EAP_FAST_H */