All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
eap_sim.h
Go to the documentation of this file.
1 /*
2  * eap_sim.h Header file containing the EAP-SIM types
3  *
4  * Version: $Id: 74dda258d0a4061bafd4648219684fc573769430 $
5  *
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.
10  *
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.
15  *
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
19  *
20  * Copyright 2003 Michael Richardson <mcr@sandelman.ottawa.on.ca>
21  * Copyright 2006 The FreeRADIUS server project
22  *
23  */
24 #ifndef _EAP_SIM_H
25 #define _EAP_SIM_H
26 
27 RCSIDH(eap_sim_h, "$Id: 74dda258d0a4061bafd4648219684fc573769430 $")
28 
29 #include "eap_types.h"
30 
31 #define EAP_SIM_VERSION 0x0001
32 
40 };
41 
46 };
47 
48 /* server states
49  *
50  * in server_start, we send a EAP-SIM Start message.
51  *
52  */
58 };
59 
60 
61 /*
62  * interfaces in eapsimlib.c
63  */
65 char const *sim_state2name(enum eapsim_clientstates state, char *buf, int buflen);
66 char const *sim_subtype2name(enum eapsim_subtype subtype, char *buf, int buflen);
67 int unmap_eapsim_basictypes(RADIUS_PACKET *r, uint8_t *attr, unsigned int attrlen);
68 
69 
70 /************************/
71 /* CRYPTO FUNCTIONS */
72 /************************/
73 
74 /*
75  * key derivation functions/structures
76  *
77  */
78 
79 #define EAPSIM_SRES_SIZE 4
80 #define EAPSIM_RAND_SIZE 16
81 #define EAPSIM_KC_SIZE 8
82 #define EAPSIM_CALCMAC_SIZE 20
83 #define EAPSIM_NONCEMT_SIZE 16
84 #define EAPSIM_AUTH_SIZE 16
85 
86 struct eapsim_keys {
87  /* inputs */
89  unsigned int identitylen;
91  uint8_t rand[3][EAPSIM_RAND_SIZE];
92  uint8_t sres[3][EAPSIM_SRES_SIZE];
93  uint8_t Kc[3][EAPSIM_KC_SIZE];
95  uint8_t versionlistlen;
96  uint8_t versionselect[2];
97 
98  /* outputs */
99  uint8_t master_key[20];
101  uint8_t K_encr[16];
102  uint8_t msk[64];
103  uint8_t emsk[64];
104 };
105 
106 
107 /*
108  * interfaces in eapsimlib.c
109  */
110 int eapsim_checkmac(TALLOC_CTX *ctx, VALUE_PAIR *rvps,
111  uint8_t key[8],
112  uint8_t *extra, int extralen,
113  uint8_t calcmac[20]);
114 
115 /*
116  * in eapcrypto.c
117  */
118 void eapsim_calculate_keys(struct eapsim_keys *ek);
119 void eapsim_dump_mk(struct eapsim_keys *ek);
120 
121 
122 #endif /* _EAP_SIM_H */
#define RCSIDH(h, id)
Definition: build.h:136
uint8_t msk[64]
Definition: eap_sim.h:102
#define EAPSIM_AUTH_SIZE
Definition: eap_sim.h:84
uint8_t sres[3][EAPSIM_SRES_SIZE]
Definition: eap_sim.h:92
eapsim_clientstates
Definition: eap_sim.h:42
uint8_t versionselect[2]
Definition: eap_sim.h:96
#define EAPSIM_KC_SIZE
Definition: eap_sim.h:81
#define EAPSIM_NONCEMT_SIZE
Definition: eap_sim.h:83
uint8_t emsk[64]
Definition: eap_sim.h:103
uint8_t rand[3][EAPSIM_RAND_SIZE]
Definition: eap_sim.h:91
int unmap_eapsim_basictypes(RADIUS_PACKET *r, uint8_t *attr, unsigned int attrlen)
Definition: eapsimlib.c:284
int eapsim_checkmac(TALLOC_CTX *ctx, VALUE_PAIR *rvps, uint8_t key[8], uint8_t *extra, int extralen, uint8_t calcmac[20])
int map_eapsim_basictypes(RADIUS_PACKET *r, eap_packet_t *ep)
Definition: eapsimlib.c:63
uint8_t K_encr[16]
Definition: eap_sim.h:101
Stores an attribute, a value and various bits of other data.
Definition: pair.h:112
char const * sim_state2name(enum eapsim_clientstates state, char *buf, int buflen)
Definition: eapsimlib.c:437
void eapsim_dump_mk(struct eapsim_keys *ek)
Definition: eapcrypto.c:103
uint8_t identity[MAX_STRING_LEN]
Definition: eap_sim.h:88
unsigned int state
Definition: proto_bfd.c:200
uint8_t K_aut[EAPSIM_AUTH_SIZE]
Definition: eap_sim.h:100
char const * sim_subtype2name(enum eapsim_subtype subtype, char *buf, int buflen)
Definition: eapsimlib.c:459
uint8_t Kc[3][EAPSIM_KC_SIZE]
Definition: eap_sim.h:93
uint8_t versionlist[MAX_STRING_LEN]
Definition: eap_sim.h:94
uint8_t master_key[20]
Definition: eap_sim.h:99
void eapsim_calculate_keys(struct eapsim_keys *ek)
Definition: eapcrypto.c:37
#define EAPSIM_SRES_SIZE
Definition: eap_sim.h:79
Structure to hold EAP data.
Definition: eap_types.h:132
uint8_t versionlistlen
Definition: eap_sim.h:95
eapsim_subtype
Definition: eap_sim.h:33
uint8_t nonce_mt[EAPSIM_NONCEMT_SIZE]
Definition: eap_sim.h:90
#define MAX_STRING_LEN
Definition: libradius.h:120
static int r
Definition: rbmonkey.c:66
#define EAPSIM_RAND_SIZE
Definition: eap_sim.h:80
eapsim_serverstates
Definition: eap_sim.h:53
unsigned int identitylen
Definition: eap_sim.h:89