summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-09-14 09:44:37 +1000
committerDamien Miller <djm@mindrot.org>2013-09-14 09:44:37 +1000
commit045bda5cb8acf0eb9d71c275ee1247e3154fc9e5 (patch)
tree3c7d3b0628251c3237ab33f7095275d0c2244eb0
parented4af412da60a084891b20412433a27966613fb8 (diff)
- djm@cvs.openbsd.org 2013/08/22 19:02:21
[sshd.c] Stir PRNG after post-accept fork. The child gets a different PRNG state anyway via rexec and explicit privsep reseeds, but it's good to be sure. ok markus@
-rw-r--r--ChangeLog8
-rw-r--r--sshd.c8
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d13a23fd1..a8d6c274e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
120130914
2 - (djm) OpenBSD CVS Sync
3 - djm@cvs.openbsd.org 2013/08/22 19:02:21
4 [sshd.c]
5 Stir PRNG after post-accept fork. The child gets a different PRNG state
6 anyway via rexec and explicit privsep reseeds, but it's good to be sure.
7 ok markus@
8
120130828 920130828
2 - (djm) [openbsd-compat/bsd-snprintf.c] teach our local snprintf code the 10 - (djm) [openbsd-compat/bsd-snprintf.c] teach our local snprintf code the
3 'j' (intmax_t/uintmax_t) and 'z' (size_t/ssize_t) conversions in case we 11 'j' (intmax_t/uintmax_t) and 'z' (size_t/ssize_t) conversions in case we
diff --git a/sshd.c b/sshd.c
index 174cc7a42..cddc87e8d 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.404 2013/07/19 07:37:48 markus Exp $ */ 1/* $OpenBSD: sshd.c,v 1.405 2013/08/22 19:02:21 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -613,6 +613,7 @@ privsep_preauth_child(void)
613 arc4random_stir(); 613 arc4random_stir();
614 arc4random_buf(rnd, sizeof(rnd)); 614 arc4random_buf(rnd, sizeof(rnd));
615 RAND_seed(rnd, sizeof(rnd)); 615 RAND_seed(rnd, sizeof(rnd));
616 bzero(rnd, sizeof(rnd));
616 617
617 /* Demote the private keys to public keys. */ 618 /* Demote the private keys to public keys. */
618 demote_sensitive_data(); 619 demote_sensitive_data();
@@ -747,6 +748,7 @@ privsep_postauth(Authctxt *authctxt)
747 arc4random_stir(); 748 arc4random_stir();
748 arc4random_buf(rnd, sizeof(rnd)); 749 arc4random_buf(rnd, sizeof(rnd));
749 RAND_seed(rnd, sizeof(rnd)); 750 RAND_seed(rnd, sizeof(rnd));
751 bzero(rnd, sizeof(rnd));
750 752
751 /* Drop privileges */ 753 /* Drop privileges */
752 do_setusercontext(authctxt->pw); 754 do_setusercontext(authctxt->pw);
@@ -1139,6 +1141,7 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
1139 struct sockaddr_storage from; 1141 struct sockaddr_storage from;
1140 socklen_t fromlen; 1142 socklen_t fromlen;
1141 pid_t pid; 1143 pid_t pid;
1144 u_char rnd[256];
1142 1145
1143 /* setup fd set for accept */ 1146 /* setup fd set for accept */
1144 fdset = NULL; 1147 fdset = NULL;
@@ -1339,6 +1342,9 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
1339 * from that of the child 1342 * from that of the child
1340 */ 1343 */
1341 arc4random_stir(); 1344 arc4random_stir();
1345 arc4random_buf(rnd, sizeof(rnd));
1346 RAND_seed(rnd, sizeof(rnd));
1347 bzero(rnd, sizeof(rnd));
1342 } 1348 }
1343 1349
1344 /* child process check (or debug mode) */ 1350 /* child process check (or debug mode) */