1 /* 2 * Extensible Authentication Protocol (EAP) definitions 3 * 4 * See 5 * RFC 2284: PPP Extensible Authentication Protocol (EAP) 6 * 7 * Copyright (C) 2020, Broadcom. 8 * 9 * Unless you and Broadcom execute a separate written software license 10 * agreement governing use of this software, this software is licensed to you 11 * under the terms of the GNU General Public License version 2 (the "GPL"), 12 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 13 * following added to such license: 14 * 15 * As a special exception, the copyright holders of this software give you 16 * permission to link this software with independent modules, and to copy and 17 * distribute the resulting executable under terms of your choice, provided that 18 * you also meet, for each linked independent module, the terms and conditions of 19 * the license of that module. An independent module is a module which is not 20 * derived from this software. The special exception does not apply to any 21 * modifications of the software. 22 * 23 * 24 * <<Broadcom-WL-IPTag/Dual:>> 25 */ 26 27 #ifndef _eap_h_ 28 #define _eap_h_ 29 30 /* This marks the start of a packed structure section. */ 31 #include <packed_section_start.h> 32 33 /* EAP packet format */ 34 typedef BWL_PRE_PACKED_STRUCT struct { 35 unsigned char code; /* EAP code */ 36 unsigned char id; /* Current request ID */ 37 unsigned short length; /* Length including header */ 38 unsigned char type; /* EAP type (optional) */ 39 unsigned char data[1]; /* Type data (optional) */ 40 } BWL_POST_PACKED_STRUCT eap_header_t; 41 42 #define EAP_HEADER_LEN 4u 43 #define EAP_HEADER_LEN_WITH_TYPE 5u 44 #define ERP_FLAGS_LEN 1u 45 #define ERP_SEQ_LEN 2u 46 #define ERP_KEYNAMENAI_HEADER_LEN 2u 47 #define ERP_CRYPTOSUITE_LEN 1u 48 49 /* EAP codes */ 50 #define EAP_REQUEST 1u 51 #define EAP_RESPONSE 2u 52 #define EAP_SUCCESS 3u 53 #define EAP_FAILURE 4u 54 #define EAP_INITIATE 5u 55 #define EAP_FINISH 6u 56 57 /* EAP types */ 58 #define EAP_IDENTITY 1 59 #define EAP_NOTIFICATION 2 60 #define EAP_NAK 3 61 #define EAP_MD5 4 62 #define EAP_OTP 5 63 #define EAP_GTC 6 64 #define EAP_TLS 13 65 #define EAP_EXPANDED 254 66 #define BCM_EAP_SES 10 67 #define BCM_EAP_EXP_LEN 12 /* EAP_LEN 5 + 3 bytes for SMI ID + 4 bytes for ven type */ 68 #define BCM_SMI_ID 0x113d 69 #define WFA_VENDOR_SMI 0x009F68 70 71 /* ERP types */ 72 #define EAP_ERP_TYPE_REAUTH_START 1u 73 #define EAP_ERP_TYPE_REAUTH 2u 74 75 /* EAP FLAGS */ 76 #define ERP_R_FLAG 0x80 /* result flag, set = failure */ 77 #define ERP_B_FLAG 0x40 /* bootstrap flag, set = bootstrap */ 78 #define ERP_L_FLAG 0x20 /* rrk lifetime tlv is present */ 79 80 /* ERP TV/TLV types */ 81 #define EAP_ERP_TLV_KEYNAME_NAI 1u 82 83 /* ERP Cryptosuite */ 84 #define EAP_ERP_CS_HMAC_SHA256_128 2u 85 86 #ifdef BCMCCX 87 #define EAP_LEAP 17 88 89 #define LEAP_VERSION 1 90 #define LEAP_CHALLENGE_LEN 8 91 #define LEAP_RESPONSE_LEN 24 92 93 /* LEAP challenge */ 94 typedef struct { 95 unsigned char version; /* should be value of LEAP_VERSION */ 96 unsigned char reserved; /* not used */ 97 unsigned char chall_len; /* always value of LEAP_CHALLENGE_LEN */ 98 unsigned char challenge[LEAP_CHALLENGE_LEN]; /* random */ 99 unsigned char username[1]; 100 } leap_challenge_t; 101 102 #define LEAP_CHALLENGE_HDR_LEN 12 103 104 /* LEAP challenge reponse */ 105 typedef struct { 106 unsigned char version; /* should be value of LEAP_VERSION */ 107 unsigned char reserved; /* not used */ 108 unsigned char resp_len; /* always value of LEAP_RESPONSE_LEN */ 109 /* MS-CHAP hash of challenge and user's password */ 110 unsigned char response[LEAP_RESPONSE_LEN]; 111 unsigned char username[1]; 112 } leap_response_t; 113 114 #define LEAP_RESPONSE_HDR_LEN 28 115 116 #endif /* BCMCCX */ 117 118 /* This marks the end of a packed structure section. */ 119 #include <packed_section_end.h> 120 121 #endif /* _eap_h_ */ 122