1 //--------------------------------------------------------------------------
2 // Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved.
3 //
4 // This program is free software; you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License Version 2 as published
6 // by the Free Software Foundation.  You may not use, modify or distribute
7 // this program under any other version of the GNU General Public License.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License along
15 // with this program; if not, write to the Free Software Foundation, Inc.,
16 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 //--------------------------------------------------------------------------
18 // eapol.h author Josh Rosenbaum <jrosenba@cisco.com>
19 
20 #ifndef PROTOCOLS_EAPOL_H
21 #define PROTOCOLS_EAPOL_H
22 
23 namespace snort
24 {
25 namespace eapol
26 {
27 struct EtherEapol
28 {
29     uint8_t version;   /* EAPOL proto version */
30     uint8_t eaptype;   /* EAPOL Packet type */
31     uint16_t len;  /* Packet body length */
32 };
33 
34 struct EAPHdr
35 {
36     uint8_t code;
37     uint8_t id;
38     uint16_t len;
39 };
40 
41 struct EapolKey
42 {
43     uint8_t type;
44     uint8_t length[2];
45     uint8_t counter[8];
46     uint8_t iv[16];
47     uint8_t index;
48     uint8_t sig[16];
49 };
50 
51 /* IEEE 802.1x eapol types */
52 #define EAPOL_TYPE_EAP      0x00      /* EAP packet */
53 #define EAPOL_TYPE_START    0x01      /* EAPOL start */
54 #define EAPOL_TYPE_LOGOFF   0x02      /* EAPOL Logoff */
55 #define EAPOL_TYPE_KEY      0x03      /* EAPOL Key */
56 #define EAPOL_TYPE_ASF      0x04      /* EAPOL Encapsulated ASF-Alert */
57 
58 /* Extensible Authentication Protocol Codes RFC 2284*/
59 #define EAP_CODE_REQUEST    0x01
60 #define EAP_CODE_RESPONSE   0x02
61 #define EAP_CODE_SUCCESS    0x03
62 #define EAP_CODE_FAILURE    0x04
63 /* EAP Types */
64 #define EAP_TYPE_IDENTITY   0x01
65 #define EAP_TYPE_NOTIFY     0x02
66 #define EAP_TYPE_NAK        0x03
67 #define EAP_TYPE_MD5        0x04
68 #define EAP_TYPE_OTP        0x05
69 #define EAP_TYPE_GTC        0x06
70 #define EAP_TYPE_TLS        0x0d
71 
72 /* Extensible Authentication Protocol Codes RFC 2284*/
73 #define EAP_CODE_REQUEST    0x01
74 #define EAP_CODE_RESPONSE   0x02
75 #define EAP_CODE_SUCCESS    0x03
76 #define EAP_CODE_FAILURE    0x04
77 /* EAP Types */
78 #define EAP_TYPE_IDENTITY   0x01
79 #define EAP_TYPE_NOTIFY     0x02
80 #define EAP_TYPE_NAK        0x03
81 #define EAP_TYPE_MD5        0x04
82 #define EAP_TYPE_OTP        0x05
83 #define EAP_TYPE_GTC        0x06
84 #define EAP_TYPE_TLS        0x0d
85 } // namespace eapol
86 } // namespace snort
87 
88 #endif /* EAPOL_H */
89 
90