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