omnet
aien-dev/omnet
Brought by drakestapleton
omnet / om / argon2 / test / trap.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note trap.om: concatenated after blake2b.om, argon2.om and argon2pool.om. Each case breaks one caller |
| 3 | note contract by one, so the program must exit 103 (trap 3) and never reach ret 0: |
| 4 | note trap 1 a2tka with sn = 1025 (secret capacity 1024) |
| 5 | note trap 2 a2hash with |P| = 65537 (one field over 65536) |
| 6 | note trap 3 a2hash with |P| + |S| + |K| + |X| = 65497 (H0 input capacity 65496) |
| 7 | fn main to int |
| 8 | a = new uchar 16 0 |
| 9 | l = argread 1 a 0 16 |
| 10 | if ne l 1 |
| 11 | ret 2 |
| 12 | end |
| 13 | c = get a 0 |
| 14 | s = new uchar 1024 0 |
| 15 | o = new uchar 32 0 |
| 16 | if eq c 49 |
| 17 | a2tka s 1025 o |
| 18 | end |
| 19 | prm = new ulong 8 0 |
| 20 | put prm 0 1 |
| 21 | put prm 1 8 |
| 22 | put prm 2 1 |
| 23 | put prm 3 32 |
| 24 | put prm 4 65537 |
| 25 | if eq c 51 |
| 26 | put prm 4 65481 |
| 27 | put prm 5 16 |
| 28 | end |
| 29 | inp = new uchar 65536 0 |
| 30 | out = new uchar 1024 0 |
| 31 | e = a2hash prm inp out |
| 32 | ret int e |
| 33 | end |