1189251Ssam/*
2189251Ssam * EAP-TLV definitions (draft-josefsson-pppext-eap-tls-eap-10.txt)
3189251Ssam * Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi>
4189251Ssam *
5252726Srpaulo * This software may be distributed under the terms of the BSD license.
6252726Srpaulo * See README for more details.
7189251Ssam */
8189251Ssam
9189251Ssam#ifndef EAP_TLV_COMMON_H
10189251Ssam#define EAP_TLV_COMMON_H
11189251Ssam
12189251Ssam/* EAP-TLV TLVs (draft-josefsson-ppext-eap-tls-eap-10.txt) */
13189251Ssam#define EAP_TLV_RESULT_TLV 3 /* Acknowledged Result */
14189251Ssam#define EAP_TLV_NAK_TLV 4
15189251Ssam#define EAP_TLV_ERROR_CODE_TLV 5
16189251Ssam#define EAP_TLV_CONNECTION_BINDING_TLV 6
17189251Ssam#define EAP_TLV_VENDOR_SPECIFIC_TLV 7
18189251Ssam#define EAP_TLV_URI_TLV 8
19189251Ssam#define EAP_TLV_EAP_PAYLOAD_TLV 9
20189251Ssam#define EAP_TLV_INTERMEDIATE_RESULT_TLV 10
21209158Srpaulo#define EAP_TLV_PAC_TLV 11 /* RFC 5422, Section 4.2 */
22189251Ssam#define EAP_TLV_CRYPTO_BINDING_TLV 12
23189251Ssam#define EAP_TLV_CALLING_STATION_ID_TLV 13
24189251Ssam#define EAP_TLV_CALLED_STATION_ID_TLV 14
25189251Ssam#define EAP_TLV_NAS_PORT_TYPE_TLV 15
26189251Ssam#define EAP_TLV_SERVER_IDENTIFIER_TLV 16
27189251Ssam#define EAP_TLV_IDENTITY_TYPE_TLV 17
28189251Ssam#define EAP_TLV_SERVER_TRUSTED_ROOT_TLV 18
29189251Ssam#define EAP_TLV_REQUEST_ACTION_TLV 19
30189251Ssam#define EAP_TLV_PKCS7_TLV 20
31189251Ssam
32189251Ssam#define EAP_TLV_RESULT_SUCCESS 1
33189251Ssam#define EAP_TLV_RESULT_FAILURE 2
34189251Ssam
35189251Ssam#define EAP_TLV_TYPE_MANDATORY 0x8000
36189251Ssam#define EAP_TLV_TYPE_MASK 0x3fff
37189251Ssam
38189251Ssam#ifdef _MSC_VER
39189251Ssam#pragma pack(push, 1)
40189251Ssam#endif /* _MSC_VER */
41189251Ssam
42189251Ssamstruct eap_tlv_hdr {
43189251Ssam	be16 tlv_type;
44189251Ssam	be16 length;
45189251Ssam} STRUCT_PACKED;
46189251Ssam
47189251Ssamstruct eap_tlv_nak_tlv {
48189251Ssam	be16 tlv_type;
49189251Ssam	be16 length;
50189251Ssam	be32 vendor_id;
51189251Ssam	be16 nak_type;
52189251Ssam} STRUCT_PACKED;
53189251Ssam
54189251Ssamstruct eap_tlv_result_tlv {
55189251Ssam	be16 tlv_type;
56189251Ssam	be16 length;
57189251Ssam	be16 status;
58189251Ssam} STRUCT_PACKED;
59189251Ssam
60189251Ssam/* RFC 4851, Section 4.2.7 - Intermediate-Result TLV */
61189251Ssamstruct eap_tlv_intermediate_result_tlv {
62189251Ssam	be16 tlv_type;
63189251Ssam	be16 length;
64189251Ssam	be16 status;
65189251Ssam	/* Followed by optional TLVs */
66189251Ssam} STRUCT_PACKED;
67189251Ssam
68189251Ssam/* RFC 4851, Section 4.2.8 - Crypto-Binding TLV */
69189251Ssamstruct eap_tlv_crypto_binding_tlv {
70189251Ssam	be16 tlv_type;
71189251Ssam	be16 length;
72189251Ssam	u8 reserved;
73189251Ssam	u8 version;
74189251Ssam	u8 received_version;
75189251Ssam	u8 subtype;
76189251Ssam	u8 nonce[32];
77189251Ssam	u8 compound_mac[20];
78189251Ssam} STRUCT_PACKED;
79189251Ssam
80189251Ssamstruct eap_tlv_pac_ack_tlv {
81189251Ssam	be16 tlv_type;
82189251Ssam	be16 length;
83189251Ssam	be16 pac_type;
84189251Ssam	be16 pac_len;
85189251Ssam	be16 result;
86189251Ssam} STRUCT_PACKED;
87189251Ssam
88189251Ssam/* RFC 4851, Section 4.2.9 - Request-Action TLV */
89189251Ssamstruct eap_tlv_request_action_tlv {
90189251Ssam	be16 tlv_type;
91189251Ssam	be16 length;
92189251Ssam	be16 action;
93189251Ssam} STRUCT_PACKED;
94189251Ssam
95209158Srpaulo/* RFC 5422, Section 4.2.6 - PAC-Type TLV */
96189251Ssamstruct eap_tlv_pac_type_tlv {
97189251Ssam	be16 tlv_type; /* PAC_TYPE_PAC_TYPE */
98189251Ssam	be16 length;
99189251Ssam	be16 pac_type;
100189251Ssam} STRUCT_PACKED;
101189251Ssam
102189251Ssam#ifdef _MSC_VER
103189251Ssam#pragma pack(pop)
104189251Ssam#endif /* _MSC_VER */
105189251Ssam
106189251Ssam#define EAP_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST 0
107189251Ssam#define EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE 1
108189251Ssam
109189251Ssam#define EAP_TLV_ACTION_PROCESS_TLV 1
110189251Ssam#define EAP_TLV_ACTION_NEGOTIATE_EAP 2
111189251Ssam
112189251Ssam#endif /* EAP_TLV_COMMON_H */
113