Add a return value to prf_plus_t.allocate_bytes()

This commit is contained in:
Martin Willi
2012-07-16 14:53:33 +02:00
parent 2d56575d52
commit 5d79e6c6b4
4 changed files with 81 additions and 19 deletions
+14 -4
View File
@@ -614,16 +614,26 @@ METHOD(keymat_v1_t, derive_child_keys, bool,
DBG4(DBG_CHD, "initiator SA seed %B", &seed);
prf_plus = prf_plus_create(this->prf, FALSE, seed);
prf_plus->allocate_bytes(prf_plus, enc_size, encr_i);
prf_plus->allocate_bytes(prf_plus, int_size, integ_i);
if (!prf_plus->allocate_bytes(prf_plus, enc_size, encr_i) ||
!prf_plus->allocate_bytes(prf_plus, int_size, integ_i))
{
prf_plus->destroy(prf_plus);
chunk_clear(&secret);
return FALSE;
}
prf_plus->destroy(prf_plus);
seed = chunk_cata("ccccc", secret, chunk_from_thing(protocol),
chunk_from_thing(spi_i), nonce_i, nonce_r);
DBG4(DBG_CHD, "responder SA seed %B", &seed);
prf_plus = prf_plus_create(this->prf, FALSE, seed);
prf_plus->allocate_bytes(prf_plus, enc_size, encr_r);
prf_plus->allocate_bytes(prf_plus, int_size, integ_r);
if (!prf_plus->allocate_bytes(prf_plus, enc_size, encr_r) ||
!prf_plus->allocate_bytes(prf_plus, int_size, integ_r))
{
prf_plus->destroy(prf_plus);
chunk_clear(&secret);
return FALSE;
}
prf_plus->destroy(prf_plus);
chunk_clear(&secret);