Skip to content

Commit df04242

Browse files
committed
re-merge arc4random.c
1 parent ad06455 commit df04242

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

openbsd-compat/arc4random.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ _rs_init(u_char *buf, size_t n)
9898
if (n < KEYSZ + IVSZ)
9999
return;
100100

101-
if (rs == NULL) {
102-
if (_rs_allocate(&rs, &rsx) == -1)
103-
_exit(1);
104-
}
105-
106101
#ifndef WITH_OPENSSL
107102
#ifdef WINDOWS
108103
#include <Wincrypt.h>
@@ -139,11 +134,17 @@ getrnd(u_char *s, size_t len)
139134
return;
140135
fatal("Couldn't open %s: %s", SSH_RANDOM_DEV,
141136
strerror(save_errno));
137+
138+
if (rs == NULL) {
139+
if (_rs_allocate(&rs, &rsx) == -1)
140+
_exit(1);
142141
}
143142

144143
chacha_keysetup(&rsx->rs_chacha, buf, KEYSZ * 8);
145144
chacha_ivsetup(&rsx->rs_chacha, buf + KEYSZ);
146145
}
146+
#endif /* !WINDOWS */
147+
#endif /* WITH_OPENSSL */
147148

148149
static void
149150
_rs_stir(void)
@@ -289,4 +290,3 @@ arc4random_buf(void *_buf, size_t n)
289290
explicit_bzero(&r, sizeof(r));
290291
}
291292
#endif /* !defined(HAVE_ARC4RANDOM_BUF) && defined(HAVE_ARC4RANDOM) */
292-

0 commit comments

Comments
 (0)