From 58951bb7f0c69bb23cb2248c26cd79e38ab35f34 Mon Sep 17 00:00:00 2001 From: Vizit0r Date: Mon, 3 Aug 2026 10:57:43 +0300 Subject: [PATCH] Fix swapped libssl/libcrypto names on macOS TSSLTools.LoadSslLibs builds the macOS candidate list for libcrypto out of 'libssl.dylib' and the list for libssl out of 'libcrypto.dylib'. The libssl handle therefore points at libcrypto and the first GetSslLibProc(FSslLibHandle, 'OPENSSL_init_ssl') raises ESslInvalidProc, so SSL cannot initialise on macOS whenever OpenSSL is loaded dynamically -- that is everywhere except iOS/Android, which take the __SSL_STATIC__ path. Swap the two lists and add the versioned names, mirroring what the LINUX branch already does: OpenSSL 3 installs libcrypto.3.dylib / libssl.3.dylib and the unversioned symlinks are not always present. Also fix a copy/paste in the same routine: the static-name branch for LSslLibs tests LIBCRYPTO_NAME but assigns LIBSSL_NAME. --- Net/Net.OpenSSL.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Net/Net.OpenSSL.pas b/Net/Net.OpenSSL.pas index c019c8e..57b0804 100644 --- a/Net/Net.OpenSSL.pas +++ b/Net/Net.OpenSSL.pas @@ -3636,7 +3636,9 @@ class procedure TSSLTools.LoadSslLibs; 'libcrypto.so.1.1', 'libcrypto.so' {$ELSEIF DEFINED(MACOS)} - 'libssl.dylib' + 'libcrypto.3.dylib', + 'libcrypto.1.1.dylib', + 'libcrypto.dylib' {$ENDIF} ]; end; @@ -3812,7 +3814,7 @@ class procedure TSSLTools.LoadSslLibs; begin if (FLibSSL <> '') then LSslLibs := [FLibSSL] - else if (LIBCRYPTO_NAME <> '') then + else if (LIBSSL_NAME <> '') then LSslLibs := [LIBSSL_NAME] else begin @@ -3830,7 +3832,9 @@ class procedure TSSLTools.LoadSslLibs; 'libssl.so.1.1', 'libssl.so' {$ELSEIF DEFINED(MACOS)} - 'libcrypto.dylib' + 'libssl.3.dylib', + 'libssl.1.1.dylib', + 'libssl.dylib' {$ENDIF} ]; end;