unit uHCLOpenSSL;

{$mode objfpc}{$H+}

/// <summary>
/// uHCLOpenSSL — makes FPC 3.2.2's HTTPS use OpenSSL 3.
///
/// <c>fphttpclient</c> + <c>opensslsockets</c> load OpenSSL at run time, and
/// FPC 3.2.2's <c>openssl</c> unit only knows the 1.1-and-older library
/// names.  OpenSSL 1.1 has been end-of-life since 2023-09 and is not shipped
/// (house decision, Lazarus-FPC notes <c>fpc-openssl-3.md</c>, 2026-09-26):
/// <list type="bullet">
/// <item>Windows: the initialization sets <c>DLLSSLName</c>/<c>DLLUtilName</c>
/// to OpenSSL 3's names, <c>libssl-3.dll</c>/<c>libcrypto-3.dll</c> (the
/// <c>-x64</c> names on a 64-bit build).  The launcher ships FireDaemon's
/// OpenSSL 3.5 LTS pair beside the exe (<c>vendor/openssl-win32/VENDOR.md</c>).</item>
/// <item>Linux: the shared <c>uCICOpenSSL3</c> adds OpenSSL 3's
/// <c>.so.3</c> suffix to the names searched.</item>
/// </list>
/// Must initialise before anything that uses <c>opensslsockets</c>: list it
/// first in the program's <c>uses</c>, and before <c>fphttpclient</c> /
/// <c>opensslsockets</c> in any unit that uses them.
/// </summary>

interface

uses
  uCICOpenSSL3, openssl;

const
  /// <summary>The OpenSSL 3 libraries this build loads on Windows.</summary>
  {$IFDEF MSWINDOWS}
  {$IFDEF CPUX86_64}
  HCL_OPENSSL_SSL_DLL    = 'libssl-3-x64.dll';
  HCL_OPENSSL_CRYPTO_DLL = 'libcrypto-3-x64.dll';
  {$ELSE}
  HCL_OPENSSL_SSL_DLL    = 'libssl-3.dll';
  HCL_OPENSSL_CRYPTO_DLL = 'libcrypto-3.dll';
  {$ENDIF}
  {$ELSE}
  HCL_OPENSSL_SSL_DLL    = '';
  HCL_OPENSSL_CRYPTO_DLL = '';
  {$ENDIF}

implementation

initialization
  {$IFDEF MSWINDOWS}
  DLLSSLName  := HCL_OPENSSL_SSL_DLL;
  DLLUtilName := HCL_OPENSSL_CRYPTO_DLL;
  {$ENDIF}
end.
