wpa_supplicant / hostapd 2.0

eap_fast_common.h

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