Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brian Smith
nettle
Commits
2e98908a
Commit
2e98908a
authored
16 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
(yarrow256_seed): Disallow length == 0.
Rev: nettle/yarrow256.c:1.3
parent
122b8a1b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
yarrow256.c
+2
-11
2 additions, 11 deletions
yarrow256.c
with
2 additions
and
11 deletions
yarrow256.c
+
2
−
11
View file @
2e98908a
...
...
@@ -109,9 +109,7 @@ yarrow256_seed(struct yarrow256_ctx *ctx,
unsigned
length
,
const
uint8_t
*
seed_file
)
{
/* FIXME: Perhaps it's better to use assert ? */
if
(
!
length
)
return
;
assert
(
length
>
0
);
sha256_update
(
&
ctx
->
pools
[
YARROW_FAST
],
length
,
seed_file
);
yarrow_fast_reseed
(
ctx
);
...
...
@@ -133,7 +131,7 @@ yarrow_generate_block(struct yarrow256_ctx *ctx,
* machine independent, and follows appendix B of the NIST
* specification of cipher modes of operation.
*
* We could keep a representation of th
y
counter as 4 32-bit values,
* We could keep a representation of th
e
counter as 4 32-bit values,
* and write entire words (in big-endian byteorder) into the counter
* block, whenever they change. */
for
(
i
=
sizeof
(
ctx
->
counter
);
i
--
;
)
...
...
@@ -278,9 +276,6 @@ yarrow256_update(struct yarrow256_ctx *ctx,
&&
(
entropy
>
YARROW_MULTIPLIER
*
length
)
)
entropy
=
YARROW_MULTIPLIER
*
length
;
/* FIXME: Calling a more sophisticated estimator could be done
* here. */
entropy
+=
source
->
estimate
[
current
];
if
(
entropy
>
YARROW_MAX_ENTROPY
)
entropy
=
YARROW_MAX_ENTROPY
;
...
...
@@ -308,10 +303,6 @@ yarrow256_update(struct yarrow256_ctx *ctx,
case
YARROW_SLOW
:
{
/* FIXME: This is somewhat inefficient. It would be better to
* either maintain the count, or do this loop only if the
* current source just crossed the threshold. */
if
(
!
yarrow256_needed_sources
(
ctx
))
{
yarrow_slow_reseed
(
ctx
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment