Skip to content

Commit a5781e2

Browse files
authored
Merge pull request libgit2#4195 from pks-t/pks/openssl-1.1
Fix building against OpenSSL v1.1
2 parents 1262963 + 8852015 commit a5781e2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/openssl_stream.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SSL_CTX *git__ssl_ctx;
3737

3838
#define GIT_SSL_DEFAULT_CIPHERS "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES128-SHA256:DHE-DSS-AES256-SHA256:DHE-DSS-AES128-SHA:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA"
3939

40-
#ifdef GIT_THREADS
40+
#if defined(GIT_THREADS) && OPENSSL_VERSION_NUMBER < 0x10100000L
4141

4242
static git_mutex *openssl_locks;
4343

@@ -70,7 +70,7 @@ static void shutdown_ssl_locking(void)
7070
git__free(openssl_locks);
7171
}
7272

73-
#endif /* GIT_THREADS */
73+
#endif /* GIT_THREADS && OPENSSL_VERSION_NUMBER < 0x10100000L */
7474

7575
static BIO_METHOD *git_stream_bio_method;
7676
static int init_bio_method(void);
@@ -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
@@ -146,7 +151,7 @@ int git_openssl_stream_global_init(void)
146151

147152
int git_openssl_set_locking(void)
148153
{
149-
#ifdef GIT_THREADS
154+
#if defined(GIT_THREADS) && OPENSSL_VERSION_NUMBER < 0x10100000L
150155
int num_locks, i;
151156

152157
num_locks = CRYPTO_num_locks();
@@ -163,6 +168,8 @@ int git_openssl_set_locking(void)
163168
CRYPTO_set_locking_callback(openssl_locking_function);
164169
git__on_shutdown(shutdown_ssl_locking);
165170
return 0;
171+
#elif OPENSSL_VERSION_NUMBER >= 0x10100000L
172+
return 0;
166173
#else
167174
giterr_set(GITERR_THREAD, "libgit2 was not built with threads");
168175
return -1;

0 commit comments

Comments
 (0)