summaryrefslogtreecommitdiff
path: root/sshd.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 /sshd.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 'sshd.c')
-rw-r--r--sshd.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sshd.c b/sshd.c
index afd959329..fb9d9b60f 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1510,6 +1510,8 @@ main(int ac, char **av)
1510 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ 1510 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
1511 sanitise_stdfd(); 1511 sanitise_stdfd();
1512 1512
1513 seed_rng();
1514
1513 /* Initialize configuration options to their default values. */ 1515 /* Initialize configuration options to their default values. */
1514 initialize_server_options(&options); 1516 initialize_server_options(&options);
1515 1517
@@ -1631,10 +1633,6 @@ main(int ac, char **av)
1631 else 1633 else
1632 closefrom(REEXEC_DEVCRYPTO_RESERVED_FD); 1634 closefrom(REEXEC_DEVCRYPTO_RESERVED_FD);
1633 1635
1634#ifdef WITH_OPENSSL
1635 OpenSSL_add_all_algorithms();
1636#endif
1637
1638 /* If requested, redirect the logs to the specified logfile. */ 1636 /* If requested, redirect the logs to the specified logfile. */
1639 if (logfile != NULL) 1637 if (logfile != NULL)
1640 log_redirect_stderr_to(logfile); 1638 log_redirect_stderr_to(logfile);
@@ -1677,8 +1675,6 @@ main(int ac, char **av)
1677 parse_server_config(&options, rexeced_flag ? "rexec" : config_file_name, 1675 parse_server_config(&options, rexeced_flag ? "rexec" : config_file_name,
1678 cfg, NULL); 1676 cfg, NULL);
1679 1677
1680 seed_rng();
1681
1682 /* Fill in default values for those options not explicitly set. */ 1678 /* Fill in default values for those options not explicitly set. */
1683 fill_default_server_options(&options); 1679 fill_default_server_options(&options);
1684 1680