aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/sa/states
diff options
context:
space:
mode:
Diffstat (limited to 'Source/charon/sa/states')
-rw-r--r--Source/charon/sa/states/Makefile.states14
-rw-r--r--Source/charon/sa/states/ike_auth_requested.c4
-rw-r--r--Source/charon/sa/states/ike_sa_init_requested.c2
-rw-r--r--Source/charon/sa/states/ike_sa_init_requested.h2
-rw-r--r--Source/charon/sa/states/ike_sa_init_responded.c4
-rw-r--r--Source/charon/sa/states/initiator_init.c25
-rw-r--r--Source/charon/sa/states/responder_init.c9
7 files changed, 38 insertions, 22 deletions
diff --git a/Source/charon/sa/states/Makefile.states b/Source/charon/sa/states/Makefile.states
index 69517ea96..a258ebef0 100644
--- a/Source/charon/sa/states/Makefile.states
+++ b/Source/charon/sa/states/Makefile.states
@@ -14,30 +14,30 @@
STATES_DIR= $(SA_DIR)states/
-OBJS+= $(BUILD_DIR)ike_auth_requested.o
+CHARON_OBJS+= $(BUILD_DIR)ike_auth_requested.o
$(BUILD_DIR)ike_auth_requested.o : $(STATES_DIR)ike_auth_requested.c $(STATES_DIR)ike_auth_requested.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)ike_sa_established.o
+CHARON_OBJS+= $(BUILD_DIR)ike_sa_established.o
$(BUILD_DIR)ike_sa_established.o : $(STATES_DIR)ike_sa_established.c $(STATES_DIR)ike_sa_established.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)ike_sa_init_requested.o
+CHARON_OBJS+= $(BUILD_DIR)ike_sa_init_requested.o
$(BUILD_DIR)ike_sa_init_requested.o : $(STATES_DIR)ike_sa_init_requested.c $(STATES_DIR)ike_sa_init_requested.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)ike_sa_init_responded.o
+CHARON_OBJS+= $(BUILD_DIR)ike_sa_init_responded.o
$(BUILD_DIR)ike_sa_init_responded.o : $(STATES_DIR)ike_sa_init_responded.c $(STATES_DIR)ike_sa_init_responded.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)initiator_init.o
+CHARON_OBJS+= $(BUILD_DIR)initiator_init.o
$(BUILD_DIR)initiator_init.o : $(STATES_DIR)initiator_init.c $(STATES_DIR)initiator_init.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)responder_init.o
+CHARON_OBJS+= $(BUILD_DIR)responder_init.o
$(BUILD_DIR)responder_init.o : $(STATES_DIR)responder_init.c $(STATES_DIR)responder_init.h
$(CC) $(CFLAGS) -c -o $@ $<
-OBJS+= $(BUILD_DIR)state.o
+CHARON_OBJS+= $(BUILD_DIR)state.o
$(BUILD_DIR)state.o : $(STATES_DIR)state.c $(STATES_DIR)state.h
$(CC) $(CFLAGS) -c -o $@ $< \ No newline at end of file
diff --git a/Source/charon/sa/states/ike_auth_requested.c b/Source/charon/sa/states/ike_auth_requested.c
index 16eea7b03..b037cfcd9 100644
--- a/Source/charon/sa/states/ike_auth_requested.c
+++ b/Source/charon/sa/states/ike_auth_requested.c
@@ -29,8 +29,8 @@
#include <encoding/payloads/id_payload.h>
#include <encoding/payloads/auth_payload.h>
#include <encoding/payloads/notify_payload.h>
-#include <transforms/signers/signer.h>
-#include <transforms/crypters/crypter.h>
+#include <crypto/signers/signer.h>
+#include <crypto/crypters/crypter.h>
#include <sa/states/ike_sa_established.h>
#include <sa/authenticator.h>
#include <sa/child_sa.h>
diff --git a/Source/charon/sa/states/ike_sa_init_requested.c b/Source/charon/sa/states/ike_sa_init_requested.c
index a5b7fbcbd..8d3ae55ed 100644
--- a/Source/charon/sa/states/ike_sa_init_requested.c
+++ b/Source/charon/sa/states/ike_sa_init_requested.c
@@ -31,7 +31,7 @@
#include <encoding/payloads/id_payload.h>
#include <encoding/payloads/auth_payload.h>
#include <encoding/payloads/ts_payload.h>
-#include <transforms/diffie_hellman.h>
+#include <crypto/diffie_hellman.h>
#include <sa/states/ike_auth_requested.h>
#include <sa/states/initiator_init.h>
#include <sa/authenticator.h>
diff --git a/Source/charon/sa/states/ike_sa_init_requested.h b/Source/charon/sa/states/ike_sa_init_requested.h
index 1fe0a6d1d..0a43afad1 100644
--- a/Source/charon/sa/states/ike_sa_init_requested.h
+++ b/Source/charon/sa/states/ike_sa_init_requested.h
@@ -27,7 +27,7 @@
#include <types.h>
#include <sa/ike_sa.h>
#include <sa/states/state.h>
-#include <transforms/diffie_hellman.h>
+#include <crypto/diffie_hellman.h>
typedef struct ike_sa_init_requested_t ike_sa_init_requested_t;
diff --git a/Source/charon/sa/states/ike_sa_init_responded.c b/Source/charon/sa/states/ike_sa_init_responded.c
index eef8ea3c4..52548749a 100644
--- a/Source/charon/sa/states/ike_sa_init_responded.c
+++ b/Source/charon/sa/states/ike_sa_init_responded.c
@@ -31,8 +31,8 @@
#include <encoding/payloads/id_payload.h>
#include <encoding/payloads/auth_payload.h>
#include <encoding/payloads/notify_payload.h>
-#include <transforms/signers/signer.h>
-#include <transforms/crypters/crypter.h>
+#include <crypto/signers/signer.h>
+#include <crypto/crypters/crypter.h>
#include <sa/states/ike_sa_established.h>
diff --git a/Source/charon/sa/states/initiator_init.c b/Source/charon/sa/states/initiator_init.c
index 18ffe0e0a..85885130f 100644
--- a/Source/charon/sa/states/initiator_init.c
+++ b/Source/charon/sa/states/initiator_init.c
@@ -28,7 +28,7 @@
#include <sa/states/ike_sa_init_requested.h>
#include <utils/allocator.h>
#include <queues/jobs/retransmit_request_job.h>
-#include <transforms/diffie_hellman.h>
+#include <crypto/diffie_hellman.h>
#include <encoding/payloads/sa_payload.h>
#include <encoding/payloads/ke_payload.h>
#include <encoding/payloads/nonce_payload.h>
@@ -92,7 +92,7 @@ struct private_initiator_init_t {
* @param this calling object
* @param request message_t object to add the NONCE payload
*/
- void (*build_nonce_payload) (private_initiator_init_t *this,message_t *request);
+ status_t (*build_nonce_payload) (private_initiator_init_t *this,message_t *request);
/**
* Destroy function called internally of this class after state change to state
@@ -177,9 +177,14 @@ status_t retry_initiate_connection (private_initiator_init_t *this, diffie_hellm
this->build_ke_payload(this, message);
/* build Nonce payload */
- this->build_nonce_payload(this,message);
-
-
+ status = this->build_nonce_payload(this, message);
+ if (status != SUCCESS)
+ {
+ this->logger->log(this->logger, ERROR, "Building nonce payload failed. Aborting");
+ message->destroy(message);
+ return DELETE_ME;
+ }
+
/* message can now be sent (must not be destroyed) */
status = this->ike_sa->send_request(this->ike_sa, message);
if (status != SUCCESS)
@@ -251,17 +256,22 @@ static void build_ke_payload(private_initiator_init_t *this, message_t *request)
/**
* Implementation of private_initiator_init_t.build_nonce_payload.
*/
-static void build_nonce_payload(private_initiator_init_t *this, message_t *request)
+static status_t build_nonce_payload(private_initiator_init_t *this, message_t *request)
{
nonce_payload_t *nonce_payload;
randomizer_t *randomizer;
+ status_t status;
this->logger->log(this->logger, CONTROL|LEVEL1, "Building NONCE payload");
this->logger->log(this->logger, CONTROL|LEVEL2, "Get pseudo random bytes for NONCE");
randomizer = this->ike_sa->get_randomizer(this->ike_sa);
- randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce));
+ status = randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce));
+ if (status != SUCCESS)
+ {
+ return status;
+ }
this->logger->log(this->logger, RAW|LEVEL2, "Initiator NONCE",&(this->sent_nonce));
@@ -271,6 +281,7 @@ static void build_nonce_payload(private_initiator_init_t *this, message_t *reque
this->logger->log(this->logger, CONTROL|LEVEL2, "Add NONCE payload to message");
request->add_payload(request, (payload_t *) nonce_payload);
+ return SUCCESS;
}
/**
diff --git a/Source/charon/sa/states/responder_init.c b/Source/charon/sa/states/responder_init.c
index 2710080a0..32aa6db86 100644
--- a/Source/charon/sa/states/responder_init.c
+++ b/Source/charon/sa/states/responder_init.c
@@ -30,7 +30,7 @@
#include <encoding/payloads/ke_payload.h>
#include <encoding/payloads/nonce_payload.h>
#include <encoding/payloads/notify_payload.h>
-#include <transforms/diffie_hellman.h>
+#include <crypto/diffie_hellman.h>
typedef struct private_responder_init_t private_responder_init_t;
@@ -428,6 +428,7 @@ static status_t build_nonce_payload(private_responder_init_t *this,nonce_payload
{
nonce_payload_t *nonce_payload;
randomizer_t *randomizer;
+ status_t status;
this->logger->log(this->logger, CONTROL | LEVEL2, "Process received NONCE payload");
allocator_free(this->received_nonce.ptr);
@@ -439,7 +440,11 @@ static status_t build_nonce_payload(private_responder_init_t *this,nonce_payload
this->logger->log(this->logger, CONTROL | LEVEL2, "Create new NONCE value.");
randomizer = this->ike_sa->get_randomizer(this->ike_sa);
- randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce));
+ status = randomizer->allocate_pseudo_random_bytes(randomizer, NONCE_SIZE, &(this->sent_nonce));
+ if (status != SUCCESS)
+ {
+ return status;
+ }
this->logger->log(this->logger, CONTROL|LEVEL2, "Building NONCE payload");
nonce_payload = nonce_payload_create();