2 * eap_sim.h Header file containing the EAP-SIM types
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Copyright 2003 Michael Richardson <mcr@sandelman.ottawa.on.ca>
21 * Copyright 2006 The FreeRADIUS server project
27 RCSIDH(eap_sim_h, "$Id$")
29 #include "eap_types.h"
31 #define EAP_SIM_VERSION 0x0001
35 eapsim_challenge = 11,
36 eapsim_notification= 12,
38 eapsim_client_error = 14,
39 eapsim_max_subtype = 15
42 enum eapsim_clientstates {
43 eapsim_client_init = 0,
44 eapsim_client_start = 1,
45 eapsim_client_maxstates
50 * in server_start, we send a EAP-SIM Start message.
53 enum eapsim_serverstates {
54 eapsim_server_start = 0,
55 eapsim_server_challenge=1,
56 eapsim_server_success=10,
57 eapsim_server_maxstates
62 * interfaces in eapsimlib.c
64 extern int map_eapsim_basictypes(RADIUS_PACKET *r, eap_packet_t *ep);
65 extern char const *sim_state2name(enum eapsim_clientstates state, char *buf, int buflen);
66 extern char const *sim_subtype2name(enum eapsim_subtype subtype, char *buf, int buflen);
67 extern int unmap_eapsim_basictypes(RADIUS_PACKET *r,
68 uint8_t *attr, unsigned int attrlen);
71 /************************/
72 /* CRYPTO FUNCTIONS */
73 /************************/
76 * key derivation functions/structures
80 #define EAPSIM_SRES_SIZE 4
81 #define EAPSIM_RAND_SIZE 16
82 #define EAPSIM_KC_SIZE 8
83 #define EAPSIM_CALCMAC_SIZE 20
84 #define EAPSIM_NONCEMT_SIZE 16
85 #define EAPSIM_AUTH_SIZE 16
89 unsigned char identity[MAX_STRING_LEN];
90 unsigned int identitylen;
91 unsigned char nonce_mt[EAPSIM_NONCEMT_SIZE];
92 unsigned char rand[3][EAPSIM_RAND_SIZE];
93 unsigned char sres[3][EAPSIM_SRES_SIZE];
94 unsigned char Kc[3][EAPSIM_KC_SIZE];
95 unsigned char versionlist[MAX_STRING_LEN];
96 unsigned char versionlistlen;
97 unsigned char versionselect[2];
100 unsigned char master_key[20];
101 unsigned char K_aut[EAPSIM_AUTH_SIZE];
102 unsigned char K_encr[16];
103 unsigned char msk[64];
104 unsigned char emsk[64];
109 * interfaces in eapsimlib.c
111 extern int eapsim_checkmac(TALLOC_CTX *ctx, VALUE_PAIR *rvps,
113 uint8_t *extra, int extralen,
114 uint8_t calcmac[20]);
119 extern void eapsim_calculate_keys(struct eapsim_keys *ek);
120 extern void eapsim_dump_mk(struct eapsim_keys *ek);
123 #endif /* _EAP_SIM_H */