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/omega-mv/blob/main/om/tls/test/fuzz/fz_https.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / om / tls / test / fuzz / fz_https.om` 95 lines ยท 2709 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note fz_https.om: fuzz target for an HTTPS response read through seed/net/https.om: http.om's 3 note response parser (hrsprd, hbodyall) over the TLS transport (htlsrecv, htlsrecvd), so the TLS 4 note record layer and the post-handshake path of om/tls/tls.om (tls_read, tls_rdapp, tls_rdrec, 5 note tls_ralert, tls_post: NewSessionTicket, KeyUpdate) see the same bytes as the HTTP parser. 6 note The connection starts as already established (fixed application keys, as after tls_connect): 7 note the handshake itself is fz_flight's target. 8 note Input: M chunks. M bit 0: response to HEAD; bit 1: suite (0 = TLS_CHACHA20_POLY1305_SHA256, 9 note 1 = TLS_AES_128_GCM_SHA256). The chunks (common.om fz_feed) are sealed under the server's 10 note application key and are all in the socket, its write side shut, before the client reads. 11 12 note fz_tset: an established client state t on fd with suite su and fixed keys 13 fn fz_tset t edit uchar * fd ulong su ulong to void 14 tls_pn t TLFD fd 4 15 put t TLPH 1 16 put t TLSU uchar su 17 put t TLWK 1 18 put t TLRK 1 19 put t TLCCS 2 20 fz_fill t TLSAP 32 65 21 fz_fill t TLCAP 32 97 22 fz_fill t TLWKEY 32 129 23 fz_fill t TLWIV 12 161 24 fz_fill t TLRKEY 32 173 25 fz_fill t TLRIV 12 205 26 end 27 28 note fz_mirc: m = the server side of t: it seals with t's read key and traffic secret, writing to fd 29 fn fz_mirc m edit uchar * t view uchar * fd ulong to void 30 for i ulong 32 31 put m add TLWKEY i get t add TLRKEY i 32 put m add TLSAP i get t add TLSAP i 33 end 34 for i ulong 12 35 put m add TLWIV i get t add TLRIV i 36 end 37 put m TLSU get t TLSU 38 put m TLWK 1 39 tls_pn m TLFD fd 4 40 end 41 42 note fz_sconn: client cs/io on a socket pair, TLS established, every chunk of x sealed into it and 43 note the server's write side shut; 0 ok, negative when the setup failed 44 fn fz_sconn cs edit ulong 320 io edit uchar 262144 m edit uchar * x view uchar * to long 45 fds = new ulong 2 0 46 if ne fz_pair fds 0 47 ret -1 48 end 49 r = hinit cs io int get fds 0 0 50 if lt r 0 51 ret r 52 end 53 r = htlsinit cs io FZHOST 54 if lt r 0 55 ret r 56 end 57 b = get cs HTB 58 su = add 1 and shr ulong get x 0 1 1 59 fz_tset part io b TLCSZ get fds 0 su 60 fz_mirc m view part io b TLCSZ get fds 1 61 s = fz_feed m x 1 62 z = shutdown int get fds 1 1 63 ret 0 64 end 65 66 fn fz_srun cs edit ulong 320 io edit uchar 262144 m edit uchar * x view uchar * to long 67 aux = new uchar 65536 0 68 r = fz_sconn cs io m x 69 if lt r 0 70 ret r 71 end 72 put cs HHEADMX 2048 73 put cs HHMAX 16 74 put cs HBCAP 4096 75 put cs HFRMAX 1024 76 put cs HISHEAD and ulong get x 0 1 77 r = hrsprd cs io 78 if le r 0 79 ret r 80 end 81 ret hbodyall cs io part aux 0 65536 82 end 83 84 fn main to int 85 cs = new ulong 320 0 86 io = new uchar 262144 0 87 m = new uchar TLCSZ 0 88 in = new uchar FZCAP 0 89 n = fz_read in 90 if lt n 1 91 ret 0 92 end 93 r = fz_srun cs io m part in 0 n 94 ret 0 95 end