aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/encoding/payloads
diff options
context:
space:
mode:
Diffstat (limited to 'Source/charon/encoding/payloads')
-rw-r--r--Source/charon/encoding/payloads/auth_payload.c13
-rw-r--r--Source/charon/encoding/payloads/cert_payload.c16
-rw-r--r--Source/charon/encoding/payloads/certreq_payload.c16
-rw-r--r--Source/charon/encoding/payloads/configuration_attribute.c14
-rw-r--r--Source/charon/encoding/payloads/cp_payload.c8
-rw-r--r--Source/charon/encoding/payloads/delete_payload.c16
-rw-r--r--Source/charon/encoding/payloads/eap_payload.c16
-rw-r--r--Source/charon/encoding/payloads/encryption_payload.c45
-rw-r--r--Source/charon/encoding/payloads/id_payload.c15
-rw-r--r--Source/charon/encoding/payloads/ike_header.c5
-rw-r--r--Source/charon/encoding/payloads/ke_payload.c14
-rw-r--r--Source/charon/encoding/payloads/nonce_payload.c11
-rw-r--r--Source/charon/encoding/payloads/notify_payload.c22
-rw-r--r--Source/charon/encoding/payloads/proposal_substructure.c18
-rw-r--r--Source/charon/encoding/payloads/sa_payload.c8
-rw-r--r--Source/charon/encoding/payloads/traffic_selector_substructure.c13
-rw-r--r--Source/charon/encoding/payloads/transform_attribute.c19
-rw-r--r--Source/charon/encoding/payloads/transform_substructure.c8
-rw-r--r--Source/charon/encoding/payloads/ts_payload.c7
-rw-r--r--Source/charon/encoding/payloads/unknown_payload.c9
-rw-r--r--Source/charon/encoding/payloads/vendor_id_payload.c16
21 files changed, 146 insertions, 163 deletions
diff --git a/Source/charon/encoding/payloads/auth_payload.c b/Source/charon/encoding/payloads/auth_payload.c
index 8adb6fd6d..cc7c4bfb1 100644
--- a/Source/charon/encoding/payloads/auth_payload.c
+++ b/Source/charon/encoding/payloads/auth_payload.c
@@ -23,7 +23,6 @@
#include "auth_payload.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
typedef struct private_auth_payload_t private_auth_payload_t;
@@ -189,9 +188,9 @@ static void set_data (private_auth_payload_t *this, chunk_t data)
{
if (this->auth_data.ptr != NULL)
{
- allocator_free_chunk(&(this->auth_data));
+ chunk_free(&(this->auth_data));
}
- this->auth_data.ptr = allocator_clone_bytes(data.ptr,data.len);
+ this->auth_data.ptr = clalloc(data.ptr,data.len);
this->auth_data.len = data.len;
this->payload_length = AUTH_PAYLOAD_HEADER_LENGTH + this->auth_data.len;
}
@@ -214,7 +213,7 @@ static chunk_t get_data_clone (private_auth_payload_t *this)
{
return (this->auth_data);
}
- cloned_data.ptr = allocator_clone_bytes(this->auth_data.ptr,this->auth_data.len);
+ cloned_data.ptr = clalloc(this->auth_data.ptr,this->auth_data.len);
cloned_data.len = this->auth_data.len;
return cloned_data;
}
@@ -226,10 +225,10 @@ static void destroy(private_auth_payload_t *this)
{
if (this->auth_data.ptr != NULL)
{
- allocator_free_chunk(&(this->auth_data));
+ chunk_free(&(this->auth_data));
}
- allocator_free(this);
+ free(this);
}
/*
@@ -237,7 +236,7 @@ static void destroy(private_auth_payload_t *this)
*/
auth_payload_t *auth_payload_create()
{
- private_auth_payload_t *this = allocator_alloc_thing(private_auth_payload_t);
+ private_auth_payload_t *this = malloc_thing(private_auth_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/cert_payload.c b/Source/charon/encoding/payloads/cert_payload.c
index a361f1345..146d42eda 100644
--- a/Source/charon/encoding/payloads/cert_payload.c
+++ b/Source/charon/encoding/payloads/cert_payload.c
@@ -20,9 +20,9 @@
* for more details.
*/
-#include "cert_payload.h"
+#include <stddef.h>
-#include <utils/allocator.h>
+#include "cert_payload.h"
/**
@@ -202,9 +202,9 @@ static void set_data (private_cert_payload_t *this, chunk_t data)
{
if (this->cert_data.ptr != NULL)
{
- allocator_free_chunk(&(this->cert_data));
+ chunk_free(&(this->cert_data));
}
- this->cert_data.ptr = allocator_clone_bytes(data.ptr,data.len);
+ this->cert_data.ptr = clalloc(data.ptr,data.len);
this->cert_data.len = data.len;
this->payload_length = CERT_PAYLOAD_HEADER_LENGTH + this->cert_data.len;
}
@@ -227,7 +227,7 @@ static chunk_t get_data_clone (private_cert_payload_t *this)
{
return (this->cert_data);
}
- cloned_data.ptr = allocator_clone_bytes(this->cert_data.ptr,this->cert_data.len);
+ cloned_data.ptr = clalloc(this->cert_data.ptr,this->cert_data.len);
cloned_data.len = this->cert_data.len;
return cloned_data;
}
@@ -239,10 +239,10 @@ static void destroy(private_cert_payload_t *this)
{
if (this->cert_data.ptr != NULL)
{
- allocator_free_chunk(&(this->cert_data));
+ chunk_free(&(this->cert_data));
}
- allocator_free(this);
+ free(this);
}
/*
@@ -250,7 +250,7 @@ static void destroy(private_cert_payload_t *this)
*/
cert_payload_t *cert_payload_create()
{
- private_cert_payload_t *this = allocator_alloc_thing(private_cert_payload_t);
+ private_cert_payload_t *this = malloc_thing(private_cert_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/certreq_payload.c b/Source/charon/encoding/payloads/certreq_payload.c
index b7372a7a2..cdab82be4 100644
--- a/Source/charon/encoding/payloads/certreq_payload.c
+++ b/Source/charon/encoding/payloads/certreq_payload.c
@@ -20,9 +20,9 @@
* for more details.
*/
-#include "certreq_payload.h"
+#include <stddef.h>
-#include <utils/allocator.h>
+#include "certreq_payload.h"
typedef struct private_certreq_payload_t private_certreq_payload_t;
@@ -182,9 +182,9 @@ static void set_data (private_certreq_payload_t *this, chunk_t data)
{
if (this->certreq_data.ptr != NULL)
{
- allocator_free_chunk(&(this->certreq_data));
+ chunk_free(&(this->certreq_data));
}
- this->certreq_data.ptr = allocator_clone_bytes(data.ptr,data.len);
+ this->certreq_data.ptr = clalloc(data.ptr,data.len);
this->certreq_data.len = data.len;
this->payload_length = CERTREQ_PAYLOAD_HEADER_LENGTH + this->certreq_data.len;
}
@@ -207,7 +207,7 @@ static chunk_t get_data_clone (private_certreq_payload_t *this)
{
return (this->certreq_data);
}
- cloned_data.ptr = allocator_clone_bytes(this->certreq_data.ptr,this->certreq_data.len);
+ cloned_data.ptr = clalloc(this->certreq_data.ptr,this->certreq_data.len);
cloned_data.len = this->certreq_data.len;
return cloned_data;
}
@@ -219,10 +219,10 @@ static void destroy(private_certreq_payload_t *this)
{
if (this->certreq_data.ptr != NULL)
{
- allocator_free_chunk(&(this->certreq_data));
+ chunk_free(&(this->certreq_data));
}
- allocator_free(this);
+ free(this);
}
/*
@@ -230,7 +230,7 @@ static void destroy(private_certreq_payload_t *this)
*/
certreq_payload_t *certreq_payload_create()
{
- private_certreq_payload_t *this = allocator_alloc_thing(private_certreq_payload_t);
+ private_certreq_payload_t *this = malloc_thing(private_certreq_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/configuration_attribute.c b/Source/charon/encoding/payloads/configuration_attribute.c
index 4f3294832..489d7f372 100644
--- a/Source/charon/encoding/payloads/configuration_attribute.c
+++ b/Source/charon/encoding/payloads/configuration_attribute.c
@@ -19,15 +19,13 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
-/* offsetof macro */
+
#include <stddef.h>
#include "configuration_attribute.h"
#include <encoding/payloads/encodings.h>
#include <types.h>
-#include <utils/allocator.h>
typedef struct private_configuration_attribute_t private_configuration_attribute_t;
@@ -196,10 +194,10 @@ static void set_value(private_configuration_attribute_t *this, chunk_t value)
if (this->attribute_value.ptr != NULL)
{
/* free existing value */
- allocator_free_chunk(&(this->attribute_value));
+ chunk_free(&(this->attribute_value));
}
- this->attribute_value.ptr = allocator_clone_bytes(value.ptr,value.len);
+ this->attribute_value.ptr = clalloc(value.ptr,value.len);
this->attribute_value.len = value.len;
this->attribute_length = this->attribute_value.len;
@@ -246,9 +244,9 @@ static void destroy(private_configuration_attribute_t *this)
{
if (this->attribute_value.ptr != NULL)
{
- allocator_free(this->attribute_value.ptr);
+ free(this->attribute_value.ptr);
}
- allocator_free(this);
+ free(this);
}
/*
@@ -256,7 +254,7 @@ static void destroy(private_configuration_attribute_t *this)
*/
configuration_attribute_t *configuration_attribute_create()
{
- private_configuration_attribute_t *this = allocator_alloc_thing(private_configuration_attribute_t);
+ private_configuration_attribute_t *this = malloc_thing(private_configuration_attribute_t);
/* payload interface */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/cp_payload.c b/Source/charon/encoding/payloads/cp_payload.c
index e9d8af77e..583488382 100644
--- a/Source/charon/encoding/payloads/cp_payload.c
+++ b/Source/charon/encoding/payloads/cp_payload.c
@@ -19,14 +19,12 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
-/* offsetof macro */
+
#include <stddef.h>
#include "cp_payload.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
#include <utils/linked_list.h>
@@ -265,7 +263,7 @@ static status_t destroy(private_cp_payload_t *this)
}
this->attributes->destroy(this->attributes);
- allocator_free(this);
+ free(this);
return SUCCESS;
}
@@ -275,7 +273,7 @@ static status_t destroy(private_cp_payload_t *this)
*/
cp_payload_t *cp_payload_create()
{
- private_cp_payload_t *this = allocator_alloc_thing(private_cp_payload_t);
+ private_cp_payload_t *this = malloc_thing(private_cp_payload_t);
/* public interface */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/delete_payload.c b/Source/charon/encoding/payloads/delete_payload.c
index 59d877945..28e78800f 100644
--- a/Source/charon/encoding/payloads/delete_payload.c
+++ b/Source/charon/encoding/payloads/delete_payload.c
@@ -20,9 +20,9 @@
* for more details.
*/
-#include "delete_payload.h"
+#include <stddef.h>
-#include <utils/allocator.h>
+#include "delete_payload.h"
typedef struct private_delete_payload_t private_delete_payload_t;
@@ -238,9 +238,9 @@ static void set_spis (private_delete_payload_t *this, chunk_t spis)
{
if (this->spis.ptr != NULL)
{
- allocator_free_chunk(&(this->spis));
+ chunk_free(&(this->spis));
}
- this->spis.ptr = allocator_clone_bytes(spis.ptr,spis.len);
+ this->spis.ptr = clalloc(spis.ptr,spis.len);
this->spis.len = spis.len;
this->payload_length = DELETE_PAYLOAD_HEADER_LENGTH + this->spis.len;
}
@@ -263,7 +263,7 @@ static chunk_t get_spis_clone (private_delete_payload_t *this)
{
return (this->spis);
}
- cloned_spis.ptr = allocator_clone_bytes(this->spis.ptr,this->spis.len);
+ cloned_spis.ptr = clalloc(this->spis.ptr,this->spis.len);
cloned_spis.len = this->spis.len;
return cloned_spis;
}
@@ -275,10 +275,10 @@ static void destroy(private_delete_payload_t *this)
{
if (this->spis.ptr != NULL)
{
- allocator_free_chunk(&(this->spis));
+ chunk_free(&(this->spis));
}
- allocator_free(this);
+ free(this);
}
/*
@@ -286,7 +286,7 @@ static void destroy(private_delete_payload_t *this)
*/
delete_payload_t *delete_payload_create()
{
- private_delete_payload_t *this = allocator_alloc_thing(private_delete_payload_t);
+ private_delete_payload_t *this = malloc_thing(private_delete_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/eap_payload.c b/Source/charon/encoding/payloads/eap_payload.c
index 2bd8d5ee0..2a0e17679 100644
--- a/Source/charon/encoding/payloads/eap_payload.c
+++ b/Source/charon/encoding/payloads/eap_payload.c
@@ -20,9 +20,9 @@
* for more details.
*/
-#include "eap_payload.h"
+#include <stddef.h>
-#include <utils/allocator.h>
+#include "eap_payload.h"
typedef struct private_eap_payload_t private_eap_payload_t;
@@ -152,9 +152,9 @@ static void set_message (private_eap_payload_t *this, chunk_t message)
{
if (this->message.ptr != NULL)
{
- allocator_free_chunk(&(this->message));
+ chunk_free(&(this->message));
}
- this->message.ptr = allocator_clone_bytes(message.ptr,message.len);
+ this->message.ptr = clalloc(message.ptr,message.len);
this->message.len = message.len;
this->payload_length = EAP_PAYLOAD_HEADER_LENGTH + this->message.len;
}
@@ -177,7 +177,7 @@ static chunk_t get_message_clone (private_eap_payload_t *this)
{
return (this->message);
}
- cloned_message.ptr = allocator_clone_bytes(this->message.ptr,this->message.len);
+ cloned_message.ptr = clalloc(this->message.ptr,this->message.len);
cloned_message.len = this->message.len;
return cloned_message;
}
@@ -189,10 +189,10 @@ static void destroy(private_eap_payload_t *this)
{
if (this->message.ptr != NULL)
{
- allocator_free_chunk(&(this->message));
+ chunk_free(&(this->message));
}
- allocator_free(this);
+ free(this);
}
/*
@@ -200,7 +200,7 @@ static void destroy(private_eap_payload_t *this)
*/
eap_payload_t *eap_payload_create()
{
- private_eap_payload_t *this = allocator_alloc_thing(private_eap_payload_t);
+ private_eap_payload_t *this = malloc_thing(private_eap_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/encryption_payload.c b/Source/charon/encoding/payloads/encryption_payload.c
index 70bbe9701..e0ca74ff4 100644
--- a/Source/charon/encoding/payloads/encryption_payload.c
+++ b/Source/charon/encoding/payloads/encryption_payload.c
@@ -19,15 +19,14 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
-/* offsetof macro */
+
#include <stddef.h>
+#include <string.h>
#include "encryption_payload.h"
#include <daemon.h>
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
#include <utils/linked_list.h>
#include <utils/logger.h>
#include <encoding/generator.h>
@@ -303,7 +302,7 @@ static status_t encrypt(private_encryption_payload_t *this)
/* concatenate payload data, padding, padding len */
to_crypt.len = this->decrypted.len + padding.len + 1;
- to_crypt.ptr = allocator_alloc(to_crypt.len);
+ to_crypt.ptr = malloc(to_crypt.len);
memcpy(to_crypt.ptr, this->decrypted.ptr, this->decrypted.len);
memcpy(to_crypt.ptr + this->decrypted.len, padding.ptr, padding.len);
@@ -315,22 +314,22 @@ static status_t encrypt(private_encryption_payload_t *this)
randomizer->destroy(randomizer);
if (status != SUCCESS)
{
- allocator_free_chunk(&to_crypt);
- allocator_free_chunk(&padding);
+ chunk_free(&to_crypt);
+ chunk_free(&padding);
return status;
}
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before encryption with padding", to_crypt);
/* encrypt to_crypt chunk */
- allocator_free(this->encrypted.ptr);
+ free(this->encrypted.ptr);
status = this->crypter->encrypt(this->crypter, to_crypt, iv, &result);
- allocator_free(padding.ptr);
- allocator_free(to_crypt.ptr);
+ free(padding.ptr);
+ free(to_crypt.ptr);
if (status != SUCCESS)
{
this->logger->log(this->logger, ERROR|LEVEL1, "encryption failed");
- allocator_free(iv.ptr);
+ free(iv.ptr);
return status;
}
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after encryption", result);
@@ -338,15 +337,15 @@ static status_t encrypt(private_encryption_payload_t *this)
/* build encrypted result with iv and signature */
this->encrypted.len = iv.len + result.len + this->signer->get_block_size(this->signer);
- allocator_free(this->encrypted.ptr);
- this->encrypted.ptr = allocator_alloc(this->encrypted.len);
+ free(this->encrypted.ptr);
+ this->encrypted.ptr = malloc(this->encrypted.len);
/* fill in result, signature is left out */
memcpy(this->encrypted.ptr, iv.ptr, iv.len);
memcpy(this->encrypted.ptr + iv.len, result.ptr, result.len);
- allocator_free(result.ptr);
- allocator_free(iv.ptr);
+ free(result.ptr);
+ free(iv.ptr);
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after encryption with IV and (invalid) signature", this->encrypted);
return SUCCESS;
@@ -391,7 +390,7 @@ static status_t decrypt(private_encryption_payload_t *this)
}
/* free previus data, if any */
- allocator_free(this->decrypted.ptr);
+ free(this->decrypted.ptr);
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data before decryption", concatenated);
@@ -419,7 +418,7 @@ static status_t decrypt(private_encryption_payload_t *this)
}
/* free padding */
- this->decrypted.ptr = allocator_realloc(this->decrypted.ptr, this->decrypted.len);
+ this->decrypted.ptr = realloc(this->decrypted.ptr, this->decrypted.len);
this->logger->log_chunk(this->logger, RAW|LEVEL2, "data after decryption without padding", this->decrypted);
this->logger->log(this->logger, CONTROL|LEVEL2, "decryption successful, trying to parse content");
return (this->parse(this));
@@ -518,7 +517,7 @@ static void generate(private_encryption_payload_t *this)
{
/* no paylads? */
this->logger->log(this->logger, CONTROL|LEVEL1, "generating contained payloads, but no available");
- allocator_free(this->decrypted.ptr);
+ free(this->decrypted.ptr);
this->decrypted = CHUNK_INITIALIZER;
iterator->destroy(iterator);
return;
@@ -541,7 +540,7 @@ static void generate(private_encryption_payload_t *this)
generator->generate_payload(generator, current_payload);
/* free already generated data */
- allocator_free(this->decrypted.ptr);
+ free(this->decrypted.ptr);
generator->write_to_chunk(generator, &(this->decrypted));
generator->destroy(generator);
@@ -649,9 +648,9 @@ static void destroy(private_encryption_payload_t *this)
current_payload->destroy(current_payload);
}
this->payloads->destroy(this->payloads);
- allocator_free(this->encrypted.ptr);
- allocator_free(this->decrypted.ptr);
- allocator_free(this);
+ free(this->encrypted.ptr);
+ free(this->decrypted.ptr);
+ free(this);
}
/*
@@ -659,7 +658,7 @@ static void destroy(private_encryption_payload_t *this)
*/
encryption_payload_t *encryption_payload_create()
{
- private_encryption_payload_t *this = allocator_alloc_thing(private_encryption_payload_t);
+ private_encryption_payload_t *this = malloc_thing(private_encryption_payload_t);
/* payload_t interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
@@ -687,7 +686,7 @@ encryption_payload_t *encryption_payload_create()
this->compute_length = compute_length;
this->generate = generate;
this->parse = parse;
- this->logger = charon->logger_manager->get_logger(charon->logger_manager, ENCRYPTION_PAYLOAD);
+ this->logger = logger_manager->get_logger(logger_manager, ENCRYPTION_PAYLOAD);
/* set default values of the fields */
this->critical = FALSE;
diff --git a/Source/charon/encoding/payloads/id_payload.c b/Source/charon/encoding/payloads/id_payload.c
index df37a06f5..6a8d7738d 100644
--- a/Source/charon/encoding/payloads/id_payload.c
+++ b/Source/charon/encoding/payloads/id_payload.c
@@ -20,10 +20,11 @@
* for more details.
*/
+#include <stddef.h>
+
#include "id_payload.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
typedef struct private_id_payload_t private_id_payload_t;
@@ -202,9 +203,9 @@ static void set_data (private_id_payload_t *this, chunk_t data)
{
if (this->id_data.ptr != NULL)
{
- allocator_free_chunk(&(this->id_data));
+ chunk_free(&(this->id_data));
}
- this->id_data.ptr = allocator_clone_bytes(data.ptr,data.len);
+ this->id_data.ptr = clalloc(data.ptr,data.len);
this->id_data.len = data.len;
this->payload_length = ID_PAYLOAD_HEADER_LENGTH + this->id_data.len;
}
@@ -228,7 +229,7 @@ static chunk_t get_data_clone (private_id_payload_t *this)
{
return (this->id_data);
}
- cloned_data.ptr = allocator_clone_bytes(this->id_data.ptr,this->id_data.len);
+ cloned_data.ptr = clalloc(this->id_data.ptr,this->id_data.len);
cloned_data.len = this->id_data.len;
return cloned_data;
}
@@ -264,9 +265,9 @@ static void destroy(private_id_payload_t *this)
{
if (this->id_data.ptr != NULL)
{
- allocator_free_chunk(&(this->id_data));
+ chunk_free(&(this->id_data));
}
- allocator_free(this);
+ free(this);
}
/*
@@ -274,7 +275,7 @@ static void destroy(private_id_payload_t *this)
*/
id_payload_t *id_payload_create(bool is_initiator)
{
- private_id_payload_t *this = allocator_alloc_thing(private_id_payload_t);
+ private_id_payload_t *this = malloc_thing(private_id_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/ike_header.c b/Source/charon/encoding/payloads/ike_header.c
index 6114c8de4..ad46d3d29 100644
--- a/Source/charon/encoding/payloads/ike_header.c
+++ b/Source/charon/encoding/payloads/ike_header.c
@@ -26,7 +26,6 @@
#include "ike_header.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
typedef struct private_ike_header_t private_ike_header_t;
@@ -324,7 +323,7 @@ static void set_message_id(private_ike_header_t *this, u_int32_t message_id)
*/
static void destroy(ike_header_t *this)
{
- allocator_free(this);
+ free(this);
}
/**
@@ -365,7 +364,7 @@ static size_t get_length(payload_t *this)
*/
ike_header_t *ike_header_create()
{
- private_ike_header_t *this = allocator_alloc_thing(private_ike_header_t);
+ private_ike_header_t *this = malloc_thing(private_ike_header_t);
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
this->public.payload_interface.get_encoding_rules = get_encoding_rules;
diff --git a/Source/charon/encoding/payloads/ke_payload.c b/Source/charon/encoding/payloads/ke_payload.c
index 5cbf99b25..0c92e033d 100644
--- a/Source/charon/encoding/payloads/ke_payload.c
+++ b/Source/charon/encoding/payloads/ke_payload.c
@@ -19,14 +19,12 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
-/* offsetof macro */
+
#include <stddef.h>
#include "ke_payload.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
typedef struct private_ke_payload_t private_ke_payload_t;
@@ -134,9 +132,9 @@ static void destroy(private_ke_payload_t *this)
{
if (this->key_exchange_data.ptr != NULL)
{
- allocator_free(this->key_exchange_data.ptr);
+ free(this->key_exchange_data.ptr);
}
- allocator_free(this);
+ free(this);
}
/**
@@ -212,13 +210,13 @@ static void set_key_exchange_data(private_ke_payload_t *this, chunk_t key_exchan
if (this->key_exchange_data.ptr != NULL)
{
/* free existing value */
- allocator_free(this->key_exchange_data.ptr);
+ free(this->key_exchange_data.ptr);
this->key_exchange_data.ptr = NULL;
this->key_exchange_data.len = 0;
}
- this->key_exchange_data.ptr = allocator_clone_bytes(key_exchange_data.ptr,key_exchange_data.len);
+ this->key_exchange_data.ptr = clalloc(key_exchange_data.ptr,key_exchange_data.len);
this->key_exchange_data.len = key_exchange_data.len;
this->compute_length(this);
@@ -245,7 +243,7 @@ static void set_dh_group_number(private_ke_payload_t *this, diffie_hellman_group
*/
ke_payload_t *ke_payload_create()
{
- private_ke_payload_t *this = allocator_alloc_thing(private_ke_payload_t);
+ private_ke_payload_t *this = malloc_thing(private_ke_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/nonce_payload.c b/Source/charon/encoding/payloads/nonce_payload.c
index aa71f8bf6..a7528fbfb 100644
--- a/Source/charon/encoding/payloads/nonce_payload.c
+++ b/Source/charon/encoding/payloads/nonce_payload.c
@@ -26,7 +26,6 @@
#include "nonce_payload.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
typedef struct private_nonce_payload_t private_nonce_payload_t;
@@ -125,7 +124,7 @@ static status_t verify(private_nonce_payload_t *this)
*/
static status_t set_nonce(private_nonce_payload_t *this, chunk_t nonce)
{
- this->nonce.ptr = allocator_clone_bytes(nonce.ptr, nonce.len);
+ this->nonce.ptr = clalloc(nonce.ptr, nonce.len);
this->nonce.len = nonce.len;
this->payload_length = NONCE_PAYLOAD_HEADER_LENGTH + nonce.len;
return SUCCESS;
@@ -137,7 +136,7 @@ static status_t set_nonce(private_nonce_payload_t *this, chunk_t nonce)
static chunk_t get_nonce(private_nonce_payload_t *this)
{
chunk_t nonce;
- nonce.ptr = allocator_clone_bytes(this->nonce.ptr,this->nonce.len);
+ nonce.ptr = clalloc(this->nonce.ptr,this->nonce.len);
nonce.len = this->nonce.len;
return nonce;
}
@@ -199,10 +198,10 @@ static void destroy(private_nonce_payload_t *this)
{
if (this->nonce.ptr != NULL)
{
- allocator_free(this->nonce.ptr);
+ free(this->nonce.ptr);
}
- allocator_free(this);
+ free(this);
}
/*
@@ -210,7 +209,7 @@ static void destroy(private_nonce_payload_t *this)
*/
nonce_payload_t *nonce_payload_create()
{
- private_nonce_payload_t *this = allocator_alloc_thing(private_nonce_payload_t);
+ private_nonce_payload_t *this = malloc_thing(private_nonce_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/notify_payload.c b/Source/charon/encoding/payloads/notify_payload.c
index b26f89b39..43d0c5322 100644
--- a/Source/charon/encoding/payloads/notify_payload.c
+++ b/Source/charon/encoding/payloads/notify_payload.c
@@ -19,15 +19,13 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
-/* offsetof macro */
+
#include <stddef.h>
#include "notify_payload.h"
#include <daemon.h>
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
/**
* String mappings for notify_message_type_t.
@@ -321,13 +319,13 @@ static void set_spi(private_notify_payload_t *this, chunk_t spi)
if (this->spi.ptr != NULL)
{
/* free existing value */
- allocator_free(this->spi.ptr);
+ free(this->spi.ptr);
this->spi.ptr = NULL;
this->spi.len = 0;
}
- this->spi.ptr = allocator_clone_bytes(spi.ptr,spi.len);
+ this->spi.ptr = clalloc(spi.ptr,spi.len);
this->spi.len = spi.len;
this->spi_size = spi.len;
@@ -352,13 +350,13 @@ static status_t set_notification_data(private_notify_payload_t *this, chunk_t no
if (this->notification_data.ptr != NULL)
{
/* free existing value */
- allocator_free(this->notification_data.ptr);
+ free(this->notification_data.ptr);
this->notification_data.ptr = NULL;
this->notification_data.len = 0;
}
- this->notification_data.ptr = allocator_clone_bytes(notification_data.ptr,notification_data.len);
+ this->notification_data.ptr = clalloc(notification_data.ptr,notification_data.len);
this->notification_data.len = notification_data.len;
this->compute_length(this);
@@ -372,14 +370,14 @@ static status_t destroy(private_notify_payload_t *this)
{
if (this->notification_data.ptr != NULL)
{
- allocator_free(this->notification_data.ptr);
+ free(this->notification_data.ptr);
}
if (this->spi.ptr != NULL)
{
- allocator_free(this->spi.ptr);
+ free(this->spi.ptr);
}
- allocator_free(this);
+ free(this);
return SUCCESS;
}
@@ -388,7 +386,7 @@ static status_t destroy(private_notify_payload_t *this)
*/
notify_payload_t *notify_payload_create()
{
- private_notify_payload_t *this = allocator_alloc_thing(private_notify_payload_t);
+ private_notify_payload_t *this = malloc_thing(private_notify_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
@@ -424,7 +422,7 @@ notify_payload_t *notify_payload_create()
this->spi_size = 0;
this->notification_data.ptr = NULL;
this->notification_data.len = 0;
- this->logger = charon->logger_manager->get_logger(charon->logger_manager, PAYLOAD);
+ this->logger = logger_manager->get_logger(logger_manager, PAYLOAD);
return (&(this->public));
}
diff --git a/Source/charon/encoding/payloads/proposal_substructure.c b/Source/charon/encoding/payloads/proposal_substructure.c
index 4ee2e91f4..cb3c695b2 100644
--- a/Source/charon/encoding/payloads/proposal_substructure.c
+++ b/Source/charon/encoding/payloads/proposal_substructure.c
@@ -19,8 +19,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
- /* offsetof macro */
+
#include <stddef.h>
#include "proposal_substructure.h"
@@ -28,7 +27,6 @@
#include <encoding/payloads/encodings.h>
#include <encoding/payloads/transform_substructure.h>
#include <types.h>
-#include <utils/allocator.h>
#include <utils/linked_list.h>
@@ -307,13 +305,13 @@ static void set_spi (private_proposal_substructure_t *this, chunk_t spi)
/* first delete already set spi value */
if (this->spi.ptr != NULL)
{
- allocator_free(this->spi.ptr);
+ free(this->spi.ptr);
this->spi.ptr = NULL;
this->spi.len = 0;
this->compute_length(this);
}
- this->spi.ptr = allocator_clone_bytes(spi.ptr,spi.len);
+ this->spi.ptr = clalloc(spi.ptr,spi.len);
this->spi.len = spi.len;
this->spi_size = spi.len;
this->compute_length(this);
@@ -452,7 +450,7 @@ static private_proposal_substructure_t* clone(private_proposal_substructure_t *t
new_clone->spi_size = this->spi_size;
if (this->spi.ptr != NULL)
{
- new_clone->spi.ptr = allocator_clone_bytes(this->spi.ptr,this->spi.len);
+ new_clone->spi.ptr = clalloc(this->spi.ptr,this->spi.len);
new_clone->spi.len = this->spi.len;
}
@@ -495,10 +493,10 @@ static status_t destroy(private_proposal_substructure_t *this)
if (this->spi.ptr != NULL)
{
- allocator_free(this->spi.ptr);
+ free(this->spi.ptr);
}
- allocator_free(this);
+ free(this);
return SUCCESS;
}
@@ -508,7 +506,7 @@ static status_t destroy(private_proposal_substructure_t *this)
*/
proposal_substructure_t *proposal_substructure_create()
{
- private_proposal_substructure_t *this = allocator_alloc_thing(private_proposal_substructure_t);
+ private_proposal_substructure_t *this = malloc_thing(private_proposal_substructure_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
@@ -622,7 +620,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal(proposal_t *
/* take over general infos */
this->spi_size = proto == PROTO_IKE ? 8 : 4;
this->spi.len = this->spi_size;
- this->spi.ptr = allocator_alloc(this->spi_size);
+ this->spi.ptr = malloc(this->spi_size);
*((u_int32_t*)this->spi.ptr) = proposal->get_spi(proposal, proto);
this->proposal_number = proposal->get_number(proposal);
this->protocol_id = proto;
diff --git a/Source/charon/encoding/payloads/sa_payload.c b/Source/charon/encoding/payloads/sa_payload.c
index 91049dd65..81b4e6709 100644
--- a/Source/charon/encoding/payloads/sa_payload.c
+++ b/Source/charon/encoding/payloads/sa_payload.c
@@ -19,14 +19,12 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
-/* offsetof macro */
+
#include <stddef.h>
#include "sa_payload.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
#include <utils/linked_list.h>
@@ -176,7 +174,7 @@ static status_t destroy(private_sa_payload_t *this)
}
this->proposals->destroy(this->proposals);
- allocator_free(this);
+ free(this);
return SUCCESS;
}
@@ -329,7 +327,7 @@ static void compute_length (private_sa_payload_t *this)
*/
sa_payload_t *sa_payload_create()
{
- private_sa_payload_t *this = allocator_alloc_thing(private_sa_payload_t);
+ private_sa_payload_t *this = malloc_thing(private_sa_payload_t);
/* public interface */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/traffic_selector_substructure.c b/Source/charon/encoding/payloads/traffic_selector_substructure.c
index 874b87e43..c1a461e8a 100644
--- a/Source/charon/encoding/payloads/traffic_selector_substructure.c
+++ b/Source/charon/encoding/payloads/traffic_selector_substructure.c
@@ -23,7 +23,6 @@
#include "traffic_selector_substructure.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
#include <utils/linked_list.h>
/**
@@ -254,7 +253,7 @@ static void set_start_host (private_traffic_selector_substructure_t *this,host_t
this->start_port = start_host->get_port(start_host);
if (this->starting_address.ptr != NULL)
{
- allocator_free_chunk(&(this->starting_address));
+ chunk_free(&(this->starting_address));
}
this->starting_address = start_host->get_address_as_chunk(start_host);
this->compute_length(this);
@@ -276,7 +275,7 @@ static void set_end_host (private_traffic_selector_substructure_t *this,host_t *
this->end_port = end_host->get_port(end_host);
if (this->ending_address.ptr != NULL)
{
- allocator_free_chunk(&(this->ending_address));
+ chunk_free(&(this->ending_address));
}
this->ending_address = end_host->get_address_as_chunk(end_host);
this->compute_length(this);
@@ -307,9 +306,9 @@ void compute_length(private_traffic_selector_substructure_t *this)
*/
static void destroy(private_traffic_selector_substructure_t *this)
{
- allocator_free(this->starting_address.ptr);
- allocator_free(this->ending_address.ptr);
- allocator_free(this);
+ free(this->starting_address.ptr);
+ free(this->ending_address.ptr);
+ free(this);
}
/*
@@ -317,7 +316,7 @@ static void destroy(private_traffic_selector_substructure_t *this)
*/
traffic_selector_substructure_t *traffic_selector_substructure_create()
{
- private_traffic_selector_substructure_t *this = allocator_alloc_thing(private_traffic_selector_substructure_t);
+ private_traffic_selector_substructure_t *this = malloc_thing(private_traffic_selector_substructure_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/transform_attribute.c b/Source/charon/encoding/payloads/transform_attribute.c
index 9f9d82924..71cdd59e2 100644
--- a/Source/charon/encoding/payloads/transform_attribute.c
+++ b/Source/charon/encoding/payloads/transform_attribute.c
@@ -19,15 +19,14 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
-/* offsetof macro */
+
+#include <string.h>
#include <stddef.h>
#include "transform_attribute.h"
#include <encoding/payloads/encodings.h>
#include <types.h>
-#include <utils/allocator.h>
typedef struct private_transform_attribute_t private_transform_attribute_t;
@@ -170,7 +169,7 @@ static void set_value_chunk(private_transform_attribute_t *this, chunk_t value)
if (this->attribute_value.ptr != NULL)
{
/* free existing value */
- allocator_free(this->attribute_value.ptr);
+ free(this->attribute_value.ptr);
this->attribute_value.ptr = NULL;
this->attribute_value.len = 0;
@@ -178,7 +177,7 @@ static void set_value_chunk(private_transform_attribute_t *this, chunk_t value)
if (value.len > 2)
{
- this->attribute_value.ptr = allocator_clone_bytes(value.ptr,value.len);
+ this->attribute_value.ptr = clalloc(value.ptr,value.len);
this->attribute_value.len = value.len;
this->attribute_length_or_value = value.len;
/* attribute has not a fixed length */
@@ -198,7 +197,7 @@ static void set_value(private_transform_attribute_t *this, u_int16_t value)
if (this->attribute_value.ptr != NULL)
{
/* free existing value */
- allocator_free(this->attribute_value.ptr);
+ free(this->attribute_value.ptr);
this->attribute_value.ptr = NULL;
this->attribute_value.len = 0;
@@ -267,7 +266,7 @@ static transform_attribute_t * clone(private_transform_attribute_t *this)
if (!new_clone->attribute_format)
{
- new_clone->attribute_value.ptr = allocator_clone_bytes(this->attribute_value.ptr,this->attribute_value.len);
+ new_clone->attribute_value.ptr = clalloc(this->attribute_value.ptr,this->attribute_value.len);
new_clone->attribute_value.len = this->attribute_value.len;
}
@@ -281,9 +280,9 @@ static void destroy(private_transform_attribute_t *this)
{
if (this->attribute_value.ptr != NULL)
{
- allocator_free(this->attribute_value.ptr);
+ free(this->attribute_value.ptr);
}
- allocator_free(this);
+ free(this);
}
/*
@@ -291,7 +290,7 @@ static void destroy(private_transform_attribute_t *this)
*/
transform_attribute_t *transform_attribute_create()
{
- private_transform_attribute_t *this = allocator_alloc_thing(private_transform_attribute_t);
+ private_transform_attribute_t *this = malloc_thing(private_transform_attribute_t);
/* payload interface */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/transform_substructure.c b/Source/charon/encoding/payloads/transform_substructure.c
index 9b0bbf4ed..350ad63e4 100644
--- a/Source/charon/encoding/payloads/transform_substructure.c
+++ b/Source/charon/encoding/payloads/transform_substructure.c
@@ -19,8 +19,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
-
- /* offsetof macro */
+
#include <stddef.h>
#include "transform_substructure.h"
@@ -28,7 +27,6 @@
#include <encoding/payloads/transform_attribute.h>
#include <encoding/payloads/encodings.h>
#include <types.h>
-#include <utils/allocator.h>
#include <utils/linked_list.h>
@@ -420,7 +418,7 @@ static void destroy(private_transform_substructure_t *this)
}
this->attributes->destroy(this->attributes);
- allocator_free(this);
+ free(this);
}
/*
@@ -428,7 +426,7 @@ static void destroy(private_transform_substructure_t *this)
*/
transform_substructure_t *transform_substructure_create()
{
- private_transform_substructure_t *this = allocator_alloc_thing(private_transform_substructure_t);
+ private_transform_substructure_t *this = malloc_thing(private_transform_substructure_t);
/* payload interface */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/ts_payload.c b/Source/charon/encoding/payloads/ts_payload.c
index 33a0cdab8..58772e666 100644
--- a/Source/charon/encoding/payloads/ts_payload.c
+++ b/Source/charon/encoding/payloads/ts_payload.c
@@ -20,10 +20,11 @@
* for more details.
*/
+#include <stddef.h>
+
#include "ts_payload.h"
#include <encoding/payloads/encodings.h>
-#include <utils/allocator.h>
#include <utils/linked_list.h>
typedef struct private_ts_payload_t private_ts_payload_t;
@@ -297,7 +298,7 @@ static void destroy(private_ts_payload_t *this)
this->traffic_selectors->destroy(this->traffic_selectors);
- allocator_free(this);
+ free(this);
}
/*
@@ -305,7 +306,7 @@ static void destroy(private_ts_payload_t *this)
*/
ts_payload_t *ts_payload_create(bool is_initiator)
{
- private_ts_payload_t *this = allocator_alloc_thing(private_ts_payload_t);
+ private_ts_payload_t *this = malloc_thing(private_ts_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/unknown_payload.c b/Source/charon/encoding/payloads/unknown_payload.c
index 5d6d2cbdb..25bb37d59 100644
--- a/Source/charon/encoding/payloads/unknown_payload.c
+++ b/Source/charon/encoding/payloads/unknown_payload.c
@@ -20,9 +20,10 @@
* for more details.
*/
+#include <stddef.h>
+
#include "unknown_payload.h"
-#include <utils/allocator.h>
typedef struct private_unknown_payload_t private_unknown_payload_t;
@@ -169,10 +170,10 @@ static void destroy(private_unknown_payload_t *this)
{
if (this->data.ptr != NULL)
{
- allocator_free_chunk(&(this->data));
+ chunk_free(&(this->data));
}
- allocator_free(this);
+ free(this);
}
/*
@@ -180,7 +181,7 @@ static void destroy(private_unknown_payload_t *this)
*/
unknown_payload_t *unknown_payload_create()
{
- private_unknown_payload_t *this = allocator_alloc_thing(private_unknown_payload_t);
+ private_unknown_payload_t *this = malloc_thing(private_unknown_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
diff --git a/Source/charon/encoding/payloads/vendor_id_payload.c b/Source/charon/encoding/payloads/vendor_id_payload.c
index 28f07608b..436b82d79 100644
--- a/Source/charon/encoding/payloads/vendor_id_payload.c
+++ b/Source/charon/encoding/payloads/vendor_id_payload.c
@@ -20,9 +20,9 @@
* for more details.
*/
-#include "vendor_id_payload.h"
+#include <stddef.h>
-#include <utils/allocator.h>
+#include "vendor_id_payload.h"
typedef struct private_vendor_id_payload_t private_vendor_id_payload_t;
@@ -153,9 +153,9 @@ static void set_data (private_vendor_id_payload_t *this, chunk_t data)
{
if (this->vendor_id_data.ptr != NULL)
{
- allocator_free_chunk(&(this->vendor_id_data));
+ chunk_free(&(this->vendor_id_data));
}
- this->vendor_id_data.ptr = allocator_clone_bytes(data.ptr,data.len);
+ this->vendor_id_data.ptr = clalloc(data.ptr,data.len);
this->vendor_id_data.len = data.len;
this->payload_length = VENDOR_ID_PAYLOAD_HEADER_LENGTH + this->vendor_id_data.len;
}
@@ -178,7 +178,7 @@ static chunk_t get_data_clone (private_vendor_id_payload_t *this)
{
return (this->vendor_id_data);
}
- cloned_data.ptr = allocator_clone_bytes(this->vendor_id_data.ptr,this->vendor_id_data.len);
+ cloned_data.ptr = clalloc(this->vendor_id_data.ptr,this->vendor_id_data.len);
cloned_data.len = this->vendor_id_data.len;
return cloned_data;
}
@@ -190,9 +190,9 @@ static void destroy(private_vendor_id_payload_t *this)
{
if (this->vendor_id_data.ptr != NULL)
{
- allocator_free_chunk(&(this->vendor_id_data));
+ chunk_free(&(this->vendor_id_data));
}
- allocator_free(this);
+ free(this);
}
/*
@@ -200,7 +200,7 @@ static void destroy(private_vendor_id_payload_t *this)
*/
vendor_id_payload_t *vendor_id_payload_create()
{
- private_vendor_id_payload_t *this = allocator_alloc_thing(private_vendor_id_payload_t);
+ private_vendor_id_payload_t *this = malloc_thing(private_vendor_id_payload_t);
/* interface functions */
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;