Skip to content
Advertisement

Is there a way to convert stdin/stdout fds into one fd?

I want to process SSL from stdin, and send SSL out stdout, but OpenSSL accepts only one file descriptor in the set fd call:

SSL_set_fd(ssl, sock);

Is there a way to combine the stdin and stdout file descriptors into one?

I realize I can make a process that just reads from stdin/out and writes to the file descriptor, but I was trying to think of a way to avoid that extra processing layer.

Advertisement

Answer

It looks like you want to use SSL_set_rfd() and SSL_set_wfd(). From the manual:

SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only for the read channel or the write channel, which can be set independently.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement