}
#endif /* WITH_OPENSSL */
+
+void
+reseed_prngs(void)
+{
+ u_int32_t rnd[256];
+
+#ifdef WITH_OPENSSL
+ RAND_poll();
+#endif
+ arc4random_stir(); /* noop on recent arc4random() implementations */
+ arc4random_buf(rnd, sizeof(rnd)); /* let arc4random notice PID change */
+
+#ifdef WITH_OPENSSL
+ RAND_seed(rnd, sizeof(rnd));
+ /* give libcrypto a chance to notice the PID change */
+ if ((RAND_bytes((u_char *)rnd, 1)) != 1)
+ fatal_f("RAND_bytes failed");
+#endif
+
+ explicit_bzero(rnd, sizeof(rnd));
+}
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _RANDOMS_H
-#define _RANDOMS_H
+#ifndef _ENTROPY_H
+#define _ENTROPY_H
struct sshbuf;
void seed_rng(void);
-void rexec_send_rng_seed(struct sshbuf *);
-void rexec_recv_rng_seed(struct sshbuf *);
+void reseed_prngs(void);
-#endif /* _RANDOMS_H */
+#endif /* _ENTROPY_H */
}
}
-static void
-reseed_prngs(void)
-{
- u_int32_t rnd[256];
-
-#ifdef WITH_OPENSSL
- RAND_poll();
-#endif
- arc4random_stir(); /* noop on recent arc4random() implementations */
- arc4random_buf(rnd, sizeof(rnd)); /* let arc4random notice PID change */
-
-#ifdef WITH_OPENSSL
- RAND_seed(rnd, sizeof(rnd));
- /* give libcrypto a chance to notice the PID change */
- if ((RAND_bytes((u_char *)rnd, 1)) != 1)
- fatal_f("RAND_bytes failed");
-#endif
-
- explicit_bzero(rnd, sizeof(rnd));
-}
-
struct sshbuf *
pack_hostkeys(void)
{
struct early_child *child;
struct sshbuf *buf;
socklen_t fromlen;
- u_char rnd[256];
sigset_t nsigset, osigset;
/* pipes connected to unauthenticated child sshd processes */
* Ensure that our random state differs
* from that of the child
*/
- arc4random_stir();
- arc4random_buf(rnd, sizeof(rnd));
-#ifdef WITH_OPENSSL
- RAND_seed(rnd, sizeof(rnd));
- if ((RAND_bytes((u_char *)rnd, 1)) != 1)
- fatal_f("RAND_bytes failed");
-#endif
- explicit_bzero(rnd, sizeof(rnd));
+ reseed_prngs();
}
}
}