Nonce: Let get_nonce, allocate_nonce return boolean
This commit is contained in:
committed by
Martin Willi
parent
f3ca96b2bf
commit
605985d122
@@ -35,16 +35,18 @@ struct nonce_gen_t {
|
||||
*
|
||||
* @param size size of nonce in bytes
|
||||
* @param buffer pointer where the generated nonce will be written
|
||||
* @return TRUE if nonce allocation was succesful, FALSE otherwise
|
||||
*/
|
||||
void (*get_nonce) (nonce_gen_t *this, size_t size, u_int8_t *buffer);
|
||||
bool (*get_nonce) (nonce_gen_t *this, size_t size, u_int8_t *buffer);
|
||||
|
||||
/**
|
||||
* Generates a nonce and allocates space for it.
|
||||
*
|
||||
* @param size size of nonce in bytes
|
||||
* @param chunk chunk which will hold the generated nonce
|
||||
* @return TRUE if nonce allocation was succesful, FALSE otherwise
|
||||
*/
|
||||
void (*allocate_nonce) (nonce_gen_t *this, size_t size, chunk_t *chunk);
|
||||
bool (*allocate_nonce) (nonce_gen_t *this, size_t size, chunk_t *chunk);
|
||||
|
||||
/**
|
||||
* Destroys a nonce generator object.
|
||||
|
||||
@@ -35,16 +35,18 @@ struct private_nonce_nonceg_t {
|
||||
rng_t* rng;
|
||||
};
|
||||
|
||||
METHOD(nonce_gen_t, get_nonce, void,
|
||||
METHOD(nonce_gen_t, get_nonce, bool,
|
||||
private_nonce_nonceg_t *this, size_t size, u_int8_t *buffer)
|
||||
{
|
||||
this->rng->get_bytes(this->rng, size, buffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(nonce_gen_t, allocate_nonce, void,
|
||||
METHOD(nonce_gen_t, allocate_nonce, bool,
|
||||
private_nonce_nonceg_t *this, size_t size, chunk_t *chunk)
|
||||
{
|
||||
this->rng->allocate_bytes(this->rng, size, chunk);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(nonce_gen_t, destroy, void,
|
||||
|
||||
Reference in New Issue
Block a user