File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,28 @@ if ("" -eq $Tls) {
9090 $Tls = " schannel"
9191 } else {
9292 $Tls = " openssl"
93+ try {
94+ # If no Tls was specified, try to guess it based on default OpenSSL version
95+ # This is more complicated in attempt to silently deal with missing openssl executable
96+ #
97+ $pinfo = New-Object System.Diagnostics.ProcessStartInfo
98+ $pinfo.FileName = " openssl"
99+ $pinfo.Arguments = " version"
100+ $pinfo.RedirectStandardError = $true
101+ $pinfo.RedirectStandardOutput = $true
102+ $pinfo.UseShellExecute = $false
103+
104+ $p = New-Object System.Diagnostics.Process
105+ $p.StartInfo = $pinfo
106+ $p.Start () | Out-Null
107+ $p.WaitForExit ()
108+
109+ $version = $p.StandardOutput.ReadToEnd ()
110+ if ($version -like " OpenSSL 3*" )
111+ {
112+ $Tls = " openssl3"
113+ }
114+ } catch { }
93115 }
94116}
95117
Original file line number Diff line number Diff line change @@ -339,7 +339,11 @@ else()
339339 if (QUIC_USE_SYSTEM_LIBCRYPTO)
340340 include (FindOpenSSL)
341341 if (OPENSSL_FOUND)
342- if (OPENSSL_VERSION VERSION_EQUAL EXPECTED_OPENSSL_VERSION OR OPENSSL_VERSION VERSION_GREATER EXPECTED_OPENSSL_VERSION)
342+ # Get Major.Minor so 3.0 can match 3.0.2.
343+ # We cannot use VERSION_GREATER as 3.0 would work for 1.1.1 but they are not compatible.
344+ string (FIND ${OPENSSL_VERSION} "." VERSIONLEN REVERSE )
345+ string (SUBSTRING ${OPENSSL_VERSION} 0 ${VERSIONLEN} OPENSSL_MAJORMINOR)
346+ if (OPENSSL_VERSION VERSION_EQUAL EXPECTED_OPENSSL_VERSION OR OPENSSL_MAJORMINOR VERSION_EQUAL EXPECTED_OPENSSL_VERSION)
343347 target_link_libraries (OpenSSLQuic INTERFACE OpenSSL::Crypto)
344348 else ()
345349 message (FATAL_ERROR "OpenSSL ${EXPECTED_OPENSSL_VERSION} not found, found ${OPENSSL_VERSION} " )
You can’t perform that action at this time.
0 commit comments