Nonce: Let get_nonce, allocate_nonce return boolean

This commit is contained in:
Reto Buerki
2012-07-16 14:53:34 +02:00
committed by Martin Willi
parent f3ca96b2bf
commit 605985d122
6 changed files with 39 additions and 9 deletions
+12 -2
View File
@@ -263,7 +263,12 @@ METHOD(task_t, build_i, status_t,
DBG1(DBG_IKE, "no nonce generator found to create nonce");
return FAILED;
}
nonceg->allocate_nonce(nonceg, NONCE_SIZE, &this->my_nonce);
if (!nonceg->allocate_nonce(nonceg, NONCE_SIZE, &this->my_nonce))
{
DBG1(DBG_IKE, "nonce allocation failed");
nonceg->destroy(nonceg);
return FAILED;
}
nonceg->destroy(nonceg);
}
@@ -302,7 +307,12 @@ METHOD(task_t, process_r, status_t,
DBG1(DBG_IKE, "no nonce generator found to create nonce");
return FAILED;
}
nonceg->allocate_nonce(nonceg, NONCE_SIZE, &this->my_nonce);
if (!nonceg->allocate_nonce(nonceg, NONCE_SIZE, &this->my_nonce))
{
DBG1(DBG_IKE, "nonce allocation failed");
nonceg->destroy(nonceg);
return FAILED;
}
nonceg->destroy(nonceg);
#ifdef ME