00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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
00028
00029
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
00038
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
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
00057
00058
00059 #define EAP_FAST_PAC_KEY_LEN 32
00060
00061
00062 #define PAC_TYPE_TUNNEL_PAC 1
00063
00064
00065 #define PAC_TYPE_USER_AUTHORIZATION 3
00066
00067
00068 #define PAC_TYPE_MACHINE_AUTHENTICATION 2
00069
00070
00071
00072
00073
00074
00075 struct eap_fast_key_block_provisioning {
00076
00077 u8 session_key_seed[EAP_FAST_SKS_LEN];
00078 u8 server_challenge[16];
00079 u8 client_challenge[16];
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