Search code examples
delphisslindy

Delphi Indy: cannot load SSL libraries first time. A retry works


I'm using the latest indy snapshot (installed yesterday) and newest SSL libraries.

When trying to send a mail using idSMTP, the first time the component connects, I get an exception:

Could't load the SSL libraries

. Funny thing is, a retry works always. Debugging I found that the problem is in IsSSLOpenSSLHeader, function Loaad: boolean, line

@OpenSSL_add_all_algorithms := LoadFunctionCLib('OpenSSL_add_all_algorithms');

Why does it fail the first time and not the second is still a mystery to me, but before I go on investigating I would like to as if anybody knows the solution to this problem.


Solution

  • The code you are using is NOT the latest snapshot. That bug was fixed a couple of weeks ago. The line you quote is NOT in the latest code, it has been replaced with the following:

    fn_OPENSSL_add_all_algorithms_noconf = 'OPENSSL_add_all_algorithms_noconf';
    fn_OpenSSL_add_all_algorithms = 'OpenSSL_add_all_algorithms';
    
    @OpenSSL_add_all_algorithms := LoadOldCLib(fn_OpenSSL_add_all_algorithms, fn_OPENSSL_add_all_algorithms_noconf);