Topic: How to use socket-type BIOs?

Hi all,

I'm using a library designed for OpenSSL.  The library's API takes BIO pointers.  It later calls BIO_read() and BIO_write() on that BIO pointer.

If I use the WolfSSL API normally, the WOLFSSL structure doesn't fill in the biord and biowr fields, so SSL_get_rbio/SSL_get_wbio won't provide me a BIO to pass to the third party library.

I can successfully create a socket BIO using BIO_new_socket with an opened/connected socket file descriptor, pass it to SSL_set_bio, then SSL_connect().  Everything succeeds.

SSL_write() of a char * buffer also succeeds.  But if I replace that with a BIO_write(), no data is sent.
BIO_write doesn't handle BIOs of type WOLFSSL_BIO_SOCKET, so it doesn't actually work on my BIO.

Thanks

Share

Re: How to use socket-type BIOs?

Hi ENOTTY,

The BIO_write expects WOLFSSL_BIO_SSL for an SSL socket write. Have you tried setting up a BIO with that type?

We have some BIO enhancements in the queue. See this pull request: https://github.com/wolfSSL/wolfssl/pull/2462

Thanks,
David Garske, wolfSSL

Share

Re: How to use socket-type BIOs?

dgarske wrote:

The BIO_write expects WOLFSSL_BIO_SSL for an SSL socket write. Have you tried setting up a BIO with that type?

Hi David,

Thanks for replying.  Are there examples somewhere of creating a BIO of the SSL type and using it?  OpenSSL's man pages have an example using BIO_new_ssl_connect but that is not one of WolfSSL's supported APIs.

Share

Re: How to use socket-type BIOs?

Hi ENOTTY,

We put up an example for using the BIO compatibility layer with SSL here:
https://github.com/wolfSSL/wolfssl-examples/pull/171

Thanks,
David Garske, wolfSSL

Share