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 / src / x25519.om

25 lines · 813 bytes Raw Blame History
1note omtls X25519 driver layer (RFC 7748 section 5). Names per CONTRACT; the first parameter is called o (the
2note word out is reserved in OM-2). The caller checks for the all-zero output of a low-order u with ot_ct_zero32.
3note o = X25519(k, u): k clamped here (decodeScalar25519), the top bit of u masked (decodeUCoordinate).
4export fn ot_x25_mul o edit uchar 32 k view uchar 32 u view uchar 32 to void
5f = new ulong 512 0
6kc = new uchar 32 0
7for i ulong 32 unroll
8put kc i get k i
9end
10put kc 0 and get kc 0 248
11put kc 31 or and get kc 31 127 64
12ot_x25_core f kc u o
13for i ulong 512
14put f i 0
15end
16for i ulong 32 unroll
17put kc i 0
18end
19end
20note o = X25519(k, 9), the public key for the private key k.
21export fn ot_x25_base o edit uchar 32 k view uchar 32 to void
22u = new uchar 32 0
23put u 0 9
24ot_x25_mul o k u
25end