OpenSSL 1.1.1 compiles on Windows by default to different filenames, then 1.0.2. libcrypto-1_1.dll and libssl-1_1.dll. So I changed in non-CRL version DLLSSLName and DLLUtilName to array[1..LIB_COUNT] of string (LIB_COUNT being 3 on Windows and 1 on another platforms). In that way matching pairs library names can be defined from newest to oldest. When LoadLib one of the pair fails, then other is also freed (if other was successful) and next one is tried until all versions are tried or both are loaded successfully. After that 1.1.1 seems to work with current version.
PS: SslMethodTLS has problems with lineendings. Diff is below. ssl_openssl_lib.pas | 53 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/ssl_openssl_lib.pas b/ssl_openssl_lib.pas index b689a05..d7e3161 100644 --- a/ssl_openssl_lib.pas +++ b/ssl_openssl_lib.pas @@ -110,29 +110,31 @@ const DLLUtilName = 'libeay32.dll'; {$ENDIF} {$ELSE} -var +const {$IFNDEF MSWINDOWS} + //Arrays must have same length, must describe combinations of names... + LIB_COUNT = 1; {$IFDEF DARWIN} - DLLSSLName: string = 'libssl.dylib'; - DLLUtilName: string = 'libcrypto.dylib'; + DLLSSLName: array[1..LIB_COUNT] of string = ('libssl.dylib'); + DLLUtilName: array[1..LIB_COUNT] of string = ('libcrypto.dylib'); {$ELSE} {$IFDEF OS2} {$IFDEF OS2GCC} - DLLSSLName: string = 'kssl.dll'; - DLLUtilName: string = 'kcrypto.dll'; + DLLSSLName: array[1..LIB_COUNT] of string = ('kssl.dll'); + DLLUtilName: array[1..LIB_COUNT] of string = ('kcrypto.dll'); {$ELSE OS2GCC} - DLLSSLName: string = 'ssl.dll'; - DLLUtilName: string = 'crypto.dll'; + DLLSSLName: array[1..LIB_COUNT] of string = ('ssl.dll'); + DLLUtilName: array[1..LIB_COUNT] of string = ('crypto.dll'); {$ENDIF OS2GCC} {$ELSE OS2} - DLLSSLName: string = 'libssl.so'; - DLLUtilName: string = 'libcrypto.so'; + DLLSSLName: array[1..LIB_COUNT] of string = ('libssl.so'); + DLLUtilName: array[1..LIB_COUNT] of string = ('libcrypto.so'); {$ENDIF OS2} {$ENDIF} {$ELSE} - DLLSSLName: string = 'ssleay32.dll'; - DLLSSLName2: string = 'libssl32.dll'; - DLLUtilName: string = 'libeay32.dll'; + LIB_COUNT = 3; + DLLSSLName: array[1..LIB_COUNT] of string = ('libssl-1_1.dll', 'ssleay32.dll', 'libssl32.dll'); + DLLUtilName: array[1..LIB_COUNT] of string = ('libcrypto-1_1.dll', 'libeay32.dll', 'libeay32.dll'); {$ENDIF} {$ENDIF} @@ -1861,7 +1863,7 @@ end; function InitSSLInterface: Boolean; var s: string; - x: integer; + x, i: integer; begin {pf} if SSLLoaded then @@ -1878,12 +1880,25 @@ begin SSLLibHandle := 1; SSLUtilHandle := 1; {$ELSE} - SSLUtilHandle := LoadLib(DLLUtilName); - SSLLibHandle := LoadLib(DLLSSLName); - {$IFDEF MSWINDOWS} - if (SSLLibHandle = 0) then - SSLLibHandle := LoadLib(DLLSSLName2); - {$ENDIF} + i := 1; + repeat + SSLUtilHandle := LoadLib(DLLUtilName[i]); + SSLLibHandle := LoadLib(DLLSSLName[i]); + if not ((SSLUtilHandle <> 0) and (SSLLibHandle <> 0)) then + begin//Both libraries were not initialized... + if SSLLibHandle <> 0 then + begin + FreeLibrary(SSLLibHandle); + SSLLibHandle := 0; + end; + if SSLUtilHandle <> 0 then + begin + FreeLibrary(SSLUtilHandle); + SSLUtilHandle := 0; + end; + Inc(i);//try next + end; + until (i > LIB_COUNT) or ((SSLLibHandle <> 0) and (SSLUtilHandle <> 0)); {$ENDIF} if (SSLLibHandle <> 0) and (SSLUtilHandle <> 0) then begin -- Virgo Pärna virgo.pa...@mail.ee _______________________________________________ synalist-public mailing list synalist-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synalist-public