Skip to content

Commit 0d3fad3

Browse files
committed
Add selection for openssl1.1
1 parent 3d3d1ba commit 0d3fad3

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ private static IntPtr ResolveDll(string libraryName, Assembly assembly, DllImpor
110110

111111
if (Directory.Exists(runtimesDirectory))
112112
{
113+
// The default libgit2 binary is linked against OpenSSL 3. On hosts that have only libcrypto.so.1.1
114+
// fall back to the OpenSSL-1.1 variant shipped alongside it.
115+
if (!NativeLibrary.TryLoad("libcrypto.so.3", out _) && NativeLibrary.TryLoad("libcrypto.so.1.1", out _))
116+
{
117+
foreach (var runtimeFolder in Directory.GetDirectories(runtimesDirectory, $"*-{processorArchitecture}"))
118+
{
119+
string variantPath = Path.Combine(runtimeFolder, "native", $"lib{libraryName}-openssl1.1.so");
120+
if (NativeLibrary.TryLoad(variantPath, out handle))
121+
{
122+
return handle;
123+
}
124+
}
125+
}
126+
113127
foreach (var runtimeFolder in Directory.GetDirectories(runtimesDirectory, $"*-{processorArchitecture}"))
114128
{
115129
string libPath = Path.Combine(runtimeFolder, "native", $"lib{libraryName}.so");

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</PropertyGroup>
3131

3232
<ItemGroup>
33-
<PackageReference Include="Octopus.LibGit2Sharp.NativeBinaries" Version="2.0.323-octopus.2.1" PrivateAssets="none" />
33+
<PackageReference Include="Octopus.LibGit2Sharp.NativeBinaries" Version="2.0.323-octopus.2.octopus-em-build-for.46" PrivateAssets="none" />
3434
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="all" />
3535
</ItemGroup>
3636

0 commit comments

Comments
 (0)