Further analysis of why config files are being loaded twice shows that these are bugs in curl and wget, both call CONF_modules_load_file directly during their initialization functions, while it is also being called from OPENSSL_init_crypto and similar top-level functions:
For wget:
(gdb) bt
#0 CONF_modules_load_file (filename=filename@entry=0x0, appname=appname@entry=0x0, flags=flags@entry=50) at ../crypto/conf/conf_mod.c:114
#1 0x00007ffff7c7da10 in openssl_config_int (settings=<optimized out>) at ../crypto/conf/conf_sap.c:69
#2 0x00007ffff7d14234 in ossl_init_config () at ../crypto/init.c:293
#3 ossl_init_config_ossl_ () at ../crypto/init.c:291
#4 0x00007ffff796947f in __pthread_once_slow (once_control=0x7ffff7e717e0 <config>, init_routine=0x7ffff7d14220 <ossl_init_config_ossl_>) at pthread_once.c:116
#5 0x00007ffff7969535 in __GI___pthread_once (once_control=once_control@entry=0x7ffff7e717e0 <config>, init_routine=init_routine@entry=0x7ffff7d14220 <ossl_init_config_ossl_>) at pthread_once.c:143
#6 0x00007ffff7d7f74d in CRYPTO_THREAD_run_once (once=once@entry=0x7ffff7e717e0 <config>, init=init@entry=0x7ffff7d14220 <ossl_init_config_ossl_>) at ../crypto/threads_pthread.c:118
#7 0x00007ffff7d148b8 in OPENSSL_init_crypto (settings=0x7fffffffdc50, opts=64) at ../crypto/init.c:701
#8 OPENSSL_init_crypto (opts=opts@entry=64, settings=settings@entry=0x7fffffffdc50) at ../crypto/init.c:620
#9 0x00007ffff7c7d9ae in OPENSSL_config (appname=appname@entry=0x0) at ../crypto/conf/conf_sap.c:39
#10 0x0000555555598237 in ssl_init () at ../../src/openssl.c:178
#11 0x000055555557cbc5 in gethttp (u=u@entry=0x5555555e63e0, original_url=original_url@entry=0x5555555e63e0, hs=hs@entry=0x7fffffffe110, dt=dt@entry=0x7fffffffe4f0, proxy=proxy@entry=0x0, iri=iri@entry=0x5555555e63b0, count=1) at ../../src/http.c:3209
#12 0x00005555555808f3 in http_loop (u=u@entry=0x5555555e63e0, original_url=original_url@entry=0x5555555e63e0, newloc=newloc@entry=0x7fffffffe408, local_file=local_file@entry=0x7fffffffe410, referer=referer@entry=0x0, dt=dt@entry=0x7fffffffe4f0, proxy=0x0, iri=0x5555555e63b0)
at ../../src/http.c:4356
#13 0x000055555558c594 in retrieve_url (orig_parsed=0x5555555e63e0, origurl=0x5555555e7600 "https://google.de/", file=0x7fffffffe4f8, newloc=0x7fffffffe500, refurl=0x0, dt=0x7fffffffe4f0, recursive=false, iri=0x5555555e63b0, register_status=true) at ../../src/retr.c:973
#14 0x00005555555644bb in main (argc=<optimized out>, argv=<optimized out>) at ../../src/main.c:2165
(gdb) c
Continuing.
Breakpoint 1, CONF_modules_load_file (filename=filename@entry=0x0, appname=appname@entry=0x0, flags=flags@entry=48) at ../crypto/conf/conf_mod.c:114
114 in ../crypto/conf/conf_mod.c
(gdb) bt
#0 CONF_modules_load_file (filename=filename@entry=0x0, appname=appname@entry=0x0, flags=flags@entry=48) at ../crypto/conf/conf_mod.c:114
#1 0x00005555555982c0 in ssl_init () at ../../src/openssl.c:202
#2 0x000055555557cbc5 in gethttp (u=u@entry=0x5555555e63e0, original_url=original_url@entry=0x5555555e63e0, hs=hs@entry=0x7fffffffe110, dt=dt@entry=0x7fffffffe4f0, proxy=proxy@entry=0x0, iri=iri@entry=0x5555555e63b0, count=1) at ../../src/http.c:3209
#3 0x00005555555808f3 in http_loop (u=u@entry=0x5555555e63e0, original_url=original_url@entry=0x5555555e63e0, newloc=newloc@entry=0x7fffffffe408, local_file=local_file@entry=0x7fffffffe410, referer=referer@entry=0x0, dt=dt@entry=0x7fffffffe4f0, proxy=0x0, iri=0x5555555e63b0)
at ../../src/http.c:4356
#4 0x000055555558c594 in retrieve_url (orig_parsed=0x5555555e63e0, origurl=0x5555555e7600 "https://google.de/", file=0x7fffffffe4f8, newloc=0x7fffffffe500, refurl=0x0, dt=0x7fffffffe4f0, recursive=false, iri=0x5555555e63b0, register_status=true) at ../../src/retr.c:973
#5 0x00005555555644bb in main (argc=<optimized out>, argv=<optimized out>) at ../../src/main.c:2165
For curl:
Breakpoint 1, CONF_modules_load_file (filename=filename@entry=0x0, appname=appname@entry=0x0, flags=flags@entry=48) at ../crypto/conf/conf_mod.c:114
114 ../crypto/conf/conf_mod.c: No such file or directory.
(gdb) bt
#0 CONF_modules_load_file (filename=filename@entry=0x0, appname=appname@entry=0x0, flags=flags@entry=48) at ../crypto/conf/conf_mod.c:114
#1 0x00007ffff7f95313 in Curl_ossl_init () at vtls/openssl.c:1052
#2 0x00007ffff7f5fa20 in global_init (flags=3, memoryfuncs=<optimized out>) at easy.c:158
#3 0x000055555555f0af in main_init (config=0x7fffffffe540) at tool_main.c:158
#4 main (argc=4, argv=0x7fffffffe6d8) at tool_main.c:296
(gdb) c
Continuing.
[New Thread 0x7ffff66f4700 (LWP 2866)]
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0[Thread 0x7ffff66f4700 (LWP 2866) exited]
Thread 1 "curl" hit Breakpoint 1, CONF_modules_load_file (filename=filename@entry=0x0, appname=appname@entry=0x0, flags=flags@entry=50) at ../crypto/conf/conf_mod.c:114
114 in ../crypto/conf/conf_mod.c
(gdb) bt
#0 CONF_modules_load_file (filename=filename@entry=0x0, appname=appname@entry=0x0, flags=flags@entry=50) at ../crypto/conf/conf_mod.c:114
#1 0x00007ffff7988a10 in openssl_config_int (settings=<optimized out>) at ../crypto/conf/conf_sap.c:69
#2 0x00007ffff7a1f234 in ossl_init_config () at ../crypto/init.c:293
#3 ossl_init_config_ossl_ () at ../crypto/init.c:291
#4 0x00007ffff7f0247f in __pthread_once_slow (once_control=0x7ffff7b7c7e0 <config>, init_routine=0x7ffff7a1f220 <ossl_init_config_ossl_>) at pthread_once.c:116
#5 0x00007ffff7f02535 in __GI___pthread_once (once_control=once_control@entry=0x7ffff7b7c7e0 <config>, init_routine=init_routine@entry=0x7ffff7a1f220 <ossl_init_config_ossl_>) at pthread_once.c:143
#6 0x00007ffff7a8a74d in CRYPTO_THREAD_run_once (once=once@entry=0x7ffff7b7c7e0 <config>, init=init@entry=0x7ffff7a1f220 <ossl_init_config_ossl_>) at ../crypto/threads_pthread.c:118
#7 0x00007ffff7a1f8b8 in OPENSSL_init_crypto (settings=0x0, opts=2097228) at ../crypto/init.c:701
#8 OPENSSL_init_crypto (opts=opts@entry=2097228, settings=settings@entry=0x0) at ../crypto/init.c:620
#9 0x00007ffff7bb4575 in OPENSSL_init_ssl (opts=2097228, opts@entry=2097152, settings=settings@entry=0x0) at ../ssl/ssl_init.c:205
#10 0x00007ffff7bb84a2 in SSL_CTX_new (meth=meth@entry=0x7ffff7c0a860 <TLS_client_method_data.23164>) at ../ssl/ssl_lib.c:2978
#11 0x00007ffff7f9877e in ossl_connect_step1 (conn=conn@entry=0x5555555cdb10, sockindex=sockindex@entry=0) at vtls/openssl.c:2527
#12 0x00007ffff7f9a23f in ossl_connect_common (conn=0x5555555cdb10, sockindex=0, nonblocking=true, done=0x7fffffffe238) at vtls/openssl.c:3752
#13 0x00007ffff7f9b14f in Curl_ssl_connect_nonblocking (conn=conn@entry=0x5555555cdb10, sockindex=sockindex@entry=0, done=done@entry=0x7fffffffe238) at vtls/vtls.c:291
#14 0x00007ffff7f46296 in https_connecting (conn=conn@entry=0x5555555cdb10, done=done@entry=0x7fffffffe238) at http.c:1575
#15 0x00007ffff7f47d13 in Curl_http_connect (done=0x7fffffffe238, conn=0x5555555cdb10) at http.c:1497
#16 Curl_http_connect (conn=0x5555555cdb10, done=0x7fffffffe238) at http.c:1462
#17 0x00007ffff7f6897d in protocol_connect (protocol_done=0x7fffffffe238, conn=<optimized out>) at multi.c:1485
#18 multi_runsingle (multi=0x5555555c2bd0, now=..., data=0x5555555cee10) at multi.c:1794
#19 0x00007ffff7f69a11 in curl_multi_perform (multi=multi@entry=0x5555555c2bd0, running_handles=running_handles@entry=0x7fffffffe3a8) at multi.c:2341
#20 0x00007ffff7f5fe8b in easy_transfer (multi=0x5555555c2bd0) at easy.c:599
#21 easy_perform (events=false, data=0x5555555cee10) at easy.c:692
#22 curl_easy_perform (data=0x5555555cee10) at easy.c:711
#23 0x000055555556e1d0 in serial_transfers (share=0x5555555c43c0, global=0x7fffffffe540) at tool_operate.c:2203
#24 run_all_transfers (result=CURLE_OK, share=0x5555555c43c0, global=0x7fffffffe540) at tool_operate.c:2379
#25 operate (global=0x7fffffffe540, argc=<optimized out>, argv=<optimized out>) at tool_operate.c:2491
#26 0x000055555555f130 in main (argc=4, argv=0x7fffffffe6d8) at tool_main.c:314
Further analysis of why config files are being loaded twice shows that these are bugs in curl and wget, both call CONF_modules_ load_file directly during their initialization functions, while it is also being called from OPENSSL_init_crypto and similar top-level functions:
For wget:
(gdb) bt load_file (filename= filename@ entry=0x0, appname= appname@ entry=0x0, flags=flags@ entry=50) at ../crypto/ conf/conf_ mod.c:114 <optimized out>) at ../crypto/ conf/conf_ sap.c:69 init.c: 293 config_ ossl_ () at ../crypto/ init.c: 291 0x7ffff7e717e0 <config>, init_routine= 0x7ffff7d14220 <ossl_init_ config_ ossl_>) at pthread_once.c:116 once_control@ entry=0x7ffff7e 717e0 <config>, init_routine= init_routine@ entry=0x7ffff7d 14220 <ossl_init_ config_ ossl_>) at pthread_once.c:143 THREAD_ run_once (once=once@ entry=0x7ffff7e 717e0 <config>, init=init@ entry=0x7ffff7d 14220 <ossl_init_ config_ ossl_>) at ../crypto/ threads_ pthread. c:118 0x7fffffffdc50, opts=64) at ../crypto/ init.c: 701 entry=64, settings= settings@ entry=0x7ffffff fdc50) at ../crypto/ init.c: 620 appname@ entry=0x0) at ../crypto/ conf/conf_ sap.c:39 openssl. c:178 0x5555555e63e0, original_ url=original_ url@entry= 0x5555555e63e0, hs=hs@entry= 0x7fffffffe110, dt=dt@entry= 0x7fffffffe4f0, proxy=proxy@ entry=0x0, iri=iri@ entry=0x5555555 e63b0, count=1) at ../../src/ http.c: 3209 0x5555555e63e0, original_ url=original_ url@entry= 0x5555555e63e0, newloc= newloc@ entry=0x7ffffff fe408, local_file= local_file@ entry=0x7ffffff fe410, referer= referer@ entry=0x0, dt=dt@entry= 0x7fffffffe4f0, proxy=0x0, iri=0x5555555e63b0) http.c: 4356 0x5555555e63e0, origurl= 0x5555555e7600 "https:/ /google. de/", file=0x7fffffff e4f8, newloc= 0x7fffffffe500, refurl=0x0, dt=0x7fffffffe4f0, recursive=false, iri=0x5555555e63b0, register_ status= true) at ../../src/ retr.c: 973 main.c: 2165
#0 CONF_modules_
#1 0x00007ffff7c7da10 in openssl_config_int (settings=
#2 0x00007ffff7d14234 in ossl_init_config () at ../crypto/
#3 ossl_init_
#4 0x00007ffff796947f in __pthread_once_slow (once_control=
#5 0x00007ffff7969535 in __GI___pthread_once (once_control=
#6 0x00007ffff7d7f74d in CRYPTO_
#7 0x00007ffff7d148b8 in OPENSSL_init_crypto (settings=
#8 OPENSSL_init_crypto (opts=opts@
#9 0x00007ffff7c7d9ae in OPENSSL_config (appname=
#10 0x0000555555598237 in ssl_init () at ../../src/
#11 0x000055555557cbc5 in gethttp (u=u@entry=
#12 0x00005555555808f3 in http_loop (u=u@entry=
at ../../src/
#13 0x000055555558c594 in retrieve_url (orig_parsed=
#14 0x00005555555644bb in main (argc=<optimized out>, argv=<optimized out>) at ../../src/
(gdb) c
Continuing.
Breakpoint 1, CONF_modules_ load_file (filename= filename@ entry=0x0, appname= appname@ entry=0x0, flags=flags@ entry=48) at ../crypto/ conf/conf_ mod.c:114 conf/conf_ mod.c load_file (filename= filename@ entry=0x0, appname= appname@ entry=0x0, flags=flags@ entry=48) at ../crypto/ conf/conf_ mod.c:114 openssl. c:202 0x5555555e63e0, original_ url=original_ url@entry= 0x5555555e63e0, hs=hs@entry= 0x7fffffffe110, dt=dt@entry= 0x7fffffffe4f0, proxy=proxy@ entry=0x0, iri=iri@ entry=0x5555555 e63b0, count=1) at ../../src/ http.c: 3209 0x5555555e63e0, original_ url=original_ url@entry= 0x5555555e63e0, newloc= newloc@ entry=0x7ffffff fe408, local_file= local_file@ entry=0x7ffffff fe410, referer= referer@ entry=0x0, dt=dt@entry= 0x7fffffffe4f0, proxy=0x0, iri=0x5555555e63b0) http.c: 4356 0x5555555e63e0, origurl= 0x5555555e7600 "https:/ /google. de/", file=0x7fffffff e4f8, newloc= 0x7fffffffe500, refurl=0x0, dt=0x7fffffffe4f0, recursive=false, iri=0x5555555e63b0, register_ status= true) at ../../src/ retr.c: 973 main.c: 2165
114 in ../crypto/
(gdb) bt
#0 CONF_modules_
#1 0x00005555555982c0 in ssl_init () at ../../src/
#2 0x000055555557cbc5 in gethttp (u=u@entry=
#3 0x00005555555808f3 in http_loop (u=u@entry=
at ../../src/
#4 0x000055555558c594 in retrieve_url (orig_parsed=
#5 0x00005555555644bb in main (argc=<optimized out>, argv=<optimized out>) at ../../src/
For curl:
Breakpoint 1, CONF_modules_ load_file (filename= filename@ entry=0x0, appname= appname@ entry=0x0, flags=flags@ entry=48) at ../crypto/ conf/conf_ mod.c:114 conf/conf_ mod.c: No such file or directory. load_file (filename= filename@ entry=0x0, appname= appname@ entry=0x0, flags=flags@ entry=48) at ../crypto/ conf/conf_ mod.c:114 <optimized out>) at easy.c:158 0x7fffffffe540) at tool_main.c:158 e6d8) at tool_main.c:296
Dload Upload Total Spent Left Speed
114 ../crypto/
(gdb) bt
#0 CONF_modules_
#1 0x00007ffff7f95313 in Curl_ossl_init () at vtls/openssl.c:1052
#2 0x00007ffff7f5fa20 in global_init (flags=3, memoryfuncs=
#3 0x000055555555f0af in main_init (config=
#4 main (argc=4, argv=0x7fffffff
(gdb) c
Continuing.
[New Thread 0x7ffff66f4700 (LWP 2866)]
% Total % Received % Xferd Average Speed Time Time Time Current
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0[Thread 0x7ffff66f4700 (LWP 2866) exited]
Thread 1 "curl" hit Breakpoint 1, CONF_modules_ load_file (filename= filename@ entry=0x0, appname= appname@ entry=0x0, flags=flags@ entry=50) at ../crypto/ conf/conf_ mod.c:114 conf/conf_ mod.c load_file (filename= filename@ entry=0x0, appname= appname@ entry=0x0, flags=flags@ entry=50) at ../crypto/ conf/conf_ mod.c:114 <optimized out>) at ../crypto/ conf/conf_ sap.c:69 init.c: 293 config_ ossl_ () at ../crypto/ init.c: 291 0x7ffff7b7c7e0 <config>, init_routine= 0x7ffff7a1f220 <ossl_init_ config_ ossl_>) at pthread_once.c:116 once_control@ entry=0x7ffff7b 7c7e0 <config>, init_routine= init_routine@ entry=0x7ffff7a 1f220 <ossl_init_ config_ ossl_>) at pthread_once.c:143 THREAD_ run_once (once=once@ entry=0x7ffff7b 7c7e0 <config>, init=init@ entry=0x7ffff7a 1f220 <ossl_init_ config_ ossl_>) at ../crypto/ threads_ pthread. c:118 init.c: 701 entry=2097228, settings= settings@ entry=0x0) at ../crypto/ init.c: 620 settings@ entry=0x0) at ../ssl/ ssl_init. c:205 entry=0x7ffff7c 0a860 <TLS_client_ method_ data.23164> ) at ../ssl/ ssl_lib. c:2978 entry=0x5555555 cdb10, sockindex= sockindex@ entry=0) at vtls/openssl.c:2527 cdb10, sockindex=0, nonblocking=true, done=0x7fffffff e238) at vtls/openssl.c:3752 connect_ nonblocking (conn=conn@ entry=0x5555555 cdb10, sockindex= sockindex@ entry=0, done=done@ entry=0x7ffffff fe238) at vtls/vtls.c:291 entry=0x5555555 cdb10, done=done@ entry=0x7ffffff fe238) at http.c:1575 fe238, conn=0x5555555c db10) at http.c:1497 cdb10, done=0x7fffffff e238) at http.c:1462 done=0x7fffffff e238, conn=<optimized out>) at multi.c:1485 0x5555555c2bd0, now=..., data=0x5555555c ee10) at multi.c:1794 multi@entry= 0x5555555c2bd0, running_ handles= running_ handles@ entry=0x7ffffff fe3a8) at multi.c:2341 0x5555555c2bd0) at easy.c:599 ee10) at easy.c:692 cee10) at easy.c:711 0x5555555c43c0, global= 0x7fffffffe540) at tool_operate.c:2203 c43c0, global= 0x7fffffffe540) at tool_operate.c:2379 0x7fffffffe540, argc=<optimized out>, argv=<optimized out>) at tool_operate.c:2491 e6d8) at tool_main.c:314
114 in ../crypto/
(gdb) bt
#0 CONF_modules_
#1 0x00007ffff7988a10 in openssl_config_int (settings=
#2 0x00007ffff7a1f234 in ossl_init_config () at ../crypto/
#3 ossl_init_
#4 0x00007ffff7f0247f in __pthread_once_slow (once_control=
#5 0x00007ffff7f02535 in __GI___pthread_once (once_control=
#6 0x00007ffff7a8a74d in CRYPTO_
#7 0x00007ffff7a1f8b8 in OPENSSL_init_crypto (settings=0x0, opts=2097228) at ../crypto/
#8 OPENSSL_init_crypto (opts=opts@
#9 0x00007ffff7bb4575 in OPENSSL_init_ssl (opts=2097228, opts@entry=2097152, settings=
#10 0x00007ffff7bb84a2 in SSL_CTX_new (meth=meth@
#11 0x00007ffff7f9877e in ossl_connect_step1 (conn=conn@
#12 0x00007ffff7f9a23f in ossl_connect_common (conn=0x5555555
#13 0x00007ffff7f9b14f in Curl_ssl_
#14 0x00007ffff7f46296 in https_connecting (conn=conn@
#15 0x00007ffff7f47d13 in Curl_http_connect (done=0x7ffffff
#16 Curl_http_connect (conn=0x5555555
#17 0x00007ffff7f6897d in protocol_connect (protocol_
#18 multi_runsingle (multi=
#19 0x00007ffff7f69a11 in curl_multi_perform (multi=
#20 0x00007ffff7f5fe8b in easy_transfer (multi=
#21 easy_perform (events=false, data=0x5555555c
#22 curl_easy_perform (data=0x5555555
#23 0x000055555556e1d0 in serial_transfers (share=
#24 run_all_transfers (result=CURLE_OK, share=0x5555555
#25 operate (global=
#26 0x000055555555f130 in main (argc=4, argv=0x7fffffff