2
* EAP server/peer: EAP-SAKE shared routines
3
* Copyright (c) 2006-2007, Jouni Malinen <j@w1.fi>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation.
9
* Alternatively, this software may be distributed under the terms of BSD
12
* See README and COPYING for more details.
15
#ifndef EAP_SAKE_COMMON_H
16
#define EAP_SAKE_COMMON_H
18
#define EAP_SAKE_VERSION 2
20
#define EAP_SAKE_SUBTYPE_CHALLENGE 1
21
#define EAP_SAKE_SUBTYPE_CONFIRM 2
22
#define EAP_SAKE_SUBTYPE_AUTH_REJECT 3
23
#define EAP_SAKE_SUBTYPE_IDENTITY 4
25
#define EAP_SAKE_AT_RAND_S 1
26
#define EAP_SAKE_AT_RAND_P 2
27
#define EAP_SAKE_AT_MIC_S 3
28
#define EAP_SAKE_AT_MIC_P 4
29
#define EAP_SAKE_AT_SERVERID 5
30
#define EAP_SAKE_AT_PEERID 6
31
#define EAP_SAKE_AT_SPI_S 7
32
#define EAP_SAKE_AT_SPI_P 8
33
#define EAP_SAKE_AT_ANY_ID_REQ 9
34
#define EAP_SAKE_AT_PERM_ID_REQ 10
35
#define EAP_SAKE_AT_ENCR_DATA 128
36
#define EAP_SAKE_AT_IV 129
37
#define EAP_SAKE_AT_PADDING 130
38
#define EAP_SAKE_AT_NEXT_TMPID 131
39
#define EAP_SAKE_AT_MSK_LIFE 132
41
#define EAP_SAKE_RAND_LEN 16
42
#define EAP_SAKE_MIC_LEN 16
43
#define EAP_SAKE_ROOT_SECRET_LEN 16
44
#define EAP_SAKE_SMS_LEN 16
45
#define EAP_SAKE_TEK_AUTH_LEN 16
46
#define EAP_SAKE_TEK_CIPHER_LEN 16
47
#define EAP_SAKE_TEK_LEN (EAP_SAKE_TEK_AUTH_LEN + EAP_SAKE_TEK_CIPHER_LEN)
57
u8 type; /* EAP_TYPE_SAKE */
58
u8 version; /* EAP_SAKE_VERSION */
68
struct eap_sake_parse_attr {
82
const u8 *perm_id_req;
88
size_t next_tmpid_len;
92
int eap_sake_parse_attributes(const u8 *buf, size_t len,
93
struct eap_sake_parse_attr *attr);
94
void eap_sake_derive_keys(const u8 *root_secret_a, const u8 *root_secret_b,
95
const u8 *rand_s, const u8 *rand_p,
96
u8 *tek, u8 *msk, u8 *emsk);
97
int eap_sake_compute_mic(const u8 *tek_auth,
98
const u8 *rand_s, const u8 *rand_p,
99
const u8 *serverid, size_t serverid_len,
100
const u8 *peerid, size_t peerid_len,
101
int peer, const u8 *eap, size_t eap_len,
102
const u8 *mic_pos, u8 *mic);
104
#endif /* EAP_SAKE_COMMON_H */