Recent

Author Topic: Could not initialize openssl library?  (Read 2054 times)

Espectr0

  • Full Member
  • ***
  • Posts: 218
Could not initialize openssl library?
« on: June 11, 2023, 01:47:28 am »
Hola,
what can go wrong in linux mint, that I get the message "Could not initialize openssl library"...
Do I need to configure something special?

Code: Pascal  [Select][+][-]
  1.  
  2. uses opensslsockets;
  3. ...
  4. FHTTPClient.AllowRedirect := True;
  5. FHTTPClient.HTTPMethod(FMethod, AURL, FDS, [200]);
  6.  

openssl is installed.

Thanks!

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Could not initialize openssl library?
« Reply #1 on: June 11, 2023, 09:58:02 am »
What protocol are you requesting? It should be TLS1.2 or higher. Usually the OpenSSL version for Mint is up to date and so will refuse anything below TLS1.2
[edit]
I just got the same error using fpcupdeluxe on windows 10.
While searching for an answer  I discoverd:
1. The current stable of openssl is 3.1
2. This is not yet supported by fpc
3. But openssl 1.1.1u (lts) is supported by fpc.
4. so check in a terminal using: openssl version

Also note fpcdupeluxe worked yesterday so currently I am at a loss.
Investigating...
I have to exactly the same laptops, with slightly differing versions of Windows 10: one works as of today, the one I am using now doesn't.
Strange. So it is probably not related to Mint, but the presence of openssl 1.1.1.
« Last Edit: June 11, 2023, 11:15:18 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Espectr0

  • Full Member
  • ***
  • Posts: 218
Re: Could not initialize openssl library?
« Reply #2 on: June 11, 2023, 12:55:02 pm »
The version installed is v3.0.2 15 Mar 2022.
It is not supported by fpc?

paweld

  • Hero Member
  • *****
  • Posts: 1003
Re: Could not initialize openssl library?
« Reply #3 on: June 11, 2023, 01:28:14 pm »
fpc trunk only.   
or use synapse
Best regards / Pozdrawiam
paweld

Espectr0

  • Full Member
  • ***
  • Posts: 218
Re: Could not initialize openssl library?
« Reply #4 on: June 11, 2023, 02:10:10 pm »
Thanks

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Could not initialize openssl library?
« Reply #5 on: June 11, 2023, 02:45:30 pm »
fpc trunk only.   
or use synapse
Since when does synapse support openssl 3.x? It does not.
Also I use mainly trunk (always recent) and trunk also does not support openssl 3.x.
It supports the long time support version of openssl 1.1.1.
openssl 3.x has a quite breaking changed API as opposed to 1.x, mostly caused by the fact that it is a complete rewrite in C++ where older versions are plain C.
« Last Edit: June 11, 2023, 02:50:29 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

rvk

  • Hero Member
  • *****
  • Posts: 6163
Re: Could not initialize openssl library?
« Reply #6 on: June 11, 2023, 03:39:42 pm »
fpc trunk only.   
or use synapse
Since when does synapse support openssl 3.x? It does not.
Since trunk R260.
https://sourceforge.net/p/synalist/code/HEAD/tree/trunk/

See ssl_openssl3.pas.

WayneSherman

  • Full Member
  • ***
  • Posts: 243
Re: Could not initialize openssl library?
« Reply #7 on: June 27, 2023, 06:55:32 pm »
Also I use mainly trunk (always recent) and trunk also does not support openssl 3.x.
It supports the long time support version of openssl 1.1.1.
openssl 3.x has a quite breaking changed API as opposed to 1.x...

FPC trunk has support for OpenSSL 3.0 since 2022-April:
https://gitlab.com/freepascal.org/fpc/source/-/commit/59672a698267ca16ea8812f4acf932f127cc7bc0
https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/openssl/src/openssl.pas#L111

abouchez

  • Full Member
  • ***
  • Posts: 111
    • Synopse
Re: Could not initialize openssl library?
« Reply #8 on: July 25, 2023, 04:07:06 pm »
Note that mORMot 2 has OpenSSL support from 1.1 to 3.x with automatic adaptation of the API.
It works with FPC 3.x compiler.

See https://github.com/synopse/mORMot2/blob/master/src/lib/mormot.lib.openssl11.pas for the raw API
and https://github.com/synopse/mORMot2/blob/master/src/crypt/mormot.crypt.openssl.pas for a set of high-level wrapper interfaces.

Note that some API is broken between 1.1 and 3.x e.g. some functions did disappear, be renamed, or changed parameter size (from 32-bit to 64bit).
So you need more than adding a dll name search to fully support the 3.x branch.
We tested and validated our wrapper on several Linux and Windows systems, and including Mac M1.

Also note that, from my experiment, OpenSSL 3.0 is way slower than OpenSSL 1.1 when setting up its internal structures and objects: for huge buffers, it is fine, but for small buffers, it has a huge overhead. It is about to be fixed in upcoming OpenSSL 3.1 IIRC.
« Last Edit: July 25, 2023, 04:23:47 pm by abouchez »

 

TinyPortal © 2005-2018