BTW. You didn't handle all exception. Yes, you have except almost everywhere but if it was everywhere you wouldn't get that access violation (because that's also an except).
If you handle the except in Snippet with a Showmessage you get image below this post. But you return Result := '' with that exception.
And further on in the program, it can't handle that Result = '' and gives an access violation. I'm not sure where but for that you would need to debug (with setting result to '' for example).
Should it be enough to include just the two DDL's in my installation package for Windows?
Yes, that should be enough.
As of Linux, if I include OpenSSL 2.0.1 in the list of dependencies, will that version be used instead of OpenSSL 3.x (even if the latter is also installed)?
(you mean 1.0.2

)
No, if you include that as >= dependencies it makes sure that's the
minimum version installed.
So with >= 1.0.2 and 3 being already installed it will do nothing. But your program would need to handle the 3 version (because there is no 1.0.2).
But if you define it as = 1.0.2 then it needs to be that version exactly.
I'm not sure if it will try to downgrade to 1.0.2 but I can guarantee you that you'll end up in a dependency hell.
Because openssl has a dependency on libc6 and libcrypto. So they also need to be downgraded.
And lots of other packages are again dependend on libc6 and openssl 3 so you end up in a loop.
Alternatively, should it be better to upgrade Lazarus (both in Windows and Linux) to the latest (but not necessarily the trunk) version if this version offers consistent support for OpenSSL 3 in all platforms?
I think I saw the '.1.1' in the array for FPC 3.2.0 so OpenSSL 1.1 should be supported.
But if you want OpenSSL 3 support... I think it's only in trunk (because I have a Lazarus 2.2.6 here with FPC 3.2.2 which only has .1.1).
BTW. That was probably also the reason Synapse came up. It can use the openssl 3 without completely recompiling FPC.
But then you would need to re-program all your communications.
Does anybody know how to "hack" the openssl.pas for loading OpenSSL 3 without recompiling FPC????
For changing the constant for DLLVersions before InitSSLInterface?
I did this now and it seems to go a step further but still crashes with the access violation.
But maybe if you build in the exception check at the right places with a showmessage of what kind of exception (instead of just return), you can find the problem.
This somewhere before the first call to a https get.
openssl.DLLVersions[1] := '.3';
BTW, this is a hack because it replaces the .1.1. You might want to insert it on position 2 instead of replacing it.
EDIT: That hack does work but there is some trouble/instability further on (I think in Wikimedia Commons).