1 /* 2 * EAP peer method: EAP-TLV (draft-josefsson-pppext-eap-tls-eap-07.txt) 3 * Copyright (c) 2004-2008, 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_TLV_H 16 #define EAP_TLV_H 17 18 /* EAP-TLV TLVs (draft-josefsson-ppext-eap-tls-eap-07.txt) */ 19 #define EAP_TLV_RESULT_TLV 3 /* Acknowledged Result */ 20 #define EAP_TLV_NAK_TLV 4 21 #define EAP_TLV_CRYPTO_BINDING_TLV 5 22 #define EAP_TLV_CONNECTION_BINDING_TLV 6 23 #define EAP_TLV_VENDOR_SPECIFIC_TLV 7 24 #define EAP_TLV_URI_TLV 8 25 #define EAP_TLV_EAP_PAYLOAD_TLV 9 26 #define EAP_TLV_INTERMEDIATE_RESULT_TLV 10 27 #define EAP_TLV_PAC_TLV 11 /* draft-cam-winget-eap-fast-01.txt */ 28 #define EAP_TLV_CRYPTO_BINDING_TLV_ 12 /* draft-cam-winget-eap-fast-01.txt */ 29 30 #define EAP_TLV_RESULT_SUCCESS 1 31 #define EAP_TLV_RESULT_FAILURE 2 32 33 #define EAP_TLV_TYPE_MANDATORY 0x8000 34 35 #ifdef _MSC_VER 36 #pragma pack(push, 1) 37 #endif /* _MSC_VER */ 38 39 struct eap_tlv_hdr { 40 u16 tlv_type; 41 u16 length; 42 } STRUCT_PACKED; 43 44 struct eap_tlv_nak_tlv { 45 u16 tlv_type; 46 u16 length; 47 u32 vendor_id; 48 u16 nak_type; 49 } STRUCT_PACKED; 50 51 struct eap_tlv_result_tlv { 52 u16 tlv_type; 53 u16 length; 54 u16 status; 55 } STRUCT_PACKED; 56 57 struct eap_tlv_intermediate_result_tlv { 58 u16 tlv_type; 59 u16 length; 60 u16 status; 61 } STRUCT_PACKED; 62 63 struct eap_tlv_crypto_binding__tlv { 64 u16 tlv_type; 65 u16 length; 66 u8 reserved; 67 u8 version; 68 u8 received_version; 69 u8 subtype; 70 u8 nonce[32]; 71 u8 compound_mac[20]; 72 } STRUCT_PACKED; 73 74 struct eap_tlv_pac_ack_tlv { 75 u16 tlv_type; 76 u16 length; 77 u16 pac_type; 78 u16 pac_len; 79 u16 result; 80 } STRUCT_PACKED; 81 82 #ifdef _MSC_VER 83 #pragma pack(pop) 84 #endif /* _MSC_VER */ 85 86 #define EAP_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST 0 87 #define EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE 1 88 89 90 u8 * eap_tlv_build_nak(int id, u16 nak_type, size_t *resp_len); 91 u8 * eap_tlv_build_result(int id, u16 status, size_t *resp_len); 92 int eap_tlv_process(struct eap_sm *sm, struct eap_method_ret *ret, 93 const struct eap_hdr *hdr, u8 **resp, size_t *resp_len, 94 int force_failure); 95 96 #endif /* EAP_TLV_H */ 97