diff --git a/src/native/libs/System.Security.Cryptography.Native/opensslshim.c b/src/native/libs/System.Security.Cryptography.Native/opensslshim.c index 10a9ae261128fe..6d9ba5deaeff82 100644 --- a/src/native/libs/System.Security.Cryptography.Native/opensslshim.c +++ b/src/native/libs/System.Security.Cryptography.Native/opensslshim.c @@ -75,21 +75,20 @@ static void OpenLibraryOnce(void) // Android OpenSSL has no soname DlOpen(LIBNAME); } -#endif - +#elif defined(__FreeBSD__) + // The ports version of OpenSSL is used over base where possible if (libssl == NULL) { - // Prefer OpenSSL 3.x - DlOpen(MAKELIB("3")); + // OpenSSL 3.5 from ports + DlOpen(MAKELIB("17")); } if (libssl == NULL) { - DlOpen(MAKELIB("1.1")); + // OpenSSL 3.5 from base as found in FreeBSD 15.0 + DlOpen(MAKELIB("35")); } -#ifdef __FreeBSD__ - // The ports version of OpenSSL is used over base where possible if (libssl == NULL) { // OpenSSL 3.0 from ports @@ -114,6 +113,16 @@ static void OpenLibraryOnce(void) } #endif + if (libssl == NULL) + { + // Prefer OpenSSL 3.x + DlOpen(MAKELIB("3")); + } + + if (libssl == NULL) + { + DlOpen(MAKELIB("1.1")); + } } static pthread_once_t g_openLibrary = PTHREAD_ONCE_INIT;