diff options
Diffstat (limited to 'src/conftest')
-rw-r--r-- | src/conftest/Makefile.am | 2 | ||||
-rw-r--r-- | src/conftest/Makefile.in | 8 | ||||
-rw-r--r-- | src/conftest/README | 2 | ||||
-rw-r--r-- | src/conftest/config.c | 3 | ||||
-rw-r--r-- | src/conftest/hooks/add_notify.c | 5 | ||||
-rw-r--r-- | src/conftest/hooks/add_payload.c | 3 | ||||
-rw-r--r-- | src/conftest/hooks/custom_proposal.c | 5 | ||||
-rw-r--r-- | src/conftest/hooks/force_cookie.c | 2 | ||||
-rw-r--r-- | src/conftest/hooks/ike_auth_fill.c | 2 | ||||
-rw-r--r-- | src/conftest/hooks/log_id.c | 4 | ||||
-rw-r--r-- | src/conftest/hooks/log_ke.c | 2 | ||||
-rw-r--r-- | src/conftest/hooks/log_proposals.c | 2 | ||||
-rw-r--r-- | src/conftest/hooks/log_ts.c | 4 | ||||
-rw-r--r-- | src/conftest/hooks/pretend_auth.c | 18 | ||||
-rw-r--r-- | src/conftest/hooks/rebuild_auth.c | 6 | ||||
-rw-r--r-- | src/conftest/hooks/set_critical.c | 3 | ||||
-rw-r--r-- | src/conftest/hooks/set_length.c | 3 | ||||
-rw-r--r-- | src/conftest/hooks/set_proposal_number.c | 2 | ||||
-rw-r--r-- | src/conftest/hooks/set_reserved.c | 13 | ||||
-rw-r--r-- | src/conftest/hooks/unencrypted_notify.c | 5 | ||||
-rw-r--r-- | src/conftest/hooks/unsort_message.c | 3 |
21 files changed, 48 insertions, 49 deletions
diff --git a/src/conftest/Makefile.am b/src/conftest/Makefile.am index 900741dbb..eeb26f225 100644 --- a/src/conftest/Makefile.am +++ b/src/conftest/Makefile.am @@ -6,7 +6,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/libcharon \ -DPLUGINS=\""${charon_plugins}\"" -AM_CFLAGS = -rdynamic +AM_CFLAGS = $(PLUGIN_CFLAGS) conftest_SOURCES = conftest.c conftest.h config.c config.h actions.c actions.h \ hooks/hook.h hooks/ike_auth_fill.c hooks/unsort_message.c \ diff --git a/src/conftest/Makefile.in b/src/conftest/Makefile.in index 453e8f827..edd07b8b5 100644 --- a/src/conftest/Makefile.in +++ b/src/conftest/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -250,6 +250,7 @@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL_LIB = @OPENSSL_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -268,6 +269,7 @@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ PTHREADLIB = @PTHREADLIB@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ @@ -295,6 +297,7 @@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +aikgen_plugins = @aikgen_plugins@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -386,6 +389,7 @@ srcdir = @srcdir@ starter_plugins = @starter_plugins@ strongswan_conf = @strongswan_conf@ strongswan_options = @strongswan_options@ +swanctldir = @swanctldir@ sysconfdir = @sysconfdir@ systemdsystemunitdir = @systemdsystemunitdir@ t_plugins = @t_plugins@ @@ -402,7 +406,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/libcharon \ -DPLUGINS=\""${charon_plugins}\"" -AM_CFLAGS = -rdynamic +AM_CFLAGS = $(PLUGIN_CFLAGS) conftest_SOURCES = conftest.c conftest.h config.c config.h actions.c actions.h \ hooks/hook.h hooks/ike_auth_fill.c hooks/unsort_message.c \ hooks/add_notify.c hooks/unencrypted_notify.c hooks/ignore_message.c \ diff --git a/src/conftest/README b/src/conftest/README index 617195df9..d37539a16 100644 --- a/src/conftest/README +++ b/src/conftest/README @@ -304,7 +304,7 @@ Compile time options required depend on the test suite. A minimalistic strongSwan build with the OpenSSL crypto backend can be configured with: ./configure --sysconfdir=/etc --disable-pluto --disable-scripts \ - --disable-tools --disable-aes --disable-des --disable-md5 \ + --disable-scepclient --disable-aes --disable-des --disable-md5 \ --disable-sha1 --disable-sha2 --disable-fips-prf --disable-gmp \ --disable-pubkey --disable-pgp --disable-dnskey --disable-updown \ --disable-attr --disable-resolve --enable-openssl --enable-conftest \ diff --git a/src/conftest/config.c b/src/conftest/config.c index 5aa742d79..c83db7ecd 100644 --- a/src/conftest/config.c +++ b/src/conftest/config.c @@ -129,6 +129,7 @@ static ike_cfg_t *load_ike_config(private_config_t *this, else { ike_cfg->add_proposal(ike_cfg, proposal_create_default(PROTO_IKE)); + ike_cfg->add_proposal(ike_cfg, proposal_create_default_aead(PROTO_IKE)); } return ike_cfg; } @@ -180,6 +181,8 @@ static child_cfg_t *load_child_config(private_config_t *this, else { child_cfg->add_proposal(child_cfg, proposal_create_default(PROTO_ESP)); + child_cfg->add_proposal(child_cfg, + proposal_create_default_aead(PROTO_ESP)); } token = settings->get_str(settings, "configs.%s.%s.lts", NULL, config, child); diff --git a/src/conftest/hooks/add_notify.c b/src/conftest/hooks/add_notify.c index 9611cad6c..73a9b1a80 100644 --- a/src/conftest/hooks/add_notify.c +++ b/src/conftest/hooks/add_notify.c @@ -73,8 +73,7 @@ METHOD(listener_t, message, bool, type = atoi(this->type); if (!type) { - type = enum_from_name(notify_type_names, this->type); - if (type == -1) + if (!enum_from_name(notify_type_names, this->type, &type)) { DBG1(DBG_CFG, "unknown notify: '%s', skipped", this->type); return TRUE; @@ -89,7 +88,7 @@ METHOD(listener_t, message, bool, { data = chunk_clone(chunk_create(this->data, strlen(this->data))); } - notify = notify_payload_create_from_protocol_and_type(NOTIFY, + notify = notify_payload_create_from_protocol_and_type(PLV2_NOTIFY, this->esp ? PROTO_ESP : PROTO_IKE, type); notify->set_spi(notify, this->spi); if (data.len) diff --git a/src/conftest/hooks/add_payload.c b/src/conftest/hooks/add_payload.c index 2903bb20f..cb5be1aef 100644 --- a/src/conftest/hooks/add_payload.c +++ b/src/conftest/hooks/add_payload.c @@ -77,8 +77,7 @@ METHOD(listener_t, message, bool, type = atoi(this->type); if (!type) { - type = enum_from_name(payload_type_short_names, this->type); - if (type == -1) + if (!enum_from_name(payload_type_short_names, this->type, &type)) { DBG1(DBG_CFG, "unknown payload: '%s', skipped", this->type); return TRUE; diff --git a/src/conftest/hooks/custom_proposal.c b/src/conftest/hooks/custom_proposal.c index 38d4286c4..ee4404575 100644 --- a/src/conftest/hooks/custom_proposal.c +++ b/src/conftest/hooks/custom_proposal.c @@ -79,8 +79,7 @@ static linked_list_t* load_proposals(private_custom_proposal_t *this, type = strtoul(key, &end, 10); if (end == key || errno) { - type = enum_from_name(transform_type_names, key); - if (type == -1) + if (!enum_from_name(transform_type_names, key, &type)) { DBG1(DBG_CFG, "unknown transform: '%s', skipped", key); continue; @@ -125,7 +124,7 @@ METHOD(listener_t, message, bool, enumerator = message->create_payload_enumerator(message); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == SECURITY_ASSOCIATION) + if (payload->get_type(payload) == PLV2_SECURITY_ASSOCIATION) { old = (sa_payload_t*)payload; message->remove_payload_at(message, enumerator); diff --git a/src/conftest/hooks/force_cookie.c b/src/conftest/hooks/force_cookie.c index 1b044db14..6be516cf4 100644 --- a/src/conftest/hooks/force_cookie.c +++ b/src/conftest/hooks/force_cookie.c @@ -44,7 +44,7 @@ METHOD(listener_t, message, bool, enumerator = message->create_payload_enumerator(message); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == NOTIFY) + if (payload->get_type(payload) == PLV2_NOTIFY) { notify_payload_t *notify = (notify_payload_t*)payload; chunk_t data; diff --git a/src/conftest/hooks/ike_auth_fill.c b/src/conftest/hooks/ike_auth_fill.c index 09590d4f3..5cdd5be38 100644 --- a/src/conftest/hooks/ike_auth_fill.c +++ b/src/conftest/hooks/ike_auth_fill.c @@ -108,7 +108,7 @@ METHOD(listener_t, message, bool, diff = this->bytes - size - CERT_PAYLOAD_HEADER_LENGTH; data = chunk_alloc(diff); memset(data.ptr, 0x12, data.len); - pld = cert_payload_create_custom(CERTIFICATE, 201, data); + pld = cert_payload_create_custom(PLV2_CERTIFICATE, 201, data); message->add_payload(message, &pld->payload_interface); DBG1(DBG_CFG, "inserting %d dummy bytes certificate payload", diff); } diff --git a/src/conftest/hooks/log_id.c b/src/conftest/hooks/log_id.c index 07dd6a44e..f47372fa7 100644 --- a/src/conftest/hooks/log_id.c +++ b/src/conftest/hooks/log_id.c @@ -45,8 +45,8 @@ METHOD(listener_t, message, bool, enumerator = message->create_payload_enumerator(message); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == ID_INITIATOR || - payload->get_type(payload) == ID_RESPONDER) + if (payload->get_type(payload) == PLV2_ID_INITIATOR || + payload->get_type(payload) == PLV2_ID_RESPONDER) { id_payload = (id_payload_t*)payload; id = id_payload->get_identification(id_payload); diff --git a/src/conftest/hooks/log_ke.c b/src/conftest/hooks/log_ke.c index 710482326..66aa4a65e 100644 --- a/src/conftest/hooks/log_ke.c +++ b/src/conftest/hooks/log_ke.c @@ -43,7 +43,7 @@ METHOD(listener_t, message, bool, enumerator = message->create_payload_enumerator(message); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == KEY_EXCHANGE) + if (payload->get_type(payload) == PLV2_KEY_EXCHANGE) { ke = (ke_payload_t*)payload; DBG1(DBG_CFG, "received DH group %N", diff --git a/src/conftest/hooks/log_proposals.c b/src/conftest/hooks/log_proposals.c index 347b83209..c0d458eae 100644 --- a/src/conftest/hooks/log_proposals.c +++ b/src/conftest/hooks/log_proposals.c @@ -45,7 +45,7 @@ METHOD(listener_t, message, bool, enumerator = message->create_payload_enumerator(message); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == SECURITY_ASSOCIATION) + if (payload->get_type(payload) == PLV2_SECURITY_ASSOCIATION) { sa = (sa_payload_t*)payload; list = sa->get_proposals(sa); diff --git a/src/conftest/hooks/log_ts.c b/src/conftest/hooks/log_ts.c index f212efa12..79c59b89a 100644 --- a/src/conftest/hooks/log_ts.c +++ b/src/conftest/hooks/log_ts.c @@ -43,8 +43,8 @@ METHOD(listener_t, message, bool, enumerator = message->create_payload_enumerator(message); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == TRAFFIC_SELECTOR_INITIATOR || - payload->get_type(payload) == TRAFFIC_SELECTOR_RESPONDER) + if (payload->get_type(payload) == PLV2_TS_INITIATOR || + payload->get_type(payload) == PLV2_TS_RESPONDER) { ts = (ts_payload_t*)payload; host_t *from, *to; diff --git a/src/conftest/hooks/pretend_auth.c b/src/conftest/hooks/pretend_auth.c index 4166afc79..54957b048 100644 --- a/src/conftest/hooks/pretend_auth.c +++ b/src/conftest/hooks/pretend_auth.c @@ -79,7 +79,7 @@ static void process_init_request(private_pretend_auth_t *this, { nonce_payload_t *nonce; - nonce = (nonce_payload_t*)message->get_payload(message, NONCE); + nonce = (nonce_payload_t*)message->get_payload(message, PLV2_NONCE); if (nonce) { free(this->nonce.ptr); @@ -98,13 +98,13 @@ static void process_auth_request(private_pretend_auth_t *this, ts_payload_t *tsi, *tsr; linked_list_t *proposals; - id = (id_payload_t*)message->get_payload(message, ID_RESPONDER); + id = (id_payload_t*)message->get_payload(message, PLV2_ID_RESPONDER); if (id) { this->id->destroy(this->id); this->id = id->get_identification(id); } - sa = (sa_payload_t*)message->get_payload(message, SECURITY_ASSOCIATION); + sa = (sa_payload_t*)message->get_payload(message, PLV2_SECURITY_ASSOCIATION); if (sa) { proposals = sa->get_proposals(sa); @@ -116,13 +116,13 @@ static void process_auth_request(private_pretend_auth_t *this, proposals->destroy_offset(proposals, offsetof(proposal_t, destroy)); } tsi = (ts_payload_t*)message->get_payload(message, - TRAFFIC_SELECTOR_INITIATOR); + PLV2_TS_INITIATOR); if (tsi) { this->tsi = tsi->get_traffic_selectors(tsi); } tsr = (ts_payload_t*)message->get_payload(message, - TRAFFIC_SELECTOR_RESPONDER); + PLV2_TS_RESPONDER); if (tsr) { this->tsr = tsr->get_traffic_selectors(tsr); @@ -154,7 +154,7 @@ static void build_certs(private_pretend_auth_t *this, cert = auth->get(auth, AUTH_RULE_SUBJECT_CERT); if (cert) { - payload = cert_payload_create_from_cert(CERTIFICATE, cert); + payload = cert_payload_create_from_cert(PLV2_CERTIFICATE, cert); if (payload) { DBG1(DBG_IKE, "pretending end entity cert \"%Y\"", @@ -167,7 +167,7 @@ static void build_certs(private_pretend_auth_t *this, { if (type == AUTH_RULE_IM_CERT) { - payload = cert_payload_create_from_cert(CERTIFICATE, cert); + payload = cert_payload_create_from_cert(PLV2_CERTIFICATE, cert); if (payload) { DBG1(DBG_IKE, "pretending issuer cert \"%Y\"", @@ -276,7 +276,7 @@ static void process_auth_response(private_pretend_auth_t *this, { notify_payload_t *notify = (notify_payload_t*)payload; - if (payload->get_type(payload) != NOTIFY || + if (payload->get_type(payload) != PLV2_NOTIFY || notify->get_notify_type(notify) != AUTHENTICATION_FAILED) { DBG1(DBG_CFG, "no %N notify found, disabling AUTH pretending", @@ -295,7 +295,7 @@ static void process_auth_response(private_pretend_auth_t *this, return; } message->add_payload(message, (payload_t*) - id_payload_create_from_identification(ID_RESPONDER, this->id)); + id_payload_create_from_identification(PLV2_ID_RESPONDER, this->id)); if (this->proposal) { message->add_payload(message, (payload_t*) diff --git a/src/conftest/hooks/rebuild_auth.c b/src/conftest/hooks/rebuild_auth.c index b7e6f22e7..bc2f00071 100644 --- a/src/conftest/hooks/rebuild_auth.c +++ b/src/conftest/hooks/rebuild_auth.c @@ -70,7 +70,7 @@ static bool rebuild_auth(private_rebuild_auth_t *this, ike_sa_t *ike_sa, u_int32_t *lenpos; payload = message->get_payload(message, - message->get_request(message) ? ID_INITIATOR : ID_RESPONDER); + message->get_request(message) ? PLV2_ID_INITIATOR : PLV2_ID_RESPONDER); if (!payload) { DBG1(DBG_CFG, "ID payload not found to rebuild AUTH"); @@ -160,7 +160,7 @@ static bool rebuild_auth(private_rebuild_auth_t *this, ike_sa_t *ike_sa, enumerator = message->create_payload_enumerator(message); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == AUTHENTICATION) + if (payload->get_type(payload) == PLV2_AUTH) { message->remove_payload_at(message, enumerator); payload->destroy(payload); @@ -191,7 +191,7 @@ METHOD(listener_t, message, bool, { nonce_payload_t *nonce; - nonce = (nonce_payload_t*)message->get_payload(message, NONCE); + nonce = (nonce_payload_t*)message->get_payload(message, PLV2_NONCE); if (nonce) { free(this->nonce.ptr); diff --git a/src/conftest/hooks/set_critical.c b/src/conftest/hooks/set_critical.c index 8ec84e13d..15c313c51 100644 --- a/src/conftest/hooks/set_critical.c +++ b/src/conftest/hooks/set_critical.c @@ -65,8 +65,7 @@ METHOD(listener_t, message, bool, type = atoi(name); if (!type) { - type = enum_from_name(payload_type_short_names, name); - if (type == -1) + if (!enum_from_name(payload_type_short_names, name, &type)) { DBG1(DBG_CFG, "invalid payload name '%s'", name); break; diff --git a/src/conftest/hooks/set_length.c b/src/conftest/hooks/set_length.c index c1a867a99..b1a1a4723 100644 --- a/src/conftest/hooks/set_length.c +++ b/src/conftest/hooks/set_length.c @@ -63,8 +63,7 @@ METHOD(listener_t, message, bool, type = atoi(this->type); if (!type) { - type = enum_from_name(payload_type_short_names, this->type); - if (type == -1) + if (!enum_from_name(payload_type_short_names, this->type, &type)) { DBG1(DBG_CFG, "unknown payload: '%s', skipped", this->type); return TRUE; diff --git a/src/conftest/hooks/set_proposal_number.c b/src/conftest/hooks/set_proposal_number.c index 0cc3cfc63..4e572d608 100644 --- a/src/conftest/hooks/set_proposal_number.c +++ b/src/conftest/hooks/set_proposal_number.c @@ -85,7 +85,7 @@ METHOD(listener_t, message, bool, enumerator = message->create_payload_enumerator(message); while (enumerator->enumerate(enumerator, &payload)) { - if (payload->get_type(payload) == SECURITY_ASSOCIATION) + if (payload->get_type(payload) == PLV2_SECURITY_ASSOCIATION) { sa = (sa_payload_t*)payload; list = sa->get_proposals(sa); diff --git a/src/conftest/hooks/set_reserved.c b/src/conftest/hooks/set_reserved.c index d1a4a977b..488e8df1c 100644 --- a/src/conftest/hooks/set_reserved.c +++ b/src/conftest/hooks/set_reserved.c @@ -55,7 +55,7 @@ static void set_bit(private_set_reserved_t *this, message_t *message, payload_t *payload; bool *bit; - if (type == HEADER) + if (type == PL_HEADER) { message->set_reserved_header_bit(message, nr); DBG1(DBG_CFG, "setting reserved bit %d of %N", @@ -91,7 +91,7 @@ static void set_byte(private_set_reserved_t *this, message_t *message, payload_t *payload; u_int8_t *byte; - if (type == TRANSFORM_SUBSTRUCTURE || type == PROPOSAL_SUBSTRUCTURE) + if (type == PLV2_TRANSFORM_SUBSTRUCTURE || type == PLV2_PROPOSAL_SUBSTRUCTURE) { enumerator_t *transforms, *proposals; transform_substructure_t *transform; @@ -101,13 +101,13 @@ static void set_byte(private_set_reserved_t *this, message_t *message, payloads = message->create_payload_enumerator(message); while (payloads->enumerate(payloads, &payload)) { - if (payload->get_type(payload) == SECURITY_ASSOCIATION) + if (payload->get_type(payload) == PLV2_SECURITY_ASSOCIATION) { sa = (sa_payload_t*)payload; proposals = sa->create_substructure_enumerator(sa); while (proposals->enumerate(proposals, &proposal)) { - if (type == PROPOSAL_SUBSTRUCTURE) + if (type == PLV2_PROPOSAL_SUBSTRUCTURE) { byte = payload_get_field(&proposal->payload_interface, RESERVED_BYTE, nr); @@ -118,7 +118,7 @@ static void set_byte(private_set_reserved_t *this, message_t *message, *byte = byteval; } } - else if (type == TRANSFORM_SUBSTRUCTURE) + else if (type == PLV2_TRANSFORM_SUBSTRUCTURE) { transforms = proposal->create_substructure_enumerator( proposal); @@ -181,8 +181,7 @@ METHOD(listener_t, message, bool, type = atoi(name); if (!type) { - type = enum_from_name(payload_type_short_names, name); - if (type == -1) + if (!enum_from_name(payload_type_short_names, name, &type)) { DBG1(DBG_CFG, "invalid payload name '%s'", name); break; diff --git a/src/conftest/hooks/unencrypted_notify.c b/src/conftest/hooks/unencrypted_notify.c index f4c35725c..2a7498527 100644 --- a/src/conftest/hooks/unencrypted_notify.c +++ b/src/conftest/hooks/unencrypted_notify.c @@ -68,8 +68,7 @@ METHOD(listener_t, ike_updown, bool, type = atoi(this->type); if (!type) { - type = enum_from_name(notify_type_names, this->type); - if (type == -1) + if (!enum_from_name(notify_type_names, this->type, &type)) { DBG1(DBG_CFG, "unknown notify: '%s', skipped", this->type); return TRUE; @@ -84,7 +83,7 @@ METHOD(listener_t, ike_updown, bool, { data = chunk_clone(chunk_create(this->data, strlen(this->data))); } - notify = notify_payload_create_from_protocol_and_type(NOTIFY, + notify = notify_payload_create_from_protocol_and_type(PLV2_NOTIFY, this->esp ? PROTO_ESP : PROTO_IKE, type); notify->set_spi(notify, this->spi); if (data.len) diff --git a/src/conftest/hooks/unsort_message.c b/src/conftest/hooks/unsort_message.c index 1b2b302af..399d2932a 100644 --- a/src/conftest/hooks/unsort_message.c +++ b/src/conftest/hooks/unsort_message.c @@ -69,8 +69,7 @@ METHOD(listener_t, message, bool, order = enumerator_create_token(this->order, ", ", " "); while (order->enumerate(order, &name)) { - type = enum_from_name(payload_type_short_names, name); - if (type != -1) + if (enum_from_name(payload_type_short_names, name, &type)) { enumerator = list->create_enumerator(list); while (enumerator->enumerate(enumerator, &payload)) |