Add FreeBSD-specific SONAME versions to portable OpenSSL probing.
authorJason Pugsley <jason.pugsley@gmail.com>
Wed, 15 Apr 2020 17:27:14 +0000 (03:27 +1000)
committerGitHub <noreply@github.com>
Wed, 15 Apr 2020 17:27:14 +0000 (10:27 -0700)
The version of OpenSSL installed will depend on the version of FreeBSD and
whether OpenSSL has been updated from the FreeBSD Ports collection.

The order of attempted loading is:
    libssl.so.11 (ports)
    libssl.so.111 (base FreeBSD using OpenSSL 1.1.1)
    libssl.so.8 (base FreeBSD using OpenSSL 1.0.2)

src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.c

index b33aa12..47ae111 100644 (file)
@@ -97,6 +97,23 @@ static bool OpenLibrary()
         DlOpen(MAKELIB("10"));
     }
 
+    // FreeBSD uses a different suffix numbering convention.
+    // Current supported FreeBSD releases should use the order .11 -> .111 -> .8
+    if (libssl == NULL)
+    {
+        DlOpen(MAKELIB("11"));
+    }
+
+    if (libssl == NULL)
+    {
+        DlOpen(MAKELIB("111"));
+    }
+
+    if (libssl == NULL)
+    {
+        DlOpen(MAKELIB("8"));
+    }
+
     return libssl != NULL;
 }