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

* src/lsh-make-seed.c (main): Updated for new yarrow interface in

nettle-2.0.
* src/seed_file.c (seed_file_write): Likewise, generate seed file
with yarrow256_random.

Rev: src/lsh-make-seed.c:1.25
Rev: src/seed_file.c:1.3
parent 56ce86e9
......@@ -1089,16 +1089,19 @@ main(int argc, char **argv)
get_interact(&yarrow, SOURCE_USER);
}
if (!options->sloppy && !yarrow256_is_seeded(&yarrow))
if (!yarrow256_is_seeded(&yarrow))
{
werror("Couldn't get enough randomness from the environment.\n");
return EXIT_FAILURE;
if (options->sloppy)
/* Pretend there's no problem. */
yarrow.seeded = 1;
else
return EXIT_FAILURE;
}
yarrow256_force_reseed(&yarrow);
yarrow256_slow_reseed(&yarrow);
/* Create file, readable only be the user. */
fd = open(lsh_get_cstring(options->filename),
O_EXCL | O_CREAT | O_WRONLY,
......
......@@ -119,13 +119,16 @@ seed_file_check_permissions(int fd, const struct lsh_string *filename)
int
seed_file_write(int fd, struct yarrow256_ctx *ctx)
{
uint8_t buffer[YARROW256_SEED_FILE_SIZE];
if (lseek(fd, 0, SEEK_SET) < 0)
{
werror("Seeking to beginning of seed file failed!? %e\n", errno);
return 0;
}
if (!write_raw(fd, YARROW256_SEED_FILE_SIZE, ctx->seed_file))
yarrow256_random (ctx, sizeof(buffer), buffer);
if (!write_raw(fd, sizeof(buffer), buffer))
{
werror("Overwriting seed file failed: %e\n", errno);
return 0;
......
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