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 / tests / arboris / caproot-check.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note Only the host fixture invokes this program. FD 3 is the issuer's table. |
| 3 | fn main to int |
| 4 | data = new uchar 48 0 |
| 5 | if ne read 0 data 0 48 48 |
| 6 | ret 2 |
| 7 | end |
| 8 | fields = new ulong 6 0 |
| 9 | for i ulong 6 |
| 10 | for j ulong 8 |
| 11 | octet = ulong get data add mul i 8 j |
| 12 | put fields i or get fields i shl octet mul j 8 |
| 13 | end |
| 14 | end |
| 15 | h = new ulong 2 0 |
| 16 | put h 0 get fields 1 |
| 17 | put h 1 get fields 2 |
| 18 | meta = new ulong 16 0 |
| 19 | put meta 0 0x4152425200000001 |
| 20 | put meta 7 get fields 3 |
| 21 | put meta 8 get fields 4 |
| 22 | table = mapnew int 3 0 22560 1 1 |
| 23 | if le table 0 |
| 24 | ret 3 |
| 25 | end |
| 26 | granted = caproot_validate table get fields 0 h meta |
| 27 | if ne mapdrop table 0 |
| 28 | ret 4 |
| 29 | end |
| 30 | if ne granted ne get fields 5 0 |
| 31 | ret 5 |
| 32 | end |
| 33 | ret 0 |
| 34 | end |