xtc_tls(3)
---xtc_tls(3)
TLS over async sockets
| XTC_TLS(3) | Library Functions Manual | XTC_TLS(3) |
NAME
xtc_tls_ctx_create,
xtc_tls_ctx_destroy,
xtc_tls_create,
xtc_tls_destroy,
xtc_tls_handshake,
xtc_tls_read, xtc_tls_write,
xtc_tls_shutdown,
xtc_tls_wants_read,
xtc_tls_wants_write — TLS
over async sockets
SYNOPSIS
DESCRIPTION
xtc_tls provides TLS 1.2 / 1.3 over xtc_io
sockets. The implementation selects a backend at configure time
(‘--with-tls=openssl|none|auto’); in v0.x only OpenSSL is
implemented.
- xtc_tls_ctx_t
- Per-process state: cert, key, CA bundle, version range, ALPN profile.
Created once via
xtc_tls_ctx_create() with role (XTC_TLS_SERVER orXTC_TLS_CLIENT) plus opts. - xtc_tls_t
- Per-connection state. Wraps a single fd. Created via
xtc_tls_create(ctx, fd, &out).
xtc_tls_create(ctx, fd, &tls);
for (;;) {
int rc = xtc_tls_handshake(tls);
if (rc == XTC_OK) break;
if (rc != XTC_E_AGAIN) abort();
uint32_t want = xtc_tls_wants_read(tls)
? XTC_IO_READABLE : XTC_IO_WRITABLE;
xtc_proc_wait_fd(fd, want, -1, &revents);
}
xtc_tls_read()
and
xtc_tls_write()
follow the same pattern: return XTC_OK on progress,
XTC_E_AGAIN when the fd needs more poll
iterations.
xtc_tls_shutdown()
performs the bidirectional close-notify dance; same WANT_* translation.
OPTIONS
xtc_tls_opts_t fields:
- cert_file, key_file
- PEM paths for server-side certificate.
- ca_file
- PEM CA bundle for verifying the peer.
- verify_peer
1to require + validate the peer's cert.- alpn_protos
- ALPN wire-form list.
- min_version, max_version
XTC_TLS_VER_12orXTC_TLS_VER_13.
SEE ALSO
HISTORY
Appeared in xtc 0.1. See docs/M_TLS.md for backend pluggability planning.
| May 28, 2026 | Debian |