Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Brian Smith
nettle
Commits
eb7c996e
Commit
eb7c996e
authored
Apr 26, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use size_t rather than unsigned for randomness related functions.
parent
220812bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
knuth-lfib.c
knuth-lfib.c
+2
-2
knuth-lfib.h
knuth-lfib.h
+2
-2
nettle-types.h
nettle-types.h
+1
-1
yarrow.h
yarrow.h
+3
-3
yarrow256.c
yarrow256.c
+3
-3
No files found.
knuth-lfib.c
View file @
eb7c996e
...
...
@@ -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. */
...
...
knuth-lfib.h
View file @
eb7c996e
...
...
@@ -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
}
...
...
nettle-types.h
View file @
eb7c996e
...
...
@@ -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
);
...
...
yarrow.h
View file @
eb7c996e
...
...
@@ -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
);
...
...
yarrow256.c
View file @
eb7c996e
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment