00001
00016 #ifndef EAP_TLV_H
00017 #define EAP_TLV_H
00018
00019
00020 #define EAP_TLV_RESULT_TLV 3
00021 #define EAP_TLV_NAK_TLV 4
00022 #define EAP_TLV_CRYPTO_BINDING_TLV 5
00023 #define EAP_TLV_CONNECTION_BINDING_TLV 6
00024 #define EAP_TLV_VENDOR_SPECIFIC_TLV 7
00025 #define EAP_TLV_URI_TLV 8
00026 #define EAP_TLV_EAP_PAYLOAD_TLV 9
00027 #define EAP_TLV_INTERMEDIATE_RESULT_TLV 10
00028 #define EAP_TLV_PAC_TLV 11
00029 #define EAP_TLV_CRYPTO_BINDING_TLV_ 12
00030
00031 #define EAP_TLV_RESULT_SUCCESS 1
00032 #define EAP_TLV_RESULT_FAILURE 2
00033
00034 #define EAP_TLV_TYPE_MANDATORY 0x8000
00035
00036 struct eap_tlv_hdr {
00037 u16 tlv_type;
00038 u16 length;
00039 };
00040
00041 struct eap_tlv_nak_tlv {
00042 u16 tlv_type;
00043 u16 length;
00044 u32 vendor_id;
00045 u16 nak_type;
00046 } __attribute__((packed));
00047
00048 struct eap_tlv_result_tlv {
00049 u16 tlv_type;
00050 u16 length;
00051 u16 status;
00052 } __attribute__((packed));
00053
00054 struct eap_tlv_intermediate_result_tlv {
00055 u16 tlv_type;
00056 u16 length;
00057 u16 status;
00058 } __attribute__((packed));
00059
00060 struct eap_tlv_crypto_binding__tlv {
00061 u16 tlv_type;
00062 u16 length;
00063 u8 reserved;
00064 u8 version;
00065 u8 received_version;
00066 u8 subtype;
00067 u8 nonce[32];
00068 u8 compound_mac[20];
00069 } __attribute__((packed));
00070
00071 struct eap_tlv_pac_ack_tlv {
00072 u16 tlv_type;
00073 u16 length;
00074 u16 pac_type;
00075 u16 pac_len;
00076 u16 result;
00077 } __attribute__((packed));
00078
00079 #define EAP_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST 0
00080 #define EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE 1
00081
00082
00083 u8 * eap_tlv_build_nak(int id, u16 nak_type, size_t *resp_len);
00084 u8 * eap_tlv_build_result(int id, u16 status, size_t *resp_len);
00085 int eap_tlv_process(struct eap_sm *sm, struct eap_method_ret *ret,
00086 const struct eap_hdr *hdr, u8 **resp, size_t *resp_len);
00087
00088 #endif
00089