diff options
Diffstat (limited to 'src/rnd.c')
-rw-r--r-- | src/rnd.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/rnd.c b/src/rnd.c new file mode 100644 index 0000000..1203e29 --- /dev/null +++ b/src/rnd.c @@ -0,0 +1,22 @@ +#include "rnd.h" +#include "util_rt.h" + + +void prne_init_rnd (prne_rnd_t *p) { + prne_memzero(p, sizeof(prne_rnd_t)); +} + +void prne_free_rnd (prne_rnd_t *p) { + if (p == NULL) { + return; + } + + if (p->free_ctx_f != NULL) { + p->free_ctx_f(p->ctx); + } + prne_memzero(p, sizeof(prne_rnd_t)); +} + +bool prne_rnd (prne_rnd_t *p, uint8_t *buf, const size_t len) { + return p->random(p->ctx, buf, len); +} |