Examples: tlshelloworld.c, tls_read or recv?
Greetings!
I was going through the examples and I noticed that the tlshelloworld.c does not make use of the tls_read nor tls_write, should these be used to populate the application buffer or is the tls consume stream enough?
Thanks!
Hello!
tls_read and tls_write work on the TLS buffer itself. tls_consume_stream writes the protocol bytes to the internal TLS buffer (after deciphering, validating and authorizing). So, we should have: recv => tls_consume_stream and then tls_read. Same way we use tls_write to write actual payload data. Then use tls_get_write_buffer to get the actual TLS bytes to write on the socket (or any other medium).
It should be also safe to use tls_write while calling tls_consume_stream (reading).
SSL_read and SSL_write are performing both socket I/O and TLS protocol I/O using recv, tls_read, send and tls_write.
Thank you!