interplane.Get Omega
Read in your language

omtls

omtls: a TLS 1.3 client (RFC 8446) written fresh in seeded Omega, for mailhand. Not audited by a cryptographer. Free (Apache-2.0).

Brought by drakestapleton

branch main Branches Tags History

omtls / README.md

132 lines · 9403 bytes Raw Blame History Source

omtls

omtls is a TLS 1.3 client written in seeded Omega, the language of omega-mv. It exists so that mailhand can read and send mail on a real mail account (IMAP on port 993, SMTP submission on 465 or 587) without a host TLS library. It was written fresh from the public standards (RFC 8446 and the RFCs and FIPS documents named below), in Omega only: no C, Rust, Python or shell logic, no OpenSSL or other TLS library in the product.

It has not been audited by a cryptographer. Read the section "What it is not" before you rely on it.

What it does

How to build and check it

You need only this repository and the compiler named in PIN, the one place the pin is written: the omega-mv commit on its first line and the sha256 of that commit's seed/out/omc on its second. Copy that seed/out/omc to ./omc (for example git --git-dir OMEGA-MV.git cat-file blob COMMIT:seed/out/omc > omc). The gate refuses any other compiler. The host is Linux on AArch64.

mkdir -p build && ./omc < tools/boot.om > build/boot && chmod 755 build/boot
build/boot gate && build/gate          # checks the compiler pin, builds everything, runs every test
build/boot omtls                       # the command: build/omtls HOST PORT [ROOTS [ALPN [CONNECT-ADDRESS]]]

build/boot UNIT joins the files listed in units/UNIT.list into one unit and compiles it. The library for other programs is units/lib.list.

What it has been checked against

The gate (tests/GATE, run by build/gate) runs all of these. Where every vector file came from and its sha256 is in tests/vectors/PROVENANCE.md.

Constant time

The code that touches secrets is split into a core (src/ct/) and the code around it. The core takes only fixed-size arrays, every loop in it is unrolled by the compiler and every array index is a constant. The gate compiles the core and reads the machine code the compiler wrote (ctscan in tools/gate.om): it refuses any conditional branch, any division instruction, any load or store whose address comes from a register offset (an index that could depend on a secret) and any indirect branch (the trap path). So the claim "no secret-dependent branch or memory address in the primitives" is checked on the compiler's output, not only on the source. Tag and Finished comparisons are fixed-length and go through that core. The code around the core (loops over message lengths, record handling) branches only on public values: lengths, counters and protocol fields. That part is checked by reading, not by the scan. One known exception: removing the zero padding of a received record (ot_tl_dec) scans back to the last non-zero byte, so its time depends on the padding length the server chose (RFC 8446 5.4 accepts this; omtls never pads). On AArch64 the program also sets the DIT bit (data-independent timing) before the handshake.

Limits

WhatLimitWhy
Record2^14 plaintext, 2^14 + 256 protectedRFC 8446 wire limits
Handshake message2^24 - 1 bytesthe 24-bit length field
One certificate entry1 MiB (refused above: error 24)handed to the X.509 code as a local array: the compiler gives no run-time allocation and globals cannot be passed
RSA modulus16384 bitsbignum limbs are stack arrays, same reason
Trust store plus presented chain16 MiB less 64 KiBthe X.509 store; a larger store is refused, never truncated
Certificate path search1,000,000 candidate examinationsstops a hostile server's cross-certificate maze (containment of untrusted input)
Every network operation30 s, one deadline per handshake / read / writeliveness against a stuck peer; settable with ot_tl_deadline

Keys and secrets

What it is not

Licence

Apache-2.0, see LICENSE. vendor/omega-mcp/sha256-om2.om is the SHA-256 unit from omega-mv, copied unchanged from omega-mcp (see NOTICE).