Skip to content

Commit 8852015

Browse files
committed
openssl_stream: use new initialization function on OpenSSL version >=1.1
Previous to OpenSSL version 1.1, the user had to initialize at least the error strings as well as the SSL algorithms by himself. OpenSSL version 1.1 instead provides a new function `OPENSSL_init_ssl`, which handles initialization of all subsystems. As the new API call will by default load error strings and initialize the SSL algorithms, we can safely replace these calls when compiling against version 1.1 or later. This fixes a compiler error when compiling against OpenSSL version 1.1 which has been built without stubs for deprecated syntax.
1 parent 29081c2 commit 8852015

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/openssl_stream.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,13 @@ int git_openssl_stream_global_init(void)
103103
ssl_opts |= SSL_OP_NO_COMPRESSION;
104104
#endif
105105

106+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
106107
SSL_load_error_strings();
107108
OpenSSL_add_ssl_algorithms();
109+
#else
110+
OPENSSL_init_ssl(0, NULL);
111+
#endif
112+
108113
/*
109114
* Load SSLv{2,3} and TLSv1 so that we can talk with servers
110115
* which use the SSL hellos, which are often used for

0 commit comments

Comments
 (0)