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
@@ -843,7 +843,10 @@ METHOD(crypto_tester_t, test_prf, bool,
failed = FALSE;
key = chunk_create(vector->key, vector->key_size);
prf->set_key(prf, key);
if (!prf->set_key(prf, key))
{
failed = TRUE;
}
/* allocated bytes */
seed = chunk_create(vector->seed, vector->len);
@@ -863,7 +866,10 @@ METHOD(crypto_tester_t, test_prf, bool,
memset(out.ptr, 0, out.len);
if (vector->stateful)
{
prf->set_key(prf, key);
if (!prf->set_key(prf, key))
{
failed = TRUE;
}
}
if (!prf->get_bytes(prf, seed, out.ptr))
{
@@ -879,7 +885,10 @@ METHOD(crypto_tester_t, test_prf, bool,
memset(out.ptr, 0, out.len);
if (vector->stateful)
{
prf->set_key(prf, key);
if (!prf->set_key(prf, key))
{
failed = TRUE;
}
}
if (!prf->allocate_bytes(prf, chunk_create(seed.ptr, 1), NULL) ||
!prf->get_bytes(prf, chunk_create(seed.ptr + 1, 1), NULL) ||