]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Use size_t rather than unsigned for randomness related functions.
authorNiels Möller <nisse@lysator.liu.se>
Fri, 26 Apr 2013 08:53:36 +0000 (10:53 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Fri, 26 Apr 2013 08:53:36 +0000 (10:53 +0200)
knuth-lfib.c
knuth-lfib.h
nettle-types.h
yarrow.h
yarrow256.c

index e07c7af6570ffd94206598b5bd316cc891eedd8d..6f7bd623bdbc288f75df17966f2ce05a3b6ed15b 100644 (file)
@@ -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. */
index 85dce637bcaeddd5b6061afdb7e52c07b1f2e1a3..304f8881b4225970e94f5fc0206f6274987c4a44 100644 (file)
@@ -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
 }
index df68cc2bfaa528450f192ceb049834aa73a1a9b3..0c3727237e0aafa164ab1e3de4d5645dbea26180 100644 (file)
@@ -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);
index 8a0de5f696d8b404f44a401ed4625ce08e7eb177..fc6ccf9cbbb2668846f0d1b64880c8bd2823fda9 100644 (file)
--- a/yarrow.h
+++ b/yarrow.h
@@ -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);
index 39cb936643262440ba2854d98d398cd8965e116c..800e4fd658f516a7d40a905a54b35ff57a14a24c 100644 (file)
@@ -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);