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
omega-mv / seed / qualification / om2 / sec / s5s7 / l5-shactx.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note contract 5 layout lines 153-165: the SHA context layout of lines 163-164 as corrected by erratum E5 |
| 3 | note (count is a scalar field: COUNT omitted). A 104-byte |
| 4 | note uchar array is passed as `c edit shactx`, every field is set with put, the bytes are written to |
| 5 | note stdout, then count and state[7] are read back with get (exit 90/91 on mismatch). |
| 6 | note stdout = oracle exp/l5-shactx.out (python3 struct; gcc offsetof oracle/s5s7/offsetof.c agrees). |
| 7 | om2 |
| 8 | layout shactx 104 |
| 9 | field state uint 8 at 0 little |
| 10 | field count ulong at 32 little |
| 11 | field buf uchar 64 at 40 little |
| 12 | end |
| 13 | fn fill c edit shactx to void |
| 14 | for i ulong 8 |
| 15 | put c state i add 0x10203040 uint i |
| 16 | end |
| 17 | put c count 0x0123456789abcdef |
| 18 | for j ulong 64 |
| 19 | put c buf j uchar add mul j 3 1 |
| 20 | end |
| 21 | end |
| 22 | fn cnt c view shactx to ulong |
| 23 | ret get c count |
| 24 | end |
| 25 | fn st7 c view shactx to uint |
| 26 | ret get c state 7 |
| 27 | end |
| 28 | fn main to int |
| 29 | c = new uchar 104 0 |
| 30 | fill c |
| 31 | w = write 1 c 0 104 |
| 32 | if ne cnt c 0x0123456789abcdef |
| 33 | ret 90 |
| 34 | end |
| 35 | if ne st7 c 0x10203047 |
| 36 | ret 91 |
| 37 | end |
| 38 | ret 0 |
| 39 | end |