I tryed to use CONF_modules_load_file(NULL, NULL, 
CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE)
and it work's fine:
$ src/curl --engine list
Build-time engines:
rsax
rdrand
dynamic
pkcs11 <--- this one is not build-in engine

I looked at OpenSSL sources and fount that OpenSSL_config(NULL) uses 
CONF_modules_load_file(NULL, NULL, 
CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE)
so do not see any difference. Mon, 2 Jun 2014 13:01:10 +0200 (CEST) от Daniel 
Stenberg <[email protected]>:
>On Mon, 2 Jun 2014, Дмитрий Фалько wrote:
>
>Thanks for your feedback on this issue!
>
>> I try to add OpenSSL_config(NULL) in openssl backeend initialization code 
>> and it work perfectly for on Ubuntu 12.04(x86_64) and armv5te(old OMAP). So 
>> seems that "but the first seems to not work" is not correct.
>
>The text refers to the bug report 1208 and in there "drook" reports 
>( https://sourceforge.net/p/curl/bugs/1208/#9c55 ):
>
>   I just got the same issue with openssl PHP extension, which I tried to fix
>   the same way; it appeared that calling OPENSSL_config() two times in two
>   different modules (though curl extension doesn't do it directly) leads to
>   openssl configuration error.
>
>... so even if this fixes your problem in the short term, there's an obvious 
>risk that this will make other's use cases burn. The amount of users running 
>curl and PHP at once is not insignificant.
>
>Hence the suggestion to instead use CONF_modules_load_file() with a NULL 
>filename ( https://sourceforge.net/p/curl/bugs/1208/#f3e4 ) but I've not 
>gotten 
>any feedback on how that actually works. Any chance you can try that and see 
>if you can get that to work for you?
>
>-- 
>
>  / daniel.haxx.se

Best Regards!
From 6ccaad053ce6f44dd31c55055ca9db040f3349c3 Mon Sep 17 00:00:00 2001
From: Dmitry Falko <[email protected]>
Date: Mon, 2 Jun 2014 15:57:12 +0400
Subject: [PATCH] Fix known bug #83 Load OpenSSL default config file

NOWN_BUG #83 curl is unable to load non-default
openssl engines, because openssl isn't initialized
properly. Add CONF_modules_load_file  to initialize
OpenSSL properly.
---
 lib/vtls/openssl.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index 68c1067..5a94b5a 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -729,7 +729,13 @@ static char *SSL_strerror(unsigned long error, char *buf, size_t size)
 int Curl_ossl_init(void)
 {
 #ifdef HAVE_ENGINE_LOAD_BUILTIN_ENGINES
+  OPENSSL_load_builtin_modules();
+
   ENGINE_load_builtin_engines();
+
+  if(CONF_modules_load_file(NULL, NULL, 
+    CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0)
+    return 0;
 #endif
 
   /* Lets get nice error messages */
-- 
1.7.9.5

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to