I have scoured Stack Overflow and the internet, but I have been unable to locate an answer to why ssl_accept() keeps returning:
[DEBUG] SSL_accept() : Failed
[DEBUG] Error string : error:00000005:lib(0):func(0):DH lib
The error happened during the Diffie-Hellman Key Exchange, e.g. where the peers tried to generate the keys for the connection. There might be several reasons for this, like invalid DH parameters given on the server side. With the your current code it is hard to see where the error actually is, but I guess is somewhere in setting up your ctx, so maybe should show the relevant parts of the code.
This is not a Diffie-Hellman library issue.
The reason you are getting the
error:00000005:lib(0):func(0):DH lib
is that you passed in the SSL_get_error()
error code to ERR_error_string()
which you should not do.
ERR_error_string()
is only used on error codes from ERR_get_error()
.
See the help page for SSL_get_error()
to know what the error means.