The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
eap_aka.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or (at
5  * your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16 
17 /**
18  * $Id: 8f2ad778d82813a0f5ae172c05834ba9d99c8386 $
19  * @file rlm_eap_aka/eap_aka.h
20  * @brief Declarations for EAP-AKA
21  *
22  * @author Arran Cudbard-Bell (a.cudbardb@freeradius.org)
23  *
24  * @copyright 2016 The FreeRADIUS server project
25  * @copyright 2016 Network RADIUS SAS (legal.com)
26  */
27 RCSIDH(rlm_eap_aka_eap_aka_h, "$Id: 8f2ad778d82813a0f5ae172c05834ba9d99c8386 $")
28 
29 #include <freeradius-devel/sim/base.h>
30 
31 /** Server states
32  *
33  * In server_start, we send a EAP-AKA Start message.
34  */
35 typedef enum {
36  EAP_AKA_SERVER_IDENTITY = 0, //!< Attempting to discover permanent
37  ///< identity of the supplicant.
38  EAP_AKA_SERVER_CHALLENGE, //!< We've challenged the supplicant.
39  EAP_AKA_SERVER_SUCCESS_NOTIFICATION, //!< Send success notification.
40  EAP_AKA_SERVER_SUCCESS, //!< Authentication completed successfully.
41  EAP_AKA_SERVER_FAILURE_NOTIFICATION, //!< Send failure notification.
42  EAP_AKA_SERVER_FAILURE, //!< Send an EAP-Failure.
45 
46 /** Cache sections to call on various protocol events
47  *
48  */
49 typedef struct {
50  CONF_SECTION *recv_eap_identity_response; //!< The initial state, entered into
51  ///< after we receive an EAP-Identity-Response.
52  ///< The result of this section determines
53  ///< whether we send a:
54  ///< - AKA-Identity-Request - i.e. requesting
55  ///< a different ID.
56  ///< - Challenge-Request - Containing the
57  ///< necessary vectors for full
58  ///< authentication.
59  ///< - Fast-Reauth-Request - Containing the
60  ///< vectors for fast re-authentication.
61 
62  CONF_SECTION *send_identity_request; //!< Called when we're about to request a
63  ///< different identity.
64  CONF_SECTION *recv_identity_response; //!< Called when we receive a new identity.
65 
66  CONF_SECTION *send_challenge_request; //!< Called when we're about to send a
67  ///< a challenge.
68  CONF_SECTION *recv_challenge_response; //!< Called when we receive a response
69  ///< to a previous challenge.
70 
71  CONF_SECTION *send_fast_reauth_request; //!< Called when we're about to send a
72  ///< Fast-Reauth-Request.
73  CONF_SECTION *recv_fast_reauth_response; //!< Called when we receive a response
74  ///< to a previous Fast-Reauth-Request.
75 
76  CONF_SECTION *recv_client_error; //!< Called if the supplicant experiences
77  ///< an error of some kind.
78  CONF_SECTION *recv_authentication_reject; //!< Called if the supplicant rejects the
79  ///< authentication attempt.
80  CONF_SECTION *recv_synchronization_failure; //!< Called if the supplicant determines
81  ///< the AUTN value is invalid.
82  ///< Usually used for resyncing with the HLR.
83 
84  CONF_SECTION *send_failure_notification; //!< Called when we're about to send a
85  ///< EAP-AKA failure notification.
86  CONF_SECTION *send_success_notification; //!< Called when we're about to send a
87  ///< EAP-AKA success notification.
88  CONF_SECTION *recv_failure_notification_ack; //!< Called when the supplicant ACKs our
89  ///< failure notification.
90  CONF_SECTION *recv_success_notification_ack; //!< Called when the supplicant ACKs our
91  ///< success notification.
92 
93  CONF_SECTION *send_eap_success; //!< Called when we send an EAP-Success message.
94  CONF_SECTION *send_eap_failure; //!< Called when we send an EAP-Failure message.
95 
96  CONF_SECTION *load_session; //!< Load cached authentication vectors.
97  CONF_SECTION *store_session; //!< Store authentication vectors.
98  CONF_SECTION *clear_session; //!< Clear authentication vectors.
100 
101 typedef struct {
102  eap_aka_server_state_t state; //!< Current session state.
103  bool allow_encrypted; //!< Whether we can send encrypted attributes.
104  bool challenge_success; //!< Whether we received the correct
105  ///< challenge response.
106 
107  fr_sim_id_req_type_t id_req; //!< The type of identity we're requesting
108  ///< or previously requested.
109  fr_sim_keys_t keys; //!< Various EAP-AKA keys.
110 
111  eap_type_t type; //!< Either FR_TYPE_AKA, or FR_TYPE_AKA_PRIME.
112  uint16_t kdf; //!< The key derivation function used to derive
113  ///< session keys.
114 
115  /*
116  * Per-session configuration
117  */
118  uint32_t request_identity; //!< Always send an identity request before a
119  ///< challenge.
120  bool send_result_ind; //!< Say that we would like to use protected
121  ///< result indications
122  ///< (AKA-Notification-Success).
123  bool send_at_bidding; //!< Indicate that we prefer EAP-AKA' and
124  ///< include an AT_BIDDING attribute.
125 
126  EVP_MD const *mac_md; //!< HMAC-MD we use to generate the MAC.
127  ///< EVP_sha1() for EAP-AKA, EVP_sha256()
128  ///< for EAP-AKA'.
129 
130  int aka_id; //!< Packet ID. (replay protection).
132 
133 typedef struct {
134  char const *network_name; //!< Network ID as described by RFC 5448.
135  request_identity request_identity; //!< Whether we always request the identity of
136  ///< the subscriber.
137  char const *virtual_server; //!< Virtual server for HLR integration.
139 
140  eap_aka_actions_t actions; //!< Pre-compiled virtual server sections.
141 } rlm_eap_aka_t;
#define RCSIDH(h, id)
Definition: build.h:445
A section grouping multiple CONF_PAIR.
Definition: cf_priv.h:89
enum eap_type eap_type_t
bool challenge_success
Whether we received the correct challenge response.
Definition: eap_aka.h:104
CONF_SECTION * send_success_notification
Called when we're about to send a EAP-AKA success notification.
Definition: eap_aka.h:86
eap_type_t type
Either FR_TYPE_AKA, or FR_TYPE_AKA_PRIME.
Definition: eap_aka.h:111
CONF_SECTION * send_fast_reauth_request
Called when we're about to send a Fast-Reauth-Request.
Definition: eap_aka.h:71
CONF_SECTION * clear_session
Clear authentication vectors.
Definition: eap_aka.h:98
bool allow_encrypted
Whether we can send encrypted attributes.
Definition: eap_aka.h:103
CONF_SECTION * send_challenge_request
Called when we're about to send a a challenge.
Definition: eap_aka.h:66
eap_aka_server_state_t state
Current session state.
Definition: eap_aka.h:102
CONF_SECTION * recv_authentication_reject
Called if the supplicant rejects the authentication attempt.
Definition: eap_aka.h:78
char const * virtual_server
Virtual server for HLR integration.
Definition: eap_aka.h:137
CONF_SECTION * recv_synchronization_failure
Called if the supplicant determines the AUTN value is invalid.
Definition: eap_aka.h:80
CONF_SECTION * recv_failure_notification_ack
Called when the supplicant ACKs our failure notification.
Definition: eap_aka.h:88
eap_aka_actions_t actions
Pre-compiled virtual server sections.
Definition: eap_aka.h:140
uint32_t request_identity
Always send an identity request before a challenge.
Definition: eap_aka.h:118
fr_sim_keys_t keys
Various EAP-AKA keys.
Definition: eap_aka.h:109
CONF_SECTION * send_failure_notification
Called when we're about to send a EAP-AKA failure notification.
Definition: eap_aka.h:84
uint16_t kdf
The key derivation function used to derive session keys.
Definition: eap_aka.h:112
CONF_SECTION * recv_success_notification_ack
Called when the supplicant ACKs our success notification.
Definition: eap_aka.h:90
CONF_SECTION * send_eap_failure
Called when we send an EAP-Failure message.
Definition: eap_aka.h:94
bool protected_success
Definition: eap_aka.h:138
CONF_SECTION * recv_fast_reauth_response
Called when we receive a response to a previous Fast-Reauth-Request.
Definition: eap_aka.h:73
CONF_SECTION * load_session
Load cached authentication vectors.
Definition: eap_aka.h:96
CONF_SECTION * recv_identity_response
Called when we receive a new identity.
Definition: eap_aka.h:64
char const * network_name
Network ID as described by RFC 5448.
Definition: eap_aka.h:134
bool send_at_bidding
Indicate that we prefer EAP-AKA' and include an AT_BIDDING attribute.
Definition: eap_aka.h:123
request_identity request_identity
Whether we always request the identity of the subscriber.
Definition: eap_aka.h:135
int aka_id
Packet ID. (replay protection).
Definition: eap_aka.h:130
EVP_MD const * mac_md
HMAC-MD we use to generate the MAC.
Definition: eap_aka.h:126
CONF_SECTION * send_eap_success
Called when we send an EAP-Success message.
Definition: eap_aka.h:93
CONF_SECTION * send_identity_request
Called when we're about to request a different identity.
Definition: eap_aka.h:62
CONF_SECTION * store_session
Store authentication vectors.
Definition: eap_aka.h:97
fr_sim_id_req_type_t id_req
The type of identity we're requesting or previously requested.
Definition: eap_aka.h:107
CONF_SECTION * recv_client_error
Called if the supplicant experiences an error of some kind.
Definition: eap_aka.h:76
eap_aka_server_state_t
Server states.
Definition: eap_aka.h:35
@ EAP_AKA_SERVER_IDENTITY
Attempting to discover permanent identity of the supplicant.
Definition: eap_aka.h:36
@ EAP_AKA_SERVER_MAX_STATES
Definition: eap_aka.h:43
@ EAP_AKA_SERVER_CHALLENGE
We've challenged the supplicant.
Definition: eap_aka.h:38
@ EAP_AKA_SERVER_FAILURE_NOTIFICATION
Send failure notification.
Definition: eap_aka.h:41
@ EAP_AKA_SERVER_SUCCESS
Authentication completed successfully.
Definition: eap_aka.h:40
@ EAP_AKA_SERVER_SUCCESS_NOTIFICATION
Send success notification.
Definition: eap_aka.h:39
@ EAP_AKA_SERVER_FAILURE
Send an EAP-Failure.
Definition: eap_aka.h:42
bool send_result_ind
Say that we would like to use protected result indications (AKA-Notification-Success).
Definition: eap_aka.h:120
CONF_SECTION * recv_eap_identity_response
The initial state, entered into after we receive an EAP-Identity-Response.
Definition: eap_aka.h:50
CONF_SECTION * recv_challenge_response
Called when we receive a response to a previous challenge.
Definition: eap_aka.h:68
Cache sections to call on various protocol events.
Definition: eap_aka.h:49
unsigned short uint16_t
Definition: merged_model.c:31
unsigned int uint32_t
Definition: merged_model.c:33