interplane.Get Omega
Read in your language

omtls

omtls: a TLS 1.3 client (RFC 8446) written fresh in seeded Omega, for mailhand. Not audited by a cryptographer. Free (Apache-2.0).

Brought by drakestapleton

branch main Branches Tags History

omtls / tests / drv / tm.om

81 lines · 1563 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note tests/drv/tm.om: ot_tm_ cases. Arguments: vector files. Line forms:
3note T <name> <seconds|BAD> <hex of the whole time TLV> ot_tm_der over exactly those bytes
4note C <name> <seconds> <y> <mo> <d> <h> <mi> <s> ot_tm_civil
5text ot_x5_zar "tm"
6text ot_x5_zwT "T"
7text ot_x5_zwC "C"
8text ot_x5_zwB "BAD"
9text ot_x5_zm1 "wrong value"
10text ot_x5_zm2 "accepted, expected BAD"
11text ot_x5_zm3 "refused, expected a value"
12text ot_x5_zm4 "malformed vector line"
13text ot_x5_zm5 "cannot read vector file"
14
15fn ot_x5_ztmT to void
16n = ot_x5_zthex 3 0
17if lt n 0
18ot_x5_zifail ot_x5_zar ot_x5_zm4
19ret
20end
21v = ot_tm_der 0 ulong n
22if eq v ot_tm_bad
23if ot_x5_zteq 2 ot_x5_zwB
24ot_x5_zipass
25ret
26end
27ot_x5_zifail ot_x5_zar ot_x5_zm3
28ret
29end
30if ot_x5_zteq 2 ot_x5_zwB
31ot_x5_zifail ot_x5_zar ot_x5_zm2
32ret
33end
34if ne v ot_x5_ztdec 2
35ot_x5_zifail ot_x5_zar ot_x5_zm1
36ret
37end
38ot_x5_zipass
39end
40
41fn ot_x5_ztmC to void
42if ne ot_x5_ztn 9
43ot_x5_zifail ot_x5_zar ot_x5_zm4
44ret
45end
46y = ot_x5_ztdec 3
47mo = ot_x5_ztdec 4
48d = ot_x5_ztdec 5
49h = ot_x5_ztdec 6
50mi = ot_x5_ztdec 7
51s = ot_x5_ztdec 8
52v = ot_tm_civil y mo d h mi s
53if ne v ot_x5_ztdec 2
54ot_x5_zifail ot_x5_zar ot_x5_zm1
55ret
56end
57ot_x5_zipass
58end
59
60fn main to int
61a = ulong 1
62while lt long a argcnt bound 64
63if eq ot_x5_ziread a false
64ot_x5_zifail ot_x5_zar ot_x5_zm5
65else
66while ot_x5_ziline bound 1000000
67if ot_x5_zteq 0 ot_x5_zwT
68ot_x5_ztmT
69else
70if ot_x5_zteq 0 ot_x5_zwC
71ot_x5_ztmC
72else
73ot_x5_zifail ot_x5_zar ot_x5_zm4
74end
75end
76end
77end
78a = add a 1
79end
80ret ot_x5_ziend ot_x5_zar
81end