If an openssl client v1.0.2m makes a connection to an SSL server, and if the server disconnects the connection without saying anything (zero bytes are sent), openssl doesn't explicitly declare this in the error message.
While in theory this is a handshake failure, there is no attempt to log why the handshake failed.
Would it be correct to add an additional line before
If an openssl client v1.0.2m makes a connection to an SSL server, and if the server disconnects the connection without saying anything (zero bytes are sent), openssl doesn't explicitly declare this in the error message.
While in theory this is a handshake failure, there is no attempt to log why the handshake failed.
Would it be correct to add an additional line before
-> 177 SSLerr(SSL_F_SSL23_WRITE, SSL_R_SSL_HANDSHAKE_FAILURE);
to state that the remote server terminated the connection unexpectedly?
Or are there other types of handshake failures that could cause is to reach this line with n equal to zero?
(lldb) run Process 8811 launched: './apps/openssl' (i386) CONNECTED(00000003) Process 8811 stopped
-> 103 if (s->packet_length < (unsigned int)n) { 104 p = s->packet; 105
106 for (;;) { Target 0: (openssl) stopped. (lldb) next Process 8811 stopped
103 if (s->packet_length < (unsigned int)n) { -> 104 p = s->packet; 105
106 for (;;) { 107 s->rwstate = SSL_READING; Target 0: (openssl) stopped. (lldb) Process 8811 stopped
106 for (;;) { -> 107 s->rwstate = SSL_READING; 108 j = BIO_read(s->rbio, (char *)&(p[s->packet_length]), 109 n - s->packet_length); 110 if (j <= 0) Target 0: (openssl) stopped. (lldb) Process 8811 stopped
106 for (;;) { 107 s->rwstate = SSL_READING; -> 108 j = BIO_read(s->rbio, (char *)&(p[s->packet_length]), 109 n - s->packet_length); 110 if (j <= 0) 111 return j; Target 0: (openssl) stopped. (lldb) Process 8811 stopped
106 for (;;) { 107 s->rwstate = SSL_READING; -> 108 j = BIO_read(s->rbio, (char *)&(p[s->packet_length]), 109 n - s->packet_length); 110 if (j <= 0) 111 return j; Target 0: (openssl) stopped. (lldb) Process 8811 stopped
-> 627 n = ssl23_read_bytes(s, 7); 628
629 if (n != 7) 630 return (n); Target 0: (openssl) stopped. (lldb) Process 8811 stopped
627 n = ssl23_read_bytes(s, 7); 628
-> 629 if (n != 7) 630 return (n); 631 p = s->packet; 632
Target 0: (openssl) stopped. (lldb) Process 8811 stopped
629 if (n != 7) -> 630 return (n); 631 p = s->packet; 632
633 memcpy(buf, p, n); Target 0: (openssl) stopped. (lldb) print n (int) $4 = 0 (lldb) next Process 8811 stopped
229 case SSL23_ST_CR_SRVR_HELLO_A: 230 case SSL23_ST_CR_SRVR_HELLO_B: -> 231 ret = ssl23_get_server_hello(s); 232 if (ret >= 0) 233 cb = NULL; 234 goto end; Target 0: (openssl) stopped. (lldb) Process 8811 stopped
Target 0: (openssl) stopped. (lldb) Process 8811 stopped
237 default: Target 0: (openssl) stopped. (lldb) Process 8811 stopped
264 static int ssl23_no_ssl2_ciphers(SSL *s) Target 0: (openssl) stopped. (lldb) Process 8811 stopped
171 clear_sys_error(); 172 if (SSL_in_init(s) && (!s->in_handshake)) { -> 173 n = s->handshake_func(s); 174 if (n < 0) 175 return (n); 176 if (n == 0) { Target 0: (openssl) stopped. (lldb) Process 8811 stopped