Add a return value to prf_t.set_key()
This commit is contained in:
@@ -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) ||
|
||||
|
||||
@@ -70,10 +70,11 @@ METHOD(prf_t, get_key_size, size_t,
|
||||
return this->mac->get_mac_size(this->mac);
|
||||
}
|
||||
|
||||
METHOD(prf_t, set_key, void,
|
||||
METHOD(prf_t, set_key, bool,
|
||||
private_prf_t *this, chunk_t key)
|
||||
{
|
||||
this->mac->set_key(this->mac, key);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(prf_t, destroy, void,
|
||||
|
||||
@@ -113,8 +113,10 @@ struct prf_t {
|
||||
* Set the key for this prf_t object.
|
||||
*
|
||||
* @param key key to set
|
||||
* @return TRUE if key set successfully
|
||||
*/
|
||||
void (*set_key) (prf_t *this, chunk_t key);
|
||||
__attribute__((warn_unused_result))
|
||||
bool (*set_key) (prf_t *this, chunk_t key);
|
||||
|
||||
/**
|
||||
* Destroys a prf object.
|
||||
|
||||
Reference in New Issue
Block a user