aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/sa
diff options
context:
space:
mode:
Diffstat (limited to 'Source/charon/sa')
-rw-r--r--Source/charon/sa/authenticator.c15
-rw-r--r--Source/charon/sa/ike_sa.c18
-rw-r--r--Source/charon/sa/ike_sa.h20
3 files changed, 43 insertions, 10 deletions
diff --git a/Source/charon/sa/authenticator.c b/Source/charon/sa/authenticator.c
index 32817b0a1..3aeb8795f 100644
--- a/Source/charon/sa/authenticator.c
+++ b/Source/charon/sa/authenticator.c
@@ -250,15 +250,14 @@ static status_t verify_auth_data (private_authenticator_t *this,
auth_data = auth_payload->get_data(auth_payload);
- status = charon->credentials->get_rsa_public_key(charon->credentials,
- other_id,
- &public_key);
- if (status != SUCCESS)
+ public_key = charon->credentials->get_rsa_public_key(charon->credentials,
+ other_id);
+ if (public_key == NULL)
{
this->logger->log(this->logger, ERROR|LEVEL1, "No RSA public key found for %s",
other_id->get_string(other_id));
other_id->destroy(other_id);
- return status;
+ return NOT_FOUND;
}
octets = this->allocate_octets(this,last_received_packet, my_nonce,other_id_payload, initiator);
@@ -338,13 +337,13 @@ static status_t compute_auth_data (private_authenticator_t *this,
status_t status;
chunk_t octets, auth_data;
- status = charon->credentials->get_rsa_private_key(charon->credentials, my_id, &private_key);
- if (status != SUCCESS)
+ private_key = charon->credentials->get_rsa_private_key(charon->credentials, my_id);
+ if (private_key == NULL)
{
this->logger->log(this->logger, ERROR|LEVEL1, "No RSA private key found for %s",
my_id->get_string(my_id));
my_id->destroy(my_id);
- return status;
+ return NOT_FOUND;
}
my_id->destroy(my_id);
diff --git a/Source/charon/sa/ike_sa.c b/Source/charon/sa/ike_sa.c
index 63879f1f2..def0013fc 100644
--- a/Source/charon/sa/ike_sa.c
+++ b/Source/charon/sa/ike_sa.c
@@ -374,6 +374,22 @@ static host_t* get_other_host(private_ike_sa_t *this)
}
/**
+ * Implementation of ike_sa_t.get_my_id.
+ */
+static identification_t* get_my_id(private_ike_sa_t *this)
+{
+ return this->connection->get_my_id(this->connection);;
+}
+
+/**
+ * Implementation of ike_sa_t.get_other_id.
+ */
+static identification_t* get_other_id(private_ike_sa_t *this)
+{
+ return this->connection->get_other_id(this->connection);;
+}
+
+/**
* Implementation of private_ike_sa_t.resend_last_reply.
*/
static status_t resend_last_reply(private_ike_sa_t *this)
@@ -1054,6 +1070,8 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
this->protected.public.get_id = (ike_sa_id_t*(*)(ike_sa_t*)) get_id;
this->protected.public.get_my_host = (host_t*(*)(ike_sa_t*)) get_my_host;
this->protected.public.get_other_host = (host_t*(*)(ike_sa_t*)) get_other_host;
+ this->protected.public.get_my_id = (identification_t*(*)(ike_sa_t*)) get_my_id;
+ this->protected.public.get_other_id = (identification_t*(*)(ike_sa_t*)) get_other_id;
this->protected.public.retransmit_request = (status_t (*) (ike_sa_t *, u_int32_t)) retransmit_request;
this->protected.public.get_state = (ike_sa_state_t (*) (ike_sa_t *this)) get_state;
this->protected.public.send_delete_ike_sa_request = (void (*)(ike_sa_t*)) send_delete_ike_sa_request;
diff --git a/Source/charon/sa/ike_sa.h b/Source/charon/sa/ike_sa.h
index 92c73391f..8b58bfe68 100644
--- a/Source/charon/sa/ike_sa.h
+++ b/Source/charon/sa/ike_sa.h
@@ -35,8 +35,8 @@
#include <crypto/prfs/prf.h>
#include <crypto/crypters/crypter.h>
#include <crypto/signers/signer.h>
-#include <config/connection.h>
-#include <config/policy.h>
+#include <config/connections/connection.h>
+#include <config/policies/policy.h>
/**
* Nonce size in bytes for nonces sending to other peer.
@@ -136,6 +136,22 @@ struct ike_sa_t {
* @return remote host_t
*/
host_t* (*get_other_host) (ike_sa_t *this);
+
+ /**
+ * @brief Get own ID of the IKE_SA.
+ *
+ * @param this calling object
+ * @return local identification_t
+ */
+ identification_t* (*get_my_id) (ike_sa_t *this);
+
+ /**
+ * @brief Get remote ID the IKE_SA.
+ *
+ * @param this calling object
+ * @return remote identification_t
+ */
+ identification_t* (*get_other_id) (ike_sa_t *this);
/**
* @brief Get the state of type of associated state object.