wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eap_sake_common.h
Go to the documentation of this file.
1 
5 #ifndef EAP_SAKE_COMMON_H
6 #define EAP_SAKE_COMMON_H
7 
8 #define EAP_SAKE_VERSION 2
9 
10 #define EAP_SAKE_SUBTYPE_CHALLENGE 1
11 #define EAP_SAKE_SUBTYPE_CONFIRM 2
12 #define EAP_SAKE_SUBTYPE_AUTH_REJECT 3
13 #define EAP_SAKE_SUBTYPE_IDENTITY 4
14 
15 #define EAP_SAKE_AT_RAND_S 1
16 #define EAP_SAKE_AT_RAND_P 2
17 #define EAP_SAKE_AT_MIC_S 3
18 #define EAP_SAKE_AT_MIC_P 4
19 #define EAP_SAKE_AT_SERVERID 5
20 #define EAP_SAKE_AT_PEERID 6
21 #define EAP_SAKE_AT_SPI_S 7
22 #define EAP_SAKE_AT_SPI_P 8
23 #define EAP_SAKE_AT_ANY_ID_REQ 9
24 #define EAP_SAKE_AT_PERM_ID_REQ 10
25 #define EAP_SAKE_AT_ENCR_DATA 128
26 #define EAP_SAKE_AT_IV 129
27 #define EAP_SAKE_AT_PADDING 130
28 #define EAP_SAKE_AT_NEXT_TMPID 131
29 #define EAP_SAKE_AT_MSK_LIFE 132
30 
31 #define EAP_SAKE_RAND_LEN 16
32 #define EAP_SAKE_MIC_LEN 16
33 #define EAP_SAKE_ROOT_SECRET_LEN 16
34 #define EAP_SAKE_SMS_LEN 16
35 #define EAP_SAKE_TEK_AUTH_LEN 16
36 #define EAP_SAKE_TEK_CIPHER_LEN 16
37 #define EAP_SAKE_TEK_LEN (EAP_SAKE_TEK_AUTH_LEN + EAP_SAKE_TEK_CIPHER_LEN)
38 
39 #ifdef _MSC_VER
40 #pragma pack(push, 1)
41 #endif /* _MSC_VER */
42 
43 struct eap_sake_hdr {
44  u8 version; /* EAP_SAKE_VERSION */
45  u8 session_id;
46  u8 subtype;
47 } STRUCT_PACKED;
48 
49 #ifdef _MSC_VER
50 #pragma pack(pop)
51 #endif /* _MSC_VER */
52 
53 
55  const u8 *rand_s;
56  const u8 *rand_p;
57  const u8 *mic_s;
58  const u8 *mic_p;
59  const u8 *serverid;
60  size_t serverid_len;
61  const u8 *peerid;
62  size_t peerid_len;
63  const u8 *spi_s;
64  size_t spi_s_len;
65  const u8 *spi_p;
66  size_t spi_p_len;
67  const u8 *any_id_req;
68  const u8 *perm_id_req;
69  const u8 *encr_data;
70  size_t encr_data_len;
71  const u8 *iv;
72  size_t iv_len;
73  const u8 *next_tmpid;
74  size_t next_tmpid_len;
75  const u8 *msk_life;
76 };
77 
78 int eap_sake_parse_attributes(const u8 *buf, size_t len,
79  struct eap_sake_parse_attr *attr);
80 void eap_sake_derive_keys(const u8 *root_secret_a, const u8 *root_secret_b,
81  const u8 *rand_s, const u8 *rand_p,
82  u8 *tek, u8 *msk, u8 *emsk);
83 int eap_sake_compute_mic(const u8 *tek_auth,
84  const u8 *rand_s, const u8 *rand_p,
85  const u8 *serverid, size_t serverid_len,
86  const u8 *peerid, size_t peerid_len,
87  int peer, const u8 *eap, size_t eap_len,
88  const u8 *mic_pos, u8 *mic);
89 void eap_sake_add_attr(struct wpabuf *buf, u8 type, const u8 *data,
90  size_t len);
91 
92 #endif /* EAP_SAKE_COMMON_H */
Definition: wpabuf.h:16
void eap_sake_derive_keys(const u8 *root_secret_a, const u8 *root_secret_b, const u8 *rand_s, const u8 *rand_p, u8 *tek, u8 *msk, u8 *emsk)
Derive EAP-SAKE keys.
Definition: eap_sake_common.c:255
Definition: eap_sake_common.h:43
int eap_sake_compute_mic(const u8 *tek_auth, const u8 *rand_s, const u8 *rand_p, const u8 *serverid, size_t serverid_len, const u8 *peerid, size_t peerid_len, int peer, const u8 *eap, size_t eap_len, const u8 *mic_pos, u8 *mic)
Compute EAP-SAKE MIC for an EAP packet.
Definition: eap_sake_common.c:312
int eap_sake_parse_attributes(const u8 *buf, size_t len, struct eap_sake_parse_attr *attr)
Parse EAP-SAKE attributes.
Definition: eap_sake_common.c:156
Definition: eap_sake_common.h:54