@@ -62,29 +62,34 @@ general case still affects you if you use ssh.
62
62
General Case
63
63
------------
64
64
65
- By default we use libcurl, which has its own ![ recommendations for
66
- thread safety] ( https://curl.haxx.se/libcurl/c/threadsafe.html ) .
67
-
68
- If libcurl was not found or was disabled, libgit2 uses OpenSSL to be
69
- able to use HTTPS as a transport. This library is made to be
70
- thread-implementation agnostic, and the users of the library must set
71
- which locking function it should use. This means that libgit2 cannot
72
- know what to set as the user of libgit2 may use OpenSSL independently
73
- and the locking settings must survive libgit2 shutting down.
74
-
75
- Even if libgit2 doesn't use OpenSSL directly, OpenSSL can still be used
76
- by libssh2 depending on the configuration. If OpenSSL is used both by
77
- libgit2 and libssh2, you only need to set up threading for OpenSSL once.
78
-
79
- libgit2 does provide a last-resort convenience function
65
+ If it's available, by default we use libcurl to provide HTTP tunneling support,
66
+ which may be linked against a number of cryptographic libraries and has its
67
+ own
68
+ [ recommendations for thread safety] ( https://curl.haxx.se/libcurl/c/threadsafe.html ) .
69
+
70
+ If there are no alternative TLS implementations (currently only
71
+ SecureTransport), libgit2 uses OpenSSL in order to use HTTPS as a transport.
72
+ OpenSSL is thread-safe starting at version 1.1.0. If your copy of libgit2 is
73
+ linked against that version, you do not need to take any further steps.
74
+
75
+ Older versions of OpenSSL are made to be thread-implementation agnostic, and the
76
+ users of the library must set which locking function it should use. libgit2
77
+ cannot know what to set as the user of libgit2 may also be using OpenSSL independently and
78
+ the locking settings must then live outside the lifetime of libgit2.
79
+
80
+ Even if libgit2 doesn't use OpenSSL directly, OpenSSL can still be used by
81
+ libssh2 or libcurl depending on the configuration. If OpenSSL is used by
82
+ more than one library, you only need to set up threading for OpenSSL once.
83
+
84
+ If libgit2 is linked against OpenSSL, it provides a last-resort convenience function
80
85
` git_openssl_set_locking() ` (available in ` sys/openssl.h ` ) to use the
81
- platform-native mutex mechanisms to perform the locking, which you may
82
- rely on if you do not want to use OpenSSL outside of libgit2, or you
83
- know that libgit2 will outlive the rest of the operations. It is not
86
+ platform-native mutex mechanisms to perform the locking, which you can use
87
+ if you do not want to use OpenSSL outside of libgit2, or you
88
+ know that libgit2 will outlive the rest of the operations. It is then not
84
89
safe to use OpenSSL multi-threaded after libgit2's shutdown function
85
90
has been called. Note ` git_openssl_set_locking() ` only works if
86
91
libgit2 uses OpenSSL directly - if OpenSSL is only used as a dependency
87
- of libssh2 as described above, ` git_openssl_set_locking() ` is a no-op.
92
+ of libssh2 or libcurl as described above, ` git_openssl_set_locking() ` is a no-op.
88
93
89
94
If your programming language offers a package/bindings for OpenSSL,
90
95
you should very strongly prefer to use that in order to set up
@@ -96,9 +101,6 @@ See the
96
101
on threading for more details, and http://trac.libssh2.org/wiki/MultiThreading
97
102
for a specific example of providing the threading callbacks.
98
103
99
- Be also aware that libgit2 does not always link against OpenSSL
100
- if there are alternatives provided by the system.
101
-
102
104
libssh2 may be linked against OpenSSL or libgcrypt. If it uses OpenSSL,
103
105
see the above paragraphs. If it uses libgcrypt, then you need to
104
106
set up its locking before using it multi-threaded. libgit2 has no
0 commit comments