From e259f7ac58f7aa31416a102f47d946d620ec1a8b Mon Sep 17 00:00:00 2001 From: Ekopalypse <47723516+Ekopalypse@users.noreply.github.com> Date: Mon, 21 Jun 2021 18:23:57 +0200 Subject: [PATCH] net: make openssl init function backward compatible (#10537) --- vlib/net/openssl/c.v | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/vlib/net/openssl/c.v b/vlib/net/openssl/c.v index 58bfc2de49..dedba2a94a 100644 --- a/vlib/net/openssl/c.v +++ b/vlib/net/openssl/c.v @@ -35,6 +35,9 @@ pub struct SSL { pub struct SSL_METHOD { } +pub struct OPENSSL_INIT_SETTINGS { +} + fn C.BIO_new_ssl_connect(ctx &C.SSL_CTX) &C.BIO fn C.BIO_set_conn_hostname(b &C.BIO, name &char) int @@ -100,9 +103,16 @@ fn C.TLS_method() voidptr fn C.TLSv1_2_method() voidptr +fn C.OPENSSL_init_ssl(opts u64, settings &OPENSSL_INIT_SETTINGS) int + fn init() { - C.SSL_load_error_strings() - C.SSL_library_init() + $if ssl_pre_1_1_version ? { + // OPENSSL_VERSION_NUMBER < 0x10100000L + C.SSL_load_error_strings() + C.SSL_library_init() + } $else { + C.OPENSSL_init_ssl(C.OPENSSL_INIT_LOAD_SSL_STRINGS, 0) + } } pub const (