@@ -91,7 +91,7 @@ int (*sk_num)(const void *sk);
9191void * (* sk_value )(const void * sk , int i );
9292void (* sk_free )(void * sk );
9393
94- void * openssl_handle ;
94+ static void * openssl_handle ;
9595
9696GIT_INLINE (void * ) openssl_sym (int * err , const char * name , bool required )
9797{
@@ -125,7 +125,8 @@ int git_openssl_stream_dynamic_init(void)
125125 (openssl_handle = dlopen ("libssl.1.1.dylib" , RTLD_NOW )) == NULL &&
126126 (openssl_handle = dlopen ("libssl.so.1.0.0" , RTLD_NOW )) == NULL &&
127127 (openssl_handle = dlopen ("libssl.1.0.0.dylib" , RTLD_NOW )) == NULL &&
128- (openssl_handle = dlopen ("libssl.so.10" , RTLD_NOW )) == NULL ) {
128+ (openssl_handle = dlopen ("libssl.so.10" , RTLD_NOW )) == NULL &&
129+ (openssl_handle = dlopen ("libssl.so.3" , RTLD_NOW )) == NULL ) {
129130 git_error_set (GIT_ERROR_SSL , "could not load ssl libraries" );
130131 return -1 ;
131132 }
@@ -175,7 +176,6 @@ int git_openssl_stream_dynamic_init(void)
175176
176177 SSL_connect = (int (* )(SSL * ))openssl_sym (& err , "SSL_connect" , true);
177178 SSL_ctrl = (long (* )(SSL * , int , long , void * ))openssl_sym (& err , "SSL_ctrl" , true);
178- SSL_get_peer_certificate = (X509 * (* )(const SSL * ))openssl_sym (& err , "SSL_get_peer_certificate" , true);
179179 SSL_library_init = (int (* )(void ))openssl_sym (& err , "SSL_library_init" , false);
180180 SSL_free = (void (* )(SSL * ))openssl_sym (& err , "SSL_free" , true);
181181 SSL_get_error = (int (* )(SSL * , int ))openssl_sym (& err , "SSL_get_error" , true);
@@ -187,6 +187,10 @@ int git_openssl_stream_dynamic_init(void)
187187 SSL_shutdown = (int (* )(SSL * ssl ))openssl_sym (& err , "SSL_shutdown" , true);
188188 SSL_write = (int (* )(SSL * , const void * , int ))openssl_sym (& err , "SSL_write" , true);
189189
190+ if (!(SSL_get_peer_certificate = (X509 * (* )(const SSL * ))openssl_sym (& err , "SSL_get_peer_certificate" , false))) {
191+ SSL_get_peer_certificate = (X509 * (* )(const SSL * ))openssl_sym (& err , "SSL_get1_peer_certificate" , true);
192+ }
193+
190194 SSL_CTX_ctrl = (long (* )(SSL_CTX * , int , long , void * ))openssl_sym (& err , "SSL_CTX_ctrl" , true);
191195 SSL_CTX_free = (void (* )(SSL_CTX * ))openssl_sym (& err , "SSL_CTX_free" , true);
192196 SSL_CTX_new = (SSL_CTX * (* )(const SSL_METHOD * ))openssl_sym (& err , "SSL_CTX_new" , true);
0 commit comments