2 * Copyright (c) 2011 Rustam Kovhaev. All rights reserved.
3 * Copyright (c) 2021 Eivind Næss. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
17 * 3. The name(s) of the authors of this software must not be used to
18 * endorse or promote products derived from this software without
19 * prior written permission.
21 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
22 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
24 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
25 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
26 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
27 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
33 #define PEAP_PHASE_1 1
34 #define PEAP_PHASE_2 2
36 #define PEAP_HEADERLEN 6
37 #define PEAP_FRAGMENT_LENGTH_FIELD 4
38 #define PEAP_FLAGS_FIELD 1
39 #define PEAP_FLAGS_ACK 0
41 #define PEAP_CAPABILITIES_TYPE 254
42 #define PEAP_CAPABILITIES_LEN 12
44 #define PEAP_TLV_TYPE 12
45 #define PEAP_TLV_LENGTH_FIELD 56
46 #define PEAP_TLV_SUBTYPE_REQUEST 0
47 #define PEAP_TLV_SUBTYPE_RESPONSE 1
48 #define PEAP_TLV_HEADERLEN 8
49 #define PEAP_TLV_RESULT_LEN 7
50 #define PEAP_TLV_LEN 71
53 * Microsoft PEAP client/server never exchange
54 * outer TLVs during PEAP authentication
56 #define PEAP_TLV_DATA_LEN 61
58 #define PEAP_TLV_TK_LEN 60
59 #define PEAP_TLV_ISK_LEN 32
60 #define PEAP_TLV_IPMKSEED_LEN 59
61 #define PEAP_TLV_TEMPKEY_LEN 40
62 #define PEAP_TLV_IPMK_LEN 40
63 #define PEAP_TLV_CMK_LEN 20
64 #define PEAP_TLV_NONCE_LEN 32
65 #define PEAP_TLV_COMP_MAC_LEN 20
66 #define PEAP_TLV_CSK_LEN 128
67 #define PEAP_TLV_TK_SEED_LABEL "client EAP encryption"
68 #define PEAP_TLV_IPMK_SEED_LABEL "Inner Methods Compound Keys"
69 #define PEAP_TLV_CSK_SEED_LABEL "Session Key Generating Function"
71 #define PEAP_S_FLAG_SET 0x20
72 #define PEAP_L_FLAG_SET 0x80
73 #define PEAP_LM_FLAG_SET 0xC0
74 #define PEAP_M_FLAG_SET 0x40
75 #define PEAP_NO_FLAGS 0x00
77 #define EAP_TLS_KEY_LEN 0x40
78 #define TLS_RECORD_MAX_SIZE 0x4000
83 * Initialize the PEAP structure
85 int peap_init(struct peap_state** psm, const char *remote_name);
88 * Process a PEAP packet
90 int peap_process(eap_state *esp, u_char id, u_char *inp, int len);
93 * Clean up the PEAP structure
95 void peap_finish(struct peap_state **psm);
97 #endif /* PPP_PEAP_H */