summaryrefslogtreecommitdiff
path: root/src/charon/encoding
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2009-06-23 11:25:24 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2009-06-23 11:25:24 +0000
commit41787e147279ff0695e9d759487266a60b80867b (patch)
tree8f28566c8fd7106c80d2536d2df540dbb4499cc5 /src/charon/encoding
parentc3e7f611ea8273c6b3909cb006ade4903a74aad0 (diff)
downloadvyos-strongswan-41787e147279ff0695e9d759487266a60b80867b.tar.gz
vyos-strongswan-41787e147279ff0695e9d759487266a60b80867b.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.3.2)
Diffstat (limited to 'src/charon/encoding')
-rw-r--r--src/charon/encoding/generator.c444
-rw-r--r--src/charon/encoding/generator.h8
-rw-r--r--src/charon/encoding/message.c132
-rw-r--r--src/charon/encoding/message.h21
-rw-r--r--src/charon/encoding/parser.c479
-rw-r--r--src/charon/encoding/parser.h2
-rw-r--r--src/charon/encoding/payloads/auth_payload.c2
-rw-r--r--src/charon/encoding/payloads/auth_payload.h2
-rw-r--r--src/charon/encoding/payloads/cert_payload.c2
-rw-r--r--src/charon/encoding/payloads/cert_payload.h2
-rw-r--r--src/charon/encoding/payloads/certreq_payload.c2
-rw-r--r--src/charon/encoding/payloads/certreq_payload.h2
-rw-r--r--src/charon/encoding/payloads/configuration_attribute.c2
-rw-r--r--src/charon/encoding/payloads/configuration_attribute.h2
-rw-r--r--src/charon/encoding/payloads/cp_payload.c2
-rw-r--r--src/charon/encoding/payloads/cp_payload.h2
-rw-r--r--src/charon/encoding/payloads/delete_payload.c2
-rw-r--r--src/charon/encoding/payloads/delete_payload.h2
-rw-r--r--src/charon/encoding/payloads/eap_payload.c2
-rw-r--r--src/charon/encoding/payloads/eap_payload.h2
-rw-r--r--src/charon/encoding/payloads/encodings.c3
-rw-r--r--src/charon/encoding/payloads/encodings.h15
-rw-r--r--src/charon/encoding/payloads/encryption_payload.c2
-rw-r--r--src/charon/encoding/payloads/encryption_payload.h2
-rw-r--r--src/charon/encoding/payloads/endpoint_notify.c2
-rw-r--r--src/charon/encoding/payloads/endpoint_notify.h2
-rw-r--r--src/charon/encoding/payloads/id_payload.c2
-rw-r--r--src/charon/encoding/payloads/id_payload.h2
-rw-r--r--src/charon/encoding/payloads/ike_header.c2
-rw-r--r--src/charon/encoding/payloads/ike_header.h2
-rw-r--r--src/charon/encoding/payloads/ke_payload.c2
-rw-r--r--src/charon/encoding/payloads/ke_payload.h2
-rw-r--r--src/charon/encoding/payloads/nonce_payload.c2
-rw-r--r--src/charon/encoding/payloads/nonce_payload.h2
-rw-r--r--src/charon/encoding/payloads/notify_payload.c2
-rw-r--r--src/charon/encoding/payloads/notify_payload.h2
-rw-r--r--src/charon/encoding/payloads/payload.c2
-rw-r--r--src/charon/encoding/payloads/payload.h2
-rw-r--r--src/charon/encoding/payloads/proposal_substructure.c2
-rw-r--r--src/charon/encoding/payloads/proposal_substructure.h2
-rw-r--r--src/charon/encoding/payloads/sa_payload.c2
-rw-r--r--src/charon/encoding/payloads/sa_payload.h2
-rw-r--r--src/charon/encoding/payloads/traffic_selector_substructure.c2
-rw-r--r--src/charon/encoding/payloads/traffic_selector_substructure.h2
-rw-r--r--src/charon/encoding/payloads/transform_attribute.c6
-rw-r--r--src/charon/encoding/payloads/transform_attribute.h2
-rw-r--r--src/charon/encoding/payloads/transform_substructure.c36
-rw-r--r--src/charon/encoding/payloads/transform_substructure.h2
-rw-r--r--src/charon/encoding/payloads/ts_payload.c2
-rw-r--r--src/charon/encoding/payloads/ts_payload.h2
-rw-r--r--src/charon/encoding/payloads/unknown_payload.c2
-rw-r--r--src/charon/encoding/payloads/unknown_payload.h2
-rw-r--r--src/charon/encoding/payloads/vendor_id_payload.c2
-rw-r--r--src/charon/encoding/payloads/vendor_id_payload.h2
54 files changed, 519 insertions, 715 deletions
diff --git a/src/charon/encoding/generator.c b/src/charon/encoding/generator.c
index dea4f0e21..406cfc688 100644
--- a/src/charon/encoding/generator.c
+++ b/src/charon/encoding/generator.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2006 Martin Willi
+ * Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: generator.c 4702 2008-11-26 10:42:54Z martin $
*/
#include <stdlib.h>
@@ -21,7 +19,6 @@
#include <arpa/inet.h>
#include <stdio.h>
-
#include "generator.h"
#include <library.h>
@@ -61,26 +58,26 @@ struct private_generator_t {
* Buffer used to generate the data into.
*/
u_int8_t *buffer;
-
+
/**
* Current write position in buffer (one byte aligned).
*/
u_int8_t *out_position;
-
+
/**
* Position of last byte in buffer.
*/
u_int8_t *roof_position;
-
+
/**
* Current bit writing to in current byte (between 0 and 7).
*/
- size_t current_bit;
-
+ u_int8_t current_bit;
+
/**
* Associated data struct to read informations from.
*/
- void * data_struct;
+ void *data_struct;
/*
* Last payload length position offset in the buffer.
@@ -115,7 +112,7 @@ struct private_generator_t {
/**
* Get size of current buffer in bytes.
*/
-static size_t get_current_buffer_size(private_generator_t *this)
+static int get_size(private_generator_t *this)
{
return this->roof_position - this->buffer;
}
@@ -123,7 +120,7 @@ static size_t get_current_buffer_size(private_generator_t *this)
/**
* Get free space of current buffer in bytes.
*/
-static size_t get_current_buffer_space(private_generator_t *this)
+static int get_space(private_generator_t *this)
{
return this->roof_position - this->out_position;
}
@@ -131,7 +128,7 @@ static size_t get_current_buffer_space(private_generator_t *this)
/**
* Get length of data in buffer (in bytes).
*/
-static size_t get_current_data_length(private_generator_t *this)
+static int get_length(private_generator_t *this)
{
return this->out_position - this->buffer;
}
@@ -139,7 +136,7 @@ static size_t get_current_data_length(private_generator_t *this)
/**
* Get current offset in buffer (in bytes).
*/
-static u_int32_t get_current_buffer_offset(private_generator_t *this)
+static u_int32_t get_offset(private_generator_t *this)
{
return this->out_position - this->buffer;
}
@@ -147,21 +144,20 @@ static u_int32_t get_current_buffer_offset(private_generator_t *this)
/**
* Makes sure enough space is available in buffer to store amount of bits.
*/
-static void make_space_available (private_generator_t *this, size_t bits)
+static void make_space_available(private_generator_t *this, int bits)
{
- while ((get_current_buffer_space(this) * 8 - this->current_bit) < bits)
+ while ((get_space(this) * 8 - this->current_bit) < bits)
{
- /* must increase buffer */
- size_t old_buffer_size = get_current_buffer_size(this);
- size_t new_buffer_size = old_buffer_size + GENERATOR_DATA_BUFFER_INCREASE_VALUE;
- size_t out_position_offset = ((this->out_position) - (this->buffer));
-
- DBG2(DBG_ENC, "increased gen buffer from %d to %d byte",
+ int old_buffer_size, new_buffer_size, out_position_offset;
+
+ old_buffer_size = get_size(this);
+ new_buffer_size = old_buffer_size + GENERATOR_DATA_BUFFER_INCREASE_VALUE;
+ out_position_offset = this->out_position - this->buffer;
+
+ DBG2(DBG_ENC, "increasing gen buffer from %d to %d byte",
old_buffer_size, new_buffer_size);
- /* Reallocate space for new buffer */
this->buffer = realloc(this->buffer,new_buffer_size);
-
this->out_position = (this->buffer + out_position_offset);
this->roof_position = (this->buffer + new_buffer_size);
}
@@ -170,11 +166,11 @@ static void make_space_available (private_generator_t *this, size_t bits)
/**
* Writes a specific amount of byte into the buffer.
*/
-static void write_bytes_to_buffer(private_generator_t *this, void * bytes,
- size_t number_of_bytes)
+static void write_bytes_to_buffer(private_generator_t *this, void *bytes,
+ int number_of_bytes)
{
int i;
- u_int8_t *read_position = (u_int8_t *) bytes;
+ u_int8_t *read_position = (u_int8_t *)bytes;
make_space_available(this, number_of_bytes * 8);
@@ -189,18 +185,19 @@ static void write_bytes_to_buffer(private_generator_t *this, void * bytes,
/**
* Writes a specific amount of byte into the buffer at a specific offset.
*/
-static void write_bytes_to_buffer_at_offset (private_generator_t *this,
- void *bytes, size_t number_of_bytes, u_int32_t offset)
+static void write_bytes_to_buffer_at_offset(private_generator_t *this,
+ void *bytes, int number_of_bytes, u_int32_t offset)
{
int i;
- u_int8_t *read_position = (u_int8_t *) bytes;
+ u_int8_t *read_position = (u_int8_t *)bytes;
u_int8_t *write_position;
- u_int32_t free_space_after_offset = get_current_buffer_size(this) - offset;
-
+ u_int32_t free_space_after_offset = get_size(this) - offset;
+
/* check first if enough space for new data is available */
if (number_of_bytes > free_space_after_offset)
{
- make_space_available(this, (number_of_bytes - free_space_after_offset) * 8);
+ make_space_available(this,
+ (number_of_bytes - free_space_after_offset) * 8);
}
write_position = this->buffer + offset;
@@ -214,98 +211,83 @@ static void write_bytes_to_buffer_at_offset (private_generator_t *this,
/**
* Generates a U_INT-Field type and writes it to buffer.
- *
- * @param this private_generator_t object
- * @param int_type type of U_INT field (U_INT_4, U_INT_8, etc.)
- * ATTRIBUTE_TYPE is also generated in this function
- * @param offset offset of value in data struct
- * @param generator_contexts generator_contexts_t object where the context is written or read from
*/
static void generate_u_int_type(private_generator_t *this,
encoding_type_t int_type,u_int32_t offset)
{
- size_t number_of_bits = 0;
-
- /* find out number of bits of each U_INT type to check for enough space
- in buffer */
+ int number_of_bits = 0;
+
+ /* find out number of bits of each U_INT type to check for enough space */
switch (int_type)
{
- case U_INT_4:
- number_of_bits = 4;
- break;
- case TS_TYPE:
- case U_INT_8:
- number_of_bits = 8;
- break;
- case U_INT_16:
- case CONFIGURATION_ATTRIBUTE_LENGTH:
- number_of_bits = 16;
- break;
- case U_INT_32:
- number_of_bits = 32;
- break;
- case U_INT_64:
- number_of_bits = 64;
- break;
- case ATTRIBUTE_TYPE:
- number_of_bits = 15;
- break;
- case IKE_SPI:
- number_of_bits = 64;
- break;
-
- default:
+ case U_INT_4:
+ number_of_bits = 4;
+ break;
+ case TS_TYPE:
+ case U_INT_8:
+ number_of_bits = 8;
+ break;
+ case U_INT_16:
+ case CONFIGURATION_ATTRIBUTE_LENGTH:
+ number_of_bits = 16;
+ break;
+ case U_INT_32:
+ number_of_bits = 32;
+ break;
+ case ATTRIBUTE_TYPE:
+ number_of_bits = 15;
+ break;
+ case IKE_SPI:
+ number_of_bits = 64;
+ break;
+ default:
DBG1(DBG_ENC, "U_INT Type %N is not supported",
encoding_type_names, int_type);
-
return;
}
- /* U_INT Types of multiple then 8 bits must be aligned */
- if (((number_of_bits % 8) == 0) && (this->current_bit != 0))
+ if ((number_of_bits % 8) == 0 && this->current_bit != 0)
{
DBG1(DBG_ENC, "U_INT Type %N is not 8 Bit aligned",
encoding_type_names, int_type);
- /* current bit has to be zero for values multiple of 8 bits */
return;
}
- /* make sure enough space is available in buffer */
make_space_available(this, number_of_bits);
- /* now handle each u int type differently */
switch (int_type)
{
case U_INT_4:
{
+ u_int8_t high, low;
+
if (this->current_bit == 0)
{
- /* highval of current byte in buffer has to be set to the new value*/
- u_int8_t high_val = *((u_int8_t *)(this->data_struct + offset)) << 4;
- /* lowval in buffer is not changed */
- u_int8_t low_val = *(this->out_position) & 0x0F;
- /* highval is set, low_val is not changed */
- *(this->out_position) = high_val | low_val;
+ /* high of current byte in buffer has to be set to the new value*/
+ high = *((u_int8_t *)(this->data_struct + offset)) << 4;
+ /* low in buffer is not changed */
+ low = *(this->out_position) & 0x0F;
+ /* high is set, low_val is not changed */
+ *(this->out_position) = high | low;
DBG3(DBG_ENC, " => %d", *(this->out_position));
/* write position is not changed, just bit position is moved */
this->current_bit = 4;
}
else if (this->current_bit == 4)
{
- /* highval in buffer is not changed */
- u_int high_val = *(this->out_position) & 0xF0;
- /* lowval of current byte in buffer has to be set to the new value*/
- u_int low_val = *((u_int8_t *)(this->data_struct + offset)) & 0x0F;
- *(this->out_position) = high_val | low_val;
+ /* high in buffer is not changed */
+ high = *(this->out_position) & 0xF0;
+ /* low of current byte in buffer has to be set to the new value*/
+ low = *((u_int8_t *)(this->data_struct + offset)) & 0x0F;
+ *(this->out_position) = high | low;
DBG3(DBG_ENC, " => %d", *(this->out_position));
this->out_position++;
this->current_bit = 0;
-
}
else
{
DBG1(DBG_ENC, "U_INT_4 Type is not 4 Bit aligned");
/* 4 Bit integers must have a 4 bit alignment */
return;
- };
+ }
break;
}
case TS_TYPE:
@@ -316,31 +298,31 @@ static void generate_u_int_type(private_generator_t *this,
DBG3(DBG_ENC, " => %d", *(this->out_position));
this->out_position++;
break;
-
}
case ATTRIBUTE_TYPE:
{
- /* attribute type must not change first bit uf current byte ! */
+ u_int8_t attribute_format_flag;
+ u_int16_t val;
+
+ /* attribute type must not change first bit of current byte */
if (this->current_bit != 1)
{
DBG1(DBG_ENC, "ATTRIBUTE FORMAT flag is not set");
- /* first bit has to be set! */
return;
}
- /* get value of attribute format flag */
- u_int8_t attribute_format_flag = *(this->out_position) & 0x80;
+ attribute_format_flag = *(this->out_position) & 0x80;
/* get attribute type value as 16 bit integer*/
- u_int16_t int16_val = *((u_int16_t*)(this->data_struct + offset));
+ val = *((u_int16_t*)(this->data_struct + offset));
/* unset most significant bit */
- int16_val &= 0x7FFF;
+ val &= 0x7FFF;
if (attribute_format_flag)
{
- int16_val |= 0x8000;
+ val |= 0x8000;
}
- int16_val = htons(int16_val);
- DBG3(DBG_ENC, " => %d", int16_val);
- /* write bytes to buffer (set bit is overwritten)*/
- write_bytes_to_buffer(this, &int16_val, sizeof(u_int16_t));
+ val = htons(val);
+ DBG3(DBG_ENC, " => %d", val);
+ /* write bytes to buffer (set bit is overwritten) */
+ write_bytes_to_buffer(this, &val, sizeof(u_int16_t));
this->current_bit = 0;
break;
@@ -348,37 +330,25 @@ static void generate_u_int_type(private_generator_t *this,
case U_INT_16:
case CONFIGURATION_ATTRIBUTE_LENGTH:
{
- u_int16_t int16_val = htons(*((u_int16_t*)(this->data_struct + offset)));
- DBG3(DBG_ENC, " => %b", (void*)&int16_val, sizeof(int16_val));
- write_bytes_to_buffer(this, &int16_val, sizeof(u_int16_t));
+ u_int16_t val = htons(*((u_int16_t*)(this->data_struct + offset)));
+ DBG3(DBG_ENC, " => %b", &val, sizeof(u_int16_t));
+ write_bytes_to_buffer(this, &val, sizeof(u_int16_t));
break;
}
case U_INT_32:
{
- u_int32_t int32_val = htonl(*((u_int32_t*)(this->data_struct + offset)));
- DBG3(DBG_ENC, " => %b", (void*)&int32_val, sizeof(int32_val));
- write_bytes_to_buffer(this, &int32_val, sizeof(u_int32_t));
+ u_int32_t val = htonl(*((u_int32_t*)(this->data_struct + offset)));
+ DBG3(DBG_ENC, " => %b", &val, sizeof(u_int32_t));
+ write_bytes_to_buffer(this, &val, sizeof(u_int32_t));
break;
}
- case U_INT_64:
- {
- /* 64 bit integers are written as two 32 bit integers */
- u_int32_t int32_val_low = htonl(*((u_int32_t*)(this->data_struct + offset)));
- u_int32_t int32_val_high = htonl(*((u_int32_t*)(this->data_struct + offset) + 1));
- DBG3(DBG_ENC, " => %b %b",
- (void*)&int32_val_low, sizeof(int32_val_low),
- (void*)&int32_val_high, sizeof(int32_val_high));
- /* TODO add support for big endian machines */
- write_bytes_to_buffer(this, &int32_val_high, sizeof(u_int32_t));
- write_bytes_to_buffer(this, &int32_val_low, sizeof(u_int32_t));
- break;
- }
-
case IKE_SPI:
{
- /* 64 bit are written as they come :-) */
- write_bytes_to_buffer(this, this->data_struct + offset, sizeof(u_int64_t));
- DBG3(DBG_ENC, " => %b", (void*)(this->data_struct + offset), sizeof(u_int64_t));
+ /* 64 bit are written as-is, no host order conversion */
+ write_bytes_to_buffer(this, this->data_struct + offset,
+ sizeof(u_int64_t));
+ DBG3(DBG_ENC, " => %b", this->data_struct + offset,
+ sizeof(u_int64_t));
break;
}
default:
@@ -396,18 +366,17 @@ static void generate_u_int_type(private_generator_t *this,
static void generate_reserved_field(private_generator_t *this, int bits)
{
/* only one bit or 8 bit fields are supported */
- if ((bits != 1) && (bits != 8))
+ if (bits != 1 && bits != 8)
{
DBG1(DBG_ENC, "reserved field of %d bits cannot be generated", bits);
return ;
}
- /* make sure enough space is available in buffer */
make_space_available(this, bits);
if (bits == 1)
- {
- /* one bit processing */
+ {
u_int8_t reserved_bit = ~(1 << (7 - this->current_bit));
+
*(this->out_position) = *(this->out_position) & reserved_bit;
if (this->current_bit == 0)
{
@@ -423,7 +392,6 @@ static void generate_reserved_field(private_generator_t *this, int bits)
}
else
{
- /* one byte processing*/
if (this->current_bit > 0)
{
DBG1(DBG_ENC, "reserved field cannot be written cause "
@@ -440,12 +408,9 @@ static void generate_reserved_field(private_generator_t *this, int bits)
*/
static void generate_flag(private_generator_t *this, u_int32_t offset)
{
- /* value of current flag */
u_int8_t flag_value;
- /* position of flag in current byte */
u_int8_t flag;
- /* if the value in the data_struct is TRUE, flag_value is set to 1, 0 otherwise */
flag_value = (*((bool *) (this->data_struct + offset))) ? 1 : 0;
/* get flag position */
flag = (flag_value << (7 - this->current_bit));
@@ -457,12 +422,10 @@ static void generate_flag(private_generator_t *this, u_int32_t offset)
/* memory must be zero */
*(this->out_position) = 0x00;
}
-
- *(this->out_position) = *(this->out_position) | flag;
+ *(this->out_position) = *(this->out_position) | flag;
+ DBG3(DBG_ENC, " => %d", *this->out_position);
- DBG3(DBG_ENC, " => %d", *(this->out_position));
-
this->current_bit++;
if (this->current_bit >= 8)
{
@@ -476,42 +439,42 @@ static void generate_flag(private_generator_t *this, u_int32_t offset)
*/
static void generate_from_chunk(private_generator_t *this, u_int32_t offset)
{
+ chunk_t *value;
+
if (this->current_bit != 0)
{
DBG1(DBG_ENC, "can not generate a chunk at Bitpos %d", this->current_bit);
return ;
}
- /* position in buffer */
- chunk_t *attribute_value = (chunk_t *)(this->data_struct + offset);
-
- DBG3(DBG_ENC, " => %B", attribute_value);
+ value = (chunk_t *)(this->data_struct + offset);
+ DBG3(DBG_ENC, " => %B", value);
- /* use write_bytes_to_buffer function to do the job */
- write_bytes_to_buffer(this, attribute_value->ptr, attribute_value->len);
+ write_bytes_to_buffer(this, value->ptr, value->len);
}
/**
* Implementation of private_generator_t.write_to_chunk.
*/
-static void write_to_chunk (private_generator_t *this,chunk_t *data)
+static void write_to_chunk(private_generator_t *this,chunk_t *data)
{
- size_t data_length = get_current_data_length(this);
+ int data_length = get_length(this);
u_int32_t header_length_field = data_length;
/* write length into header length field */
if (this->header_length_position_offset > 0)
{
- u_int32_t int32_val = htonl(header_length_field);
- write_bytes_to_buffer_at_offset(this, &int32_val, sizeof(u_int32_t),
+ u_int32_t val = htonl(header_length_field);
+ write_bytes_to_buffer_at_offset(this, &val, sizeof(u_int32_t),
this->header_length_position_offset);
}
-
+
if (this->current_bit > 0)
- data_length++;
- data->ptr = malloc(data_length);
- memcpy(data->ptr,this->buffer,data_length);
- data->len = data_length;
+ {
+ data_length++;
+ }
+ *data = chunk_alloc(data_length);
+ memcpy(data->ptr, this->buffer, data_length);
DBG3(DBG_ENC, "generated data of this generator %B", data);
}
@@ -521,26 +484,24 @@ static void write_to_chunk (private_generator_t *this,chunk_t *data)
*/
static void generate_payload (private_generator_t *this,payload_t *payload)
{
- int i;
- this->data_struct = payload;
+ int i, offset_start;
size_t rule_count;
encoding_rule_t *rules;
payload_type_t payload_type;
- u_int8_t *payload_start;
- /* get payload type */
+ this->data_struct = payload;
payload_type = payload->get_type(payload);
/* spi size has to get reseted */
this->last_spi_size = 0;
- payload_start = this->out_position;
+ offset_start = this->out_position - this->buffer;
DBG2(DBG_ENC, "generating payload of type %N",
payload_type_names, payload_type);
/* each payload has its own encoding rules */
- payload->get_encoding_rules(payload,&rules,&rule_count);
-
+ payload->get_encoding_rules(payload, &rules, &rule_count);
+
for (i = 0; i < rule_count;i++)
{
DBG2(DBG_ENC, " generating rule %d %N",
@@ -551,13 +512,12 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
case U_INT_8:
case U_INT_16:
case U_INT_32:
- case U_INT_64:
case IKE_SPI:
case TS_TYPE:
case ATTRIBUTE_TYPE:
case CONFIGURATION_ATTRIBUTE_LENGTH:
{
- generate_u_int_type(this, rules[i].type,rules[i].offset);
+ generate_u_int_type(this, rules[i].type, rules[i].offset);
break;
}
case RESERVED_BIT:
@@ -577,35 +537,28 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
}
case PAYLOAD_LENGTH:
{
- /* position of payload lenght field is temporary stored */
- this->last_payload_length_position_offset = get_current_buffer_offset(this);
- /* payload length is generated like an U_INT_16 */
+ this->last_payload_length_position_offset = get_offset(this);
generate_u_int_type(this, U_INT_16,rules[i].offset);
break;
}
case HEADER_LENGTH:
{
- /* position of header length field is temporary stored */
- this->header_length_position_offset = get_current_buffer_offset(this);
- /* header length is generated like an U_INT_32 */
+ this->header_length_position_offset = get_offset(this);
generate_u_int_type(this ,U_INT_32, rules[i].offset);
break;
}
case SPI_SIZE:
- /* spi size is handled as 8 bit unsigned integer */
generate_u_int_type(this, U_INT_8, rules[i].offset);
- /* last spi size is temporary stored */
- this->last_spi_size = *((u_int8_t *)(this->data_struct + rules[i].offset));
+ this->last_spi_size = *((u_int8_t *)(this->data_struct +
+ rules[i].offset));
break;
case ADDRESS:
{
- /* the Address value is generated from chunk */
generate_from_chunk(this, rules[i].offset);
break;
}
case SPI:
{
- /* the SPI value is generated from chunk */
generate_from_chunk(this, rules[i].offset);
break;
}
@@ -625,14 +578,15 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
u_int16_t length_of_payload;
u_int16_t header_length = 0;
u_int16_t length_in_network_order;
-
+
switch(rules[i].type)
{
case KEY_EXCHANGE_DATA:
header_length = KE_PAYLOAD_HEADER_LENGTH;
break;
case NOTIFICATION_DATA:
- header_length = NOTIFY_PAYLOAD_HEADER_LENGTH + this->last_spi_size ;
+ header_length = NOTIFY_PAYLOAD_HEADER_LENGTH +
+ this->last_spi_size;
break;
case NONCE_DATA:
header_length = NONCE_PAYLOAD_HEADER_LENGTH;
@@ -664,47 +618,42 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
default:
break;
}
-
- /* the data value is generated from chunk */
generate_from_chunk(this, rules[i].offset);
- payload_length_position_offset = this->last_payload_length_position_offset;
+ payload_length_position_offset =
+ this->last_payload_length_position_offset;
+ length_of_payload = header_length +
+ ((chunk_t *)(this->data_struct + rules[i].offset))->len;
- /* Length of payload is calculated */
- length_of_payload = header_length + ((chunk_t *)(this->data_struct + rules[i].offset))->len;
-
- length_in_network_order = htons(length_of_payload);
+ length_in_network_order = htons(length_of_payload);
write_bytes_to_buffer_at_offset(this, &length_in_network_order,
- sizeof(u_int16_t),payload_length_position_offset);
+ sizeof(u_int16_t), payload_length_position_offset);
break;
}
case PROPOSALS:
{
- /* before iterative generate the transforms, store the current payload length position */
- u_int32_t payload_length_position_offset = this->last_payload_length_position_offset;
+ u_int32_t payload_length_position_offset =
+ this->last_payload_length_position_offset;
/* Length of SA_PAYLOAD is calculated */
u_int16_t length_of_sa_payload = SA_PAYLOAD_HEADER_LENGTH;
u_int16_t int16_val;
- /* proposals are stored in a linked list and so accessed */
- linked_list_t *proposals = *((linked_list_t **)(this->data_struct + rules[i].offset));
+ linked_list_t *proposals = *((linked_list_t **)
+ (this->data_struct + rules[i].offset));
iterator_t *iterator;
payload_t *current_proposal;
- /* create forward iterator */
iterator = proposals->create_iterator(proposals,TRUE);
- /* every proposal is processed (iterative call )*/
while (iterator->iterate(iterator, (void**)&current_proposal))
{
u_int32_t before_generate_position_offset;
u_int32_t after_generate_position_offset;
- before_generate_position_offset = get_current_buffer_offset(this);
- this->public.generate_payload(&(this->public),current_proposal);
- after_generate_position_offset = get_current_buffer_offset(this);
-
- /* increase size of transform */
- length_of_sa_payload += (after_generate_position_offset - before_generate_position_offset);
+ before_generate_position_offset = get_offset(this);
+ generate_payload(this, current_proposal);
+ after_generate_position_offset = get_offset(this);
+ length_of_sa_payload += (after_generate_position_offset -
+ before_generate_position_offset);
}
iterator->destroy(iterator);
@@ -715,60 +664,61 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
}
case TRANSFORMS:
{
- /* before iterative generate the transforms, store the current length position */
- u_int32_t payload_length_position_offset = this->last_payload_length_position_offset;
- u_int16_t length_of_proposal = PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH + this->last_spi_size;
+ u_int32_t payload_length_position_offset =
+ this->last_payload_length_position_offset;
+ u_int16_t length_of_proposal =
+ PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH + this->last_spi_size;
u_int16_t int16_val;
- linked_list_t *transforms = *((linked_list_t **)(this->data_struct + rules[i].offset));
+ linked_list_t *transforms = *((linked_list_t **)
+ (this->data_struct + rules[i].offset));
iterator_t *iterator;
payload_t *current_transform;
- /* create forward iterator */
iterator = transforms->create_iterator(transforms,TRUE);
while (iterator->iterate(iterator, (void**)&current_transform))
{
u_int32_t before_generate_position_offset;
u_int32_t after_generate_position_offset;
- before_generate_position_offset = get_current_buffer_offset(this);
- this->public.generate_payload(&(this->public),current_transform);
- after_generate_position_offset = get_current_buffer_offset(this);
+ before_generate_position_offset = get_offset(this);
+ generate_payload(this, current_transform);
+ after_generate_position_offset = get_offset(this);
- /* increase size of transform */
- length_of_proposal += (after_generate_position_offset - before_generate_position_offset);
+ length_of_proposal += (after_generate_position_offset -
+ before_generate_position_offset);
}
-
iterator->destroy(iterator);
int16_val = htons(length_of_proposal);
write_bytes_to_buffer_at_offset(this, &int16_val,
sizeof(u_int16_t), payload_length_position_offset);
-
break;
}
case TRANSFORM_ATTRIBUTES:
{
- /* before iterative generate the transform attributes, store the current length position */
- u_int32_t transform_length_position_offset = this->last_payload_length_position_offset;
- u_int16_t length_of_transform = TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH;
+ u_int32_t transform_length_position_offset =
+ this->last_payload_length_position_offset;
+ u_int16_t length_of_transform =
+ TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH;
u_int16_t int16_val;
- linked_list_t *transform_attributes =*((linked_list_t **)(this->data_struct + rules[i].offset));
+ linked_list_t *transform_attributes =*((linked_list_t **)
+ (this->data_struct + rules[i].offset));
iterator_t *iterator;
payload_t *current_attribute;
- /* create forward iterator */
- iterator = transform_attributes->create_iterator(transform_attributes,TRUE);
+ iterator = transform_attributes->create_iterator(
+ transform_attributes, TRUE);
while (iterator->iterate(iterator, (void**)&current_attribute))
{
u_int32_t before_generate_position_offset;
u_int32_t after_generate_position_offset;
- before_generate_position_offset = get_current_buffer_offset(this);
- this->public.generate_payload(&(this->public),current_attribute);
- after_generate_position_offset = get_current_buffer_offset(this);
+ before_generate_position_offset = get_offset(this);
+ generate_payload(this, current_attribute);
+ after_generate_position_offset = get_offset(this);
- /* increase size of transform */
- length_of_transform += (after_generate_position_offset - before_generate_position_offset);
+ length_of_transform += (after_generate_position_offset -
+ before_generate_position_offset);
}
iterator->destroy(iterator);
@@ -776,32 +726,32 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
int16_val = htons(length_of_transform);
write_bytes_to_buffer_at_offset(this, &int16_val,
sizeof(u_int16_t),transform_length_position_offset);
-
break;
}
case CONFIGURATION_ATTRIBUTES:
{
- /* before iterative generate the configuration attributes, store the current length position */
- u_int32_t configurations_length_position_offset = this->last_payload_length_position_offset;
+ u_int32_t configurations_length_position_offset =
+ this->last_payload_length_position_offset;
u_int16_t length_of_configurations = CP_PAYLOAD_HEADER_LENGTH;
u_int16_t int16_val;
- linked_list_t *configuration_attributes =*((linked_list_t **)(this->data_struct + rules[i].offset));
+ linked_list_t *configuration_attributes = *((linked_list_t **)
+ (this->data_struct + rules[i].offset));
iterator_t *iterator;
payload_t *current_attribute;
- /* create forward iterator */
- iterator = configuration_attributes->create_iterator(configuration_attributes,TRUE);
+ iterator = configuration_attributes->create_iterator(
+ configuration_attributes,TRUE);
while (iterator->iterate(iterator, (void**)&current_attribute))
{
u_int32_t before_generate_position_offset;
u_int32_t after_generate_position_offset;
- before_generate_position_offset = get_current_buffer_offset(this);
- this->public.generate_payload(&(this->public),current_attribute);
- after_generate_position_offset = get_current_buffer_offset(this);
+ before_generate_position_offset = get_offset(this);
+ generate_payload(this, current_attribute);
+ after_generate_position_offset = get_offset(this);
- /* increase size of transform */
- length_of_configurations += (after_generate_position_offset - before_generate_position_offset);
+ length_of_configurations += after_generate_position_offset -
+ before_generate_position_offset;
}
iterator->destroy(iterator);
@@ -809,14 +759,14 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
int16_val = htons(length_of_configurations);
write_bytes_to_buffer_at_offset(this, &int16_val,
sizeof(u_int16_t),configurations_length_position_offset);
-
break;
}
case ATTRIBUTE_FORMAT:
{
generate_flag(this, rules[i].offset);
/* Attribute format is a flag which is stored in context*/
- this->attribute_format = *((bool *) (this->data_struct + rules[i].offset));
+ this->attribute_format =
+ *((bool *)(this->data_struct + rules[i].offset));
break;
}
@@ -826,7 +776,8 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
{
generate_u_int_type(this, U_INT_16, rules[i].offset);
/* this field hold the length of the attribute */
- this->attribute_length = *((u_int16_t *)(this->data_struct + rules[i].offset));
+ this->attribute_length =
+ *((u_int16_t *)(this->data_struct + rules[i].offset));
}
else
{
@@ -846,30 +797,28 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
}
case TRAFFIC_SELECTORS:
{
- /* before iterative generate the traffic_selectors, store the current payload length position */
- u_int32_t payload_length_position_offset = this->last_payload_length_position_offset;
- /* Length of SA_PAYLOAD is calculated */
+ u_int32_t payload_length_position_offset =
+ this->last_payload_length_position_offset;
u_int16_t length_of_ts_payload = TS_PAYLOAD_HEADER_LENGTH;
u_int16_t int16_val;
- /* traffic selectors are stored in a linked list and so accessed */
- linked_list_t *traffic_selectors = *((linked_list_t **)(this->data_struct + rules[i].offset));
+ linked_list_t *traffic_selectors = *((linked_list_t **)
+ (this->data_struct + rules[i].offset));
iterator_t *iterator;
- payload_t *current_traffic_selector_substructure;
+ payload_t *current_tss;
- /* create forward iterator */
- iterator = traffic_selectors->create_iterator(traffic_selectors,TRUE);
- /* every proposal is processed (iterative call )*/
- while (iterator->iterate(iterator, (void **)&current_traffic_selector_substructure))
+ iterator = traffic_selectors->create_iterator(
+ traffic_selectors,TRUE);
+ while (iterator->iterate(iterator, (void **)&current_tss))
{
u_int32_t before_generate_position_offset;
u_int32_t after_generate_position_offset;
-
- before_generate_position_offset = get_current_buffer_offset(this);
- this->public.generate_payload(&(this->public),current_traffic_selector_substructure);
- after_generate_position_offset = get_current_buffer_offset(this);
- /* increase size of transform */
- length_of_ts_payload += (after_generate_position_offset - before_generate_position_offset);
+ before_generate_position_offset = get_offset(this);
+ generate_payload(this, current_tss);
+ after_generate_position_offset = get_offset(this);
+
+ length_of_ts_payload += (after_generate_position_offset -
+ before_generate_position_offset);
}
iterator->destroy(iterator);
@@ -893,7 +842,8 @@ static void generate_payload (private_generator_t *this,payload_t *payload)
DBG2(DBG_ENC, "generating %N payload finished",
payload_type_names, payload_type);
DBG3(DBG_ENC, "generated data for this payload %b",
- payload_start, this->out_position-payload_start);
+ this->buffer + offset_start,
+ this->out_position - this->buffer - offset_start);
}
/**
@@ -916,9 +866,9 @@ generator_t *generator_create()
this = malloc_thing(private_generator_t);
/* initiate public functions */
- this->public.generate_payload = (void(*)(generator_t*, payload_t *)) generate_payload;
+ this->public.generate_payload = (void(*)(generator_t*, payload_t *))generate_payload;
this->public.destroy = (void(*)(generator_t*)) destroy;
- this->public.write_to_chunk = (void (*) (generator_t *,chunk_t *)) write_to_chunk;
+ this->public.write_to_chunk = (void (*) (generator_t *,chunk_t *))write_to_chunk;
/* allocate memory for buffer */
this->buffer = malloc(GENERATOR_DATA_BUFFER_SIZE);
diff --git a/src/charon/encoding/generator.h b/src/charon/encoding/generator.h
index 5c8755d04..f6fb8981c 100644
--- a/src/charon/encoding/generator.h
+++ b/src/charon/encoding/generator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2006 Martin Willi
+ * Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: generator.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
@@ -67,10 +65,10 @@ struct generator_t {
/**
* Writes all generated data of the generator to a chunk.
*
- * @param data chunk to write the data to
+ * @param data chunk to write the data to
*/
void (*write_to_chunk) (generator_t *this,chunk_t *data);
-
+
/**
* Destroys a generator_t object.
*/
diff --git a/src/charon/encoding/message.c b/src/charon/encoding/message.c
index 600fe97d9..7c6fdb499 100644
--- a/src/charon/encoding/message.c
+++ b/src/charon/encoding/message.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2006-2007 Tobias Brunner
+ * Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2006 Daniel Roethlisberger
- * Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
@@ -14,8 +14,6 @@
* 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.
- *
- * $Id: message.c 4339 2008-09-11 11:14:09Z martin $
*/
#include <stdlib.h>
@@ -208,7 +206,7 @@ static payload_rule_t ike_auth_i_payload_rules[] = {
{NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, FALSE},
{EXTENSIBLE_AUTHENTICATION, 0, 1, TRUE, TRUE},
{AUTHENTICATION, 0, 1, TRUE, TRUE},
- {ID_INITIATOR, 1, 1, TRUE, FALSE},
+ {ID_INITIATOR, 0, 1, TRUE, FALSE},
{CERTIFICATE, 0, 4, TRUE, FALSE},
{CERTIFICATE_REQUEST, 0, 1, TRUE, FALSE},
{ID_RESPONDER, 0, 1, TRUE, FALSE},
@@ -217,9 +215,9 @@ static payload_rule_t ike_auth_i_payload_rules[] = {
{TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE},
{TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE},
#else
- {SECURITY_ASSOCIATION, 1, 1, TRUE, FALSE},
- {TRAFFIC_SELECTOR_INITIATOR, 1, 1, TRUE, FALSE},
- {TRAFFIC_SELECTOR_RESPONDER, 1, 1, TRUE, FALSE},
+ {SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE},
+ {TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE},
+ {TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE},
#endif /* ME */
{CONFIGURATION, 0, 1, TRUE, FALSE},
{VENDOR_ID, 0, 10, TRUE, FALSE},
@@ -261,9 +259,9 @@ static payload_rule_t ike_auth_r_payload_rules[] = {
/* payload type min max encr suff */
{NOTIFY, 0, MAX_NOTIFY_PAYLOADS, TRUE, TRUE},
{EXTENSIBLE_AUTHENTICATION, 0, 1, TRUE, TRUE},
+ {AUTHENTICATION, 0, 1, TRUE, TRUE},
{CERTIFICATE, 0, 4, TRUE, FALSE},
{ID_RESPONDER, 0, 1, TRUE, FALSE},
- {AUTHENTICATION, 0, 1, TRUE, FALSE},
{SECURITY_ASSOCIATION, 0, 1, TRUE, FALSE},
{TRAFFIC_SELECTOR_INITIATOR, 0, 1, TRUE, FALSE},
{TRAFFIC_SELECTOR_RESPONDER, 0, 1, TRUE, FALSE},
@@ -846,11 +844,11 @@ static host_t * get_destination(private_message_t *this)
}
/**
- * Implementation of message_t.get_payload_iterator.
+ * Implementation of message_t.create_payload_enumerator.
*/
-static iterator_t *get_payload_iterator(private_message_t *this)
+static enumerator_t *create_payload_enumerator(private_message_t *this)
{
- return this->payloads->create_iterator(this->payloads, TRUE);
+ return this->payloads->create_enumerator(this->payloads);
}
/**
@@ -859,10 +857,10 @@ static iterator_t *get_payload_iterator(private_message_t *this)
static payload_t *get_payload(private_message_t *this, payload_type_t type)
{
payload_t *current, *found = NULL;
- iterator_t *iterator;
+ enumerator_t *enumerator;
- iterator = this->payloads->create_iterator(this->payloads, TRUE);
- while (iterator->iterate(iterator, (void**)&current))
+ enumerator = create_payload_enumerator(this);
+ while (enumerator->enumerate(enumerator, &current))
{
if (current->get_type(current) == type)
{
@@ -870,16 +868,42 @@ static payload_t *get_payload(private_message_t *this, payload_type_t type)
break;
}
}
- iterator->destroy(iterator);
+ enumerator->destroy(enumerator);
return found;
}
/**
+ * Implementation of message_t.get_notify
+ */
+static notify_payload_t* get_notify(private_message_t *this, notify_type_t type)
+{
+ enumerator_t *enumerator;
+ notify_payload_t *notify = NULL;
+ payload_t *payload;
+
+ enumerator = create_payload_enumerator(this);
+ while (enumerator->enumerate(enumerator, &payload))
+ {
+ if (payload->get_type(payload) == NOTIFY)
+ {
+ notify = (notify_payload_t*)payload;
+ if (notify->get_notify_type(notify) == type)
+ {
+ break;
+ }
+ notify = NULL;
+ }
+ }
+ enumerator->destroy(enumerator);
+ return notify;
+}
+
+/**
* get a string representation of the message
*/
static char* get_string(private_message_t *this, char *buf, int len)
{
- iterator_t *iterator;
+ enumerator_t *enumerator;
payload_t *payload;
int written;
char *pos = buf;
@@ -898,8 +922,8 @@ static char* get_string(private_message_t *this, char *buf, int len)
pos += written;
len -= written;
- iterator = this->payloads->create_iterator(this->payloads, TRUE);
- while (iterator->iterate(iterator, (void**)&payload))
+ enumerator = create_payload_enumerator(this);
+ while (enumerator->enumerate(enumerator, &payload))
{
written = snprintf(pos, len, " %N", payload_type_short_names,
payload->get_type(payload));
@@ -922,7 +946,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
len -= written;
}
}
- iterator->destroy(iterator);
+ enumerator->destroy(enumerator);
/* remove last space */
snprintf(pos, len, " ]");
@@ -1076,7 +1100,7 @@ static status_t generate(private_message_t *this, crypter_t *crypter,
generator_t *generator;
ike_header_t *ike_header;
payload_t *payload, *next_payload;
- iterator_t *iterator;
+ enumerator_t *enumerator;
status_t status;
chunk_t packet_data;
char str[256];
@@ -1131,21 +1155,20 @@ static status_t generate(private_message_t *this, crypter_t *crypter,
ike_header->set_initiator_flag(ike_header, this->ike_sa_id->is_initiator(this->ike_sa_id));
ike_header->set_initiator_spi(ike_header, this->ike_sa_id->get_initiator_spi(this->ike_sa_id));
ike_header->set_responder_spi(ike_header, this->ike_sa_id->get_responder_spi(this->ike_sa_id));
-
+
generator = generator_create();
payload = (payload_t*)ike_header;
-
/* generate every payload expect last one, this is done later*/
- iterator = this->payloads->create_iterator(this->payloads, TRUE);
- while(iterator->iterate(iterator, (void**)&next_payload))
+ enumerator = create_payload_enumerator(this);
+ while (enumerator->enumerate(enumerator, &next_payload))
{
payload->set_next_type(payload, next_payload->get_type(next_payload));
generator->generate_payload(generator, payload);
payload = next_payload;
}
- iterator->destroy(iterator);
+ enumerator->destroy(enumerator);
/* last payload has no next payload*/
payload->set_next_type(payload, NO_PAYLOAD);
@@ -1411,72 +1434,78 @@ static status_t decrypt_payloads(private_message_t *this,crypter_t *crypter, sig
static status_t verify(private_message_t *this)
{
int i;
- iterator_t *iterator;
+ enumerator_t *enumerator;
payload_t *current_payload;
size_t total_found_payloads = 0;
DBG2(DBG_ENC, "verifying message structure");
- iterator = this->payloads->create_iterator(this->payloads,TRUE);
/* check for payloads with wrong count*/
- for (i = 0; i < this->message_rule->payload_rule_count;i++)
+ for (i = 0; i < this->message_rule->payload_rule_count; i++)
{
size_t found_payloads = 0;
-
- /* check all payloads for specific rule */
- iterator->reset(iterator);
+ payload_rule_t *rule;
- while(iterator->iterate(iterator,(void **)&current_payload))
+ rule = &this->message_rule->payload_rules[i];
+ enumerator = create_payload_enumerator(this);
+
+ /* check all payloads for specific rule */
+ while (enumerator->enumerate(enumerator, &current_payload))
{
payload_type_t current_payload_type;
+ unknown_payload_t *unknown_payload;
current_payload_type = current_payload->get_type(current_payload);
if (current_payload_type == UNKNOWN_PAYLOAD)
{
/* unknown payloads are ignored, IF they are not critical */
- unknown_payload_t *unknown_payload = (unknown_payload_t*)current_payload;
+ unknown_payload = (unknown_payload_t*)current_payload;
if (unknown_payload->is_critical(unknown_payload))
{
DBG1(DBG_ENC, "%N is not supported, but its critical!",
payload_type_names, current_payload_type);
- iterator->destroy(iterator);
+ enumerator->destroy(enumerator);
return NOT_SUPPORTED;
}
}
- else if (current_payload_type == this->message_rule->payload_rules[i].payload_type)
+ else if (current_payload_type == rule->payload_type)
{
found_payloads++;
total_found_payloads++;
- DBG2(DBG_ENC, "found payload of type %N",
- payload_type_names, this->message_rule->payload_rules[i].payload_type);
+ DBG2(DBG_ENC, "found payload of type %N", payload_type_names,
+ rule->payload_type);
- /* as soon as ohe payload occures more then specified, the verification fails */
- if (found_payloads > this->message_rule->payload_rules[i].max_occurence)
+ /* as soon as ohe payload occures more then specified,
+ * the verification fails */
+ if (found_payloads >
+ rule->max_occurence)
{
- DBG1(DBG_ENC, "payload of type %N more than %d times (%d) occured in current message",
- payload_type_names, current_payload_type,
- this->message_rule->payload_rules[i].max_occurence, found_payloads);
- iterator->destroy(iterator);
+ DBG1(DBG_ENC, "payload of type %N more than %d times (%d) "
+ "occured in current message", payload_type_names,
+ current_payload_type, rule->max_occurence,
+ found_payloads);
+ enumerator->destroy(enumerator);
return VERIFY_ERROR;
}
}
}
- if (found_payloads < this->message_rule->payload_rules[i].min_occurence)
+ if (found_payloads < rule->min_occurence)
{
DBG1(DBG_ENC, "payload of type %N not occured %d times (%d)",
- payload_type_names, this->message_rule->payload_rules[i].payload_type,
- this->message_rule->payload_rules[i].min_occurence, found_payloads);
- iterator->destroy(iterator);
+ payload_type_names, rule->payload_type, rule->min_occurence,
+ found_payloads);
+ enumerator->destroy(enumerator);
return VERIFY_ERROR;
}
- if ((this->message_rule->payload_rules[i].sufficient) && (this->payloads->get_count(this->payloads) == total_found_payloads))
+ if (rule->sufficient &&
+ this->payloads->get_count(this->payloads) == total_found_payloads)
{
- iterator->destroy(iterator);
+ enumerator->destroy(enumerator);
return SUCCESS;
}
+ enumerator->destroy(enumerator);
}
- iterator->destroy(iterator);
return SUCCESS;
}
@@ -1604,8 +1633,9 @@ message_t *message_create_from_packet(packet_t *packet)
this->public.get_source = (host_t * (*) (message_t*)) get_source;
this->public.set_destination = (void (*) (message_t*,host_t*)) set_destination;
this->public.get_destination = (host_t * (*) (message_t*)) get_destination;
- this->public.get_payload_iterator = (iterator_t * (*) (message_t *)) get_payload_iterator;
+ this->public.create_payload_enumerator = (enumerator_t * (*) (message_t *)) create_payload_enumerator;
this->public.get_payload = (payload_t * (*) (message_t *, payload_type_t)) get_payload;
+ this->public.get_notify = (notify_payload_t*(*)(message_t*, notify_type_t type))get_notify;
this->public.parse_header = (status_t (*) (message_t *)) parse_header;
this->public.parse_body = (status_t (*) (message_t *,crypter_t*,signer_t*)) parse_body;
this->public.get_packet = (packet_t * (*) (message_t*)) get_packet;
diff --git a/src/charon/encoding/message.h b/src/charon/encoding/message.h
index 40941c2c9..1db3ea0cc 100644
--- a/src/charon/encoding/message.h
+++ b/src/charon/encoding/message.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2006-2007 Tobias Brunner
+ * Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2006 Daniel Roethlisberger
- * Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
@@ -14,8 +14,6 @@
* 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.
- *
- * $Id: message.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
@@ -286,14 +284,11 @@ struct message_t {
void (*set_destination) (message_t *this, host_t *host);
/**
- * Returns an iterator on all stored payloads.
- *
- * @warning Don't insert payloads over this iterator.
- * Use add_payload() instead.
+ * Create an enumerator over all payloads.
*
- * @return iterator_t object which has to get destroyd by the caller
+ * @return enumerator over payload_t
*/
- iterator_t * (*get_payload_iterator) (message_t *this);
+ enumerator_t * (*create_payload_enumerator) (message_t *this);
/**
* Find a payload of a specific type.
@@ -306,6 +301,14 @@ struct message_t {
payload_t* (*get_payload) (message_t *this, payload_type_t type);
/**
+ * Get the first notify payload of a specific type.
+ *
+ * @param type type of notification payload
+ * @return notify payload, NULL if no such notify found
+ */
+ notify_payload_t* (*get_notify)(message_t *this, notify_type_t type);
+
+ /**
* Returns a clone of the internal stored packet_t object.
*
* @return packet_t object as clone of internal one
diff --git a/src/charon/encoding/parser.c b/src/charon/encoding/parser.c
index 396054810..ac2b78c28 100644
--- a/src/charon/encoding/parser.c
+++ b/src/charon/encoding/parser.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2006 Martin Willi
+ * Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: parser.c 4703 2008-11-26 10:54:08Z martin $
*/
#include <stdlib.h>
@@ -88,29 +86,52 @@ 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)
+{
+ DBG1(DBG_ENC, " not enough input to parse rule %d %N",
+ number, encoding_type_names, this->rules[number].type);
+ return FALSE;
+}
+
+/**
+ * Log unaligned rules
+ */
+static bool bad_bitpos(private_parser_t *this, int number)
+{
+ DBG1(DBG_ENC, " found rule %d %N on bitpos %d",
+ number, encoding_type_names, this->rules[number].type, this->bit_pos);
+ return FALSE;
+}
+
+/**
* Parse a 4-Bit unsigned integer from the current parsing position.
*/
-static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *output_pos)
+static bool parse_uint4(private_parser_t *this, int rule_number,
+ u_int8_t *output_pos)
{
- if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
+ if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
{
- DBG1(DBG_ENC, " not enough input to parse rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
switch (this->bit_pos)
{
case 0:
- /* caller interested in result ? */
- if (output_pos != NULL)
+ if (output_pos)
{
*output_pos = *(this->byte_pos) >> 4;
}
this->bit_pos = 4;
break;
- case 4:
- /* caller interested in result ? */
- if (output_pos != NULL)
+ case 4:
+ if (output_pos)
{
*output_pos = *(this->byte_pos) & 0x0F;
}
@@ -118,311 +139,240 @@ static status_t parse_uint4(private_parser_t *this, int rule_number, u_int8_t *o
this->byte_pos++;
break;
default:
- DBG2(DBG_ENC, " found rule %d %N on bitpos %d",
- rule_number, encoding_type_names,
- this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
+ return bad_bitpos(this, rule_number);
}
-
- if (output_pos != NULL)
+ if (output_pos)
{
DBG3(DBG_ENC, " => %d", *output_pos);
}
-
- return SUCCESS;
+ return TRUE;
}
/**
* Parse a 8-Bit unsigned integer from the current parsing position.
*/
-static status_t parse_uint8(private_parser_t *this, int rule_number, u_int8_t *output_pos)
+static bool parse_uint8(private_parser_t *this, int rule_number,
+ u_int8_t *output_pos)
{
- if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
+ if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
{
- DBG1(DBG_ENC, " not enough input to parse rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
if (this->bit_pos)
{
- DBG1(DBG_ENC, " found rule %d %N on bitpos %d",
- rule_number, encoding_type_names,
- this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
+ return bad_bitpos(this, rule_number);
}
-
- /* caller interested in result ? */
- if (output_pos != NULL)
+ if (output_pos)
{
*output_pos = *(this->byte_pos);
DBG3(DBG_ENC, " => %d", *output_pos);
}
this->byte_pos++;
-
- return SUCCESS;
+ return TRUE;
}
/**
* Parse a 15-Bit unsigned integer from the current parsing position.
*/
-static status_t parse_uint15(private_parser_t *this, int rule_number, u_int16_t *output_pos)
+static bool parse_uint15(private_parser_t *this, int rule_number,
+ u_int16_t *output_pos)
{
if (this->byte_pos + sizeof(u_int16_t) > this->input_roof)
{
- DBG1(DBG_ENC, " not enough input to parse rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
if (this->bit_pos != 1)
{
- DBG2(DBG_ENC, " found rule %d %N on bitpos %d", rule_number,
- encoding_type_names, this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
+ return bad_bitpos(this, rule_number);
}
- /* caller interested in result ? */
- if (output_pos != NULL)
+ if (output_pos)
{
- *output_pos = ntohs(*((u_int16_t*)this->byte_pos)) & ~0x8000;
+ memcpy(output_pos, this->byte_pos, sizeof(u_int16_t));
+ *output_pos = ntohs(*output_pos) & ~0x8000;
DBG3(DBG_ENC, " => %d", *output_pos);
}
- this->byte_pos += 2;
+ this->byte_pos += sizeof(u_int16_t);
this->bit_pos = 0;
-
- return SUCCESS;
+ return TRUE;
}
/**
* Parse a 16-Bit unsigned integer from the current parsing position.
*/
-static status_t parse_uint16(private_parser_t *this, int rule_number, u_int16_t *output_pos)
+static bool parse_uint16(private_parser_t *this, int rule_number,
+ u_int16_t *output_pos)
{
if (this->byte_pos + sizeof(u_int16_t) > this->input_roof)
{
- DBG1(DBG_ENC, " not enough input to parse rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
if (this->bit_pos)
{
- DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number,
- encoding_type_names, this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
+ return bad_bitpos(this, rule_number);
}
- /* caller interested in result ? */
- if (output_pos != NULL)
+ if (output_pos)
{
- *output_pos = ntohs(*((u_int16_t*)this->byte_pos));
-
+ memcpy(output_pos, this->byte_pos, sizeof(u_int16_t));
+ *output_pos = ntohs(*output_pos);
DBG3(DBG_ENC, " => %d", *output_pos);
}
- this->byte_pos += 2;
-
- return SUCCESS;
+ this->byte_pos += sizeof(u_int16_t);
+ return TRUE;
}
/**
* Parse a 32-Bit unsigned integer from the current parsing position.
*/
-static status_t parse_uint32(private_parser_t *this, int rule_number, u_int32_t *output_pos)
+static bool parse_uint32(private_parser_t *this, int rule_number,
+ u_int32_t *output_pos)
{
if (this->byte_pos + sizeof(u_int32_t) > this->input_roof)
{
- DBG1(DBG_ENC, " not enough input to parse rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
if (this->bit_pos)
{
- DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number,
- encoding_type_names, this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
+ return bad_bitpos(this, rule_number);
}
- /* caller interested in result ? */
- if (output_pos != NULL)
+ if (output_pos)
{
- *output_pos = ntohl(*((u_int32_t*)this->byte_pos));
-
+ memcpy(output_pos, this->byte_pos, sizeof(u_int32_t));
+ *output_pos = ntohl(*output_pos);
DBG3(DBG_ENC, " => %d", *output_pos);
}
- this->byte_pos += 4;
-
- return SUCCESS;
-}
-
-/**
- * Parse a 64-Bit unsigned integer from the current parsing position.
- */
-static status_t parse_uint64(private_parser_t *this, int rule_number, u_int64_t *output_pos)
-{
- if (this->byte_pos + sizeof(u_int64_t) > this->input_roof)
- {
- DBG1(DBG_ENC, " not enough input to parse rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
- }
- if (this->bit_pos)
- {
- DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number,
- encoding_type_names, this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
- }
- /* caller interested in result ? */
- if (output_pos != NULL)
- {
- /* assuming little endian host order */
- *(output_pos + 1) = ntohl(*((u_int32_t*)this->byte_pos));
- *output_pos = ntohl(*(((u_int32_t*)this->byte_pos) + 1));
-
- DBG3(DBG_ENC, " => %b", (void*)output_pos, sizeof(u_int64_t));
- }
- this->byte_pos += 8;
-
- return SUCCESS;
+ this->byte_pos += sizeof(u_int32_t);
+ return TRUE;
}
/**
* Parse a given amount of bytes and writes them to a specific location
*/
-static status_t parse_bytes (private_parser_t *this, int rule_number, u_int8_t *output_pos,size_t bytes)
+static bool parse_bytes(private_parser_t *this, int rule_number,
+ u_int8_t *output_pos, int bytes)
{
if (this->byte_pos + bytes > this->input_roof)
{
- DBG1(DBG_ENC, " not enough input to parse rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
if (this->bit_pos)
{
- DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number,
- encoding_type_names, this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
+ return bad_bitpos(this, rule_number);
}
-
- /* caller interested in result ? */
- if (output_pos != NULL)
+ if (output_pos)
{
- memcpy(output_pos,this->byte_pos,bytes);
-
- DBG3(DBG_ENC, " => %b", (void*)output_pos, bytes);
+ memcpy(output_pos, this->byte_pos, bytes);
+ DBG3(DBG_ENC, " => %b", output_pos, bytes);
}
this->byte_pos += bytes;
-
- return SUCCESS;
+ return TRUE;
}
/**
* Parse a single Bit from the current parsing position
*/
-static status_t parse_bit(private_parser_t *this, int rule_number, bool *output_pos)
+static bool parse_bit(private_parser_t *this, int rule_number,
+ bool *output_pos)
{
if (this->byte_pos + sizeof(u_int8_t) > this->input_roof)
{
- DBG1(DBG_ENC, " not enough input to parse rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
- /* caller interested in result ? */
- if (output_pos != NULL)
+ if (output_pos)
{
u_int8_t mask;
mask = 0x01 << (7 - this->bit_pos);
*output_pos = *this->byte_pos & mask;
-
+
if (*output_pos)
- {
- /* set to a "clean", comparable true */
+ { /* set to a "clean", comparable true */
*output_pos = TRUE;
}
-
DBG3(DBG_ENC, " => %d", *output_pos);
}
this->bit_pos = (this->bit_pos + 1) % 8;
- if (this->bit_pos == 0)
+ if (this->bit_pos == 0)
{
- this->byte_pos++;
+ this->byte_pos++;
}
-
- return SUCCESS;
+ return TRUE;
}
/**
* Parse substructures in a list.
*/
-static status_t parse_list(private_parser_t *this, int rule_number, linked_list_t **output_pos, payload_type_t payload_type, size_t length)
+static bool parse_list(private_parser_t *this, int rule_number,
+ linked_list_t **output_pos, payload_type_t payload_type, int length)
{
- linked_list_t * list = *output_pos;
+ linked_list_t *list = *output_pos;
if (length < 0)
{
- DBG1(DBG_ENC, " invalid length for rule %d %N",
- rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
-
if (this->bit_pos)
{
- DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number,
- encoding_type_names, this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
+ return bad_bitpos(this, rule_number);
}
-
while (length > 0)
{
u_int8_t *pos_before = this->byte_pos;
payload_t *payload;
- status_t status;
+
DBG2(DBG_ENC, " %d bytes left, parsing recursively %N",
length, payload_type_names, payload_type);
- status = this->public.parse_payload((parser_t*)this, payload_type, &payload);
- if (status != SUCCESS)
+
+ if (parse_payload(this, payload_type, &payload) != SUCCESS)
{
DBG1(DBG_ENC, " parsing of a %N substructure failed",
payload_type_names, payload_type);
- return status;
+ return FALSE;
}
list->insert_last(list, payload);
length -= this->byte_pos - pos_before;
}
+ if (length != 0)
+ { /* must yield exactly to zero */
+ DBG1(DBG_ENC, " length of %N substructure list invalid",
+ payload_type_names, payload_type);
+ return FALSE;
+ }
*output_pos = list;
- return SUCCESS;
+ return TRUE;
}
/**
* Parse data from current parsing position in a chunk.
*/
-static status_t parse_chunk(private_parser_t *this, int rule_number, chunk_t *output_pos, size_t length)
+static bool parse_chunk(private_parser_t *this, int rule_number,
+ chunk_t *output_pos, int length)
{
if (this->byte_pos + length > this->input_roof)
{
- DBG1(DBG_ENC, " not enough input (%d bytes) to parse rule %d %N",
- length, rule_number, encoding_type_names, this->rules[rule_number].type);
- return PARSE_ERROR;
+ return short_input(this, rule_number);
}
if (this->bit_pos)
{
- DBG1(DBG_ENC, " found rule %d %N on bitpos %d", rule_number,
- encoding_type_names, this->rules[rule_number].type, this->bit_pos);
- return PARSE_ERROR;
+ return bad_bitpos(this, rule_number);
}
- if (output_pos != NULL)
+ if (output_pos)
{
- output_pos->len = length;
- output_pos->ptr = malloc(length);
+ *output_pos = chunk_alloc(length);
memcpy(output_pos->ptr, this->byte_pos, length);
+ DBG3(DBG_ENC, " => %b", output_pos->ptr, length);
}
this->byte_pos += length;
- DBG3(DBG_ENC, " => %b", (void*)output_pos->ptr, length);
-
- return SUCCESS;
+ 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)
+static status_t parse_payload(private_parser_t *this,
+ payload_type_t payload_type, payload_t **payload)
{
payload_t *pld;
void *output;
- size_t rule_count, payload_length = 0, spi_size = 0, attribute_length = 0;
+ size_t rule_count;
+ int payload_length = 0, spi_size = 0, attribute_length = 0;
u_int16_t ts_type = 0;
bool attribute_format = FALSE;
int rule_number;
@@ -435,7 +385,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
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, this->input_roof - this->byte_pos);
if (pld->get_type(pld) == UNKNOWN_PAYLOAD)
{
@@ -447,7 +397,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
output = pld;
/* parse the payload with its own rulse */
- pld->get_encoding_rules(pld, &(this->rules), &rule_count);
+ pld->get_encoding_rules(pld, &this->rules, &rule_count);
for (rule_number = 0; rule_number < rule_count; rule_number++)
{
rule = &(this->rules[rule_number]);
@@ -457,7 +407,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
{
case U_INT_4:
{
- if (parse_uint4(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint4(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -466,7 +416,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case U_INT_8:
{
- if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint8(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -475,7 +425,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case U_INT_16:
{
- if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint16(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -484,16 +434,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case U_INT_32:
{
- if (parse_uint32(this, rule_number, output + rule->offset) != SUCCESS)
- {
- pld->destroy(pld);
- return PARSE_ERROR;
- }
- break;
- }
- case U_INT_64:
- {
- if (parse_uint64(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint32(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -502,7 +443,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case IKE_SPI:
{
- if (parse_bytes(this, rule_number, output + rule->offset,8) != SUCCESS)
+ if (!parse_bytes(this, rule_number, output + rule->offset, 8))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -511,7 +452,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case RESERVED_BIT:
{
- if (parse_bit(this, rule_number, NULL) != SUCCESS)
+ if (!parse_bit(this, rule_number, NULL))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -520,7 +461,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case RESERVED_BYTE:
{
- if (parse_uint8(this, rule_number, NULL) != SUCCESS)
+ if (!parse_uint8(this, rule_number, NULL))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -529,7 +470,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case FLAG:
{
- if (parse_bit(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_bit(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -538,11 +479,12 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case PAYLOAD_LENGTH:
{
- if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint16(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
}
+ /* parsed u_int16 should be aligned */
payload_length = *(u_int16_t*)(output + rule->offset);
if (payload_length < UNKNOWN_PAYLOAD_HEADER_LENGTH)
{
@@ -553,7 +495,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case HEADER_LENGTH:
{
- if (parse_uint32(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint32(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -562,7 +504,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case SPI_SIZE:
{
- if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint8(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -572,7 +514,8 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case SPI:
{
- if (parse_chunk(this, rule_number, output + rule->offset, spi_size) != SUCCESS)
+ if (!parse_chunk(this, rule_number, output + rule->offset,
+ spi_size))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -582,8 +525,9 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case PROPOSALS:
{
if (payload_length < SA_PAYLOAD_HEADER_LENGTH ||
- parse_list(this, rule_number, output + rule->offset, PROPOSAL_SUBSTRUCTURE,
- payload_length - SA_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_list(this, rule_number, output + rule->offset,
+ PROPOSAL_SUBSTRUCTURE,
+ payload_length - SA_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -592,9 +536,11 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case TRANSFORMS:
{
- if (payload_length < spi_size + PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH ||
- parse_list(this, rule_number, output + rule->offset, TRANSFORM_SUBSTRUCTURE,
- payload_length - spi_size - PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH) != SUCCESS)
+ if (payload_length <
+ spi_size + PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH ||
+ !parse_list(this, rule_number, output + rule->offset,
+ TRANSFORM_SUBSTRUCTURE, payload_length - spi_size -
+ PROPOSAL_SUBSTRUCTURE_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -604,8 +550,9 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case TRANSFORM_ATTRIBUTES:
{
if (payload_length < TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH ||
- parse_list(this, rule_number, output + rule->offset, TRANSFORM_ATTRIBUTE,
- payload_length - TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH) != SUCCESS)
+ !parse_list(this, rule_number, output + rule->offset,
+ TRANSFORM_ATTRIBUTE,
+ payload_length - TRANSFORM_SUBSTRUCTURE_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -615,8 +562,9 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case CONFIGURATION_ATTRIBUTES:
{
if (payload_length < CP_PAYLOAD_HEADER_LENGTH ||
- parse_list(this, rule_number, output + rule->offset, CONFIGURATION_ATTRIBUTE,
- payload_length - CP_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_list(this, rule_number, output + rule->offset,
+ CONFIGURATION_ATTRIBUTE,
+ payload_length - CP_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -625,7 +573,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case ATTRIBUTE_FORMAT:
{
- if (parse_bit(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_bit(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -635,17 +583,16 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case ATTRIBUTE_TYPE:
{
- if (parse_uint15(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint15(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
}
- attribute_format = *(bool*)(output + rule->offset);
break;
}
case CONFIGURATION_ATTRIBUTE_LENGTH:
{
- if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint16(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -654,8 +601,8 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
break;
}
case ATTRIBUTE_LENGTH_OR_VALUE:
- {
- if (parse_uint16(this, rule_number, output + rule->offset) != SUCCESS)
+ {
+ if (!parse_uint16(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -665,43 +612,42 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
}
case ATTRIBUTE_VALUE:
{
- if (attribute_format == FALSE)
+ if (attribute_format == FALSE &&
+ !parse_chunk(this, rule_number, output + rule->offset,
+ attribute_length))
{
- if (parse_chunk(this, rule_number, output + rule->offset, attribute_length) != SUCCESS)
- {
- pld->destroy(pld);
- return PARSE_ERROR;
- }
+ pld->destroy(pld);
+ return PARSE_ERROR;
}
break;
}
case NONCE_DATA:
{
if (payload_length < NONCE_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - NONCE_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - NONCE_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
- }
+ }
break;
}
case ID_DATA:
{
if (payload_length < ID_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - ID_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - ID_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
- }
+ }
break;
}
case AUTH_DATA:
{
if (payload_length < AUTH_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - AUTH_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - AUTH_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -711,8 +657,8 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case CERT_DATA:
{
if (payload_length < CERT_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - CERT_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - CERT_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -722,8 +668,8 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case CERTREQ_DATA:
{
if (payload_length < CERTREQ_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - CERTREQ_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - CERTREQ_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -733,8 +679,8 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case EAP_DATA:
{
if (payload_length < EAP_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - EAP_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - EAP_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
@@ -744,109 +690,112 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
case SPIS:
{
if (payload_length < DELETE_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - DELETE_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - DELETE_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
- }
- break;
+ }
+ break;
}
case VID_DATA:
{
if (payload_length < VENDOR_ID_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - VENDOR_ID_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - VENDOR_ID_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
- }
- break;
+ }
+ break;
}
case CONFIGURATION_ATTRIBUTE_VALUE:
{
- size_t data_length = attribute_length;
- if (parse_chunk(this, rule_number, output + rule->offset, data_length) != SUCCESS)
+ if (!parse_chunk(this, rule_number, output + rule->offset,
+ attribute_length))
{
pld->destroy(pld);
return PARSE_ERROR;
- }
- break;
+ }
+ break;
}
case KEY_EXCHANGE_DATA:
{
if (payload_length < KE_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - KE_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - KE_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
- }
- break;
+ }
+ break;
}
case NOTIFICATION_DATA:
{
if (payload_length < NOTIFY_PAYLOAD_HEADER_LENGTH + spi_size ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - NOTIFY_PAYLOAD_HEADER_LENGTH - spi_size) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - NOTIFY_PAYLOAD_HEADER_LENGTH - spi_size))
{
pld->destroy(pld);
return PARSE_ERROR;
- }
- break;
+ }
+ break;
}
case ENCRYPTED_DATA:
- {
+ {
if (payload_length < ENCRYPTION_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - ENCRYPTION_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - ENCRYPTION_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
- }
- break;
+ }
+ break;
}
case TS_TYPE:
{
- if (parse_uint8(this, rule_number, output + rule->offset) != SUCCESS)
+ if (!parse_uint8(this, rule_number, output + rule->offset))
{
pld->destroy(pld);
return PARSE_ERROR;
}
ts_type = *(u_int8_t*)(output + rule->offset);
- break;
+ break;
}
case ADDRESS:
{
- size_t address_length = (ts_type == TS_IPV4_ADDR_RANGE) ? 4 : 16;
- if (parse_chunk(this, rule_number, output + rule->offset,address_length) != SUCCESS)
+ int address_length = (ts_type == TS_IPV4_ADDR_RANGE) ? 4 : 16;
+
+ if (!parse_chunk(this, rule_number, output + rule->offset,
+ address_length))
{
pld->destroy(pld);
return PARSE_ERROR;
}
- break;
+ break;
}
case TRAFFIC_SELECTORS:
{
if (payload_length < TS_PAYLOAD_HEADER_LENGTH ||
- parse_list(this, rule_number, output + rule->offset, TRAFFIC_SELECTOR_SUBSTRUCTURE,
- payload_length - TS_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_list(this, rule_number, output + rule->offset,
+ TRAFFIC_SELECTOR_SUBSTRUCTURE,
+ payload_length - TS_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
}
- break;
+ break;
}
case UNKNOWN_DATA:
{
if (payload_length < UNKNOWN_PAYLOAD_HEADER_LENGTH ||
- parse_chunk(this, rule_number, output + rule->offset,
- payload_length - UNKNOWN_PAYLOAD_HEADER_LENGTH) != SUCCESS)
+ !parse_chunk(this, rule_number, output + rule->offset,
+ payload_length - UNKNOWN_PAYLOAD_HEADER_LENGTH))
{
pld->destroy(pld);
return PARSE_ERROR;
}
- break;
+ break;
}
default:
{
@@ -871,8 +820,7 @@ static status_t parse_payload(private_parser_t *this, payload_type_t payload_typ
*/
static int get_remaining_byte_count (private_parser_t *this)
{
- int count = (this->input_roof - this->byte_pos);
- return count;
+ return this->input_roof - this->byte_pos;
}
/**
@@ -889,7 +837,7 @@ static void reset_context (private_parser_t *this)
*/
static void destroy(private_parser_t *this)
{
- free(this);
+ free(this);
}
/*
@@ -899,7 +847,7 @@ 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.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;
@@ -909,5 +857,6 @@ parser_t *parser_create(chunk_t data)
this->bit_pos = 0;
this->input_roof = data.ptr + data.len;
- return (parser_t*)this;
+ return &this->public;
}
+
diff --git a/src/charon/encoding/parser.h b/src/charon/encoding/parser.h
index 222e328d1..230492438 100644
--- a/src/charon/encoding/parser.h
+++ b/src/charon/encoding/parser.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: parser.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/auth_payload.c b/src/charon/encoding/payloads/auth_payload.c
index f9ca23236..53406f564 100644
--- a/src/charon/encoding/payloads/auth_payload.c
+++ b/src/charon/encoding/payloads/auth_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: auth_payload.c 4051 2008-06-10 09:08:27Z tobias $
*/
#include "auth_payload.h"
diff --git a/src/charon/encoding/payloads/auth_payload.h b/src/charon/encoding/payloads/auth_payload.h
index 26375a398..4287f14d9 100644
--- a/src/charon/encoding/payloads/auth_payload.h
+++ b/src/charon/encoding/payloads/auth_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: auth_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/cert_payload.c b/src/charon/encoding/payloads/cert_payload.c
index 7ff334006..54a8c1392 100644
--- a/src/charon/encoding/payloads/cert_payload.c
+++ b/src/charon/encoding/payloads/cert_payload.c
@@ -13,8 +13,6 @@
* 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.
- *
- * $Id: cert_payload.c 4317 2008-09-02 11:00:13Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/cert_payload.h b/src/charon/encoding/payloads/cert_payload.h
index d6e328850..fba404ee2 100644
--- a/src/charon/encoding/payloads/cert_payload.h
+++ b/src/charon/encoding/payloads/cert_payload.h
@@ -13,8 +13,6 @@
* 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.
- *
- * $Id: cert_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/certreq_payload.c b/src/charon/encoding/payloads/certreq_payload.c
index 1b499e9e8..50adedb28 100644
--- a/src/charon/encoding/payloads/certreq_payload.c
+++ b/src/charon/encoding/payloads/certreq_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: certreq_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/certreq_payload.h b/src/charon/encoding/payloads/certreq_payload.h
index a246f0e93..ff9814f8a 100644
--- a/src/charon/encoding/payloads/certreq_payload.h
+++ b/src/charon/encoding/payloads/certreq_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: certreq_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/configuration_attribute.c b/src/charon/encoding/payloads/configuration_attribute.c
index ad8177e1f..674feeddd 100644
--- a/src/charon/encoding/payloads/configuration_attribute.c
+++ b/src/charon/encoding/payloads/configuration_attribute.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: configuration_attribute.c 4844 2009-01-20 22:55:13Z andreas $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/configuration_attribute.h b/src/charon/encoding/payloads/configuration_attribute.h
index 13aaa0e90..404130114 100644
--- a/src/charon/encoding/payloads/configuration_attribute.h
+++ b/src/charon/encoding/payloads/configuration_attribute.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: configuration_attribute.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/cp_payload.c b/src/charon/encoding/payloads/cp_payload.c
index d39dc2a47..b5f1b35c7 100644
--- a/src/charon/encoding/payloads/cp_payload.c
+++ b/src/charon/encoding/payloads/cp_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: cp_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/cp_payload.h b/src/charon/encoding/payloads/cp_payload.h
index c31b1667d..6ffcca708 100644
--- a/src/charon/encoding/payloads/cp_payload.h
+++ b/src/charon/encoding/payloads/cp_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: cp_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/delete_payload.c b/src/charon/encoding/payloads/delete_payload.c
index 01ee7f027..c2be1e8b5 100644
--- a/src/charon/encoding/payloads/delete_payload.c
+++ b/src/charon/encoding/payloads/delete_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: delete_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/delete_payload.h b/src/charon/encoding/payloads/delete_payload.h
index 862deb9dc..58840741a 100644
--- a/src/charon/encoding/payloads/delete_payload.h
+++ b/src/charon/encoding/payloads/delete_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: delete_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/eap_payload.c b/src/charon/encoding/payloads/eap_payload.c
index d9a6fe6dd..1199bac45 100644
--- a/src/charon/encoding/payloads/eap_payload.c
+++ b/src/charon/encoding/payloads/eap_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: eap_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/eap_payload.h b/src/charon/encoding/payloads/eap_payload.h
index 337f82e12..a4d8a38c6 100644
--- a/src/charon/encoding/payloads/eap_payload.h
+++ b/src/charon/encoding/payloads/eap_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: eap_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/encodings.c b/src/charon/encoding/payloads/encodings.c
index 66c1fd999..85caeda82 100644
--- a/src/charon/encoding/payloads/encodings.c
+++ b/src/charon/encoding/payloads/encodings.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: encodings.c 3589 2008-03-13 14:14:44Z martin $
*/
@@ -24,7 +22,6 @@ ENUM(encoding_type_names, U_INT_4, ENCRYPTED_DATA,
"U_INT_8",
"U_INT_16",
"U_INT_32",
- "U_INT_64",
"RESERVED_BIT",
"RESERVED_BYTE",
"FLAG",
diff --git a/src/charon/encoding/payloads/encodings.h b/src/charon/encoding/payloads/encodings.h
index ad98874a2..03554f0af 100644
--- a/src/charon/encoding/payloads/encodings.h
+++ b/src/charon/encoding/payloads/encodings.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: encodings.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
@@ -99,19 +97,6 @@ enum encoding_type_t {
U_INT_32,
/**
- * Representing a 64 Bit unsigned int value.
- *
- * When generating it must be changed from host to network order.
- * The value is read from the associated data struct.
- * The current write position is moved 64 bit forward afterwards.
- *
- * When parsing it must be changed from network to host order.
- * The value is written to the associated data struct.
- * The current read pointer is moved 64 bit forward afterwards.
- */
- U_INT_64,
-
- /**
* represents a RESERVED_BIT used in FLAG-Bytes.
*
* When generating, the next bit is set to zero and the current write
diff --git a/src/charon/encoding/payloads/encryption_payload.c b/src/charon/encoding/payloads/encryption_payload.c
index 7237c69c5..55a37bb25 100644
--- a/src/charon/encoding/payloads/encryption_payload.c
+++ b/src/charon/encoding/payloads/encryption_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: encryption_payload.c 3862 2008-04-22 07:14:24Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/encryption_payload.h b/src/charon/encoding/payloads/encryption_payload.h
index 1d3eeb793..3b94587ec 100644
--- a/src/charon/encoding/payloads/encryption_payload.h
+++ b/src/charon/encoding/payloads/encryption_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: encryption_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/endpoint_notify.c b/src/charon/encoding/payloads/endpoint_notify.c
index c9ef47afb..c30d29942 100644
--- a/src/charon/encoding/payloads/endpoint_notify.c
+++ b/src/charon/encoding/payloads/endpoint_notify.c
@@ -11,8 +11,6 @@
* 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.
- *
- * $Id: endpoint_notify.c 3735 2008-04-02 18:21:03Z tobias $
*/
#include "endpoint_notify.h"
diff --git a/src/charon/encoding/payloads/endpoint_notify.h b/src/charon/encoding/payloads/endpoint_notify.h
index 36f483c67..66aabc683 100644
--- a/src/charon/encoding/payloads/endpoint_notify.h
+++ b/src/charon/encoding/payloads/endpoint_notify.h
@@ -11,8 +11,6 @@
* 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.
- *
- * $Id: endpoint_notify.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/id_payload.c b/src/charon/encoding/payloads/id_payload.c
index 347ad7563..4a527cb24 100644
--- a/src/charon/encoding/payloads/id_payload.c
+++ b/src/charon/encoding/payloads/id_payload.c
@@ -14,8 +14,6 @@
* 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.
- *
- * $Id: id_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/id_payload.h b/src/charon/encoding/payloads/id_payload.h
index 9de21cc6a..555b1324b 100644
--- a/src/charon/encoding/payloads/id_payload.h
+++ b/src/charon/encoding/payloads/id_payload.h
@@ -13,8 +13,6 @@
* 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.
- *
- * $Id: id_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/ike_header.c b/src/charon/encoding/payloads/ike_header.c
index 1db64f0e3..d27bfb82c 100644
--- a/src/charon/encoding/payloads/ike_header.c
+++ b/src/charon/encoding/payloads/ike_header.c
@@ -13,8 +13,6 @@
* 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.
- *
- * $Id: ike_header.c 3666 2008-03-26 18:40:19Z tobias $
*/
/* offsetof macro */
diff --git a/src/charon/encoding/payloads/ike_header.h b/src/charon/encoding/payloads/ike_header.h
index 7292c2c9c..8de316d19 100644
--- a/src/charon/encoding/payloads/ike_header.h
+++ b/src/charon/encoding/payloads/ike_header.h
@@ -13,8 +13,6 @@
* 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.
- *
- * $Id: ike_header.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/ke_payload.c b/src/charon/encoding/payloads/ke_payload.c
index 2f718e49c..aa3e075ca 100644
--- a/src/charon/encoding/payloads/ke_payload.c
+++ b/src/charon/encoding/payloads/ke_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: ke_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/ke_payload.h b/src/charon/encoding/payloads/ke_payload.h
index bc5c9224a..7e182d970 100644
--- a/src/charon/encoding/payloads/ke_payload.h
+++ b/src/charon/encoding/payloads/ke_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: ke_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/nonce_payload.c b/src/charon/encoding/payloads/nonce_payload.c
index da68ce4ab..f9e075380 100644
--- a/src/charon/encoding/payloads/nonce_payload.c
+++ b/src/charon/encoding/payloads/nonce_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: nonce_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
/* offsetof macro */
diff --git a/src/charon/encoding/payloads/nonce_payload.h b/src/charon/encoding/payloads/nonce_payload.h
index b433c7023..4adaba481 100644
--- a/src/charon/encoding/payloads/nonce_payload.h
+++ b/src/charon/encoding/payloads/nonce_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: nonce_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/notify_payload.c b/src/charon/encoding/payloads/notify_payload.c
index a4377c275..d2a995ace 100644
--- a/src/charon/encoding/payloads/notify_payload.c
+++ b/src/charon/encoding/payloads/notify_payload.c
@@ -14,8 +14,6 @@
* 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.
- *
- * $Id: notify_payload.c 4842 2009-01-19 12:32:42Z andreas $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/notify_payload.h b/src/charon/encoding/payloads/notify_payload.h
index 9f7577c26..a5f501dca 100644
--- a/src/charon/encoding/payloads/notify_payload.h
+++ b/src/charon/encoding/payloads/notify_payload.h
@@ -14,8 +14,6 @@
* 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.
- *
- * $Id: notify_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/payload.c b/src/charon/encoding/payloads/payload.c
index 71350458f..1cee6d2aa 100644
--- a/src/charon/encoding/payloads/payload.c
+++ b/src/charon/encoding/payloads/payload.c
@@ -13,8 +13,6 @@
* 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.
- *
- * $Id: payload.c 4618 2008-11-11 09:22:00Z tobias $
*/
diff --git a/src/charon/encoding/payloads/payload.h b/src/charon/encoding/payloads/payload.h
index 7cb1b7735..78f5b7b97 100644
--- a/src/charon/encoding/payloads/payload.h
+++ b/src/charon/encoding/payloads/payload.h
@@ -13,8 +13,6 @@
* 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.
- *
- * $Id: payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/proposal_substructure.c b/src/charon/encoding/payloads/proposal_substructure.c
index daa015d3e..a8166023c 100644
--- a/src/charon/encoding/payloads/proposal_substructure.c
+++ b/src/charon/encoding/payloads/proposal_substructure.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: proposal_substructure.c 3658 2008-03-26 10:06:45Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/proposal_substructure.h b/src/charon/encoding/payloads/proposal_substructure.h
index 212366d77..8ccb917d6 100644
--- a/src/charon/encoding/payloads/proposal_substructure.h
+++ b/src/charon/encoding/payloads/proposal_substructure.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: proposal_substructure.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/sa_payload.c b/src/charon/encoding/payloads/sa_payload.c
index ecc3b0f60..3ca2f08c8 100644
--- a/src/charon/encoding/payloads/sa_payload.c
+++ b/src/charon/encoding/payloads/sa_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: sa_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/sa_payload.h b/src/charon/encoding/payloads/sa_payload.h
index 237432422..58ae72544 100644
--- a/src/charon/encoding/payloads/sa_payload.h
+++ b/src/charon/encoding/payloads/sa_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: sa_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/traffic_selector_substructure.c b/src/charon/encoding/payloads/traffic_selector_substructure.c
index eb5bbc626..7dcdce6aa 100644
--- a/src/charon/encoding/payloads/traffic_selector_substructure.c
+++ b/src/charon/encoding/payloads/traffic_selector_substructure.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: traffic_selector_substructure.c 4639 2008-11-12 15:09:24Z martin $
*/
#include "traffic_selector_substructure.h"
diff --git a/src/charon/encoding/payloads/traffic_selector_substructure.h b/src/charon/encoding/payloads/traffic_selector_substructure.h
index 9179d1478..ee3e204a0 100644
--- a/src/charon/encoding/payloads/traffic_selector_substructure.h
+++ b/src/charon/encoding/payloads/traffic_selector_substructure.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: traffic_selector_substructure.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/transform_attribute.c b/src/charon/encoding/payloads/transform_attribute.c
index b9b5ff879..507d04a34 100644
--- a/src/charon/encoding/payloads/transform_attribute.c
+++ b/src/charon/encoding/payloads/transform_attribute.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: transform_attribute.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <string.h>
@@ -248,7 +246,7 @@ static u_int16_t get_attribute_type (private_transform_attribute_t *this)
/**
* Implementation of transform_attribute_t.clone.
*/
-static transform_attribute_t * clone(private_transform_attribute_t *this)
+static transform_attribute_t * _clone(private_transform_attribute_t *this)
{
private_transform_attribute_t *new_clone;
@@ -302,7 +300,7 @@ transform_attribute_t *transform_attribute_create()
this->public.get_value = (u_int16_t (*) (transform_attribute_t *)) get_value;
this->public.set_attribute_type = (void (*) (transform_attribute_t *,u_int16_t type)) set_attribute_type;
this->public.get_attribute_type = (u_int16_t (*) (transform_attribute_t *)) get_attribute_type;
- this->public.clone = (transform_attribute_t * (*) (transform_attribute_t *)) clone;
+ this->public.clone = (transform_attribute_t * (*) (transform_attribute_t *)) _clone;
this->public.destroy = (void (*) (transform_attribute_t *)) destroy;
/* set default values of the fields */
diff --git a/src/charon/encoding/payloads/transform_attribute.h b/src/charon/encoding/payloads/transform_attribute.h
index 6755ff74c..f7d71a9df 100644
--- a/src/charon/encoding/payloads/transform_attribute.h
+++ b/src/charon/encoding/payloads/transform_attribute.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: transform_attribute.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/transform_substructure.c b/src/charon/encoding/payloads/transform_substructure.c
index 7c3d6421a..497bd53b2 100644
--- a/src/charon/encoding/payloads/transform_substructure.c
+++ b/src/charon/encoding/payloads/transform_substructure.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: transform_substructure.c 3971 2008-05-16 13:27:21Z tobias $
*/
#include <stddef.h>
@@ -382,37 +380,23 @@ transform_substructure_t *transform_substructure_create()
/*
* Described in header
*/
-transform_substructure_t *transform_substructure_create_type(transform_type_t transform_type, u_int16_t transform_id, u_int16_t key_length)
+transform_substructure_t *transform_substructure_create_type(
+ transform_type_t transform_type,
+ u_int16_t transform_id, u_int16_t key_length)
{
transform_substructure_t *transform = transform_substructure_create();
transform->set_transform_type(transform,transform_type);
transform->set_transform_id(transform,transform_id);
- /* a keylength attribute is only created for variable length algos */
- if (transform_type == ENCRYPTION_ALGORITHM)
+ if (key_length)
{
- switch(transform_id)
- {
- case ENCR_AES_CBC:
- case ENCR_IDEA:
- case ENCR_CAST:
- case ENCR_BLOWFISH:
- case ENCR_AES_CCM_ICV8:
- case ENCR_AES_CCM_ICV12:
- case ENCR_AES_CCM_ICV16:
- case ENCR_AES_GCM_ICV8:
- case ENCR_AES_GCM_ICV12:
- case ENCR_AES_GCM_ICV16:
- {
- transform_attribute_t *attribute = transform_attribute_create_key_length(key_length);
- transform->add_transform_attribute(transform,attribute);
- break;
- }
- default:
- break;
- }
+ transform_attribute_t *attribute;
+
+ attribute = transform_attribute_create_key_length(key_length);
+ transform->add_transform_attribute(transform, attribute);
+
}
-
return transform;
}
+
diff --git a/src/charon/encoding/payloads/transform_substructure.h b/src/charon/encoding/payloads/transform_substructure.h
index cc8adc38a..b02a94a6c 100644
--- a/src/charon/encoding/payloads/transform_substructure.h
+++ b/src/charon/encoding/payloads/transform_substructure.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: transform_substructure.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/ts_payload.c b/src/charon/encoding/payloads/ts_payload.c
index 5d53793b1..92ddc380f 100644
--- a/src/charon/encoding/payloads/ts_payload.c
+++ b/src/charon/encoding/payloads/ts_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: ts_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/ts_payload.h b/src/charon/encoding/payloads/ts_payload.h
index 91f26f55d..3c8a6d595 100644
--- a/src/charon/encoding/payloads/ts_payload.h
+++ b/src/charon/encoding/payloads/ts_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: ts_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/unknown_payload.c b/src/charon/encoding/payloads/unknown_payload.c
index 8a8db308d..309663233 100644
--- a/src/charon/encoding/payloads/unknown_payload.c
+++ b/src/charon/encoding/payloads/unknown_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: unknown_payload.c 3589 2008-03-13 14:14:44Z martin $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/unknown_payload.h b/src/charon/encoding/payloads/unknown_payload.h
index 03894c619..44b6e1a71 100644
--- a/src/charon/encoding/payloads/unknown_payload.h
+++ b/src/charon/encoding/payloads/unknown_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: unknown_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**
diff --git a/src/charon/encoding/payloads/vendor_id_payload.c b/src/charon/encoding/payloads/vendor_id_payload.c
index 3e47b9348..52d9e12a5 100644
--- a/src/charon/encoding/payloads/vendor_id_payload.c
+++ b/src/charon/encoding/payloads/vendor_id_payload.c
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: vendor_id_payload.c 4120 2008-06-27 15:22:27Z andreas $
*/
#include <stddef.h>
diff --git a/src/charon/encoding/payloads/vendor_id_payload.h b/src/charon/encoding/payloads/vendor_id_payload.h
index b8798f24e..9ee9ea1d4 100644
--- a/src/charon/encoding/payloads/vendor_id_payload.h
+++ b/src/charon/encoding/payloads/vendor_id_payload.h
@@ -12,8 +12,6 @@
* 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.
- *
- * $Id: vendor_id_payload.h 5003 2009-03-24 17:43:01Z martin $
*/
/**