Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tls-uses-pqc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,24 @@ static void SetOpenSSLImportResolver()
// Use the latest OpenSSL version on the system.
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), (name, assembly, searchPath) =>
{
Console.WriteLine($"Resolving {name}...");

if (name == "libssl")
{
if (NativeLibrary.TryLoad("libssl.so.4", assembly, searchPath, out var h) ||
NativeLibrary.TryLoad("libssl.so.3", assembly, searchPath, out h))
{
return h;
}
throw new NotSupportedException($"Cannot resolve {name}.");
Console.WriteLine($"error: Cannot resolve {name}.");
Console.WriteLine();
Console.WriteLine("Mapped files:");
Console.WriteLine(File.ReadAllText("/proc/self/maps"));

// On Mono, throwing an exception here gets swallowed, so do an application exit instead.
Environment.Exit(1);
}

return IntPtr.Zero; // Use the default resolution logic.
});
}
Expand Down
Loading