How openziti/tlsuv works
TLSUV is a cross-platform asynchronous TLS communication library built around libuv. The main workflow is an application establishing a stream connection, driving a TLS handshake and encrypted I/O, then optionally using the HTTP or WebSocket client APIs. Its TLS engine is selectable, with documented OpenSSL, mbedTLS, Windows crypto, and BoringSSL implementations; certificate/key support and PKCS#11 are additional capabilities. The README documents these capabilities, but several implementation excerpts are incomplete, so uncertain internal wiring is omitted.
Main entry points: http.c HTTP client · tls_engine.c Engine selection · tlsuv.c TLS stream · tls_engine.h TLS engine API
Components 23
Async transport
- TLS stream
src/tlsuv.c - Connector
src/connector.c - Socket I/O
src/socket.c - TLS link
src/tls_link.c
Protocol clients
- HTTP client
src/http.c - HTTP requests
src/http_req.c - URL parsing
src/url.c - WebSocket client
src/websocket.c - HTTP compression
src/compression.c
TLS engines
- TLS engine API
include/tlsuv/tls_engine.h - Engine selection
src/tls_engine.c - OpenSSL engine
src/openssl/engine.c - mbedTLS engine
src/mbedtls/engine.c - BoringSSL engine
src/boringssl/engine.c - Windows crypto
src/win32crypto/engine.c
Keys and identity
- Platform keychain
src/keychain.c - Apple keychain
src/apple/keychain.c - Windows keychain
src/win32/win32_keychain.c - PKCS#11 support
src/p11.c
Other components
- Application
- libuv
- Remote peer
- PKCS#11 provider
Connections 26
- Application → TLS stream: creates stream
- TLS stream → Connector: connects through
- Connector → libuv: uses event loop
- Connector → Socket I/O: establishes I/O
- Socket I/O → Remote peer: exchanges bytes
- TLS stream → TLS link: drives TLS I/O
- TLS link → Engine selection: gets context
- Engine selection → OpenSSL engine: selects implementation
- Engine selection → mbedTLS engine: selects implementation
- Engine selection → BoringSSL engine: selects implementation
- Engine selection → Windows crypto: selects implementation
- OpenSSL engine → TLS engine API: implements API
- mbedTLS engine → TLS engine API: implements API
- BoringSSL engine → TLS engine API: implements API
- Windows crypto → TLS engine API: implements API
- Application → HTTP client: uses client
- HTTP client → HTTP requests: handles requests
- HTTP client → URL parsing: parses addresses
- HTTP client → TLS stream: uses transport
- HTTP client → HTTP compression: compresses content
- Application → WebSocket client: uses client
- WebSocket client → TLS stream: uses transport
- Platform keychain → Apple keychain: uses platform backend
- Platform keychain → Windows keychain: uses platform backend
- OpenSSL engine → PKCS#11 support: supports keys
- PKCS#11 support → PKCS#11 provider: accesses tokens