The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
eap_fast.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or (at
6 * your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: 8cdb16bc45b495e6b0d7996bb985e88c190bbdc1 $
20 * @file eap_fast.h
21 * @brief Function declarations and packet structures
22 *
23 * @author Alexander Clouter (alex@digriz.org.uk)
24 *
25 * @copyright 2016 Alan DeKok (aland@freeradius.org)
26 * @copyright 2016 The FreeRADIUS server project
27 */
28RCSIDH(eap_fast_h, "$Id: 8cdb16bc45b495e6b0d7996bb985e88c190bbdc1 $")
29
30#include <freeradius-devel/eap/tls.h>
31#include <freeradius-devel/radius/radius.h>
32#include <freeradius-devel/util/chap.h>
33
34#define EAP_FAST_VERSION 1
35
36#define EAP_FAST_KEY_LEN 64
37#define EAP_EMSK_LEN 64
38#define EAP_FAST_SKS_LEN 40
39#define EAP_FAST_SIMCK_LEN 40
40#define EAP_FAST_CMK_LEN 20
41
42#define EAP_FAST_TLV_MANDATORY 0x8000
43#define EAP_FAST_TLV_TYPE 0x3fff
44
45#define EAP_FAST_FATAL_ERROR 2000
46#define EAP_FAST_ERR_TUNNEL_COMPROMISED 2001
47#define EAP_FAST_ERR_UNEXPECTED_TLV 2002
48
49#define EAP_FAST_TLV_RESULT_SUCCESS 1
50#define EAP_FAST_TLV_RESULT_FAILURE 2
51
59
66
73
74#define PAC_KEY_LENGTH 32
75#define PAC_A_ID_LENGTH 16
76#define PAC_I_ID_LENGTH 16
77#define PAC_A_ID_INFO_LENGTH 32
78
79typedef struct {
82} CC_HINT(__packed__) eap_fast_pac_attr_hdr_t;
83
84typedef struct {
86 uint32_t data; // secs since epoch
87} CC_HINT(__packed__) eap_fast_pac_attr_lifetime_t;
88
93
98
103
108
113
119
120typedef struct {
122 unsigned char aad[PAC_A_ID_LENGTH];
123 unsigned char iv[EVP_MAX_IV_LENGTH];
124 unsigned char tag[EVP_GCM_TLS_TAG_LEN];
125 uint8_t data[sizeof(eap_fast_attr_pac_opaque_plaintext_t) * 2]; // space for EVP
126} CC_HINT(__packed__) eap_fast_attr_pac_opaque_t;
127
135
141
142/* RFC 4851, Section 4.2.8 - Crypto-Binding TLV */
153
158
159/* RFC 5422: Section 3.3 - Key Derivations Used in the EAP-FAST Provisioning Exchange */
160typedef struct {
161 uint8_t session_key_seed[EAP_FAST_SKS_LEN];
162 uint8_t server_challenge[MD5_DIGEST_LENGTH];
163 uint8_t client_challenge[MD5_DIGEST_LENGTH];
164} CC_HINT(__packed__) eap_fast_keyblock_t;
165
166typedef struct {
168
170
171 int mode;
177 struct {
178 uint8_t mppe_send[MD5_DIGEST_LENGTH];
179 uint8_t mppe_recv[MD5_DIGEST_LENGTH];
180 } CC_HINT(__packed__) isk;
183
186
189 uint8_t const *a_id;
191
192 struct {
193 uint8_t *key;
195 fr_time_t expires;
196 bool expired;
197 bool send;
198 } pac;
199
201
202#ifdef WITH_PROXY
203 bool proxy_tunneled_request_as_eap; //!< Proxy tunneled session as EAP, or as de-capsulated
204 //!< protocol.
205#endif
208
214
223
250extern HIDDEN fr_dict_t const *dict_eap_fast;
251
252/*
253 * Process the FAST portion of an EAP-FAST request.
254 */
255void eap_fast_tlv_append(fr_tls_session_t *tls_session, fr_dict_attr_t const *da, bool mandatory,
256 int length, const void *data) CC_HINT(nonnull);
257fr_radius_packet_code_t eap_fast_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session) CC_HINT(nonnull);
258
259/*
260 * A bunch of EAP-FAST helper functions.
261 */
263 uint8_t const *data, size_t data_len,
264 UNUSED void *decode_ctx);
#define RCSIDH(h, id)
Definition build.h:484
#define HIDDEN
Definition build.h:314
#define UNUSED
Definition build.h:315
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:101
fr_radius_packet_code_t
RADIUS packet codes.
Definition defs.h:31
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_info_i_id
HIDDEN fr_dict_attr_t const * attr_eap_fast_result
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_info_a_id_info
HIDDEN fr_dict_attr_t const * attr_eap_fast_nak
HIDDEN fr_dict_attr_t const * attr_proxy_to_realm
uint8_t const * a_id
Definition eap_fast.h:189
#define EAP_FAST_SKS_LEN
Definition eap_fast.h:38
eap_fast_pac_attr_lifetime_t lifetime
Definition eap_fast.h:116
eap_fast_pac_attr_hdr_t hdr
Definition eap_fast.h:95
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_a_id_info
eap_fast_pac_attr_hdr_t hdr
Definition eap_fast.h:100
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_key
ssize_t eap_fast_decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t data_len, UNUSED void *decode_ctx)
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_info_tlv
eap_fast_pac_attr_lifetime_t lifetime
Definition eap_fast.h:130
HIDDEN fr_dict_attr_t const * attr_eap_fast_error
eap_fast_stage_t stage
Definition eap_fast.h:172
HIDDEN fr_dict_attr_t const * attr_user_name
Definition base.c:104
HIDDEN fr_dict_attr_t const * attr_ms_mppe_send_key
Definition base.c:101
#define PAC_A_ID_LENGTH
Definition eap_fast.h:75
eap_fast_pac_attr_pac_key_t key
Definition eap_fast.h:137
eap_fast_keyblock_t * keyblock
Definition eap_fast.h:173
eap_fast_pac_attr_hdr_t hdr
Definition eap_fast.h:85
fr_time_delta_t pac_lifetime
Definition eap_fast.h:187
uint8_t * s_imck
Definition eap_fast.h:174
eap_fast_tlv_crypto_binding_tlv_subtype_t
Definition eap_fast.h:154
@ EAP_FAST_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST
Definition eap_fast.h:155
@ EAP_FAST_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE
Definition eap_fast.h:156
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_info_pac_type
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_info_pac_lifetime
eap_fast_pac_attr_a_id_info_t a_id_info
Definition eap_fast.h:132
HIDDEN fr_dict_attr_t const * attr_ms_chap_peer_challenge
int default_provisioning_method
Definition eap_fast.h:185
eap_fast_pac_attr_hdr_t hdr
Definition eap_fast.h:129
HIDDEN fr_dict_attr_t const * attr_ms_mppe_recv_key
Definition base.c:102
HIDDEN fr_dict_attr_t const * attr_eap_tls_require_client_cert
#define PAC_I_ID_LENGTH
Definition eap_fast.h:76
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_type
HIDDEN fr_dict_attr_t const * attr_user_password
fr_pair_t * username
Definition eap_fast.h:167
eap_fast_pac_attr_hdr_t hdr
Definition eap_fast.h:121
HIDDEN fr_dict_attr_t const * attr_eap_fast_intermediate_result
HIDDEN fr_dict_attr_t const * attr_ms_chap_challenge
uint8_t * emsk
Definition eap_fast.h:182
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_opaque_pac_type
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_tlv
eap_fast_pac_attr_hdr_t hdr
Definition eap_fast.h:110
eap_fast_attr_pac_opaque_t opaque
Definition eap_fast.h:139
HIDDEN fr_dict_attr_t const * attr_eap_fast_eap_payload
eap_fast_pac_attr_pac_type_t type
Definition eap_fast.h:115
HIDDEN fr_dict_attr_t const * attr_eap_fast_crypto_binding
fr_radius_packet_code_t eap_fast_process(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
Definition eap_fast.c:898
HIDDEN fr_dict_attr_t const * attr_eap_fast_vendor_specific
eap_fast_pac_attr_hdr_t hdr
Definition eap_fast.h:90
HIDDEN fr_dict_t const * dict_eap_fast
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_info_a_id
HIDDEN fr_dict_attr_t const * attr_freeradius_proxied_to
Definition base.c:100
char const * authority_identity
Definition eap_fast.h:188
HIDDEN fr_dict_attr_t const * attr_eap_msk
Definition base.c:97
eap_fast_attr_pac_info_t info
Definition eap_fast.h:138
#define PAC_A_ID_INFO_LENGTH
Definition eap_fast.h:77
eap_fast_pac_attr_a_id_t a_id
Definition eap_fast.h:131
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_opaque_i_id
eap_fast_pac_attr_hdr_t hdr
Definition eap_fast.h:105
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_i_id
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_opaque_pac_lifetime
uint8_t * cmk
Definition eap_fast.h:175
eap_fast_pac_attr_pac_type_t type
Definition eap_fast.h:133
eap_fast_stage_t
Definition eap_fast.h:52
@ EAP_FAST_COMPLETE
Definition eap_fast.h:57
@ EAP_FAST_AUTHENTICATION
Definition eap_fast.h:54
@ EAP_FAST_CRYPTOBIND_CHECK
Definition eap_fast.h:55
@ EAP_FAST_PROVISIONING
Definition eap_fast.h:56
@ EAP_FAST_TLS_SESSION_HANDSHAKE
Definition eap_fast.h:53
void eap_fast_tlv_append(fr_tls_session_t *tls_session, fr_dict_attr_t const *da, bool mandatory, int length, const void *data)
Definition eap_fast.c:108
#define PAC_KEY_LENGTH
Definition eap_fast.h:74
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_opaque_pac_key
eap_fast_auth_type_t
Definition eap_fast.h:60
@ EAP_FAST_UNKNOWN
Definition eap_fast.h:61
@ EAP_FAST_NORMAL_AUTH
Definition eap_fast.h:64
@ EAP_FAST_PROVISIONING_ANON
Definition eap_fast.h:62
@ EAP_FAST_PROVISIONING_AUTH
Definition eap_fast.h:63
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_opaque_tlv
CONF_SECTION * server_cs
Definition eap_fast.h:206
eap_fast_pac_attr_pac_key_t key
Definition eap_fast.h:117
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_a_id
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_lifetime
HIDDEN fr_dict_attr_t const * attr_eap_emsk
Definition base.c:98
HIDDEN fr_dict_attr_t const * attr_eap_message
Definition base.c:96
HIDDEN fr_dict_attr_t const * attr_eap_type
Definition base.c:92
eap_fast_pac_type_t
Definition eap_fast.h:67
@ PAC_TYPE_MAX
Definition eap_fast.h:71
@ PAC_TYPE_USER_AUTHZ
Definition eap_fast.h:70
@ PAC_TYPE_TUNNEL
Definition eap_fast.h:68
@ PAC_TYPE_MACHINE_AUTH
Definition eap_fast.h:69
uint8_t const * pac_opaque_key
Definition eap_fast.h:190
HIDDEN fr_dict_attr_t const * attr_eap_fast_pac_acknowledge
uint8_t * msk
Definition eap_fast.h:181
Tracks the progress of a single session of any EAP method.
Definition session.h:40
#define MD5_DIGEST_LENGTH
unsigned short uint16_t
unsigned int uint32_t
long int ssize_t
unsigned char uint8_t
fr_aka_sim_id_type_t type
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
A time delta, a difference in time measured in nanoseconds.
Definition time.h:80
"server local" time.
Definition time.h:69
static fr_slen_t parent
Definition pair.h:851
static fr_slen_t data
Definition value.h:1265
int nonnull(2, 5))
static size_t char ** out
Definition value.h:997