summaryrefslogtreecommitdiff
path: root/src/libcharon/encoding
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/encoding')
-rw-r--r--src/libcharon/encoding/generator.c2
-rw-r--r--src/libcharon/encoding/message.c36
-rw-r--r--src/libcharon/encoding/message.h2
-rw-r--r--src/libcharon/encoding/parser.c60
-rw-r--r--src/libcharon/encoding/payloads/certreq_payload.c3
-rw-r--r--src/libcharon/encoding/payloads/cp_payload.h2
-rw-r--r--src/libcharon/encoding/payloads/eap_payload.c12
-rw-r--r--src/libcharon/encoding/payloads/eap_payload.h13
-rw-r--r--src/libcharon/encoding/payloads/encryption_payload.c2
-rw-r--r--src/libcharon/encoding/payloads/endpoint_notify.c125
-rw-r--r--src/libcharon/encoding/payloads/endpoint_notify.h15
-rw-r--r--src/libcharon/encoding/payloads/ike_header.c9
-rw-r--r--src/libcharon/encoding/payloads/ike_header.h5
-rw-r--r--src/libcharon/encoding/payloads/notify_payload.c50
-rw-r--r--src/libcharon/encoding/payloads/notify_payload.h22
-rw-r--r--src/libcharon/encoding/payloads/payload.c23
-rw-r--r--src/libcharon/encoding/payloads/payload.h7
-rw-r--r--src/libcharon/encoding/payloads/proposal_substructure.c2
-rw-r--r--src/libcharon/encoding/payloads/sa_payload.c12
-rw-r--r--src/libcharon/encoding/payloads/transform_substructure.c2
-rw-r--r--src/libcharon/encoding/payloads/transform_substructure.h2
21 files changed, 230 insertions, 176 deletions
diff --git a/src/libcharon/encoding/generator.c b/src/libcharon/encoding/generator.c
index ce3844361..60fa7e0c4 100644
--- a/src/libcharon/encoding/generator.c
+++ b/src/libcharon/encoding/generator.c
@@ -523,7 +523,7 @@ METHOD(generator_t, generate_payload, void,
payload_type_names, payload_type);
DBG3(DBG_ENC, "generated data for this payload %b",
this->buffer + offset_start,
- this->out_position - this->buffer - offset_start);
+ (u_int)(this->out_position - this->buffer - offset_start));
}
METHOD(generator_t, destroy, void,
diff --git a/src/libcharon/encoding/message.c b/src/libcharon/encoding/message.c
index 214612fdb..2b5399294 100644
--- a/src/libcharon/encoding/message.c
+++ b/src/libcharon/encoding/message.c
@@ -63,13 +63,13 @@
typedef struct {
/* Payload type */
payload_type_t type;
- /* Minimal occurence of this payload. */
+ /* Minimal occurrence of this payload. */
size_t min_occurence;
- /* Max occurence of this payload. */
+ /* Max occurrence of this payload. */
size_t max_occurence;
/* TRUE if payload must be encrypted */
bool encrypted;
- /* If payload occurs, the message rule is fullfilled */
+ /* If payload occurs, the message rule is fulfilled */
bool sufficient;
} payload_rule_t;
@@ -861,9 +861,23 @@ static char* get_string(private_message_t *this, char *buf, int len)
len -= written;
if (payload->get_type(payload) == NOTIFY)
{
- notify_payload_t *notify = (notify_payload_t*)payload;
- written = snprintf(pos, len, "(%N)", notify_type_short_names,
- notify->get_notify_type(notify));
+ notify_payload_t *notify;
+ notify_type_t type;
+ chunk_t data;
+
+ notify = (notify_payload_t*)payload;
+ type = notify->get_notify_type(notify);
+ data = notify->get_notification_data(notify);
+ if (type == MS_NOTIFY_STATUS && data.len == 4)
+ {
+ written = snprintf(pos, len, "(%N(%d))", notify_type_short_names,
+ type, untoh32(data.ptr));
+ }
+ else
+ {
+ written = snprintf(pos, len, "(%N)", notify_type_short_names,
+ type);
+ }
if (written >= len || written < 0)
{
return buf;
@@ -1065,7 +1079,7 @@ METHOD(message_t, generate, status_t,
encryption_payload_t *encryption = NULL;
enumerator_t *enumerator;
chunk_t chunk;
- char str[256];
+ char str[BUF_LEN];
u_int32_t *lenpos;
bool *reserved;
int i;
@@ -1312,7 +1326,7 @@ static status_t decrypt_payloads(private_message_t *this, aead_t *aead)
DBG2(DBG_ENC, "found an encryption payload");
- if (enumerator->enumerate(enumerator, &payload))
+ if (this->payloads->has_more(this->payloads, enumerator))
{
DBG1(DBG_ENC, "encrypted payload is not last payload");
status = VERIFY_ERROR;
@@ -1405,7 +1419,7 @@ static status_t verify(private_message_t *this)
if (found > rule->max_occurence)
{
DBG1(DBG_ENC, "payload of type %N more than %d times (%d) "
- "occured in current message", payload_type_names,
+ "occurred in current message", payload_type_names,
type, rule->max_occurence, found);
enumerator->destroy(enumerator);
return VERIFY_ERROR;
@@ -1416,7 +1430,7 @@ static status_t verify(private_message_t *this)
if (!complete && found < rule->min_occurence)
{
- DBG1(DBG_ENC, "payload of type %N not occured %d times (%d)",
+ DBG1(DBG_ENC, "payload of type %N not occurred %d times (%d)",
payload_type_names, rule->type, rule->min_occurence, found);
return VERIFY_ERROR;
}
@@ -1434,7 +1448,7 @@ METHOD(message_t, parse_body, status_t,
status_t status = SUCCESS;
payload_t *payload;
payload_type_t type;
- char str[256];
+ char str[BUF_LEN];
type = this->first_payload;
diff --git a/src/libcharon/encoding/message.h b/src/libcharon/encoding/message.h
index 51197308c..0e78ea436 100644
--- a/src/libcharon/encoding/message.h
+++ b/src/libcharon/encoding/message.h
@@ -321,7 +321,7 @@ struct message_t {
/**
* Find a payload of a specific type.
*
- * Returns the first occurance.
+ * Returns the first occurrence.
*
* @param type type of the payload to find
* @return payload, or NULL if no such payload found
diff --git a/src/libcharon/encoding/parser.c b/src/libcharon/encoding/parser.c
index 32cefb9e7..e49210309 100644
--- a/src/libcharon/encoding/parser.c
+++ b/src/libcharon/encoding/parser.c
@@ -86,12 +86,6 @@ struct private_parser_t {
};
/**
- * Forward declaration
- */
-static status_t parse_payload(private_parser_t *this,
- payload_type_t payload_type, payload_t **payload);
-
-/**
* Log invalid length error
*/
static bool short_input(private_parser_t *this, int number)
@@ -320,7 +314,8 @@ static bool parse_list(private_parser_t *this, int rule_number,
DBG2(DBG_ENC, " %d bytes left, parsing recursively %N",
length, payload_type_names, payload_type);
- if (parse_payload(this, payload_type, &payload) != SUCCESS)
+ if (this->public.parse_payload(&this->public, payload_type,
+ &payload) != SUCCESS)
{
DBG1(DBG_ENC, " parsing of a %N substructure failed",
payload_type_names, payload_type);
@@ -363,11 +358,8 @@ static bool parse_chunk(private_parser_t *this, int rule_number,
return TRUE;
}
-/**
- * Implementation of parser_t.parse_payload.
- */
-static status_t parse_payload(private_parser_t *this,
- payload_type_t payload_type, payload_t **payload)
+METHOD(parser_t, parse_payload, status_t,
+ private_parser_t *this, payload_type_t payload_type, payload_t **payload)
{
payload_t *pld;
void *output;
@@ -385,7 +377,7 @@ static status_t parse_payload(private_parser_t *this,
payload_type_names, payload_type, this->input_roof - this->byte_pos);
DBG3(DBG_ENC, "parsing payload from %b",
- this->byte_pos, this->input_roof - this->byte_pos);
+ this->byte_pos, (u_int)(this->input_roof - this->byte_pos));
/* base pointer for output, avoids casting in every rule */
output = pld;
@@ -785,27 +777,21 @@ static status_t parse_payload(private_parser_t *this,
return SUCCESS;
}
-/**
- * Implementation of parser_t.get_remaining_byte_count.
- */
-static int get_remaining_byte_count (private_parser_t *this)
+METHOD(parser_t, get_remaining_byte_count, int,
+ private_parser_t *this)
{
return this->input_roof - this->byte_pos;
}
-/**
- * Implementation of parser_t.reset_context.
- */
-static void reset_context (private_parser_t *this)
+METHOD(parser_t, reset_context, void,
+ private_parser_t *this)
{
this->byte_pos = this->input;
this->bit_pos = 0;
}
-/**
- * Implementation of parser_t.destroy.
- */
-static void destroy(private_parser_t *this)
+METHOD(parser_t, destroy, void,
+ private_parser_t *this)
{
free(this);
}
@@ -815,17 +801,19 @@ static void destroy(private_parser_t *this)
*/
parser_t *parser_create(chunk_t data)
{
- private_parser_t *this = malloc_thing(private_parser_t);
-
- this->public.parse_payload = (status_t(*)(parser_t*,payload_type_t,payload_t**))parse_payload;
- this->public.reset_context = (void(*)(parser_t*)) reset_context;
- this->public.get_remaining_byte_count = (int (*) (parser_t *))get_remaining_byte_count;
- this->public.destroy = (void(*)(parser_t*)) destroy;
-
- this->input = data.ptr;
- this->byte_pos = data.ptr;
- this->bit_pos = 0;
- this->input_roof = data.ptr + data.len;
+ private_parser_t *this;
+
+ INIT(this,
+ .public = {
+ .parse_payload = _parse_payload,
+ .reset_context = _reset_context,
+ .get_remaining_byte_count = _get_remaining_byte_count,
+ .destroy = _destroy,
+ },
+ .input = data.ptr,
+ .byte_pos = data.ptr,
+ .input_roof = data.ptr + data.len,
+ );
return &this->public;
}
diff --git a/src/libcharon/encoding/payloads/certreq_payload.c b/src/libcharon/encoding/payloads/certreq_payload.c
index 8e0836f0e..02015f273 100644
--- a/src/libcharon/encoding/payloads/certreq_payload.c
+++ b/src/libcharon/encoding/payloads/certreq_payload.c
@@ -111,8 +111,7 @@ METHOD(payload_t, verify, status_t,
{
if (this->encoding == ENC_X509_SIGNATURE)
{
- if (this->data.len < HASH_SIZE_SHA1 ||
- this->data.len % HASH_SIZE_SHA1)
+ if (this->data.len % HASH_SIZE_SHA1)
{
DBG1(DBG_ENC, "invalid X509 hash length (%d) in certreq",
this->data.len);
diff --git a/src/libcharon/encoding/payloads/cp_payload.h b/src/libcharon/encoding/payloads/cp_payload.h
index 7dcf58f7e..afae6091a 100644
--- a/src/libcharon/encoding/payloads/cp_payload.h
+++ b/src/libcharon/encoding/payloads/cp_payload.h
@@ -63,7 +63,7 @@ struct cp_payload_t {
payload_t payload_interface;
/**
- * Creates an iterator of stored configuration_attribute_t objects.
+ * Creates an enumerator of stored configuration_attribute_t objects.
*
* @return enumerator over configration_attribute_T
*/
diff --git a/src/libcharon/encoding/payloads/eap_payload.c b/src/libcharon/encoding/payloads/eap_payload.c
index eafb668b6..cacaef222 100644
--- a/src/libcharon/encoding/payloads/eap_payload.c
+++ b/src/libcharon/encoding/payloads/eap_payload.c
@@ -284,6 +284,18 @@ eap_payload_t *eap_payload_create_data(chunk_t data)
/*
* Described in header
*/
+eap_payload_t *eap_payload_create_data_own(chunk_t data)
+{
+ eap_payload_t *this = eap_payload_create();
+
+ this->set_data(this, data);
+ free(data.ptr);
+ return this;
+}
+
+/*
+ * Described in header
+ */
eap_payload_t *eap_payload_create_code(eap_code_t code, u_int8_t identifier)
{
chunk_t data;
diff --git a/src/libcharon/encoding/payloads/eap_payload.h b/src/libcharon/encoding/payloads/eap_payload.h
index 0bde4b15e..60d9c99d2 100644
--- a/src/libcharon/encoding/payloads/eap_payload.h
+++ b/src/libcharon/encoding/payloads/eap_payload.h
@@ -95,18 +95,27 @@ struct eap_payload_t {
/**
* Creates an empty eap_payload_t object.
*
- * @return eap_payload_t object
+ * @return eap_payload_t object
*/
eap_payload_t *eap_payload_create(void);
/**
* Creates an eap_payload_t object with data.
*
- * @return eap_payload_t object
+ * @param data data, gets cloned
+ * @return eap_payload_t object
*/
eap_payload_t *eap_payload_create_data(chunk_t data);
/**
+ * Creates an eap_payload_t object with data, owning the data.
+ *
+ * @param data data on heap, gets owned and freed
+ * @return eap_payload_t object
+ */
+eap_payload_t *eap_payload_create_data_own(chunk_t data);
+
+/**
* Creates an eap_payload_t object with a code.
*
* Could should be either EAP_SUCCESS/EAP_FAILURE, use
diff --git a/src/libcharon/encoding/payloads/encryption_payload.c b/src/libcharon/encoding/payloads/encryption_payload.c
index 3b23ea9fb..e7b8063b7 100644
--- a/src/libcharon/encoding/payloads/encryption_payload.c
+++ b/src/libcharon/encoding/payloads/encryption_payload.c
@@ -142,7 +142,7 @@ METHOD(payload_t, set_next_type, void,
}
/**
- * Compute the lenght of the whole payload
+ * Compute the length of the whole payload
*/
static void compute_length(private_encryption_payload_t *this)
{
diff --git a/src/libcharon/encoding/payloads/endpoint_notify.c b/src/libcharon/encoding/payloads/endpoint_notify.c
index faec1ea71..1ead0a052 100644
--- a/src/libcharon/encoding/payloads/endpoint_notify.c
+++ b/src/libcharon/encoding/payloads/endpoint_notify.c
@@ -76,6 +76,11 @@ ENUM(me_endpoint_type_names, HOST, RELAYED,
);
/**
+ * Forward declaration
+ */
+static private_endpoint_notify_t *endpoint_notify_create();
+
+/**
* Helper functions to parse integer values
*/
static status_t parse_uint8(u_int8_t **cur, u_int8_t *top, u_int8_t *val)
@@ -216,10 +221,8 @@ static chunk_t build_notification_data(private_endpoint_notify_t *this)
return data;
}
-/**
- * Implementation of endpoint_notify_t.build_notify
- */
-static notify_payload_t *build_notify(private_endpoint_notify_t *this)
+METHOD(endpoint_notify_t, build_notify, notify_payload_t*,
+ private_endpoint_notify_t *this)
{
chunk_t data;
notify_payload_t *notify;
@@ -233,64 +236,53 @@ static notify_payload_t *build_notify(private_endpoint_notify_t *this)
return notify;
}
-/**
- * Implementation of endpoint_notify_t.get_priority.
- */
-static u_int32_t get_priority(private_endpoint_notify_t *this)
+
+METHOD(endpoint_notify_t, get_priority, u_int32_t,
+ private_endpoint_notify_t *this)
{
return this->priority;
}
-/**
- * Implementation of endpoint_notify_t.set_priority.
- */
-static void set_priority(private_endpoint_notify_t *this, u_int32_t priority)
+METHOD(endpoint_notify_t, set_priority, void,
+ private_endpoint_notify_t *this, u_int32_t priority)
{
this->priority = priority;
}
-/**
- * Implementation of endpoint_notify_t.get_type.
- */
-static me_endpoint_type_t get_type(private_endpoint_notify_t *this)
+METHOD(endpoint_notify_t, get_type, me_endpoint_type_t,
+ private_endpoint_notify_t *this)
{
return this->type;
}
-/**
- * Implementation of endpoint_notify_t.get_family.
- */
-static me_endpoint_family_t get_family(private_endpoint_notify_t *this)
+METHOD(endpoint_notify_t, get_family, me_endpoint_family_t,
+ private_endpoint_notify_t *this)
{
return this->family;
}
-/**
- * Implementation of endpoint_notify_t.get_host.
- */
-static host_t *get_host(private_endpoint_notify_t *this)
+METHOD(endpoint_notify_t, get_host, host_t*,
+ private_endpoint_notify_t *this)
{
return this->endpoint;
}
-/**
- * Implementation of endpoint_notify_t.get_base.
- */
-static host_t *get_base(private_endpoint_notify_t *this)
+METHOD(endpoint_notify_t, get_base, host_t*,
+ private_endpoint_notify_t *this)
{
return (!this->base) ? this->endpoint : this->base;
}
-/**
- * Implementation of endpoint_notify_t.clone.
- */
-static endpoint_notify_t *_clone(private_endpoint_notify_t *this)
+METHOD(endpoint_notify_t, clone_, endpoint_notify_t*,
+ private_endpoint_notify_t *this)
{
- private_endpoint_notify_t *clone = (private_endpoint_notify_t*)endpoint_notify_create();
+ private_endpoint_notify_t *clone;
+ clone = endpoint_notify_create();
clone->priority = this->priority;
clone->type = this->type;
clone->family = this->family;
+
if (this->endpoint)
{
clone->endpoint = this->endpoint->clone(this->endpoint);
@@ -304,52 +296,47 @@ static endpoint_notify_t *_clone(private_endpoint_notify_t *this)
return &clone->public;
}
-/**
- * Implementation of endpoint_notify_t.destroy.
- */
-static status_t destroy(private_endpoint_notify_t *this)
+METHOD(endpoint_notify_t, destroy, void,
+ private_endpoint_notify_t *this)
{
DESTROY_IF(this->endpoint);
DESTROY_IF(this->base);
free(this);
- return SUCCESS;
}
-/*
- * Described in header
+/**
+ * Creates an empty endpoint notify
*/
-endpoint_notify_t *endpoint_notify_create()
+static private_endpoint_notify_t *endpoint_notify_create()
{
- private_endpoint_notify_t *this = malloc_thing(private_endpoint_notify_t);
-
- /* public functions */
- this->public.get_priority = (u_int32_t (*) (endpoint_notify_t *)) get_priority;
- this->public.set_priority = (void (*) (endpoint_notify_t *, u_int32_t)) set_priority;
- this->public.get_type = (me_endpoint_type_t (*) (endpoint_notify_t *)) get_type;
- this->public.get_family = (me_endpoint_family_t (*) (endpoint_notify_t *)) get_family;
- this->public.get_host = (host_t *(*) (endpoint_notify_t *)) get_host;
- this->public.get_base = (host_t *(*) (endpoint_notify_t *)) get_base;
- this->public.build_notify = (notify_payload_t *(*) (endpoint_notify_t *)) build_notify;
- this->public.clone = (endpoint_notify_t *(*) (endpoint_notify_t *)) _clone;
- this->public.destroy = (void (*) (endpoint_notify_t *)) destroy;
-
- /* set default values of the fields */
- this->priority = 0;
- this->family = NO_FAMILY;
- this->type = NO_TYPE;
- this->endpoint = NULL;
- this->base = NULL;
-
- return &this->public;
+ private_endpoint_notify_t *this;
+
+ INIT(this,
+ .public = {
+ .get_priority = _get_priority,
+ .set_priority = _set_priority,
+ .get_type = _get_type,
+ .get_family = _get_family,
+ .get_host = _get_host,
+ .get_base = _get_base,
+ .build_notify = _build_notify,
+ .clone = _clone_,
+ .destroy = _destroy,
+ },
+ .family = NO_FAMILY,
+ .type = NO_TYPE,
+ );
+
+ return this;
}
/**
* Described in header
*/
-endpoint_notify_t *endpoint_notify_create_from_host(me_endpoint_type_t type, host_t *host, host_t *base)
+endpoint_notify_t *endpoint_notify_create_from_host(me_endpoint_type_t type,
+ host_t *host, host_t *base)
{
- private_endpoint_notify_t *this = (private_endpoint_notify_t*)endpoint_notify_create();
-
+ private_endpoint_notify_t *this = endpoint_notify_create();
this->type = type;
switch(type)
@@ -406,13 +393,17 @@ endpoint_notify_t *endpoint_notify_create_from_host(me_endpoint_type_t type, hos
*/
endpoint_notify_t *endpoint_notify_create_from_payload(notify_payload_t *notify)
{
+ private_endpoint_notify_t *this;
+ chunk_t data;
+
if (notify->get_notify_type(notify) != ME_ENDPOINT)
{
return NULL;
}
- private_endpoint_notify_t *this = (private_endpoint_notify_t*)endpoint_notify_create();
- chunk_t data = notify->get_notification_data(notify);
+ this = endpoint_notify_create();
+ data = notify->get_notification_data(notify);
+
if (parse_notification_data(this, data) != SUCCESS)
{
destroy(this);
diff --git a/src/libcharon/encoding/payloads/endpoint_notify.h b/src/libcharon/encoding/payloads/endpoint_notify.h
index 120eef49a..853aadf3d 100644
--- a/src/libcharon/encoding/payloads/endpoint_notify.h
+++ b/src/libcharon/encoding/payloads/endpoint_notify.h
@@ -125,7 +125,7 @@ struct endpoint_notify_t {
/**
* Generates a notification payload from this endpoint.
*
- * @return built notify_payload_t
+ * @return built notify_payload_t
*/
notify_payload_t *(*build_notify) (endpoint_notify_t *this);
@@ -143,19 +143,12 @@ struct endpoint_notify_t {
};
/**
- * Creates an empty endpoint_notify_t object.
- *
- * @return created endpoint_notify_t object
- */
-endpoint_notify_t *endpoint_notify_create(void);
-
-
-/**
* Creates an endpoint_notify_t object from a host.
*
* @param type the endpoint type
* @param host host to base the notify on (gets cloned)
- * @param base base of the endpoint, applies only to reflexive endpoints (gets cloned)
+ * @param base base of the endpoint, applies only to reflexive
+ * endpoints (gets cloned)
* @return created endpoint_notify_t object
*/
endpoint_notify_t *endpoint_notify_create_from_host(me_endpoint_type_t type,
@@ -166,7 +159,7 @@ endpoint_notify_t *endpoint_notify_create_from_host(me_endpoint_type_t type,
*
* @param notify the notify payload
* @return - created endpoint_notify_t object
- * - NULL if invalid payload
+ * - NULL if invalid payload
*/
endpoint_notify_t *endpoint_notify_create_from_payload(notify_payload_t *notify);
diff --git a/src/libcharon/encoding/payloads/ike_header.c b/src/libcharon/encoding/payloads/ike_header.c
index 80dcee0cb..24d22f3a1 100644
--- a/src/libcharon/encoding/payloads/ike_header.c
+++ b/src/libcharon/encoding/payloads/ike_header.c
@@ -101,17 +101,18 @@ struct private_ike_header_t {
ENUM_BEGIN(exchange_type_names, EXCHANGE_TYPE_UNDEFINED, EXCHANGE_TYPE_UNDEFINED,
"EXCHANGE_TYPE_UNDEFINED");
-ENUM_NEXT(exchange_type_names, IKE_SA_INIT, INFORMATIONAL, EXCHANGE_TYPE_UNDEFINED,
+ENUM_NEXT(exchange_type_names, IKE_SA_INIT, IKE_SESSION_RESUME, EXCHANGE_TYPE_UNDEFINED,
"IKE_SA_INIT",
"IKE_AUTH",
"CREATE_CHILD_SA",
- "INFORMATIONAL");
+ "INFORMATIONAL",
+ "IKE_SESSION_RESUME");
#ifdef ME
-ENUM_NEXT(exchange_type_names, ME_CONNECT, ME_CONNECT, INFORMATIONAL,
+ENUM_NEXT(exchange_type_names, ME_CONNECT, ME_CONNECT, IKE_SESSION_RESUME,
"ME_CONNECT");
ENUM_END(exchange_type_names, ME_CONNECT);
#else
-ENUM_END(exchange_type_names, INFORMATIONAL);
+ENUM_END(exchange_type_names, IKE_SESSION_RESUME);
#endif /* ME */
/**
diff --git a/src/libcharon/encoding/payloads/ike_header.h b/src/libcharon/encoding/payloads/ike_header.h
index f52c852c5..5579a4961 100644
--- a/src/libcharon/encoding/payloads/ike_header.h
+++ b/src/libcharon/encoding/payloads/ike_header.h
@@ -80,6 +80,11 @@ enum exchange_type_t{
* INFORMATIONAL.
*/
INFORMATIONAL = 37,
+
+ /**
+ * IKE_SESSION_RESUME (RFC 5723).
+ */
+ IKE_SESSION_RESUME = 38,
#ifdef ME
/**
* ME_CONNECT
diff --git a/src/libcharon/encoding/payloads/notify_payload.c b/src/libcharon/encoding/payloads/notify_payload.c
index 77f15ec6d..e03d1af67 100644
--- a/src/libcharon/encoding/payloads/notify_payload.c
+++ b/src/libcharon/encoding/payloads/notify_payload.c
@@ -56,7 +56,9 @@ ENUM_NEXT(notify_type_names, SINGLE_PAIR_REQUIRED, CHILD_SA_NOT_FOUND, AUTHENTIC
"CHILD_SA_NOT_FOUND");
ENUM_NEXT(notify_type_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, CHILD_SA_NOT_FOUND,
"ME_CONNECT_FAILED");
-ENUM_NEXT(notify_type_names, INITIAL_CONTACT, EAP_ONLY_AUTHENTICATION, ME_CONNECT_FAILED,
+ENUM_NEXT(notify_type_names, MS_NOTIFY_STATUS, MS_NOTIFY_STATUS, ME_CONNECT_FAILED,
+ "MS_NOTIFY_STATUS");
+ENUM_NEXT(notify_type_names, INITIAL_CONTACT, PSK_CONFIRM, MS_NOTIFY_STATUS,
"INITIAL_CONTACT",
"SET_WINDOW_SIZE",
"ADDITIONAL_TS_POSSIBLE",
@@ -90,18 +92,28 @@ ENUM_NEXT(notify_type_names, INITIAL_CONTACT, EAP_ONLY_AUTHENTICATION, ME_CONNEC
"LINK_ID",
"USE_WESP_MODE",
"ROHC_SUPPORTED",
- "EAP_ONLY_AUTHENTICATION");
-ENUM_NEXT(notify_type_names, USE_BEET_MODE, USE_BEET_MODE, EAP_ONLY_AUTHENTICATION,
+ "EAP_ONLY_AUTHENTICATION",
+ "CHILDLESS_IKEV2_SUPPORTED",
+ "QUICK_CRASH_DETECTION",
+ "IKEV2_MESSAGE_ID_SYNC_SUPPORTED",
+ "IKEV2_REPLAY_COUNTER_SYNC_SUPPORTED",
+ "IKEV2_MESSAGE_ID_SYNC",
+ "IPSEC_REPLAY_COUNTER_SYNC",
+ "SECURE PASSWORD_METHOD",
+ "PSK_PERSIST",
+ "PSK_CONFIRM");
+ENUM_NEXT(notify_type_names, USE_BEET_MODE, USE_BEET_MODE, PSK_CONFIRM,
"USE_BEET_MODE");
-ENUM_NEXT(notify_type_names, ME_MEDIATION, ME_RESPONSE, USE_BEET_MODE,
+ENUM_NEXT(notify_type_names, ME_MEDIATION, RADIUS_ATTRIBUTE, USE_BEET_MODE,
"ME_MEDIATION",
"ME_ENDPOINT",
"ME_CALLBACK",
"ME_CONNECTID",
"ME_CONNECTKEY",
"ME_CONNECTAUTH",
- "ME_RESPONSE");
-ENUM_END(notify_type_names, ME_RESPONSE);
+ "ME_RESPONSE",
+ "RADIUS_ATTRIBUTE",);
+ENUM_END(notify_type_names, RADIUS_ATTRIBUTE);
ENUM_BEGIN(notify_type_short_names, UNSUPPORTED_CRITICAL_PAYLOAD, UNSUPPORTED_CRITICAL_PAYLOAD,
@@ -135,11 +147,13 @@ ENUM_NEXT(notify_type_short_names, SINGLE_PAIR_REQUIRED, CHILD_SA_NOT_FOUND, AUT
"NO_CHILD_SA");
ENUM_NEXT(notify_type_short_names, ME_CONNECT_FAILED, ME_CONNECT_FAILED, CHILD_SA_NOT_FOUND,
"ME_CONN_FAIL");
-ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT, EAP_ONLY_AUTHENTICATION, ME_CONNECT_FAILED,
+ENUM_NEXT(notify_type_short_names, MS_NOTIFY_STATUS, MS_NOTIFY_STATUS, ME_CONNECT_FAILED,
+ "MS_STATUS");
+ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT, PSK_CONFIRM, MS_NOTIFY_STATUS,
"INIT_CONTACT",
"SET_WINSIZE",
"ADD_TS_POSS",
- "IPCOMP_SUPP",
+ "IPCOMP_SUP",
"NATD_S_IP",
"NATD_D_IP",
"COOKIE",
@@ -169,18 +183,28 @@ ENUM_NEXT(notify_type_short_names, INITIAL_CONTACT, EAP_ONLY_AUTHENTICATION, ME_
"LINK_ID",
"WESP_MODE",
"ROHC_SUP",
- "EAP_ONLY");
-ENUM_NEXT(notify_type_short_names, USE_BEET_MODE, USE_BEET_MODE, EAP_ONLY_AUTHENTICATION,
+ "EAP_ONLY",
+ "CHDLESS_SUP",
+ "CRASH_DET",
+ "MSG_ID_SYN_SUP",
+ "RPL_CTR_SYN_SUP",
+ "MSG_ID_SYN",
+ "RPL_CTR_SYN",
+ "SEC_PASSWD",
+ "PSK_PST",
+ "PSK_CFM");
+ENUM_NEXT(notify_type_short_names, USE_BEET_MODE, USE_BEET_MODE, PSK_CONFIRM,
"BEET_MODE");
-ENUM_NEXT(notify_type_short_names, ME_MEDIATION, ME_RESPONSE, USE_BEET_MODE,
+ENUM_NEXT(notify_type_short_names, ME_MEDIATION, RADIUS_ATTRIBUTE, USE_BEET_MODE,
"ME_MED",
"ME_EP",
"ME_CB",
"ME_CID",
"ME_CKEY",
"ME_CAUTH",
- "ME_R");
-ENUM_END(notify_type_short_names, ME_RESPONSE);
+ "ME_R",
+ "RADIUS");
+ENUM_END(notify_type_short_names, RADIUS_ATTRIBUTE);
typedef struct private_notify_payload_t private_notify_payload_t;
diff --git a/src/libcharon/encoding/payloads/notify_payload.h b/src/libcharon/encoding/payloads/notify_payload.h
index 8abc236e1..ced282700 100644
--- a/src/libcharon/encoding/payloads/notify_payload.h
+++ b/src/libcharon/encoding/payloads/notify_payload.h
@@ -71,6 +71,9 @@ enum notify_type_t {
/* IKE-ME, private use */
ME_CONNECT_FAILED = 8192,
+ /* Windows error code */
+ MS_NOTIFY_STATUS = 12345,
+
/* notify status messages */
INITIAL_CONTACT = 16384,
SET_WINDOW_SIZE = 16385,
@@ -115,7 +118,20 @@ enum notify_type_t {
ROHC_SUPPORTED = 16416,
/* EAP-only authentication, RFC 5998 */
EAP_ONLY_AUTHENTICATION = 16417,
-
+ /* Childless initiation of IKEv2 SA, RFC 6023 */
+ CHILDLESS_IKEV2_SUPPORTED = 16418,
+ /* Quick crash detection for IKE, RFC 6290 */
+ QUICK_CRASH_DETECTION = 16419,
+ /* High availability of IKEv2/IPsec, RFC 6311 */
+ IKEV2_MESSAGE_ID_SYNC_SUPPORTED = 16420,
+ IKEV2_REPLAY_COUNTER_SYNC_SUPPORTED = 16421,
+ IKEV2_MESSAGE_ID_SYNC = 16422,
+ IPSEC_REPLAY_COUNTER_SYNC = 16423,
+ /* Secure password methods, RFC 6467 */
+ SECURE_PASSWORD_METHOD = 16424,
+ /* PACE - draft-kuegler-ipsecme-pace-ikev2 */
+ PSK_PERSIST = 16425,
+ PSK_CONFIRM = 16426,
/* BEET mode, not even a draft yet. private use */
USE_BEET_MODE = 40961,
/* IKE-ME, private use */
@@ -125,7 +141,9 @@ enum notify_type_t {
ME_CONNECTID = 40965,
ME_CONNECTKEY = 40966,
ME_CONNECTAUTH = 40967,
- ME_RESPONSE = 40968
+ ME_RESPONSE = 40968,
+ /* RADIUS attribute received/to send to a AAA backend */
+ RADIUS_ATTRIBUTE = 40969,
};
/**
diff --git a/src/libcharon/encoding/payloads/payload.c b/src/libcharon/encoding/payloads/payload.c
index d1e677db7..a2c0a4385 100644
--- a/src/libcharon/encoding/payloads/payload.c
+++ b/src/libcharon/encoding/payloads/payload.c
@@ -39,7 +39,8 @@
ENUM_BEGIN(payload_type_names, NO_PAYLOAD, NO_PAYLOAD,
"NO_PAYLOAD");
-ENUM_NEXT(payload_type_names, SECURITY_ASSOCIATION, EXTENSIBLE_AUTHENTICATION, NO_PAYLOAD,
+ENUM_NEXT(payload_type_names, SECURITY_ASSOCIATION,
+ GENERIC_SECURE_PASSWORD_METHOD, NO_PAYLOAD,
"SECURITY_ASSOCIATION",
"KEY_EXCHANGE",
"ID_INITIATOR",
@@ -55,9 +56,10 @@ ENUM_NEXT(payload_type_names, SECURITY_ASSOCIATION, EXTENSIBLE_AUTHENTICATION, N
"TRAFFIC_SELECTOR_RESPONDER",
"ENCRYPTED",
"CONFIGURATION",
- "EXTENSIBLE_AUTHENTICATION");
+ "EXTENSIBLE_AUTHENTICATION",
+ "GENERIC_SECURE_PASSWORD_METHOD");
#ifdef ME
-ENUM_NEXT(payload_type_names, ID_PEER, ID_PEER, EXTENSIBLE_AUTHENTICATION,
+ENUM_NEXT(payload_type_names, ID_PEER, ID_PEER, GENERIC_SECURE_PASSWORD_METHOD,
"ID_PEER");
ENUM_NEXT(payload_type_names, HEADER, CONFIGURATION_ATTRIBUTE, ID_PEER,
"HEADER",
@@ -67,7 +69,8 @@ ENUM_NEXT(payload_type_names, HEADER, CONFIGURATION_ATTRIBUTE, ID_PEER,
"TRAFFIC_SELECTOR_SUBSTRUCTURE",
"CONFIGURATION_ATTRIBUTE");
#else
-ENUM_NEXT(payload_type_names, HEADER, CONFIGURATION_ATTRIBUTE, EXTENSIBLE_AUTHENTICATION,
+ENUM_NEXT(payload_type_names, HEADER, CONFIGURATION_ATTRIBUTE,
+ GENERIC_SECURE_PASSWORD_METHOD,
"HEADER",
"PROPOSAL_SUBSTRUCTURE",
"TRANSFORM_SUBSTRUCTURE",
@@ -80,7 +83,8 @@ ENUM_END(payload_type_names, CONFIGURATION_ATTRIBUTE);
/* short forms of payload names */
ENUM_BEGIN(payload_type_short_names, NO_PAYLOAD, NO_PAYLOAD,
"--");
-ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION, EXTENSIBLE_AUTHENTICATION, NO_PAYLOAD,
+ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION,
+ GENERIC_SECURE_PASSWORD_METHOD, NO_PAYLOAD,
"SA",
"KE",
"IDi",
@@ -96,9 +100,11 @@ ENUM_NEXT(payload_type_short_names, SECURITY_ASSOCIATION, EXTENSIBLE_AUTHENTICAT
"TSr",
"E",
"CP",
- "EAP");
+ "EAP",
+ "GSPM");
#ifdef ME
-ENUM_NEXT(payload_type_short_names, ID_PEER, ID_PEER, EXTENSIBLE_AUTHENTICATION,
+ENUM_NEXT(payload_type_short_names, ID_PEER, ID_PEER,
+ GENERIC_SECURE_PASSWORD_METHOD,
"IDp");
ENUM_NEXT(payload_type_short_names, HEADER, CONFIGURATION_ATTRIBUTE, ID_PEER,
"HDR",
@@ -108,7 +114,8 @@ ENUM_NEXT(payload_type_short_names, HEADER, CONFIGURATION_ATTRIBUTE, ID_PEER,
"TSSUB",
"CPATTR");
#else
-ENUM_NEXT(payload_type_short_names, HEADER, CONFIGURATION_ATTRIBUTE, EXTENSIBLE_AUTHENTICATION,
+ENUM_NEXT(payload_type_short_names, HEADER, CONFIGURATION_ATTRIBUTE,
+ GENERIC_SECURE_PASSWORD_METHOD,
"HDR",
"PROP",
"TRANS",
diff --git a/src/libcharon/encoding/payloads/payload.h b/src/libcharon/encoding/payloads/payload.h
index 0f407ff42..a9af29b5b 100644
--- a/src/libcharon/encoding/payloads/payload.h
+++ b/src/libcharon/encoding/payloads/payload.h
@@ -79,7 +79,7 @@ enum payload_type_t{
AUTHENTICATION = 39,
/**
- * Nonces, for initator and responder (Ni, Nr, N)
+ * Nonces, for initiator and responder (Ni, Nr, N)
*/
NONCE = 40,
@@ -123,6 +123,11 @@ enum payload_type_t{
*/
EXTENSIBLE_AUTHENTICATION = 48,
+ /**
+ * Generic Secure Password Method (GSPM).
+ */
+ GENERIC_SECURE_PASSWORD_METHOD = 49,
+
#ifdef ME
/**
* Identification payload for peers has a value from
diff --git a/src/libcharon/encoding/payloads/proposal_substructure.c b/src/libcharon/encoding/payloads/proposal_substructure.c
index f39c3b0e6..4753d574d 100644
--- a/src/libcharon/encoding/payloads/proposal_substructure.c
+++ b/src/libcharon/encoding/payloads/proposal_substructure.c
@@ -407,7 +407,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal(
this = (private_proposal_substructure_t*)proposal_substructure_create();
- /* encryption algorithm is only availble in ESP */
+ /* encryption algorithm is only available in ESP */
enumerator = proposal->create_enumerator(proposal, ENCRYPTION_ALGORITHM);
while (enumerator->enumerate(enumerator, &alg, &key_size))
{
diff --git a/src/libcharon/encoding/payloads/sa_payload.c b/src/libcharon/encoding/payloads/sa_payload.c
index db20d052f..010f63cfd 100644
--- a/src/libcharon/encoding/payloads/sa_payload.c
+++ b/src/libcharon/encoding/payloads/sa_payload.c
@@ -106,7 +106,6 @@ METHOD(payload_t, verify, status_t,
status_t status = SUCCESS;
enumerator_t *enumerator;
proposal_substructure_t *substruct;
- bool first = TRUE;
/* check proposal numbering */
enumerator = this->proposals->create_enumerator(this->proposals);
@@ -115,16 +114,6 @@ METHOD(payload_t, verify, status_t,
current_number = substruct->get_proposal_number(substruct);
if (current_number < expected_number)
{
- if (current_number != expected_number + 1)
- {
- DBG1(DBG_ENC, "proposal number is %d, expected %d or %d",
- current_number, expected_number, expected_number + 1);
- status = FAILED;
- break;
- }
- }
- else if (current_number < expected_number)
- {
DBG1(DBG_ENC, "proposal number smaller than previous");
status = FAILED;
break;
@@ -136,7 +125,6 @@ METHOD(payload_t, verify, status_t,
DBG1(DBG_ENC, "PROPOSAL_SUBSTRUCTURE verification failed");
break;
}
- first = FALSE;
expected_number = current_number;
}
enumerator->destroy(enumerator);
diff --git a/src/libcharon/encoding/payloads/transform_substructure.c b/src/libcharon/encoding/payloads/transform_substructure.c
index 0428da726..3f04b3539 100644
--- a/src/libcharon/encoding/payloads/transform_substructure.c
+++ b/src/libcharon/encoding/payloads/transform_substructure.c
@@ -84,7 +84,7 @@ encoding_rule_t transform_substructure_encodings[] = {
{ U_INT_8, offsetof(private_transform_substructure_t, transform_type) },
/* 1 Reserved Byte */
{ RESERVED_BYTE, offsetof(private_transform_substructure_t, reserved[1]) },
- /* tranform ID is a number of 8 bit */
+ /* transform ID is a number of 8 bit */
{ U_INT_16, offsetof(private_transform_substructure_t, transform_id) },
/* Attributes are stored in a transform attribute,
offset points to a linked_list_t pointer */
diff --git a/src/libcharon/encoding/payloads/transform_substructure.h b/src/libcharon/encoding/payloads/transform_substructure.h
index c961700a4..102dbb3d3 100644
--- a/src/libcharon/encoding/payloads/transform_substructure.h
+++ b/src/libcharon/encoding/payloads/transform_substructure.h
@@ -118,7 +118,7 @@ transform_substructure_t *transform_substructure_create(void);
*
* @param type type of transform to create
* @param id transform id specifc for the transform type
- * @param key_length key length for key lenght attribute, 0 to omit
+ * @param key_length key length for key length attribute, 0 to omit
* @return transform_substructure_t object
*/
transform_substructure_t *transform_substructure_create_type(