wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eap_fast_common.h
Go to the documentation of this file.
1 
5 #ifndef EAP_FAST_H
6 #define EAP_FAST_H
7 
8 #define EAP_FAST_VERSION 1
9 #define EAP_FAST_KEY_LEN 64
10 #define EAP_FAST_SIMCK_LEN 40
11 #define EAP_FAST_SKS_LEN 40
12 #define EAP_FAST_CMK_LEN 20
13 
14 #define TLS_EXT_PAC_OPAQUE 35
15 
16 /*
17  * RFC 5422: Section 4.2.1 - Formats for PAC TLV Attributes / Type Field
18  * Note: bit 0x8000 (Mandatory) and bit 0x4000 (Reserved) are also defined
19  * in the general PAC TLV format (Section 4.2).
20  */
21 #define PAC_TYPE_PAC_KEY 1
22 #define PAC_TYPE_PAC_OPAQUE 2
23 #define PAC_TYPE_CRED_LIFETIME 3
24 #define PAC_TYPE_A_ID 4
25 #define PAC_TYPE_I_ID 5
26 /*
27  * 6 was previous assigned for SERVER_PROTECTED_DATA, but
28  * draft-cam-winget-eap-fast-provisioning-02.txt changed this to Reserved.
29  */
30 #define PAC_TYPE_A_ID_INFO 7
31 #define PAC_TYPE_PAC_ACKNOWLEDGEMENT 8
32 #define PAC_TYPE_PAC_INFO 9
33 #define PAC_TYPE_PAC_TYPE 10
34 
35 #ifdef _MSC_VER
36 #pragma pack(push, 1)
37 #endif /* _MSC_VER */
38 
39 struct pac_tlv_hdr {
40  be16 type;
41  be16 len;
42 } STRUCT_PACKED;
43 
44 #ifdef _MSC_VER
45 #pragma pack(pop)
46 #endif /* _MSC_VER */
47 
48 
49 #define EAP_FAST_PAC_KEY_LEN 32
50 
51 /* RFC 5422: 4.2.6 PAC-Type TLV */
52 #define PAC_TYPE_TUNNEL_PAC 1
53 /* Application Specific Short Lived PACs (only in volatile storage) */
54 /* User Authorization PAC */
55 #define PAC_TYPE_USER_AUTHORIZATION 3
56 /* Application Specific Long Lived PACs */
57 /* Machine Authentication PAC */
58 #define PAC_TYPE_MACHINE_AUTHENTICATION 2
59 
60 
61 /*
62  * RFC 5422:
63  * Section 3.3 - Key Derivations Used in the EAP-FAST Provisioning Exchange
64  */
66  /* Extra key material after TLS key_block */
67  u8 session_key_seed[EAP_FAST_SKS_LEN];
68  u8 server_challenge[16]; /* MSCHAPv2 ServerChallenge */
69  u8 client_challenge[16]; /* MSCHAPv2 ClientChallenge */
70 };
71 
72 
73 struct wpabuf;
74 struct tls_connection;
75 
77  u8 *eap_payload_tlv;
78  size_t eap_payload_tlv_len;
79  struct eap_tlv_crypto_binding_tlv *crypto_binding;
80  size_t crypto_binding_len;
81  int iresult;
82  int result;
83  int request_action;
84  u8 *pac;
85  size_t pac_len;
86 };
87 
88 void eap_fast_put_tlv_hdr(struct wpabuf *buf, u16 type, u16 len);
89 void eap_fast_put_tlv(struct wpabuf *buf, u16 type, const void *data,
90  u16 len);
91 void eap_fast_put_tlv_buf(struct wpabuf *buf, u16 type,
92  const struct wpabuf *data);
93 struct wpabuf * eap_fast_tlv_eap_payload(struct wpabuf *buf);
94 void eap_fast_derive_master_secret(const u8 *pac_key, const u8 *server_random,
95  const u8 *client_random, u8 *master_secret);
96 u8 * eap_fast_derive_key(void *ssl_ctx, struct tls_connection *conn,
97  const char *label, size_t len);
98 void eap_fast_derive_eap_msk(const u8 *simck, u8 *msk);
99 void eap_fast_derive_eap_emsk(const u8 *simck, u8 *emsk);
100 int eap_fast_parse_tlv(struct eap_fast_tlv_parse *tlv,
101  int tlv_type, u8 *pos, size_t len);
102 
103 #endif /* EAP_FAST_H */
Definition: eap_fast_common.h:39
Definition: wpabuf.h:16
Definition: eap_tlv_common.h:65
Definition: eap_fast_common.h:76
Definition: tls_gnutls.c:38
Definition: eap_fast_common.h:65