Repository navigation
Beryl 0.2.0
TLS 1.3, client and server, in pure Crystal. A program that serves or
fetches HTTPS through Beryl links no OpenSSL. TLS 1.3 is the only version
Beryl speaks.
- TLS 1.3 (#21 to #25): the key schedule and transcript hash, the record
layer, the client and server state machines,Beryl::TLS::Context,
SocketandServershaped likeOpenSSL::SSL, session tickets and PSK
resumption (psk_dhe_keonly), HelloRetryRequest, ALPN, SNI, KeyUpdate,
record_size_limit, GREASE, and certificate verification through
Beryl::Certificateswith name and IP checks against the Mozilla roots
or a trust store of the program's choosing. Gates: RFC 8448 traces byte
for byte, BoGo (every applicable TLS 1.3 test), tlsfuzzer's TLS 1.3
scripts, interop with OpenSSL 4.1.0, curl 8.23.0 and Go 1.27.4 in both
roles, and a handshake fuzzer, all in CI. Guide:docs/tls.md. - Security review follow-ups (#26), from the independent review of the
TLS code (M4, L1, L2, L3, L5, L6, L8):- Handshakes wipe every secret they derive in an
ensure, including on
failure; connections wipe the traffic, exporter and resumption master
secrets and the record IVs at close and after a failure (M4). - A plaintext alert read while keys are installed raises
UnauthenticatedAlertinstead of passing as the peer's alert (L1). - Duplicate extensions and key shares are found with sets, so a
ClientHello of many entries is checked in linear time (L2). - change_cipher_spec is refused before the first ClientHello and between
the fragments of a handshake message (L3). - A ticket issued in the future is never resumed (L5).
- A client ticket records the certificate verifier of its connection and
is offered only by a context with the same verifier (L6). - A sending key moves on with an automatic KeyUpdate after
Limits#largest_record_count_per_keyrecords (16,777,216 by default);
Context::Server#session_ticket_count=accepts 0 to 16 (L8). - The client sends its own
record_size_limit(RFC 8449) and the server
answers with its own; both come fromLimits#record_size_limitand
are enforced on what each end reads once both sent one.
- Handshakes wipe every secret they derive in an
- HTTP::Server seam (#27): sockets accepted by
Beryl::TLS::Server
raise TLS failures from reads and writes asConnectionFailed < IO::Error,
soHTTP::Server#bind(Beryl::TLS::Server.new(tcp_server, context))ends a
client whose handshake fails without an unhandled exception
(Socket#is_raising_io_errors=). - Record layer speed (F4, first step) (#30): each connection reuses its
record buffers (grown to the largest record seen) instead of allocating
two per record read and two per record written. On an Amber app over
HTTPS (wrk, 32 connections, M1 Max) this took requests per second from
about 65,000 to 79,000 on a small page, ahead of the same app on OpenSSL
(71,000). - System trust store (#28):
TrustStore.systemreadsSSL_CERT_FILE,
as OpenSSL and Go do. Beryl::VERSIONreads 0.2.0.- Handshakes wipe every secret they derive in an
ensure, including on
failure; connections wipe the traffic, exporter and resumption master
secrets and the record IVs at close and after a failure (M4). - A plaintext alert read while keys are installed raises
UnauthenticatedAlertinstead of passing as the peer's alert (L1). - Duplicate extensions and key shares are found with sets, so a
ClientHello of many entries is checked in linear time (L2). - change_cipher_spec is refused before the first ClientHello and between
the fragments of a handshake message (L3). - A ticket issued in the future is never resumed (L5).
- A client ticket records the certificate verifier of its connection and
is offered only by a context with the same verifier (L6). - A sending key moves on with an automatic KeyUpdate after
Limits#largest_record_count_per_keyrecords (16,777,216 by default);
Context::Server#session_ticket_count=accepts 0 to 16 (L8). - The client sends its own
record_size_limit(RFC 8449) and the server
answers with its own; both come fromLimits#record_size_limitand
are enforced on what each end reads once both sent one.
- Handshakes wipe every secret they derive in an
- HTTP::Server seam (#27): sockets accepted by
Beryl::TLS::Server
raise TLS failures from reads and writes asConnectionFailed < IO::Error,
soHTTP::Server#bind(Beryl::TLS::Server.new(tcp_server, context))ends a
client whose handshake fails without an unhandled exception
(Socket#is_raising_io_errors=). Beryl::VERSIONreads 0.2.0.
Checks at the tagged commit
Release PR #30 on GitHub Actions, run 45508940460: 19 jobs green (specs, published vectors and the no-OpenSSL linkage proof; differentials against libcrypto on ubuntu-24.04 and ubuntu-24.04-arm; constant-time and timing checks including RSA at 2,048, 3,072 and 4,096 bits; Linux on AArch64; TLS against BoringSSL's BoGo, tlsfuzzer's TLS 1.3 scripts, OpenSSL, curl and Go; the TLS handshake fuzzer). The merge commit has the same tree as the tested head.
Commit: 36bf6b5c5fb06041d9f9e96f7eaf9344aaa48cd5
Tree: 746c331161a07ebe8f1a196f29e808045cc4570a
Tarball: beryl-0.2.0.tar.gz (git archive --format=tar.gz --prefix=beryl-0.2.0/ v0.2.0)
Tarball sha256: 7397eea11d9d40fd6aa55f767901835b49121f2ae64c64077d97b3ab24a2a6cb