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 / poly.om

43 lines · 952 bytes Raw Blame History
1note omtls Poly1305 driver layer (RFC 8439 2.5): blocks of d into the state st (see src/ct/p1.om).
2note aead true: a short last block is zero-padded and still gets the 2^128 bit (RFC 8439 2.8 pad16);
3note aead false: it gets 0x01 then zeros and no 2^128 bit (2.5.1).
4fn ot_p1_upd st edit ulong 24 d view uchar * aead bool to void
5b = new uchar 16 0
6n = len d
7p = ulong 0
8while ge sub n p 16 bound 9223372036854775807
9for i ulong 16 unroll
10put b i get d add p i
11end
12ot_p1_blk st b 1
13p = add p 16
14end
15r = sub n p
16if gt r 0
17for i ulong 16 unroll
18put b i 0
19end
20for i ulong r
21put b i get d add p i
22end
23if aead
24ot_p1_blk st b 1
25else
26put b r 1
27ot_p1_blk st b 0
28end
29end
30for i ulong 16 unroll
31put b i 0
32end
33end
34note One-shot Poly1305 tag of msg under the one-time key.
35fn ot_p1_mac key view uchar 32 msg view uchar * tag edit uchar 16 to void
36st = new ulong 24 0
37ot_p1_key st key
38ot_p1_upd st msg false
39ot_p1_tag st tag
40for i ulong 24 unroll
41put st i 0
42end
43end