Repository navigation
Releases
v0.3.0
- Fixed a panic in the native engine on a handshake message whose declared length is near 16 MiB. With
max_handshake_message_lenraised to 16 MiB or more, a peer could crash the process by sending a 4-byte Certificate header, even in ReleaseFast. The default limit of 64 KiB was not affected. - The libssl server now offers secp521r1 by default, after the other groups. The native engine's defaults are unchanged.
output_buffer_lenis 49 bytes larger, 16,482 bytes, for both engines. A connection whose transport writer buffer is smaller panics when it is created, now in every build mode.- Fixed the in-place writer losing buffered data when a flush failed during a rebase (
writableSliceGreedyPreserveand similar). The data stays buffered, so a write that was cancelled can still be followed byclose, which sends it with close_notify. - Upgraded AWS-LC from 1.73.0 to 5.15.0, the current mainline release. AWS-LC 5.x is the continuation of the 1.x line under its new versioning scheme. It brings fixes to X.509 name constraints and libssl, and assembly for ML-DSA.
v0.2.1
- A certificate without DNS subject alternative names is now matched against the host by its subject common name, as OpenSSL and libpq do. Self-signed certificates made with only a common name, such as those in PostgreSQL's documentation, are accepted. A certificate that has DNS names is still matched against those only.
Certificate.matchesHostno longer matches a host name with a leading dot, which AWS-LC treats as a pattern for any subdomain. The libssl server's certificate selection could match such an SNI name.
v0.2.0
This release adds an optional engine based on AWS-LC's libssl. Build with -Dimpl=libssl to use it with the same ztls API. It supports TLS 1.0 through 1.3 as both client and server, including CBC suites and RSA key exchange. The native engine remains the default and is faster; the libssl engine provides broader compatibility and requires a C++ runtime.
config.Clientandconfig.Servernow requireio. The libssl engine uses it to wait for its connection lock without blocking a thread. With this engine, reads, writes and handshakes can returnCanceled.nowis optional. When omitted, certificate verification reads the current time throughio.- Added
min_versionandmax_versionto the client and server options. These andcipher_suitescan be left as null to use the engine's defaults. The native engine rejects unsupported cipher suites and version ranges. verify_schemesandsigning_schemesare now optional and use the engine's defaults. Added the TLS 1.2 schemesecdsa_sha1andrsa_pkcs1_sha1: libssl enables them by default, while the native engine requires them to be explicitly listed.config.known_signature_schemeslists all supported schemes.- Added
Connection.keyUpdatesSentandConnection.keyUpdatesReceivedto count KeyUpdate messages. - Removed the
tls12build option. The native TLS 1.2 client is now always included. - On x86_64 Windows,
asmnow defaults to false, so builds no longer need NASM. Use-Dasm=trueto enable AWS-LC's assembly. - Invalid configurations are rejected before the handshake starts, including group lists with no usable key exchange group and native server configurations with no TLS 1.3 cipher suite.
- Fixed the native client advertising secp521r1 for key exchange, which it does not implement. TLS 1.2 connections can still use P-521 certificates when secp521r1 is listed.
- The native engine now accepts empty handshake records after the handshake. It also handles
close_notifyor transport EOF during a post-handshake message as a clean shutdown, unlessstrict_close_notifyrequires a truncation error. NewSessionTicket messages larger than the greater of 16 KiB andmax_handshake_message_lenare rejected withillegal_parameter. - Fixed KeyUpdate handling in the native engine. If a peer's update request is pending when
requestKeyUpdateis called, both updates are sent as required by RFC 8446 §4.6.3. A transport failure duringrequestKeyUpdateno longer discards the pending request.
Interoperability tests, API tests and tlsfuzzer now run against both engines. BoGo and TLS-Anvil continue to test the native engine.
v0.1.0
The first release. ztls is a TLS library for Zig on AWS-LC's libcrypto, for clients and servers on std.Io readers and writers, with independent read and write directions for one task reading while another writes.
- TLS 1.3 client and server, and a TLS 1.2 client for servers that have nothing newer (ECDHE with AES-GCM or ChaCha20-Poly1305 and the extended master secret). The
tls12build option leaves the TLS 1.2 client out. - AES-128-GCM, AES-256-GCM and ChaCha20-Poly1305; X25519MLKEM768, X25519, P-256 and P-384 key exchange, with HelloRetryRequest on both sides.
- ECDSA, RSA-PSS and Ed25519 signatures; certificate verification by AWS-LC's X.509 code against a trust store built from PEM or DER, from files, or from the system's roots.
- Server name indication, with the server's certificate picked by name or by a callback, ALPN, and client certificates, requested or required.
- KeyUpdate in both directions and close_notify. Writers have
requestKeyUpdateandclose. - A cleartext reader and writer that are ordinary
std.Io.Readerandstd.Io.Writer, plus an in-place writer that encrypts inside the transport buffer. A transport failure, such as a cancelled read or write, does not end the connection: the operation may be retried, and adeferunder cancel protection can still close cleanly. - Session resumption, 0-RTT, a TLS 1.2 server, CBC suites and RSA key exchange are left out.
Tested with BoGo, tlsfuzzer and TLS-Anvil, against OpenSSL and Go's crypto/tls, and with a survey of real servers: the Chrome UX Report's top 10,000 sites and 5,000 more drawn at random from its list.