<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hello,<br/>
 <br/>
we encountered a strange behaviour of OpenSSL 1.1.0 when our test with "sslscan" provokes an unfinished <br/>
handshake.</div>

<div> </div>

<div>Our asynchronous communication approach uses memory BIOs in order to read/write data from other <br/>
communication layers into the SSL object. After the read/write operations are done the BIOs are freed.</div>

<div> </div>

<div>Our example code is basically as follows:<br/>
---<br/>
err = SSL_accept (ssl); </div>

<div> </div>

<div>BIO *rBIO = BIO_new(BIO_s_mem());<br/>
BIO *wBIO = BIO_new(BIO_s_mem());<br/>
    <br/>
SSL_set_bio(ssl, rBIO, wBIO); </div>

<div> </div>

<div>// ... operate with read / write BIOs and SSL_read/SSL_write</div>

<div> </div>

<div>SSL_set_bio(ssl, NULL, NULL); // free BIOs when finished</div>

<div> </div>

<div>SSL_free(ssl);<br/>
---</div>

<div> </div>

<div>When calling SSL_free() after a complete handshake, everything is fine, but when calling SSL_free() after an <br/>
unfinished handshake, the assertion "assert(s->wbio != NULL);" in ssl_free_wbio_buffer() fails:<br/>
---<br/>
void ssl_free_wbio_buffer(SSL *s)<br/>
{<br/>
    /* callers ensure s is never null */<br/>
    if (s->bbio == NULL)<br/>
        return;<br/>
    s->wbio = BIO_pop(s->wbio);<br/>
    assert(s->wbio != NULL);            /* <- this assertion fails! */<br/>
    BIO_free(s->bbio);<br/>
    s->bbio = NULL;<br/>
}<br/>
---</div>

<div> </div>

<div>With a complete handshake the new attribute “bbio” is freed by calling the method tls_finish_handshake(), <br/>
which itself calls ssl_free_wbio_buffer(). When the handshake is not finished successfully, the “bbio” is not freed, and <br/>
therefore when calling SSL_free() the assert in ssl_free_wbio_buffer() fails.</div>

<div> </div>

<div>The problem exists since OpenSSL 1.1.0 - there were no problems with OpenSSL 1.0.2x.</div>

<div> </div>

<div>Is this a faulty behavior of the OpenSSL 1.1.0? <br/>
 <br/>
Thank you for your help!<br/>
 <br/>
Best regards,<br/>
Marcus<br/>
 </div>
</div></div></body></html>