Add a return value to prf_t.set_key()

This commit is contained in:
Martin Willi
2012-07-16 14:53:34 +02:00
parent ecc080b393
commit f3ca96b2bf
12 changed files with 92 additions and 43 deletions
+12 -3
View File
@@ -129,7 +129,10 @@ METHOD(simaka_crypto_t, derive_keys_full, bool,
DBG3(DBG_LIB, "MK %B", mk);
/* K_encr | K_auth | MSK | EMSK = prf() | prf() | prf() | prf() */
this->prf->set_key(this->prf, *mk);
if (this->prf->set_key(this->prf, *mk))
{
return FALSE;
}
str = chunk_alloca(this->prf->get_block_size(this->prf) * 3);
for (i = 0; i < 3; i++)
{
@@ -167,7 +170,10 @@ METHOD(simaka_crypto_t, derive_keys_reauth, bool,
int i;
/* K_encr | K_auth = prf() | prf() */
this->prf->set_key(this->prf, mk);
if (!this->prf->set_key(this->prf, mk))
{
return FALSE;
}
str = chunk_alloca(this->prf->get_block_size(this->prf) * 2);
for (i = 0; i < 2; i++)
{
@@ -207,7 +213,10 @@ METHOD(simaka_crypto_t, derive_keys_reauth_msk, bool,
this->hasher->get_hash(this->hasher, mk, xkey);
/* MSK | EMSK = prf() | prf() | prf() | prf() */
this->prf->set_key(this->prf, chunk_create(xkey, sizeof(xkey)));
if (!this->prf->set_key(this->prf, chunk_create(xkey, sizeof(xkey))))
{
return FALSE;
}
str = chunk_alloca(this->prf->get_block_size(this->prf) * 2);
for (i = 0; i < 2; i++)
{