In order to understand SSL/TLS
, I downloaded OpenSSL-1.0.2k
on Windows-7
and compiled with Cygwin
gcc
64 b
SSL_get_error()
so you can start debugging. Rather than just throwing up your hands.SSL_ERROR_SYSCALL
. You didn't catch it where you thought you should because case (SSL_ERROR_SYSCALL || SSL_ERROR_SSL || SSL_ERROR_WANT_CONNECT || SSL_ERROR_WANT_ACCEPT):
doesn't do what you think. It will turn into case 1
because of the semantics of ||
. There should be separate case
statements for each value.errno
, as per the documentation you quoted yourself, which means that you should then trace that. Rather than just throwing up your hands. And note that you must do so before calling any other system calls (such as write()
via printf()
), so it might help to save errno
immediately.errno
directly with printf("errno=%d\n", errno)
, but it would be more useful to print the error message, which you can do with either perror()
or printf("error=%s\n", syserror(errno))
.SSL_get_error()
is not an errno
value, and neither is the original -1 you started with. An errno
value comes from the errno
variable. SSL_accept()
returned -1, for which there is no actual evidence here.So it is entirely possible that there is no error here at all.