diff options
Diffstat (limited to 'Source/charon/sa/states')
-rw-r--r-- | Source/charon/sa/states/ike_auth_requested.c | 29 | ||||
-rw-r--r-- | Source/charon/sa/states/ike_sa_established.c | 7 | ||||
-rw-r--r-- | Source/charon/sa/states/ike_sa_init_requested.c | 19 | ||||
-rw-r--r-- | Source/charon/sa/states/ike_sa_init_responded.c | 33 | ||||
-rw-r--r-- | Source/charon/sa/states/initiator_init.c | 13 | ||||
-rw-r--r-- | Source/charon/sa/states/responder_init.c | 17 |
6 files changed, 58 insertions, 60 deletions
diff --git a/Source/charon/sa/states/ike_auth_requested.c b/Source/charon/sa/states/ike_auth_requested.c index b037cfcd9..00c38a887 100644 --- a/Source/charon/sa/states/ike_auth_requested.c +++ b/Source/charon/sa/states/ike_auth_requested.c @@ -19,11 +19,12 @@ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ - + +#include <string.h> + #include "ike_auth_requested.h" #include <daemon.h> -#include <utils/allocator.h> #include <encoding/payloads/ts_payload.h> #include <encoding/payloads/sa_payload.h> #include <encoding/payloads/id_payload.h> @@ -329,11 +330,11 @@ static status_t process_message(private_ike_auth_requested_t *this, message_t *i } else { - seed = allocator_alloc_as_chunk(this->sent_nonce.len + this->received_nonce.len); + seed = chunk_alloc(this->sent_nonce.len + this->received_nonce.len); memcpy(seed.ptr, this->sent_nonce.ptr, this->sent_nonce.len); memcpy(seed.ptr + this->sent_nonce.len, this->received_nonce.ptr, this->received_nonce.len); prf_plus = prf_plus_create(this->ike_sa->get_child_prf(this->ike_sa), seed); - allocator_free_chunk(&seed); + chunk_free(&seed); status = this->child_sa->update(this->child_sa, this->proposal, prf_plus); prf_plus->destroy(prf_plus); @@ -571,9 +572,9 @@ static ike_sa_state_t get_state(private_ike_auth_requested_t *this) */ static void destroy(private_ike_auth_requested_t *this) { - allocator_free_chunk(&(this->received_nonce)); - allocator_free_chunk(&(this->sent_nonce)); - allocator_free_chunk(&(this->ike_sa_init_reply_data)); + chunk_free(&(this->received_nonce)); + chunk_free(&(this->sent_nonce)); + chunk_free(&(this->ike_sa_init_reply_data)); if (this->child_sa) { this->child_sa->destroy(this->child_sa); @@ -600,16 +601,16 @@ static void destroy(private_ike_auth_requested_t *this) { this->proposal->destroy(this->proposal); } - allocator_free(this); + free(this); } /** * Implements protected_ike_sa_t.destroy_after_state_change */ static void destroy_after_state_change(private_ike_auth_requested_t *this) { - allocator_free_chunk(&(this->received_nonce)); - allocator_free_chunk(&(this->sent_nonce)); - allocator_free_chunk(&(this->ike_sa_init_reply_data)); + chunk_free(&(this->received_nonce)); + chunk_free(&(this->sent_nonce)); + chunk_free(&(this->ike_sa_init_reply_data)); if (this->my_ts) { traffic_selector_t *ts; @@ -632,7 +633,7 @@ static void destroy_after_state_change(private_ike_auth_requested_t *this) { this->proposal->destroy(this->proposal); } - allocator_free(this); + free(this); } /* @@ -640,7 +641,7 @@ static void destroy_after_state_change(private_ike_auth_requested_t *this) */ ike_auth_requested_t *ike_auth_requested_create(protected_ike_sa_t *ike_sa,chunk_t sent_nonce,chunk_t received_nonce,chunk_t ike_sa_init_reply_data, child_sa_t *child_sa) { - private_ike_auth_requested_t *this = allocator_alloc_thing(private_ike_auth_requested_t); + private_ike_auth_requested_t *this = malloc_thing(private_ike_auth_requested_t); /* interface functions */ this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message; @@ -660,7 +661,7 @@ ike_auth_requested_t *ike_auth_requested_create(protected_ike_sa_t *ike_sa,chunk this->received_nonce = received_nonce; this->sent_nonce = sent_nonce; this->ike_sa_init_reply_data = ike_sa_init_reply_data; - this->logger = charon->logger_manager->get_logger(charon->logger_manager, IKE_SA); + this->logger = logger_manager->get_logger(logger_manager, IKE_SA); this->my_ts = NULL; this->other_ts = NULL; this->proposal = NULL; diff --git a/Source/charon/sa/states/ike_sa_established.c b/Source/charon/sa/states/ike_sa_established.c index f96734423..e91409f6a 100644 --- a/Source/charon/sa/states/ike_sa_established.c +++ b/Source/charon/sa/states/ike_sa_established.c @@ -23,7 +23,6 @@ #include "ike_sa_established.h" #include <daemon.h> -#include <utils/allocator.h> #include <encoding/payloads/delete_payload.h> @@ -214,7 +213,7 @@ static ike_sa_state_t get_state(private_ike_sa_established_t *this) */ static void destroy(private_ike_sa_established_t *this) { - allocator_free(this); + free(this); } /* @@ -222,7 +221,7 @@ static void destroy(private_ike_sa_established_t *this) */ ike_sa_established_t *ike_sa_established_create(protected_ike_sa_t *ike_sa) { - private_ike_sa_established_t *this = allocator_alloc_thing(private_ike_sa_established_t); + private_ike_sa_established_t *this = malloc_thing(private_ike_sa_established_t); /* interface functions */ this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message; @@ -234,7 +233,7 @@ ike_sa_established_t *ike_sa_established_create(protected_ike_sa_t *ike_sa) /* private data */ this->ike_sa = ike_sa; - this->logger = charon->logger_manager->get_logger(charon->logger_manager, IKE_SA); + this->logger = logger_manager->get_logger(logger_manager, IKE_SA); return &(this->public); } diff --git a/Source/charon/sa/states/ike_sa_init_requested.c b/Source/charon/sa/states/ike_sa_init_requested.c index 8d3ae55ed..e3769303c 100644 --- a/Source/charon/sa/states/ike_sa_init_requested.c +++ b/Source/charon/sa/states/ike_sa_init_requested.c @@ -23,7 +23,6 @@ #include "ike_sa_init_requested.h" #include <daemon.h> -#include <utils/allocator.h> #include <encoding/payloads/sa_payload.h> #include <encoding/payloads/ke_payload.h> #include <encoding/payloads/nonce_payload.h> @@ -411,7 +410,7 @@ static status_t process_message(private_ike_sa_init_requested_t *this, message_t */ status_t process_nonce_payload (private_ike_sa_init_requested_t *this, nonce_payload_t *nonce_payload) { - allocator_free(this->received_nonce.ptr); + free(this->received_nonce.ptr); this->received_nonce = nonce_payload->get_nonce(nonce_payload); return SUCCESS; } @@ -693,12 +692,12 @@ static ike_sa_state_t get_state(private_ike_sa_init_requested_t *this) static void destroy_after_state_change (private_ike_sa_init_requested_t *this) { this->diffie_hellman->destroy(this->diffie_hellman); - allocator_free_chunk(&(this->ike_sa_init_request_data)); + chunk_free(&(this->ike_sa_init_request_data)); if (this->proposal) { this->proposal->destroy(this->proposal); } - allocator_free(this); + free(this); } /** @@ -707,9 +706,9 @@ static void destroy_after_state_change (private_ike_sa_init_requested_t *this) static void destroy(private_ike_sa_init_requested_t *this) { this->diffie_hellman->destroy(this->diffie_hellman); - allocator_free(this->sent_nonce.ptr); - allocator_free(this->received_nonce.ptr); - allocator_free_chunk(&(this->ike_sa_init_request_data)); + free(this->sent_nonce.ptr); + free(this->received_nonce.ptr); + chunk_free(&(this->ike_sa_init_request_data)); if (this->child_sa) { this->child_sa->destroy(this->child_sa); @@ -718,7 +717,7 @@ static void destroy(private_ike_sa_init_requested_t *this) { this->proposal->destroy(this->proposal); } - allocator_free(this); + free(this); } /* @@ -726,7 +725,7 @@ static void destroy(private_ike_sa_init_requested_t *this) */ ike_sa_init_requested_t *ike_sa_init_requested_create(protected_ike_sa_t *ike_sa, diffie_hellman_t *diffie_hellman, chunk_t sent_nonce,chunk_t ike_sa_init_request_data) { - private_ike_sa_init_requested_t *this = allocator_alloc_thing(private_ike_sa_init_requested_t); + private_ike_sa_init_requested_t *this = malloc_thing(private_ike_sa_init_requested_t); /* interface functions */ this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message; @@ -748,7 +747,7 @@ ike_sa_init_requested_t *ike_sa_init_requested_create(protected_ike_sa_t *ike_sa /* private data */ this->ike_sa = ike_sa; this->received_nonce = CHUNK_INITIALIZER; - this->logger = charon->logger_manager->get_logger(charon->logger_manager, IKE_SA); + this->logger = logger_manager->get_logger(logger_manager, IKE_SA); this->diffie_hellman = diffie_hellman; this->proposal = NULL; this->sent_nonce = sent_nonce; diff --git a/Source/charon/sa/states/ike_sa_init_responded.c b/Source/charon/sa/states/ike_sa_init_responded.c index 52548749a..54c0cc26b 100644 --- a/Source/charon/sa/states/ike_sa_init_responded.c +++ b/Source/charon/sa/states/ike_sa_init_responded.c @@ -19,11 +19,12 @@ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ - + +#include <string.h> + #include "ike_sa_init_responded.h" #include <daemon.h> -#include <utils/allocator.h> #include <sa/authenticator.h> #include <sa/child_sa.h> #include <encoding/payloads/ts_payload.h> @@ -473,11 +474,11 @@ static status_t build_sa_payload(private_ike_sa_init_responded_t *this, sa_paylo } /* set up child sa */ - seed = allocator_alloc_as_chunk(this->received_nonce.len + this->sent_nonce.len); + seed = chunk_alloc(this->received_nonce.len + this->sent_nonce.len); memcpy(seed.ptr, this->received_nonce.ptr, this->received_nonce.len); memcpy(seed.ptr + this->received_nonce.len, this->sent_nonce.ptr, this->sent_nonce.len); prf_plus = prf_plus_create(this->ike_sa->get_child_prf(this->ike_sa), seed); - allocator_free_chunk(&seed); + chunk_free(&seed); connection = this->ike_sa->get_connection(this->ike_sa); this->child_sa = child_sa_create(connection->get_my_host(connection), @@ -607,10 +608,10 @@ static ike_sa_state_t get_state(private_ike_sa_init_responded_t *this) */ static void destroy(private_ike_sa_init_responded_t *this) { - allocator_free_chunk(&(this->received_nonce)); - allocator_free_chunk(&(this->sent_nonce)); - allocator_free_chunk(&(this->ike_sa_init_response_data)); - allocator_free_chunk(&(this->ike_sa_init_request_data)); + chunk_free(&(this->received_nonce)); + chunk_free(&(this->sent_nonce)); + chunk_free(&(this->ike_sa_init_response_data)); + chunk_free(&(this->ike_sa_init_request_data)); if (this->my_ts) { traffic_selector_t *ts; @@ -634,17 +635,17 @@ static void destroy(private_ike_sa_init_responded_t *this) this->child_sa->destroy(this->child_sa); } - allocator_free(this); + free(this); } /** * Implementation of private_ike_sa_init_responded.destroy_after_state_change. */ static void destroy_after_state_change(private_ike_sa_init_responded_t *this) { - allocator_free_chunk(&(this->received_nonce)); - allocator_free_chunk(&(this->sent_nonce)); - allocator_free_chunk(&(this->ike_sa_init_response_data)); - allocator_free_chunk(&(this->ike_sa_init_request_data)); + chunk_free(&(this->received_nonce)); + chunk_free(&(this->sent_nonce)); + chunk_free(&(this->ike_sa_init_response_data)); + chunk_free(&(this->ike_sa_init_request_data)); if (this->my_ts) { traffic_selector_t *ts; @@ -664,7 +665,7 @@ static void destroy_after_state_change(private_ike_sa_init_responded_t *this) this->other_ts->destroy(this->other_ts); } - allocator_free(this); + free(this); } /* @@ -672,7 +673,7 @@ static void destroy_after_state_change(private_ike_sa_init_responded_t *this) */ ike_sa_init_responded_t *ike_sa_init_responded_create(protected_ike_sa_t *ike_sa, chunk_t received_nonce, chunk_t sent_nonce,chunk_t ike_sa_init_request_data, chunk_t ike_sa_init_response_data) { - private_ike_sa_init_responded_t *this = allocator_alloc_thing(private_ike_sa_init_responded_t); + private_ike_sa_init_responded_t *this = malloc_thing(private_ike_sa_init_responded_t); /* interface functions */ this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message; @@ -696,7 +697,7 @@ ike_sa_init_responded_t *ike_sa_init_responded_create(protected_ike_sa_t *ike_sa this->my_ts = NULL; this->other_ts = NULL; this->child_sa = NULL; - this->logger = charon->logger_manager->get_logger(charon->logger_manager, IKE_SA); + this->logger = logger_manager->get_logger(logger_manager, IKE_SA); return &(this->public); } diff --git a/Source/charon/sa/states/initiator_init.c b/Source/charon/sa/states/initiator_init.c index 85885130f..35d15235d 100644 --- a/Source/charon/sa/states/initiator_init.c +++ b/Source/charon/sa/states/initiator_init.c @@ -26,7 +26,6 @@ #include <daemon.h> #include <sa/states/state.h> #include <sa/states/ike_sa_init_requested.h> -#include <utils/allocator.h> #include <queues/jobs/retransmit_request_job.h> #include <crypto/diffie_hellman.h> #include <encoding/payloads/sa_payload.h> @@ -247,7 +246,7 @@ static void build_ke_payload(private_initiator_init_t *this, message_t *request) ke_payload->set_dh_group_number(ke_payload, dh_group); ke_payload->set_key_exchange_data(ke_payload, key_data); - allocator_free_chunk(&key_data); + chunk_free(&key_data); this->logger->log(this->logger, CONTROL|LEVEL2, "Add KE payload to message"); request->add_payload(request, (payload_t *) ke_payload); @@ -315,9 +314,9 @@ static void destroy(private_initiator_init_t *this) } if (this->sent_nonce.ptr != NULL) { - allocator_free(this->sent_nonce.ptr); + free(this->sent_nonce.ptr); } - allocator_free(this); + free(this); } /** @@ -326,7 +325,7 @@ static void destroy(private_initiator_init_t *this) static void destroy_after_state_change (private_initiator_init_t *this) { this->logger->log(this->logger, CONTROL | LEVEL3, "Going to destroy initiator_init_t state object"); - allocator_free(this); + free(this); } /* @@ -334,7 +333,7 @@ static void destroy_after_state_change (private_initiator_init_t *this) */ initiator_init_t *initiator_init_create(protected_ike_sa_t *ike_sa) { - private_initiator_init_t *this = allocator_alloc_thing(private_initiator_init_t); + private_initiator_init_t *this = malloc_thing(private_initiator_init_t); /* interface functions */ this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message; @@ -353,7 +352,7 @@ initiator_init_t *initiator_init_create(protected_ike_sa_t *ike_sa) /* private data */ this->ike_sa = ike_sa; - this->logger = charon->logger_manager->get_logger(charon->logger_manager, IKE_SA); + this->logger = logger_manager->get_logger(logger_manager, IKE_SA); this->sent_nonce = CHUNK_INITIALIZER; this->diffie_hellman = NULL; diff --git a/Source/charon/sa/states/responder_init.c b/Source/charon/sa/states/responder_init.c index 32aa6db86..10acf645c 100644 --- a/Source/charon/sa/states/responder_init.c +++ b/Source/charon/sa/states/responder_init.c @@ -25,7 +25,6 @@ #include <daemon.h> #include <sa/states/state.h> #include <sa/states/ike_sa_init_responded.h> -#include <utils/allocator.h> #include <encoding/payloads/sa_payload.h> #include <encoding/payloads/ke_payload.h> #include <encoding/payloads/nonce_payload.h> @@ -413,7 +412,7 @@ static status_t build_ke_payload(private_responder_init_t *this,ke_payload_t *ke ke_payload = ke_payload_create(); ke_payload->set_key_exchange_data(ke_payload,key_data); ke_payload->set_dh_group_number(ke_payload, this->dh_group_number); - allocator_free_chunk(&key_data); + chunk_free(&key_data); this->logger->log(this->logger, CONTROL|LEVEL2, "Add KE payload to message"); response->add_payload(response,(payload_t *) ke_payload); @@ -431,7 +430,7 @@ static status_t build_nonce_payload(private_responder_init_t *this,nonce_payload status_t status; this->logger->log(this->logger, CONTROL | LEVEL2, "Process received NONCE payload"); - allocator_free(this->received_nonce.ptr); + free(this->received_nonce.ptr); this->received_nonce = CHUNK_INITIALIZER; this->logger->log(this->logger, CONTROL | LEVEL2, "Get NONCE value and store it"); @@ -498,9 +497,9 @@ static void destroy(private_responder_init_t *this) this->logger->log(this->logger, CONTROL | LEVEL1, "Going to destroy responder init state object"); this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy sent nonce"); - allocator_free_chunk(&(this->sent_nonce)); + chunk_free(&(this->sent_nonce)); this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy received nonce"); - allocator_free_chunk(&(this->received_nonce)); + chunk_free(&(this->received_nonce)); if (this->diffie_hellman != NULL) { @@ -512,7 +511,7 @@ static void destroy(private_responder_init_t *this) this->proposal->destroy(this->proposal); } this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy object"); - allocator_free(this); + free(this); } /** @@ -534,7 +533,7 @@ static void destroy_after_state_change (private_responder_init_t *this) } this->logger->log(this->logger, CONTROL | LEVEL2, "Destroy object"); - allocator_free(this); + free(this); } /* @@ -542,7 +541,7 @@ static void destroy_after_state_change (private_responder_init_t *this) */ responder_init_t *responder_init_create(protected_ike_sa_t *ike_sa) { - private_responder_init_t *this = allocator_alloc_thing(private_responder_init_t); + private_responder_init_t *this = malloc_thing(private_responder_init_t); /* interface functions */ this->public.state_interface.process_message = (status_t (*) (state_t *,message_t *)) process_message; @@ -558,7 +557,7 @@ responder_init_t *responder_init_create(protected_ike_sa_t *ike_sa) /* private data */ this->ike_sa = ike_sa; - this->logger = charon->logger_manager->get_logger(charon->logger_manager, IKE_SA); + this->logger = logger_manager->get_logger(logger_manager, IKE_SA); this->sent_nonce = CHUNK_INITIALIZER; this->received_nonce = CHUNK_INITIALIZER; this->dh_group_number = MODP_UNDEFINED; |