Commit eb7c996e authored by Niels Möller's avatar Niels Möller

Use size_t rather than unsigned for randomness related functions.

parent 220812bc
......@@ -117,7 +117,7 @@ knuth_lfib_get(struct knuth_lfib_ctx *ctx)
/* NOTE: Not at all optimized. */
void
knuth_lfib_get_array(struct knuth_lfib_ctx *ctx,
unsigned n, uint32_t *a)
size_t n, uint32_t *a)
{
unsigned i;
......@@ -128,7 +128,7 @@ knuth_lfib_get_array(struct knuth_lfib_ctx *ctx,
/* NOTE: Not at all optimized. */
void
knuth_lfib_random(struct knuth_lfib_ctx *ctx,
unsigned n, uint8_t *dst)
size_t n, uint8_t *dst)
{
/* Use 24 bits from each number, xoring together some of the
bits. */
......
......@@ -61,12 +61,12 @@ knuth_lfib_get(struct knuth_lfib_ctx *ctx);
/* Get an array of numbers */
void
knuth_lfib_get_array(struct knuth_lfib_ctx *ctx,
unsigned n, uint32_t *a);
size_t n, uint32_t *a);
/* Get an array of octets. */
void
knuth_lfib_random(struct knuth_lfib_ctx *ctx,
unsigned n, uint8_t *dst);
size_t n, uint8_t *dst);
#ifdef __cplusplus
}
......
......@@ -34,7 +34,7 @@ extern "C" {
/* Randomness. Used by key generation and dsa signature creation. */
typedef void nettle_random_func(void *ctx,
unsigned length, uint8_t *dst);
size_t length, uint8_t *dst);
/* Progress report function, mainly for key generation. */
typedef void nettle_progress_func(void *ctx, int c);
......
......@@ -87,17 +87,17 @@ yarrow256_init(struct yarrow256_ctx *ctx,
void
yarrow256_seed(struct yarrow256_ctx *ctx,
unsigned length,
size_t length,
const uint8_t *seed_file);
/* Returns 1 on reseed */
int
yarrow256_update(struct yarrow256_ctx *ctx,
unsigned source, unsigned entropy,
unsigned length, const uint8_t *data);
size_t length, const uint8_t *data);
void
yarrow256_random(struct yarrow256_ctx *ctx, unsigned length, uint8_t *dst);
yarrow256_random(struct yarrow256_ctx *ctx, size_t length, uint8_t *dst);
int
yarrow256_is_seeded(struct yarrow256_ctx *ctx);
......
......@@ -101,7 +101,7 @@ yarrow256_init(struct yarrow256_ctx *ctx,
void
yarrow256_seed(struct yarrow256_ctx *ctx,
unsigned length,
size_t length,
const uint8_t *seed_file)
{
assert(length > 0);
......@@ -228,7 +228,7 @@ yarrow256_slow_reseed(struct yarrow256_ctx *ctx)
int
yarrow256_update(struct yarrow256_ctx *ctx,
unsigned source_index, unsigned entropy,
unsigned length, const uint8_t *data)
size_t length, const uint8_t *data)
{
enum yarrow_pool_id current;
struct yarrow_source *source;
......@@ -315,7 +315,7 @@ yarrow_gate(struct yarrow256_ctx *ctx)
}
void
yarrow256_random(struct yarrow256_ctx *ctx, unsigned length, uint8_t *dst)
yarrow256_random(struct yarrow256_ctx *ctx, size_t length, uint8_t *dst)
{
assert(ctx->seeded);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment