eap-peap: Initiate Phase 2 immediately for TLS 1.3
Before TLS 1.3, the server sent the last handshake message and had the option to piggyback the EAP-Identity request directly onto the packet with the TLS Finished message, or wait for the empty message by the client that acknowledges the completion of the handshake. With TLS 1.3, the client finishes the handshake after the server. So this option is irrelevant there and we immediately start with Phase 2.
This commit is contained in:
@@ -181,6 +181,11 @@ static eap_peap_t *eap_peap_create(private_eap_peap_t * this,
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
if (is_server)
|
||||
{
|
||||
eap_peap_server_t *server = (eap_peap_server_t*)application;
|
||||
server->set_tls(server, tls);
|
||||
}
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,11 @@ struct private_eap_peap_server_t {
|
||||
*/
|
||||
identification_t *peer;
|
||||
|
||||
/**
|
||||
* TLS connection
|
||||
*/
|
||||
tls_t *tls;
|
||||
|
||||
/**
|
||||
* Current EAP-PEAP phase2 state
|
||||
*/
|
||||
@@ -341,16 +346,19 @@ METHOD(tls_application_t, build, status_t,
|
||||
eap_type_t type;
|
||||
pen_t vendor;
|
||||
|
||||
if (this->ph2_method == NULL && this->start_phase2 && this->start_phase2_id)
|
||||
if (!this->ph2_method && this->start_phase2 &&
|
||||
(this->start_phase2_id ||
|
||||
this->tls->get_version_max(this->tls) >= TLS_1_3))
|
||||
{
|
||||
/*
|
||||
* Start Phase 2 with an EAP Identity request either piggybacked right
|
||||
* onto the TLS Finished payload or delayed after the reception of an
|
||||
* empty EAP Acknowledge message.
|
||||
/* for TLS < 1.3, either start Phase 2 with an EAP Identity request
|
||||
* piggybacked right onto the TLS Finished payload or delayed after the
|
||||
* reception of an empty EAP Acknowledge message. with TLS 1.3, Phase 2
|
||||
* is always started immediately as the client finishes the handshake
|
||||
* after the server
|
||||
*/
|
||||
this->ph2_method = charon->eap->create_instance(charon->eap, EAP_IDENTITY,
|
||||
0, EAP_SERVER, this->server, this->peer);
|
||||
if (this->ph2_method == NULL)
|
||||
if (!this->ph2_method)
|
||||
{
|
||||
DBG1(DBG_IKE, "%N method not available",
|
||||
eap_type_names, EAP_IDENTITY);
|
||||
@@ -393,6 +401,12 @@ METHOD(tls_application_t, build, status_t,
|
||||
return INVALID_STATE;
|
||||
}
|
||||
|
||||
METHOD(eap_peap_server_t, set_tls, void,
|
||||
private_eap_peap_server_t *this, tls_t *tls)
|
||||
{
|
||||
this->tls = tls;
|
||||
}
|
||||
|
||||
METHOD(tls_application_t, destroy, void,
|
||||
private_eap_peap_server_t *this)
|
||||
{
|
||||
@@ -420,6 +434,7 @@ eap_peap_server_t *eap_peap_server_create(identification_t *server,
|
||||
.build = _build,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.set_tls = _set_tls,
|
||||
},
|
||||
.server = server->clone(server),
|
||||
.peer = peer->clone(peer),
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
typedef struct eap_peap_server_t eap_peap_server_t;
|
||||
|
||||
#include "tls.h"
|
||||
#include "tls_application.h"
|
||||
|
||||
#include <library.h>
|
||||
@@ -38,6 +39,14 @@ struct eap_peap_server_t {
|
||||
* Implements the TLS application data handler.
|
||||
*/
|
||||
tls_application_t application;
|
||||
|
||||
/**
|
||||
* Set a reference to the parent TLS connection this application is
|
||||
* assigned to.
|
||||
*
|
||||
* @param tls TLS connection
|
||||
*/
|
||||
void (*set_tls)(eap_peap_server_t *this, tls_t *tls);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user