summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2018-11-23 10:40:06 +1100
committerDamien Miller <djm@mindrot.org>2018-11-23 10:42:05 +1100
commit42c5ec4b97b6a1bae70f323952d0646af16ce710 (patch)
tree6d85f7daebb7241b80bc91126f433dca62e850e8 /ssh.c
parent5b60b6c02009547a3e2a99d4886965de2a4719da (diff)
refactor libcrypto initialisation
Don't call OpenSSL_add_all_algorithms() unless OpenSSL actually supports it. Move all libcrypto initialisation to a single function, and call that from seed_rng() that is called early in each tool's main(). Prompted by patch from Rosen Penev
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/ssh.c b/ssh.c
index 1e471f5c4..1ac903d16 100644
--- a/ssh.c
+++ b/ssh.c
@@ -610,6 +610,8 @@ main(int ac, char **av)
610 av = saved_av; 610 av = saved_av;
611#endif 611#endif
612 612
613 seed_rng();
614
613 /* 615 /*
614 * Discard other fds that are hanging around. These can cause problem 616 * Discard other fds that are hanging around. These can cause problem
615 * with backgrounded ssh processes started by ControlPersist. 617 * with backgrounded ssh processes started by ControlPersist.
@@ -1036,11 +1038,6 @@ main(int ac, char **av)
1036 1038
1037 host_arg = xstrdup(host); 1039 host_arg = xstrdup(host);
1038 1040
1039#ifdef WITH_OPENSSL
1040 OpenSSL_add_all_algorithms();
1041 ERR_load_crypto_strings();
1042#endif
1043
1044 /* Initialize the command to execute on remote host. */ 1041 /* Initialize the command to execute on remote host. */
1045 if ((command = sshbuf_new()) == NULL) 1042 if ((command = sshbuf_new()) == NULL)
1046 fatal("sshbuf_new failed"); 1043 fatal("sshbuf_new failed");
@@ -1264,8 +1261,6 @@ main(int ac, char **av)
1264 tty_flag = 0; 1261 tty_flag = 0;
1265 } 1262 }
1266 1263
1267 seed_rng();
1268
1269 if (options.user == NULL) 1264 if (options.user == NULL)
1270 options.user = xstrdup(pw->pw_name); 1265 options.user = xstrdup(pw->pw_name);
1271 1266