Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omtls/blob/main/src/ct/cmp.om # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omtls / src / ct / cmp.om` 43 lines ยท 1424 bytes Raw Blame History 1 note omtls shared constant-time helpers (ot_ct_). CT core: sized arrays, unrolled loops, constant indices. 2 note ot_ct_lo8 gives the low byte of x as a uchar with no branch: a plain `uchar v` conversion emits a range check 3 note (a conditional branch to a trap-5 stub); `and x 255` is exact in f64 and UCVTF/FCVTZU/UQXTN narrow it with no 4 note branch and no trap site (checked on the emitted code with objdump, omc `f4fa7951`). 5 fn ot_ct_lo8 x ulong to uchar inline 6 ret uchar f64 and x 255 7 end 8 note Equality of two sized byte arrays: OR of the XORs (0..255), then bit 63 of acc - 1 is 1 exactly when acc is 0. 9 fn ot_ct_eq16 a view uchar 16 b view uchar 16 to bool 10 acc = ulong 0 11 for i ulong 16 unroll 12 acc = or acc ulong xor get a i get b i 13 end 14 ret eq and shr sub acc 1 63 1 1 15 end 16 fn ot_ct_eq32 a view uchar 32 b view uchar 32 to bool 17 acc = ulong 0 18 for i ulong 32 unroll 19 acc = or acc ulong xor get a i get b i 20 end 21 ret eq and shr sub acc 1 63 1 1 22 end 23 fn ot_ct_eq48 a view uchar 48 b view uchar 48 to bool 24 acc = ulong 0 25 for i ulong 48 unroll 26 acc = or acc ulong xor get a i get b i 27 end 28 ret eq and shr sub acc 1 63 1 1 29 end 30 fn ot_ct_eq64 a view uchar 64 b view uchar 64 to bool 31 acc = ulong 0 32 for i ulong 64 unroll 33 acc = or acc ulong xor get a i get b i 34 end 35 ret eq and shr sub acc 1 63 1 1 36 end 37 fn ot_ct_zero32 a view uchar 32 to bool 38 acc = ulong 0 39 for i ulong 32 unroll 40 acc = or acc ulong get a i 41 end 42 ret eq and shr sub acc 1 63 1 1 43 end