I am using openssl to establish the TLS connection with the remote server.
Here are the code snippets:
if ((ret = SSL_connect(c->ssl)) <= 0) {
ret = SSL_get_error(c->ssl, ret);
if((err = ERR_get_error())) {
SSL_load_error_strings();
ERR_load_crypto_strings();
CRERROR(LOGSSLUTILS, "SSL connect err code:[%lu](%s)\n", err, ERR_error_string(err, NULL));
CRERROR(LOGSSLUTILS, "Error is %s \n",ERR_reason_error_string(err));
}
}
for some unknown reason, the ssl_connect failed and I just want to identify the reason by using the ERR_error_string, the outputs are:
SSL connect err code:[336077172] (error:14082174:lib(20):func(130):reason(372))
Error: cmrSSLlInit:174 Error is (null)
As you can see, I can only get the error code but cannot get the readable error string.
How how can I get the readable error string ?