I have to secure an existing socket client connection using OpenSSL to replace connect
, send
, receive
, close
functions.
But I'm not really comfortable with the use of the SSL and BIO functions.
I know there have been some questioning about it here and here, but it is still not clear to me the exact difference between them.
Can anyone help me understand the exact relation between them (1)?
OpenSSL documentation always refer to BIO as an underlying structure, but there is no further explanation on the subject.
As I understand it, any call to SSL_write
will also write to a BIO, that can be handled or not.
Is there any difference in doing a BIO_write
or a SSL_write
to send data to the socket (2)?
If no, what is the advantage of using the BIO functions in my case (3)? Is there any (4)?
I have found some useful examples on SSL clients here and here.
The first one mix up the use of BIO and SSL functions like using SSL_do_handshake
instead of BIO_do_handshake
. Is that ok (5)?
Since BIO is underlying to SSL functions, should I avoid using it (6)?