diff options
author | Damien Miller <djm@mindrot.org> | 2018-11-23 10:40:06 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-11-23 10:42:05 +1100 |
commit | 42c5ec4b97b6a1bae70f323952d0646af16ce710 (patch) | |
tree | 6d85f7daebb7241b80bc91126f433dca62e850e8 /regress | |
parent | 5b60b6c02009547a3e2a99d4886965de2a4719da (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 'regress')
-rw-r--r-- | regress/unittests/sshkey/tests.c | 5 | ||||
-rw-r--r-- | regress/unittests/test_helper/test_helper.c | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/regress/unittests/sshkey/tests.c b/regress/unittests/sshkey/tests.c index 13f265cdb..78aa9223d 100644 --- a/regress/unittests/sshkey/tests.c +++ b/regress/unittests/sshkey/tests.c | |||
@@ -7,8 +7,6 @@ | |||
7 | 7 | ||
8 | #include "includes.h" | 8 | #include "includes.h" |
9 | 9 | ||
10 | #include <openssl/evp.h> | ||
11 | |||
12 | #include "../test_helper/test_helper.h" | 10 | #include "../test_helper/test_helper.h" |
13 | 11 | ||
14 | void sshkey_tests(void); | 12 | void sshkey_tests(void); |
@@ -18,9 +16,6 @@ void sshkey_fuzz_tests(void); | |||
18 | void | 16 | void |
19 | tests(void) | 17 | tests(void) |
20 | { | 18 | { |
21 | OpenSSL_add_all_algorithms(); | ||
22 | ERR_load_CRYPTO_strings(); | ||
23 | |||
24 | sshkey_tests(); | 19 | sshkey_tests(); |
25 | sshkey_file_tests(); | 20 | sshkey_file_tests(); |
26 | sshkey_fuzz_tests(); | 21 | sshkey_fuzz_tests(); |
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c index cd08b5778..6b4f343a8 100644 --- a/regress/unittests/test_helper/test_helper.c +++ b/regress/unittests/test_helper/test_helper.c | |||
@@ -35,11 +35,13 @@ | |||
35 | #include <signal.h> | 35 | #include <signal.h> |
36 | 36 | ||
37 | #include <openssl/bn.h> | 37 | #include <openssl/bn.h> |
38 | #include <openssl/err.h> | ||
38 | 39 | ||
39 | #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS) | 40 | #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS) |
40 | # include <vis.h> | 41 | # include <vis.h> |
41 | #endif | 42 | #endif |
42 | 43 | ||
44 | #include "entropy.h" | ||
43 | #include "test_helper.h" | 45 | #include "test_helper.h" |
44 | #include "atomicio.h" | 46 | #include "atomicio.h" |
45 | 47 | ||
@@ -123,6 +125,9 @@ main(int argc, char **argv) | |||
123 | { | 125 | { |
124 | int ch; | 126 | int ch; |
125 | 127 | ||
128 | seed_rng(); | ||
129 | ERR_load_CRYPTO_strings(); | ||
130 | |||
126 | /* Handle systems without __progname */ | 131 | /* Handle systems without __progname */ |
127 | if (__progname == NULL) { | 132 | if (__progname == NULL) { |
128 | __progname = strrchr(argv[0], '/'); | 133 | __progname = strrchr(argv[0], '/'); |