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 / security673 / relational / evidence / gate1 / 37.src
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note SC1-L: public pointers a,b; secret contents; only equality result disclosed. |
| 3 | fn compare32 a view uchar 32 b view uchar 32 to ulong |
| 4 | d = uchar 0 |
| 5 | for i ulong 32 |
| 6 | d = uchar 0 |
| 7 | end |
| 8 | ret shr sub ulong d 1 63 |
| 9 | end |
| 10 | note SPDX-License-Identifier: Apache-2.0 |
| 11 | note Concatenate after compare32.om. Test assertions are outside scanned primitive. |
| 12 | text ok "PASS L1 native: equal, every mismatch position, all256 bytes, paired unequal outputs\n" |
| 13 | fn main to int |
| 14 | a = new uchar 32 0 |
| 15 | b = new uchar 32 0 |
| 16 | if ne compare32 a b 1 |
| 17 | ret 11 |
| 18 | end |
| 19 | for p ulong 32 |
| 20 | for v ulong 256 |
| 21 | put a p uchar v |
| 22 | put b p uchar v |
| 23 | if ne compare32 a b 1 |
| 24 | ret 12 |
| 25 | end |
| 26 | put b p xor uchar v 1 |
| 27 | if ne compare32 a b 0 |
| 28 | ret 13 |
| 29 | end |
| 30 | put a p xor uchar v 128 |
| 31 | if ne compare32 a b 0 |
| 32 | ret 14 |
| 33 | end |
| 34 | end |
| 35 | put a p 0 |
| 36 | put b p 0 |
| 37 | end |
| 38 | n = write 1 ok 0 len ok |
| 39 | if ne n long len ok |
| 40 | ret 15 |
| 41 | end |
| 42 | ret 0 |
| 43 | end |