summaryrefslogtreecommitdiff
path: root/hostfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'hostfile.c')
-rw-r--r--hostfile.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hostfile.c b/hostfile.c
index 2850a4793..4548fbab3 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hostfile.c,v 1.66 2015/05/04 06:10:48 djm Exp $ */ 1/* $OpenBSD: hostfile.c,v 1.67 2016/09/17 18:00:27 tedu 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
@@ -123,14 +123,13 @@ host_hash(const char *host, const char *name_from_hostfile, u_int src_len)
123 u_char salt[256], result[256]; 123 u_char salt[256], result[256];
124 char uu_salt[512], uu_result[512]; 124 char uu_salt[512], uu_result[512];
125 static char encoded[1024]; 125 static char encoded[1024];
126 u_int i, len; 126 u_int len;
127 127
128 len = ssh_digest_bytes(SSH_DIGEST_SHA1); 128 len = ssh_digest_bytes(SSH_DIGEST_SHA1);
129 129
130 if (name_from_hostfile == NULL) { 130 if (name_from_hostfile == NULL) {
131 /* Create new salt */ 131 /* Create new salt */
132 for (i = 0; i < len; i++) 132 arc4random_buf(salt, len);
133 salt[i] = arc4random();
134 } else { 133 } else {
135 /* Extract salt from known host entry */ 134 /* Extract salt from known host entry */
136 if (extract_salt(name_from_hostfile, src_len, salt, 135 if (extract_salt(name_from_hostfile, src_len, salt,