RNGs' get_bytes and allocate_bytes return boolean

This commit is contained in:
Tobias Brunner
2012-07-16 14:53:34 +02:00
committed by Martin Willi
parent 605985d122
commit 39e807728e
6 changed files with 39 additions and 21 deletions
@@ -40,7 +40,7 @@ struct private_random_rng_t {
int fd;
};
METHOD(rng_t, get_bytes, void,
METHOD(rng_t, get_bytes, bool,
private_random_rng_t *this, size_t bytes, u_int8_t *buffer)
{
size_t done;
@@ -59,13 +59,15 @@ METHOD(rng_t, get_bytes, void,
}
done += got;
}
return TRUE;
}
METHOD(rng_t, allocate_bytes, void,
METHOD(rng_t, allocate_bytes, bool,
private_random_rng_t *this, size_t bytes, chunk_t *chunk)
{
*chunk = chunk_alloc(bytes);
get_bytes(this, chunk->len, chunk->ptr);
return TRUE;
}
METHOD(rng_t, destroy, void,