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

libtls: make the TLS_EOF_NO_CLOSE_NOTIFY bit user-visible #144

Open
skarnet opened this issue Nov 15, 2023 · 0 comments
Open

libtls: make the TLS_EOF_NO_CLOSE_NOTIFY bit user-visible #144

skarnet opened this issue Nov 15, 2023 · 0 comments

Comments

@skarnet
Copy link

skarnet commented Nov 15, 2023

Context: I'm writing an asynchronous TLS tunnel engine supporting libtls as a backend, with an option to omit (or force) sending a close_notify and check if the peer sent one.

When the peer closes the connection, this is reported to the user as tls_read() returning 0, which is all good, but I need to know whether the peer sent a close_notify or not. Currently, this information is only available as ctx->state & TLS_EOF_NO_CLOSE_NOTIFY; it is used by tls_close(), but I have no way of retrieving it when I'm not the one initiating the close. And I cannot access ctx->state because struct tls is private.

It would be nice to have an accessor for this. It could be as simple as:

int tls_eof_no_close_notify(struct tls *ctx)
{
  return ctx->state & TLS_EOF_CLOSE_NOTIFY != 0;
}

Thanks in advance.

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

1 participant