[openssl-users] Trouble with BIO_s_mem() and SSL_new() on OpenSSL-1.1.0-pre7-dev

Matt Caswell matt at openssl.org
Sat Aug 6 08:47:32 UTC 2016



On 06/08/16 02:32, Jim Carroll wrote:
> We have a non-blocking windows app that we are migrating to from OpenSSL
> 1.0.2i to 1.1.0-pre7-dev. We move data from sockets to SSL via
> BIO_s_mem() objects.
> 
>  
> 
>     rbio = BIO_new(BIO_s_mem());
> 
>     wbio = BIO_new(BIO_s_mem());
> 
>  
> 
>     ssl = SSL_new(ssl_ctx);
> 
>     SSL_set_bio(ssl, rbio, wbio);
> 
>  
> 
> We move data in via BIO_write(rbio, ...), but later an SSL_read(ssl,
> ...) returns bytes -1 and SSL_get_error() returns SSL_ERROR(1)
> 
>  
> 
> Debug stepping through the code, we were surprised to discover that
> ssl3_read_n() dispatched the SSL_read() into BIO_s_connect(). A detailed
> study of the code, and I can assure that at no point do we ever
> associate the windows socket with SSL.
>
> Is it possible that that SSL_new() no longer allows the use of memory
> BIO's? I know that's a long shot question, but we're grasping at straws
> here.

No, the use of memory BIO's is perfectly acceptable - and in fact we do
exactly that in our own self-tests. See create_ssl_connection() in
test/ssltestlib.c.

Matt



More information about the openssl-users mailing list