Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: tlshelloworld.c, tls_read or recv? #85

Open
Velho opened this issue Jul 24, 2023 · 1 comment
Open

Examples: tlshelloworld.c, tls_read or recv? #85

Velho opened this issue Jul 24, 2023 · 1 comment

Comments

@Velho
Copy link

Velho commented Jul 24, 2023

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!

@eduardsui
Copy link
Owner

eduardsui commented Jul 25, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants