]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fix asynclook for libunbound needing SSL initialization
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 24 May 2018 12:59:17 +0000 (12:59 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 24 May 2018 12:59:17 +0000 (12:59 +0000)
git-svn-id: file:///svn/unbound/trunk@4691 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
testcode/asynclook.c

index f104fdb9b2d80f0803f9c8f4dc6a68f33d20b1cb..a62aaaf427f1fd204500887a23a86ea9fff548fc 100644 (file)
@@ -360,7 +360,7 @@ memstats$(EXEEXT):  $(MEMSTATS_OBJ_LINK)
        $(LINK) -o $@ $(MEMSTATS_OBJ_LINK) $(SSLLIB) $(LIBS)
 
 asynclook$(EXEEXT):    $(ASYNCLOOK_OBJ_LINK) libunbound.la
-       $(LINK) -o $@ $(ASYNCLOOK_OBJ_LINK) $(LIBS) -L. -L.libs -lunbound
+       $(LINK) -o $@ $(ASYNCLOOK_OBJ_LINK) -L. -L.libs -lunbound $(SSLLIB) $(LIBS)
 
 streamtcp$(EXEEXT):    $(STREAMTCP_OBJ_LINK)
        $(LINK) -o $@ $(STREAMTCP_OBJ_LINK) $(SSLLIB) $(LIBS)
index a2bdb62130b79bd33a94b0f13b72d7c85eabfd35..06bcf5ab862a89502f9946930f905c41ef8c43ad 100644 (file)
 #undef free
 #undef strdup
 #endif
+#ifdef HAVE_SSL
+#ifdef HAVE_OPENSSL_SSL_H
+#include <openssl/ssl.h>
+#endif
+#ifdef HAVE_OPENSSL_ERR_H
+#include <openssl/err.h>
+#endif
+#endif /* HAVE_SSL */
+
 
 /** keeping track of the async ids */
 struct track_id {
@@ -459,6 +468,27 @@ int main(int argc, char** argv)
        argc -= optind;
        argv += optind;
 
+#ifdef HAVE_SSL
+#ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS
+       ERR_load_crypto_strings();
+#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL)
+       ERR_load_SSL_strings();
+#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_CRYPTO)
+       OpenSSL_add_all_algorithms();
+#else
+       OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
+               | OPENSSL_INIT_ADD_ALL_DIGESTS
+               | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
+#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL)
+       (void)SSL_library_init();
+#else
+       (void)OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
+#endif
+#endif /* HAVE_SSL */
+
        if(ext)
                return ext_test(ctx, argc, argv);