diff options
Diffstat (limited to 'entropy.c')
-rw-r--r-- | entropy.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include <errno.h> | 40 | #include <errno.h> |
41 | #include <signal.h> | 41 | #include <signal.h> |
42 | #include <stdlib.h> | ||
42 | #include <string.h> | 43 | #include <string.h> |
43 | #include <unistd.h> | 44 | #include <unistd.h> |
44 | #include <stddef.h> /* for offsetof */ | 45 | #include <stddef.h> /* for offsetof */ |
@@ -201,14 +202,15 @@ rexec_send_rng_seed(struct sshbuf *m) | |||
201 | void | 202 | void |
202 | rexec_recv_rng_seed(struct sshbuf *m) | 203 | rexec_recv_rng_seed(struct sshbuf *m) |
203 | { | 204 | { |
204 | u_char *buf = NULL; | 205 | const u_char *buf = NULL; |
205 | size_t len = 0; | 206 | size_t len = 0; |
206 | int r; | 207 | int r; |
207 | 208 | ||
208 | if ((r = sshbuf_get_string_direct(m, &buf, &len)) != 0 | 209 | if ((r = sshbuf_get_string_direct(m, &buf, &len)) != 0) |
209 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 210 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
210 | 211 | ||
211 | debug3("rexec_recv_rng_seed: seeding rng with %u bytes", len); | 212 | debug3("rexec_recv_rng_seed: seeding rng with %lu bytes", |
213 | (unsigned long)len); | ||
212 | RAND_add(buf, len, len); | 214 | RAND_add(buf, len, len); |
213 | } | 215 | } |
214 | #endif /* OPENSSL_PRNG_ONLY */ | 216 | #endif /* OPENSSL_PRNG_ONLY */ |
@@ -247,7 +249,10 @@ seed_rng(void) | |||
247 | 249 | ||
248 | #else /* WITH_OPENSSL */ | 250 | #else /* WITH_OPENSSL */ |
249 | 251 | ||
250 | /* Acutal initialisation is handled in arc4random() */ | 252 | #include <stdlib.h> |
253 | #include <string.h> | ||
254 | |||
255 | /* Actual initialisation is handled in arc4random() */ | ||
251 | void | 256 | void |
252 | seed_rng(void) | 257 | seed_rng(void) |
253 | { | 258 | { |