summaryrefslogtreecommitdiff
path: root/regress
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 /regress
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 'regress')
-rw-r--r--regress/unittests/sshkey/tests.c5
-rw-r--r--regress/unittests/test_helper/test_helper.c5
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 @@
#include "includes.h"
-#include <openssl/evp.h>
-
#include "../test_helper/test_helper.h"
void sshkey_tests(void);
@@ -18,9 +16,6 @@ void sshkey_fuzz_tests(void);
void
tests(void)
{
- OpenSSL_add_all_algorithms();
- ERR_load_CRYPTO_strings();
-
sshkey_tests();
sshkey_file_tests();
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 @@
#include <signal.h>
#include <openssl/bn.h>
+#include <openssl/err.h>
#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS)
# include <vis.h>
#endif
+#include "entropy.h"
#include "test_helper.h"
#include "atomicio.h"
@@ -123,6 +125,9 @@ main(int argc, char **argv)
{
int ch;
+ seed_rng();
+ ERR_load_CRYPTO_strings();
+
/* Handle systems without __progname */
if (__progname == NULL) {
__progname = strrchr(argv[0], '/');