I found example code at https://gist.github.com/darrenjs/4645f115d10aa4b5cebf57483ec82eca that uses openssl BIO to implement "nonblocking" socket IO.
But in main function poll only listens stdin and socket fd. poll never listens rbio and wbio.
Is it means function BIO_write and BIO_read are blocking? If they are blocking it makes that code blocking right? If they are not blocking why poll function doesn't listen that BIOs?
I tried to use BIO_get_fd function but it always returns 0. I think it not supposed to create fd as default. I tried to init BIO with *bio = BIO_new(BIO_s_fd()) but still BIO_get_fd returns 0.
I created two pipe int pipes[2][2] used function BIO_set_fd and gave pipes[0][1] to rbio and gave pipes[1][1] to wbio. BIO_write works with that way. But SSL_read function fails with error SSL_ERROR_SYSCALL I think it means SSL_read tried to read pipes[0][1]. I know pipes as one way use like; pipe[0] will be used for read pipe[1] will use for write. But I didn't find way to set pipe[0] pipe[1] to same BIO.
Is it possible to implement pipes to openssl BIOs?
If it's not possible how i can say openssl to create their BIO fd so I can use that fd in poll/epoll/etc?
Note; my main target is doing event based BIO without using socket fd in SSL/BIO functions. I'll handle data transfer between socket fd and BIO fd.