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/aienux/allen/tests/tls-crypto-aead.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 / aienux / allen / tests / tls-crypto-aead.om` 179 lines ยท 3962 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-or-later 2 note RFC8439 sections2.3.2/2.8.2 official block and AEAD vectors; negative cases mutate those vectors. 3 note https://www.rfc-editor.org/rfc/rfc8439 ; attribution/license in tls-crypto-fixture.om. 4 note Additional zero/partial/full/block-boundary/max-buffer roundtrips are property tests, not oracles. 5 text Vblock "`10f1e7e4d13b5915500fdd1fa32071c4c7d1f4c733c068030422aa9ac3d46c4ed2826446079faa0914c2d705d98b02a2b5129cd1de164eb9cbd083e8a2503c4e`" 6 text Vplain "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it." 7 text Vcipher "`d31a8d34648e60db7b86afbc53ef7ec2a4aded51296e08fea9e2b5a736ee62d63dbea45e8ca9671282fafb69da92728b1a71de0a9e060b2905d6a5b67ecd3b3692ddbd7f2d778b8c9803aee328091b58fab324e4fad675945585808b4831d7bc3ff4def08e4b7a9de576d26586cec64b6116`" 8 text Vtag "`1ae10b594f09e26a7e902ecbd0600691`" 9 text Vaad "`50515253c0c1c2c3c4c5c6c7`" 10 11 fn tvblock to void 12 tcwipe 13 for i ulong 32 14 put Tckey i uchar i 15 end 16 put Tciv 3 9 17 put Tciv 7 74 18 tccblock 1 19 for i ulong 64 20 p = mul i 2 21 v = tvbyte get Vblock p get Vblock add p 1 22 tvcheck eq get Tccblk i v 1 23 end 24 tccwipe 25 tvscrub 26 end 27 28 fn tvsetup to void 29 tcwipe 30 for i ulong 32 31 put Tckey i uchar add i 128 32 end 33 put Tciv 0 7 34 for i ulong 8 35 put Tciv add i 4 uchar add i 64 36 end 37 for i ulong 12 38 p = mul i 2 39 put Tcaad i tvbyte get Vaad p get Vaad add p 1 40 end 41 for i ulong len Vplain 42 put Tcbuf i get Vplain i 43 end 44 put Tcbuf len Vplain 221 45 end 46 47 fn tvcipher to void 48 for i ulong len Vplain 49 p = mul i 2 50 v = tvbyte get Vcipher p get Vcipher add p 1 51 tvcheck eq get Tcbuf i v 2 52 end 53 tvcheck eq get Tcbuf len Vplain 221 3 54 tvscrub 55 end 56 57 fn tvtag to void 58 for i ulong 16 59 p = mul i 2 60 v = tvbyte get Vtag p get Vtag add p 1 61 tvcheck eq get Tctag i v 4 62 end 63 end 64 65 fn tvbad to void 66 note Each bit of every tag byte is checked, with ciphertext unchanged after every rejection. 67 for i ulong 16 68 for j ulong 8 69 v = shl uchar 1 j 70 put Tctag i xor get Tctag i v 71 tvcheck not tcopen len Vplain 12 5 72 tvcipher 73 put Tctag i xor get Tctag i v 74 end 75 end 76 for i ulong 12 77 put Tcaad i xor get Tcaad i 1 78 tvcheck not tcopen len Vplain 12 6 79 tvcipher 80 put Tcaad i xor get Tcaad i 1 81 end 82 for i ulong 12 83 put Tciv i xor get Tciv i 1 84 tvcheck not tcopen len Vplain 12 7 85 tvcipher 86 put Tciv i xor get Tciv i 1 87 end 88 for i ulong 32 89 put Tckey i xor get Tckey i 1 90 tvcheck not tcopen len Vplain 12 8 91 tvcipher 92 put Tckey i xor get Tckey i 1 93 end 94 for i ulong len Vplain 95 put Tcbuf i xor get Tcbuf i 1 96 tvcheck not tcopen len Vplain 12 9 97 put Tcbuf i xor get Tcbuf i 1 98 tvcipher 99 end 100 tvcheck not tcopen sub len Vplain 1 12 10 101 tvcipher 102 tvcheck not tcopen len Vplain 11 11 103 tvcipher 104 tvcheck not tcopen 65537 12 12 105 tvcipher 106 tvcheck not tcopen len Vplain 33 12 107 tvcipher 108 tvcheck not tcopen `18446744073709551615` 0 12 109 tvcipher 110 tvcheck not tcseal 65537 12 13 111 tvcipher 112 tvcheck not tcseal len Vplain 33 13 113 tvcipher 114 for i ulong 16 115 p = mul i 2 116 put Tctag i tvbyte get Vtag p get Vtag add p 1 117 end 118 end 119 120 fn tvround n ulong aadlen ulong to void 121 tcwipe 122 for i ulong 32 123 put Tckey i uchar i 124 put Tcaad i uchar add i 32 125 end 126 note Unique deterministic fixture nonce per length/AAD combination; not production randomness. 127 put Tciv 0 uchar and n 255 128 put Tciv 1 uchar and shr n 8 255 129 put Tciv 2 uchar and shr n 16 255 130 put Tciv 3 uchar aadlen 131 for i ulong n 132 put Tcbuf i uchar and i 255 133 end 134 if lt n 65536 135 put Tcbuf n 233 136 end 137 tvcheck tcseal n aadlen 30 138 tvscrub 139 tvcheck tcopen n aadlen 31 140 tvscrub 141 for i ulong n 142 tvcheck eq get Tcbuf i uchar and i 255 32 143 end 144 if lt n 65536 145 tvcheck eq get Tcbuf n 233 33 146 end 147 end 148 149 fn main to int 150 tvblock 151 tvsetup 152 tvcheck tcseal len Vplain 12 14 153 tvcipher 154 tvtag 155 tvbad 156 tvcheck tcopen len Vplain 12 15 157 for i ulong len Vplain 158 tvcheck eq get Tcbuf i get Vplain i 16 159 end 160 tvscrub 161 tvround 0 0 162 tvround 1 1 163 tvround 15 15 164 tvround 16 16 165 tvround 17 17 166 tvround 63 31 167 tvround 64 32 168 tvround 65 0 169 tvround 65536 32 170 tcwipe 171 tvscrub 172 for i ulong 65536 173 tvcheck eq get Tcbuf i 0 34 174 end 175 for i ulong 32 176 tvcheck eq get Tckey i 0 35 177 end 178 ret 0 179 end