EAP packet classes organized in hierarchy now
This commit is contained in:
@@ -83,6 +83,7 @@
|
||||
<ClInclude Include="..\include\Credentials.h" />
|
||||
<ClInclude Include="..\include\Method.h" />
|
||||
<ClInclude Include="..\include\Module.h" />
|
||||
<ClInclude Include="..\include\TTLS.h" />
|
||||
<ClInclude Include="..\src\StdAfx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@@ -26,6 +26,9 @@
|
||||
<ClInclude Include="..\include\Module.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\TTLS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\StdAfx.cpp">
|
||||
|
@@ -30,6 +30,7 @@ namespace eap
|
||||
|
||||
#include "Config.h"
|
||||
#include "Credentials.h"
|
||||
#include "TTLS.h"
|
||||
|
||||
#include "../../TLS/include/Method.h"
|
||||
#include "../../EAPBase/include/Method.h"
|
||||
@@ -39,20 +40,6 @@ namespace eap
|
||||
{
|
||||
class method_ttls : public method_tls
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// EAP-TTLS packet flags
|
||||
///
|
||||
/// \sa [Extensible Authentication Protocol Tunneled Transport Layer Security Authenticated Protocol Version 0 (EAP-TTLSv0) (Chapter: 9.1 Packet Format)](https://tools.ietf.org/html/rfc5281#section-9.1)
|
||||
///
|
||||
#pragma warning(suppress: 4480)
|
||||
enum flags_t : unsigned char {
|
||||
flags_length_incl = method_tls::flags_req_length_incl, ///< Length included
|
||||
flags_more_frag = method_tls::flags_req_more_frag, ///< More fragments
|
||||
flags_start = method_tls::flags_req_start, ///< Start
|
||||
flags_ver_mask = 0x07, ///< Version mask
|
||||
};
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs an EAP method
|
||||
|
52
lib/TTLS/include/TTLS.h
Normal file
52
lib/TTLS/include/TTLS.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2015-2016 Amebis
|
||||
Copyright 2016 G<>ANT
|
||||
|
||||
This file is part of G<>ANTLink.
|
||||
|
||||
G<>ANTLink is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
G<>ANTLink is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// EAP-TTLS packet
|
||||
///
|
||||
class packet_ttls;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../TLS/include/TLS.h"
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
class packet_ttls : public packet_tls
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// EAP-TTLS packet flags
|
||||
///
|
||||
/// \sa [Extensible Authentication Protocol Tunneled Transport Layer Security Authenticated Protocol Version 0 (EAP-TTLSv0) (Chapter: 9.1 Packet Format)](https://tools.ietf.org/html/rfc5281#section-9.1)
|
||||
///
|
||||
#pragma warning(suppress: 4480)
|
||||
enum flags_t : unsigned char {
|
||||
flags_length_incl = packet_tls::flags_req_length_incl, ///< Length included
|
||||
flags_more_frag = packet_tls::flags_req_more_frag, ///< More fragments
|
||||
flags_start = packet_tls::flags_req_start, ///< Start
|
||||
flags_ver_mask = 0x07, ///< Version mask
|
||||
};
|
||||
};
|
||||
}
|
@@ -95,11 +95,11 @@ void eap::method_ttls::process_request_packet(
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
_Inout_ EapPeerMethodOutput *pEapOutput)
|
||||
{
|
||||
if (pReceivedPacket->Code == EapCodeRequest && (pReceivedPacket->Data[1] & flags_start)) {
|
||||
if (pReceivedPacket->Code == EapCodeRequest && (pReceivedPacket->Data[1] & packet_ttls::flags_start)) {
|
||||
// This is a start EAP-TTLS packet.
|
||||
|
||||
// Determine minimum EAP-TTLS version supported by server and us.
|
||||
version_t ver_remote = (version_t)(pReceivedPacket->Data[1] & flags_ver_mask);
|
||||
version_t ver_remote = (version_t)(pReceivedPacket->Data[1] & packet_ttls::flags_ver_mask);
|
||||
m_version = std::min<version_t>(ver_remote, version_0);
|
||||
m_module.log_event(&EAPMETHOD_TTLS_HANDSHAKE_START, event_data((unsigned int)eap_type_ttls), event_data((unsigned char)m_version), event_data((unsigned char)ver_remote), event_data::blank);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void eap::method_ttls::get_response_packet(
|
||||
|
||||
// Change packet type to EAP-TTLS, and add EAP-TTLS version.
|
||||
pSendPacket->Data[0] = (BYTE)eap_type_ttls;
|
||||
pSendPacket->Data[1] &= ~flags_ver_mask;
|
||||
pSendPacket->Data[1] &= ~packet_ttls::flags_ver_mask;
|
||||
pSendPacket->Data[1] |= m_version;
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "../include/Credentials.h"
|
||||
#include "../include/Method.h"
|
||||
#include "../include/Module.h"
|
||||
#include "../include/TTLS.h"
|
||||
|
||||
#include "../../PAP/include/Config.h"
|
||||
#include "../../PAP/include/Credentials.h"
|
||||
|
Reference in New Issue
Block a user