libeap: ttls: encapsulate using RADIUS VSA
[mech_eap.git] / libeap / src / eap_common / eap_ttls.h
1 /*
2  * EAP server/peer: EAP-TTLS (RFC 5281)
3  * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
4  *
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.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14
15 #ifndef EAP_TTLS_H
16 #define EAP_TTLS_H
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 struct ttls_avp {
23         be32 avp_code;
24         be32 avp_length; /* 8-bit flags, 24-bit length;
25                           * length includes AVP header */
26         /* optional 32-bit Vendor-ID */
27         /* Data */
28 };
29
30 struct ttls_avp_vendor {
31         be32 avp_code;
32         be32 avp_length; /* 8-bit flags, 24-bit length;
33                           * length includes AVP header */
34         be32 vendor_id;
35         /* Data */
36 };
37
38
39 #define AVP_FLAGS_VENDOR 0x80
40 #define AVP_FLAGS_MANDATORY 0x40
41
42 #define AVP_PAD(start, pos) \
43 do { \
44         int __pad; \
45         __pad = (4 - (((pos) - (start)) & 3)) & 3; \
46         os_memset((pos), 0, __pad); \
47         pos += __pad; \
48 } while (0)
49
50
51 /* RFC 2865 */
52 #define RADIUS_ATTR_USER_NAME 1
53 #define RADIUS_ATTR_USER_PASSWORD 2
54 #define RADIUS_ATTR_CHAP_PASSWORD 3
55 #define RADIUS_ATTR_REPLY_MESSAGE 18
56 #define RADIUS_ATTR_VENDOR_SPECIFIC 26
57 #define RADIUS_ATTR_CHAP_CHALLENGE 60
58 #define RADIUS_ATTR_EAP_MESSAGE 79
59
60 /* RFC 2548 */
61 #define RADIUS_VENDOR_ID_MICROSOFT 311
62 #define RADIUS_ATTR_MS_CHAP_RESPONSE 1
63 #define RADIUS_ATTR_MS_CHAP_ERROR 2
64 #define RADIUS_ATTR_MS_CHAP_NT_ENC_PW 6
65 #define RADIUS_ATTR_MS_CHAP_CHALLENGE 11
66 #define RADIUS_ATTR_MS_CHAP2_RESPONSE 25
67 #define RADIUS_ATTR_MS_CHAP2_SUCCESS 26
68 #define RADIUS_ATTR_MS_CHAP2_CPW 27
69
70 #define EAP_TTLS_MSCHAPV2_CHALLENGE_LEN 16
71 #define EAP_TTLS_MSCHAPV2_RESPONSE_LEN 50
72 #define EAP_TTLS_MSCHAP_CHALLENGE_LEN 8
73 #define EAP_TTLS_MSCHAP_RESPONSE_LEN 50
74 #define EAP_TTLS_CHAP_CHALLENGE_LEN 16
75 #define EAP_TTLS_CHAP_PASSWORD_LEN 16
76
77 #define RADIUS_VENDOR_ID_UKERNA 25622
78 #define RADIUS_ATTR_UKERNA_CHBIND 135
79
80 #ifdef __cplusplus
81 }
82 #endif
83
84 #endif /* EAP_TTLS_H */