aboutsummaryrefslogtreecommitdiff
path: root/util-linux/seedrng.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/seedrng.c')
-rw-r--r--util-linux/seedrng.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/util-linux/seedrng.c b/util-linux/seedrng.c
index 6c02b735f..c762e9ecd 100644
--- a/util-linux/seedrng.c
+++ b/util-linux/seedrng.c
@@ -103,16 +103,16 @@ static int seed_rng(uint8_t *seed, size_t len, bool credit)
103 int entropy_count; 103 int entropy_count;
104 int buf_size; 104 int buf_size;
105 uint8_t buffer[MAX_SEED_LEN]; 105 uint8_t buffer[MAX_SEED_LEN];
106 } req = { 106 } req;
107 .entropy_count = credit ? len * 8 : 0,
108 .buf_size = len
109 };
110 int random_fd, ret; 107 int random_fd, ret;
111 108
112 if (len > sizeof(req.buffer)) { 109 if (len > sizeof(req.buffer)) {
113 errno = EFBIG; 110 errno = EFBIG;
114 return -1; 111 return -1;
115 } 112 }
113
114 req.entropy_count = credit ? len * 8 : 0;
115 req.buf_size = len;
116 memcpy(req.buffer, seed, len); 116 memcpy(req.buffer, seed, len);
117 117
118 random_fd = open("/dev/urandom", O_RDONLY); 118 random_fd = open("/dev/urandom", O_RDONLY);
@@ -164,7 +164,7 @@ int seedrng_main(int argc UNUSED_PARAM, char *argv[])
164 uint8_t new_seed[MAX_SEED_LEN]; 164 uint8_t new_seed[MAX_SEED_LEN];
165 size_t new_seed_len; 165 size_t new_seed_len;
166 bool new_seed_creditable, skip_credit = false; 166 bool new_seed_creditable, skip_credit = false;
167 struct timespec timestamp = { 0 }; 167 struct timespec timestamp;
168 sha256_ctx_t hash; 168 sha256_ctx_t hash;
169 169
170 enum { 170 enum {