mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-25 23:05:21 +02:00
upstream commit
replace two arc4random loops with arc4random_buf ok deraadt natano Upstream-ID: e18ede972d1737df54b49f011fa4f3917a403f48
This commit is contained in:
parent
00df97ff68
commit
1036356324
15
clientloop.c
15
clientloop.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: clientloop.c,v 1.287 2016/09/12 01:22:38 deraadt Exp $ */
|
/* $OpenBSD: clientloop.c,v 1.288 2016/09/17 18:00:27 tedu Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -311,7 +311,7 @@ client_x11_get_proto(const char *display, const char *xauth_path,
|
|||||||
char xauthfile[PATH_MAX], xauthdir[PATH_MAX];
|
char xauthfile[PATH_MAX], xauthdir[PATH_MAX];
|
||||||
static char proto[512], data[512];
|
static char proto[512], data[512];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int got_data = 0, generated = 0, do_unlink = 0, i, r;
|
int got_data = 0, generated = 0, do_unlink = 0, r;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
u_int now, x11_timeout_real;
|
u_int now, x11_timeout_real;
|
||||||
|
|
||||||
@ -438,17 +438,16 @@ client_x11_get_proto(const char *display, const char *xauth_path,
|
|||||||
* for the local connection.
|
* for the local connection.
|
||||||
*/
|
*/
|
||||||
if (!got_data) {
|
if (!got_data) {
|
||||||
u_int32_t rnd = 0;
|
u_int8_t rnd[16];
|
||||||
|
u_int i;
|
||||||
|
|
||||||
logit("Warning: No xauth data; "
|
logit("Warning: No xauth data; "
|
||||||
"using fake authentication data for X11 forwarding.");
|
"using fake authentication data for X11 forwarding.");
|
||||||
strlcpy(proto, SSH_X11_PROTO, sizeof proto);
|
strlcpy(proto, SSH_X11_PROTO, sizeof proto);
|
||||||
for (i = 0; i < 16; i++) {
|
arc4random_buf(rnd, sizeof(rnd));
|
||||||
if (i % 4 == 0)
|
for (i = 0; i < sizeof(rnd); i++) {
|
||||||
rnd = arc4random();
|
|
||||||
snprintf(data + 2 * i, sizeof data - 2 * i, "%02x",
|
snprintf(data + 2 * i, sizeof data - 2 * i, "%02x",
|
||||||
rnd & 0xff);
|
rnd[i]);
|
||||||
rnd >>= 8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: hostfile.c,v 1.66 2015/05/04 06:10:48 djm Exp $ */
|
/* $OpenBSD: hostfile.c,v 1.67 2016/09/17 18:00:27 tedu Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -123,14 +123,13 @@ host_hash(const char *host, const char *name_from_hostfile, u_int src_len)
|
|||||||
u_char salt[256], result[256];
|
u_char salt[256], result[256];
|
||||||
char uu_salt[512], uu_result[512];
|
char uu_salt[512], uu_result[512];
|
||||||
static char encoded[1024];
|
static char encoded[1024];
|
||||||
u_int i, len;
|
u_int len;
|
||||||
|
|
||||||
len = ssh_digest_bytes(SSH_DIGEST_SHA1);
|
len = ssh_digest_bytes(SSH_DIGEST_SHA1);
|
||||||
|
|
||||||
if (name_from_hostfile == NULL) {
|
if (name_from_hostfile == NULL) {
|
||||||
/* Create new salt */
|
/* Create new salt */
|
||||||
for (i = 0; i < len; i++)
|
arc4random_buf(salt, len);
|
||||||
salt[i] = arc4random();
|
|
||||||
} else {
|
} else {
|
||||||
/* Extract salt from known host entry */
|
/* Extract salt from known host entry */
|
||||||
if (extract_salt(name_from_hostfile, src_len, salt,
|
if (extract_salt(name_from_hostfile, src_len, salt,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user