Fix swapped libssl/libcrypto names on macOS (SSL cannot initialise) - #196
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TSSLTools.LoadSslLibsbuilds the macOS candidate list for libcrypto out of'libssl.dylib', and the list for libssl out of'libcrypto.dylib'— the two are swapped.The consequence is not cosmetic:
FSslLibHandleends up pointing at libcrypto, and the very first lookup off it@OPENSSL_init_ssl := GetSslLibProc(FSslLibHandle, 'OPENSSL_init_ssl');raises
ESslInvalidProc(GetSslLibProcraises when the symbol is missing, and libcrypto does not export anySSL_*). So SSL cannot initialise on macOS whenever OpenSSL is loaded dynamically — which is everywhere except iOS/Android, since__SSL_STATIC__is only defined for those two and the whole body ofLoadSslLibsis under{$IFNDEF __SSL_STATIC__}.Changes
LINUXbranch already does. OpenSSL 3 installslibcrypto.3.dylib/libssl.3.dylib; the unversioned symlinks are not always present.LSslLibstestsLIBCRYPTO_NAMEbut assignsLIBSSL_NAME:This one is currently unreachable (both consts are
''in dynamic builds, and the routine is compiled out in static ones), so it is just cleanup — happy to drop it from this PR if you would rather keep it focused.Checked
Compiles clean on Win64 (Delphi 37.0) via
Net.CrossWebSocketClient.pas, which pulls inNet.OpenSSL— no new warnings or hints.