summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/eap_peap
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2012-06-28 21:16:07 +0200
committerYves-Alexis Perez <corsac@corsac.net>2012-06-28 21:16:07 +0200
commita3b482a8facde4b453ad821bfe40effbe3d17903 (patch)
tree636f02074b05b7473f5db1fe60fa2bceb0094a62 /src/libcharon/plugins/eap_peap
parentd816a1afbd841e9943bb439fe4e110b7c4970550 (diff)
parentb34738ed08c2227300d554b139e2495ca5da97d6 (diff)
downloadvyos-strongswan-a3b482a8facde4b453ad821bfe40effbe3d17903.tar.gz
vyos-strongswan-a3b482a8facde4b453ad821bfe40effbe3d17903.zip
Merge tag 'upstream/4.6.4'
Upstream version 4.6.4
Diffstat (limited to 'src/libcharon/plugins/eap_peap')
-rw-r--r--src/libcharon/plugins/eap_peap/Makefile.in7
-rw-r--r--src/libcharon/plugins/eap_peap/eap_peap.c3
-rw-r--r--src/libcharon/plugins/eap_peap/eap_peap_avp.c19
-rw-r--r--src/libcharon/plugins/eap_peap/eap_peap_avp.h8
-rw-r--r--src/libcharon/plugins/eap_peap/eap_peap_peer.c4
-rw-r--r--src/libcharon/plugins/eap_peap/eap_peap_plugin.c33
-rw-r--r--src/libcharon/plugins/eap_peap/eap_peap_server.c4
7 files changed, 57 insertions, 21 deletions
diff --git a/src/libcharon/plugins/eap_peap/Makefile.in b/src/libcharon/plugins/eap_peap/Makefile.in
index 0ed4a3dcf..4f860e175 100644
--- a/src/libcharon/plugins/eap_peap/Makefile.in
+++ b/src/libcharon/plugins/eap_peap/Makefile.in
@@ -196,6 +196,9 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
+attest_plugins = @attest_plugins@
+axis2c_CFLAGS = @axis2c_CFLAGS@
+axis2c_LIBS = @axis2c_LIBS@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -204,6 +207,7 @@ build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
c_plugins = @c_plugins@
+clearsilver_LIBS = @clearsilver_LIBS@
datadir = @datadir@
datarootdir = @datarootdir@
dbusservicedir = @dbusservicedir@
@@ -220,11 +224,13 @@ host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
+imcvdir = @imcvdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
ipsecdir = @ipsecdir@
ipsecgroup = @ipsecgroup@
+ipseclibdir = @ipseclibdir@
ipsecuser = @ipsecuser@
libcharon_plugins = @libcharon_plugins@
libdir = @libdir@
@@ -268,6 +274,7 @@ sharedstatedir = @sharedstatedir@
soup_CFLAGS = @soup_CFLAGS@
soup_LIBS = @soup_LIBS@
srcdir = @srcdir@
+starter_plugins = @starter_plugins@
strongswan_conf = @strongswan_conf@
sysconfdir = @sysconfdir@
systemdsystemunitdir = @systemdsystemunitdir@
diff --git a/src/libcharon/plugins/eap_peap/eap_peap.c b/src/libcharon/plugins/eap_peap/eap_peap.c
index 5bae0fa9b..bd426bba7 100644
--- a/src/libcharon/plugins/eap_peap/eap_peap.c
+++ b/src/libcharon/plugins/eap_peap/eap_peap.c
@@ -166,7 +166,8 @@ static eap_peap_t *eap_peap_create(private_eap_peap_t * this,
"charon.plugins.eap-peap.max_message_count", MAX_MESSAGE_COUNT);
include_length = lib->settings->get_bool(lib->settings,
"charon.plugins.eap-peap.include_length", FALSE);
- tls = tls_create(is_server, server, peer, TLS_PURPOSE_EAP_PEAP, application);
+ tls = tls_create(is_server, server, peer, TLS_PURPOSE_EAP_PEAP,
+ application, NULL);
this->tls_eap = tls_eap_create(EAP_PEAP, tls, frag_size, max_msg_count,
include_length);
if (!this->tls_eap)
diff --git a/src/libcharon/plugins/eap_peap/eap_peap_avp.c b/src/libcharon/plugins/eap_peap/eap_peap_avp.c
index 06e5222d9..10f6ec11c 100644
--- a/src/libcharon/plugins/eap_peap/eap_peap_avp.c
+++ b/src/libcharon/plugins/eap_peap/eap_peap_avp.c
@@ -25,6 +25,8 @@ static const chunk_t MS_AVP_Success = chunk_from_chars(
0x80, 0x03, 0x00, 0x02, 0x00, 0x01);
static const chunk_t MS_AVP_Failure = chunk_from_chars(
0x80, 0x03, 0x00, 0x02, 0x00, 0x02);
+static const chunk_t MS_SoH_Request = chunk_from_chars(
+ 0x00, 0x01, 0x37, 0x00, 0x00, 0x00, 0x21, 0x00, 0x02, 0x00, 0x00);
typedef struct private_eap_peap_avp_t private_eap_peap_avp_t;
@@ -45,7 +47,7 @@ struct private_eap_peap_avp_t {
};
METHOD(eap_peap_avp_t, build, void,
- private_eap_peap_avp_t *this, tls_writer_t *writer, chunk_t data)
+ private_eap_peap_avp_t *this, bio_writer_t *writer, chunk_t data)
{
u_int8_t code;
eap_packet_t *pkt;
@@ -62,6 +64,19 @@ METHOD(eap_peap_avp_t, build, void,
writer->write_uint8(writer, EAP_MSTLV);
avp_data = (pkt->code == EAP_SUCCESS) ? MS_AVP_Success : MS_AVP_Failure;
}
+ /**
+ * Still trying to form a correct MS SoH Request
+ *
+ else if (pkt->type == EAP_MSCHAPV2)
+ {
+ code = (this->is_server) ? EAP_REQUEST : EAP_RESPONSE;
+ writer->write_uint8(writer, code);
+ writer->write_uint8(writer, pkt->identifier);
+ writer->write_uint16(writer, 16);
+ writer->write_uint8(writer, EAP_EXPANDED);
+ avp_data = MS_SoH_Request;
+ }
+ */
else
{
avp_data = chunk_skip(data, 4);
@@ -70,7 +85,7 @@ METHOD(eap_peap_avp_t, build, void,
}
METHOD(eap_peap_avp_t, process, status_t,
- private_eap_peap_avp_t* this, tls_reader_t *reader, chunk_t *data,
+ private_eap_peap_avp_t* this, bio_reader_t *reader, chunk_t *data,
u_int8_t identifier)
{
u_int8_t code;
diff --git a/src/libcharon/plugins/eap_peap/eap_peap_avp.h b/src/libcharon/plugins/eap_peap/eap_peap_avp.h
index db22f0f8f..98c5f1912 100644
--- a/src/libcharon/plugins/eap_peap/eap_peap_avp.h
+++ b/src/libcharon/plugins/eap_peap/eap_peap_avp.h
@@ -25,8 +25,8 @@ typedef struct eap_peap_avp_t eap_peap_avp_t;
#include <library.h>
-#include <tls_reader.h>
-#include <tls_writer.h>
+#include <bio/bio_reader.h>
+#include <bio/bio_writer.h>
/**
* EAP-PEAP Attribute-Value Pair (AVP) handler.
@@ -44,7 +44,7 @@ struct eap_peap_avp_t {
* - FAILED if AVP processing failed
* - NEED_MORE if another invocation of process/build needed
*/
- status_t (*process)(eap_peap_avp_t *this, tls_reader_t *reader,
+ status_t (*process)(eap_peap_avp_t *this, bio_reader_t *reader,
chunk_t *data, u_int8_t identifier);
/**
@@ -53,7 +53,7 @@ struct eap_peap_avp_t {
* @param writer TLS data buffer to write to
* @param data EAP Message to send
*/
- void (*build)(eap_peap_avp_t *this, tls_writer_t *writer, chunk_t data);
+ void (*build)(eap_peap_avp_t *this, bio_writer_t *writer, chunk_t data);
/**
* Destroy a eap_peap_application_t.
diff --git a/src/libcharon/plugins/eap_peap/eap_peap_peer.c b/src/libcharon/plugins/eap_peap/eap_peap_peer.c
index ca2af4fee..72e201fb6 100644
--- a/src/libcharon/plugins/eap_peap/eap_peap_peer.c
+++ b/src/libcharon/plugins/eap_peap/eap_peap_peer.c
@@ -63,7 +63,7 @@ struct private_eap_peap_peer_t {
};
METHOD(tls_application_t, process, status_t,
- private_eap_peap_peer_t *this, tls_reader_t *reader)
+ private_eap_peap_peer_t *this, bio_reader_t *reader)
{
chunk_t data = chunk_empty;
status_t status;
@@ -185,7 +185,7 @@ METHOD(tls_application_t, process, status_t,
}
METHOD(tls_application_t, build, status_t,
- private_eap_peap_peer_t *this, tls_writer_t *writer)
+ private_eap_peap_peer_t *this, bio_writer_t *writer)
{
chunk_t data;
eap_code_t code;
diff --git a/src/libcharon/plugins/eap_peap/eap_peap_plugin.c b/src/libcharon/plugins/eap_peap/eap_peap_plugin.c
index bac5f2d3e..e8deee9e1 100644
--- a/src/libcharon/plugins/eap_peap/eap_peap_plugin.c
+++ b/src/libcharon/plugins/eap_peap/eap_peap_plugin.c
@@ -25,13 +25,31 @@ METHOD(plugin_t, get_name, char*,
return "eap-peap";
}
+METHOD(plugin_t, get_features, int,
+ eap_peap_plugin_t *this, plugin_feature_t *features[])
+{
+ static plugin_feature_t f[] = {
+ PLUGIN_CALLBACK(eap_method_register, eap_peap_create_server),
+ PLUGIN_PROVIDE(EAP_SERVER, EAP_PEAP),
+ PLUGIN_DEPENDS(EAP_SERVER, EAP_IDENTITY),
+ PLUGIN_DEPENDS(HASHER, HASH_MD5),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA1),
+ PLUGIN_DEPENDS(RNG, RNG_WEAK),
+ PLUGIN_CALLBACK(eap_method_register, eap_peap_create_peer),
+ PLUGIN_PROVIDE(EAP_PEER, EAP_PEAP),
+ PLUGIN_DEPENDS(EAP_PEER, EAP_IDENTITY),
+ PLUGIN_DEPENDS(HASHER, HASH_MD5),
+ PLUGIN_DEPENDS(HASHER, HASH_SHA1),
+ PLUGIN_DEPENDS(RNG, RNG_WEAK),
+ PLUGIN_DEPENDS(RNG, RNG_STRONG),
+ };
+ *features = f;
+ return countof(f);
+}
+
METHOD(plugin_t, destroy, void,
eap_peap_plugin_t *this)
{
- charon->eap->remove_method(charon->eap,
- (eap_constructor_t)eap_peap_create_server);
- charon->eap->remove_method(charon->eap,
- (eap_constructor_t)eap_peap_create_peer);
free(this);
}
@@ -45,15 +63,10 @@ plugin_t *eap_peap_plugin_create()
INIT(this,
.plugin = {
.get_name = _get_name,
- .reload = (void*)return_false,
+ .get_features = _get_features,
.destroy = _destroy,
},
);
- charon->eap->add_method(charon->eap, EAP_PEAP, 0, EAP_SERVER,
- (eap_constructor_t)eap_peap_create_server);
- charon->eap->add_method(charon->eap, EAP_PEAP, 0, EAP_PEER,
- (eap_constructor_t)eap_peap_create_peer);
-
return &this->plugin;
}
diff --git a/src/libcharon/plugins/eap_peap/eap_peap_server.c b/src/libcharon/plugins/eap_peap/eap_peap_server.c
index 3fabc3575..4acdd9f07 100644
--- a/src/libcharon/plugins/eap_peap/eap_peap_server.c
+++ b/src/libcharon/plugins/eap_peap/eap_peap_server.c
@@ -158,7 +158,7 @@ static status_t start_phase2_tnc(private_eap_peap_server_t *this)
}
METHOD(tls_application_t, process, status_t,
- private_eap_peap_server_t *this, tls_reader_t *reader)
+ private_eap_peap_server_t *this, bio_reader_t *reader)
{
chunk_t data = chunk_empty;
status_t status;
@@ -330,7 +330,7 @@ METHOD(tls_application_t, process, status_t,
}
METHOD(tls_application_t, build, status_t,
- private_eap_peap_server_t *this, tls_writer_t *writer)
+ private_eap_peap_server_t *this, bio_writer_t *writer)
{
chunk_t data;
eap_code_t code;