xref: /freebsd/contrib/wpa/src/eap_common/eap_ttls.h (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1 /*
2  * EAP server/peer: EAP-TTLS (RFC 5281)
3  * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef EAP_TTLS_H
10 #define EAP_TTLS_H
11 
12 struct ttls_avp {
13 	be32 avp_code;
14 	be32 avp_length; /* 8-bit flags, 24-bit length;
15 			  * length includes AVP header */
16 	/* optional 32-bit Vendor-ID */
17 	/* Data */
18 };
19 
20 struct ttls_avp_vendor {
21 	be32 avp_code;
22 	be32 avp_length; /* 8-bit flags, 24-bit length;
23 			  * length includes AVP header */
24 	be32 vendor_id;
25 	/* Data */
26 };
27 
28 #define AVP_FLAGS_VENDOR 0x80
29 #define AVP_FLAGS_MANDATORY 0x40
30 
31 #define AVP_PAD(start, pos) \
32 do { \
33 	int __pad; \
34 	__pad = (4 - (((pos) - (start)) & 3)) & 3; \
35 	os_memset((pos), 0, __pad); \
36 	pos += __pad; \
37 } while (0)
38 
39 
40 /* RFC 2865 */
41 #define RADIUS_ATTR_USER_NAME 1
42 #define RADIUS_ATTR_USER_PASSWORD 2
43 #define RADIUS_ATTR_CHAP_PASSWORD 3
44 #define RADIUS_ATTR_REPLY_MESSAGE 18
45 #define RADIUS_ATTR_CHAP_CHALLENGE 60
46 #define RADIUS_ATTR_EAP_MESSAGE 79
47 
48 /* RFC 2548 */
49 #define RADIUS_VENDOR_ID_MICROSOFT 311
50 #define RADIUS_ATTR_MS_CHAP_RESPONSE 1
51 #define RADIUS_ATTR_MS_CHAP_ERROR 2
52 #define RADIUS_ATTR_MS_CHAP_NT_ENC_PW 6
53 #define RADIUS_ATTR_MS_CHAP_CHALLENGE 11
54 #define RADIUS_ATTR_MS_CHAP2_RESPONSE 25
55 #define RADIUS_ATTR_MS_CHAP2_SUCCESS 26
56 #define RADIUS_ATTR_MS_CHAP2_CPW 27
57 
58 #define EAP_TTLS_MSCHAPV2_CHALLENGE_LEN 16
59 #define EAP_TTLS_MSCHAPV2_RESPONSE_LEN 50
60 #define EAP_TTLS_MSCHAP_CHALLENGE_LEN 8
61 #define EAP_TTLS_MSCHAP_RESPONSE_LEN 50
62 #define EAP_TTLS_CHAP_CHALLENGE_LEN 16
63 #define EAP_TTLS_CHAP_PASSWORD_LEN 16
64 
65 #endif /* EAP_TTLS_H */
66