added API for random number generators, served through credential factory

ported randomizer_t to a rng_t on top of /dev/(u)random (plugin random)
This commit is contained in:
Martin Willi
2008-04-15 05:56:35 +00:00
parent 0644ebd3de
commit 6a365f0740
33 changed files with 700 additions and 451 deletions
+3 -16
View File
@@ -23,7 +23,6 @@
#include <debug.h>
#include <printf_hook.h>
#include <utils/randomizer.h>
/**
* Empty chunk.
@@ -285,22 +284,10 @@ void chunk_free(chunk_t *chunk)
/**
* Described in header.
*/
void chunk_free_randomized(chunk_t *chunk)
void chunk_clear(chunk_t *chunk)
{
if (chunk->ptr)
{
if (chunk->len > 0)
{
randomizer_t *randomizer = randomizer_create();
randomizer->get_pseudo_random_bytes(randomizer,
chunk->len, chunk->ptr);
randomizer->destroy(randomizer);
};
free(chunk->ptr);
chunk->ptr = NULL;
}
chunk->len = 0;
memset(chunk->ptr, 0, chunk->len);
chunk_free(chunk);
}
/**