chunk_t buffer;
};
-METHOD(prf_plus_t, get_bytes, void,
+METHOD(prf_plus_t, get_bytes, bool,
private_prf_plus_t *this, size_t length, u_int8_t *buffer)
{
size_t round, written = 0;
this->used += round;
written += round;
}
+ return TRUE;
}
METHOD(prf_plus_t, allocate_bytes, bool,
if (length)
{
*chunk = chunk_alloc(length);
- get_bytes(this, length, chunk->ptr);
- }
- else
- {
- *chunk = chunk_empty;
+ return get_bytes(this, length, chunk->ptr);
}
+ *chunk = chunk_empty;
return TRUE;
}
*
* @param length number of bytes to get
* @param buffer pointer where the generated bytes will be written
+ * @return TRUE if bytes generated successfully
*/
- void (*get_bytes) (prf_plus_t *this, size_t length, u_int8_t *buffer);
+ __attribute__((warn_unused_result))
+ bool (*get_bytes) (prf_plus_t *this, size_t length, u_int8_t *buffer);
/**
* Allocate pseudo random bytes.