summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-11-01 20:34:58 +0800
committerGitHub <noreply@github.com>2022-11-01 13:34:58 +0100
commit59083e2e48bbf49daaa8d29e233c6f57f33a05ef (patch)
tree24257e5a8f8ca58955516ddf6f21589488477ff8
parent75ece74bdd29d0a1495da05c9d30e367b62efb2b (diff)
downloadNim-59083e2e48bbf49daaa8d29e233c6f57f33a05ef.tar.gz
fixes ssl static link regression (#20722)
-rw-r--r--lib/wrappers/openssl.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/wrappers/openssl.nim b/lib/wrappers/openssl.nim
index 35b7f29a8..edbbd9618 100644
--- a/lib/wrappers/openssl.nim
+++ b/lib/wrappers/openssl.nim
@@ -280,7 +280,9 @@ proc TLSv1_method*(): PSSL_METHOD{.cdecl, dynlib: DLLSSLName, importc.}
 # and support SSLv3, TLSv1, TLSv1.1 and TLSv1.2
 # SSLv23_method(), SSLv23_server_method(), SSLv23_client_method() are removed in 1.1.0
 
-when compileOption("dynlibOverride", "ssl") or defined(noOpenSSLHacks):
+const useStaticLink = compileOption("dynlibOverride", "ssl") or defined(noOpenSSLHacks)
+
+when useStaticLink:
   # Static linking
 
   when defined(openssl10):
@@ -839,6 +841,8 @@ when not defined(nimDisableCertificateValidation) and not defined(windows):
     proc SSL_get1_peer_certificate*(ssl: SslCtx): PX509 {.cdecl, dynlib: DLLSSLName, importc.}
     proc SSL_get_peer_certificate*(ssl: SslCtx): PX509 =
       SSL_get1_peer_certificate(ssl)
+  elif useStaticLink:
+    proc SSL_get_peer_certificate*(ssl: SslCtx): PX509 {.cdecl, dynlib: DLLSSLName, importc.}
   else:
     proc SSL_get_peer_certificate*(ssl: SslCtx): PX509 =
       let methodSym = sslSymNullable("SSL_get_peer_certificate", "SSL_get1_peer_certificate")