diff options
author | Martin Willi <martin@revosec.ch> | 2012-01-10 16:02:46 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-03-20 17:31:35 +0100 |
commit | 3fca5bd123021dadada62557798ec1f7b107a41a (patch) | |
tree | 46967fb9c1704cb3575324699301ff1e68b7cb6e /src | |
parent | 31689338d616b157c4e3f254bc9e8ba400488095 (diff) | |
download | strongswan-3fca5bd123021dadada62557798ec1f7b107a41a.tar.bz2 strongswan-3fca5bd123021dadada62557798ec1f7b107a41a.tar.xz |
Check if we have an RNG for IKEv1 task manager before using it
Diffstat (limited to 'src')
-rwxr-xr-x | src/libcharon/sa/ikev1/task_manager_v1.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libcharon/sa/ikev1/task_manager_v1.c b/src/libcharon/sa/ikev1/task_manager_v1.c index 01427f6ea..c07df41f0 100755 --- a/src/libcharon/sa/ikev1/task_manager_v1.c +++ b/src/libcharon/sa/ikev1/task_manager_v1.c @@ -334,12 +334,6 @@ METHOD(task_manager_t, initiate, status_t, exchange_type_t exchange = EXCHANGE_TYPE_UNDEFINED; bool new_mid = FALSE, expect_response = FALSE, flushed = FALSE; - if (!this->rng) - { - DBG1(DBG_IKE, "no RNG supported"); - return FAILED; - } - if (this->initiating.type != EXCHANGE_TYPE_UNDEFINED) { DBG2(DBG_IKE, "delaying task initiation, %N exchange in progress", @@ -1132,7 +1126,7 @@ METHOD(task_manager_t, process_message, status_t, job = (job_t*)delete_ike_sa_job_create(ike_sa_id, FALSE); lib->scheduler->schedule_job(lib->scheduler, job, lib->settings->get_int(lib->settings, - "charon.half_open_timeout", HALF_OPEN_IKE_SA_TIMEOUT)); + "charon.half_open_timeout", HALF_OPEN_IKE_SA_TIMEOUT)); } this->ike_sa->set_statistic(this->ike_sa, STAT_INBOUND, time_monotonic(NULL)); @@ -1482,9 +1476,15 @@ task_manager_v1_t *task_manager_v1_create(ike_sa_t *ike_sa) "charon.retransmit_base", RETRANSMIT_BASE), ); - this->rng->get_bytes(this->rng, sizeof(this->dpd_send_seqnr), - (void*)&this->dpd_send_seqnr); + if (!this->rng) + { + DBG1(DBG_IKE, "no RNG found, unable to create IKE_SA"); + destroy(this); + return NULL; + } + this->rng->get_bytes(this->rng, sizeof(this->dpd_send_seqnr), + (void*)&this->dpd_send_seqnr); this->dpd_send_seqnr &= 0x7FFFFFFF; return &this->public; |