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 / tools / gate.om

902 lines · 17169 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note gate.om: the omtls gate. Build: build/boot gate (units/gate.list). Run from the repository root:
3note build/gate [GATE-FILE] (default tests/GATE)
4note First it reads PIN (the one place the compiler pin is written: "omega-mv <40 hex>" then "omc-sha256 <64 hex>")
5note and checks that ./omc has that sha256 (exit 2, "NOT_RUN", otherwise). Then it runs the steps of the
6note gate file in order, one per line ("note" lines and blank lines skipped):
7note build UNIT build/boot UNIT must exit 0
8note run UNIT EXIT PREFIX ARGS... build/UNIT ARGS... must exit EXIT and its last stdout line must start with PREFIX
9note ("-" for no line check); stdin is /dev/null
10note mut NAME UNIT MUTFILE ARGS... build/boot UNIT MUTFILE NAME must exit 0, then build/UNIT.mut ARGS... must NOT
11note exit 0 (the mutant is killed); a trap or signal also kills it
12note ctscan UNIT build/boot UNIT, then the emitted AArch64 words must contain no conditional branch
13note (B.cond, CBZ, CBNZ, TBZ, TBNZ), no UDIV/SDIV, no register-offset load or store and no
14note indirect branch (BR/BLR: the trap path); see README "Constant time"
15note ctmut NAME UNIT MUTFILE the mutant built for a ctscan unit must be flagged by the scan
16note pincheck no tracked file but PIN restates the pin: a whole hex word of 7 or more digits
17note that is a prefix of the PIN revision or compiler sha256 is a finding (git ls-files)
18note Every child gets 3600 seconds; running out is a failure, never a pass (an alarm, not a capacity limit).
19note Output: one line per step, then "OMTLS GATE PASS steps=N mutants-killed=K/M" (exit 0) or "OMTLS GATE FAIL ..." (exit 1).
20const GT_LIMIT long 3600000000000
21global gt_file uchar 8388608
22global gt_buf uchar 8388608
23global gt_v ulong 64
24global gt_pk uchar 65536
25global gt_tok ulong 4096
26global gt_path uchar 8192
27global gt_pinv uchar 256
28global gt_list uchar 1048576
29text gt_pinf "PIN"
30text gt_pmv "omega-mv "
31text gt_psha "omc-sha256 "
32text gt_git "/usr/bin/git"
33text gt_lsf "ls-files"
34text gt_w_pincheck "pincheck"
35text gt_s_restate "FAIL pincheck: restates PIN: "
36text gt_omc "./omc"
37text gt_t_boot "build/boot"
38text gt_buildp "build/"
39text gt_mutsfx ".mut"
40text gt_defgate "tests/GATE"
41text gt_null "/dev/null"
42text gt_outf "build/gate.out"
43text gt_errf "build/gate.err"
44text gt_w_note "note"
45text gt_w_build "build"
46text gt_w_run "run"
47text gt_w_mut "mut"
48text gt_w_ctscan "ctscan"
49text gt_w_ctmut "ctmut"
50text gt_w_dash "-"
51text gt_nl "\n"
52text gt_sp " "
53text gt_s_pass "PASS "
54text gt_s_fail "FAIL "
55text gt_s_killed "KILLED "
56text gt_s_surv "SURVIVED "
57text gt_s_exit " exit="
58text gt_s_want " want="
59text gt_s_last " last="
60text gt_s_ct " words="
61text gt_s_cb " condbr="
62text gt_s_dv " div="
63text gt_s_rm " regmem="
64text gt_s_ib " indirect="
65text gt_s_bad "FAIL malformed gate line: "
66text gt_s_io "OMTLS GATE FAIL cannot read "
67text gt_s_notrun "OMTLS GATE NOT_RUN ./omc is not the compiler PIN names (or PIN is malformed)\n"
68text gt_s_final "OMTLS GATE "
69text gt_s_steps " steps="
70text gt_s_failed " failed="
71text gt_s_mk " mutants-killed="
72text gt_s_slash "/"
73
74note ---- output ----
75fn gt_say t view uchar * to void
76k = write 1 t 0 len t
77end
78fn gt_num n ulong to void
79d = new uchar 24 0
80i = ulong 24
81v = n
82while true bound 30
83i = sub i 1
84put d i uchar add 48 rem v 10
85v = div v 10
86if eq v 0
87break
88end
89end
90k = write 1 d i sub 24 i
91end
92fn gt_saytok t ulong to void
93note print token t of the current line (offsets in gt_tok)
94s = get gt_tok mul t 2
95e = get gt_tok add mul t 2 1
96k = write 1 gt_file s sub e s
97end
98fn gt_sayline to void
99k = write 1 gt_file get gt_v 20 sub get gt_v 21 get gt_v 20
100gt_say gt_nl
101end
102
103note ---- read a whole file into gt_buf (length gt_v[1]) from the path in gt_path (length gt_v[6]) ----
104fn gt_load to bool
105fd = fopen gt_path 0 get gt_v 6 0 0
106if lt fd 0
107ret false
108end
109n = ulong 0
110ok = true
111cap = len gt_buf
112while true bound 9223372036854775807
113if ge n cap
114ok = false
115break
116end
117k = read int fd gt_buf n sub cap n
118if eq k -4
119continue
120end
121if lt k 0
122ok = false
123break
124end
125if eq k 0
126break
127end
128n = add n ulong k
129end
130z = fclose int fd
131put gt_v 1 n
132ret ok
133end
134fn gt_pset t view uchar * to void
135for i ulong len t
136put gt_path i get t i
137end
138put gt_v 6 len t
139end
140fn gt_padd t view uchar * to void
141p = get gt_v 6
142for i ulong len t
143put gt_path add p i get t i
144end
145put gt_v 6 add p len t
146end
147fn gt_paddtok t ulong to void
148s = get gt_tok mul t 2
149e = get gt_tok add mul t 2 1
150p = get gt_v 6
151for i ulong sub e s
152put gt_path add p i get gt_file add s i
153end
154put gt_v 6 add p sub e s
155end
156
157note ---- the compiler pin: sha256 of ./omc with the vendored FIPS 180-4 unit ----
158fn gt_pinok to bool
159fd = fopen gt_omc 0 len gt_omc 0 0
160if lt fd 0
161ret false
162end
163c = new uchar 104 0
164b = new uchar 65536 0
165d = new uchar 32 0
166sha256_init c
167while true bound 9223372036854775807
168k = read int fd b 0 65536
169if eq k -4
170continue
171end
172if lt k 0
173z = fclose int fd
174ret false
175end
176if eq k 0
177break
178end
179sha256_update c part b 0 ulong k
180end
181z = fclose int fd
182sha256_final c d
183ret gt_pincmp d
184end
185fn gt_pincmp d view uchar 32 to bool
186hx = new uchar 16 0
187for i ulong 16
188if lt i 10
189put hx i uchar add 48 i
190else
191put hx i uchar add 87 i
192end
193end
194for i ulong 32
195v = get d i
196o = add 64 mul i 2
197hi = get hx ulong shr v 4
198lo = get hx ulong and v 15
199if or ne get gt_pinv o hi ne get gt_pinv add o 1 lo
200ret false
201end
202end
203ret true
204end
205note ---- PIN: exactly "omega-mv " + 40 hex, LF, "omc-sha256 " + 64 hex, LF; into gt_pinv[0..40) and [64..128) ----
206fn gt_ishex c uchar to bool
207ret or and ge c 48 le c 57 and ge c 97 le c 102
208end
209fn gt_loadpin to bool
210gt_pset gt_pinf
211if not gt_load
212ret false
213end
214if ne get gt_v 1 126
215ret false
216end
217for i ulong 9
218if ne get gt_buf i get gt_pmv i
219ret false
220end
221end
222for i ulong 11
223if ne get gt_buf add 50 i get gt_psha i
224ret false
225end
226end
227if or ne get gt_buf 49 10 ne get gt_buf 125 10
228ret false
229end
230for i ulong 40
231c = get gt_buf add 9 i
232if not gt_ishex c
233ret false
234end
235put gt_pinv i c
236end
237for i ulong 64
238c = get gt_buf add 61 i
239if not gt_ishex c
240ret false
241end
242put gt_pinv add 64 i c
243end
244ret true
245end
246note ---- pincheck: the tracked files (git ls-files) must not restate the pin ----
247fn gt_step_pincheck to bool
248gt_pkstart
249gt_pkt gt_git
250gt_pkt gt_lsf
251st = gt_exec
252if ne st 0
253ret gt_fail
254end
255gt_pset gt_outf
256if not gt_load
257ret gt_fail
258end
259n = get gt_v 1
260if gt n len gt_list
261ret gt_fail
262end
263for i ulong n
264put gt_list i get gt_buf i
265end
266bad = ulong 0
267files = ulong 0
268p = ulong 0
269while lt p n bound 9223372036854775807
270q = p
271while lt q n bound 9223372036854775807
272if eq get gt_list q 10
273break
274end
275q = add q 1
276end
277if gt q p
278files = add files 1
279bad = add bad gt_scanpin p q
280end
281p = add q 1
282end
283put gt_v 52 files
284if gt bad 0
285ret gt_fail
286end
287ret gt_pass
288end
289note one tracked path gt_list[p, q): its findings (PIN itself is the pin's one place and is skipped)
290fn gt_ispinpath p ulong q ulong to bool
291if ne sub q p 3
292ret false
293end
294a = and eq get gt_list p 80 eq get gt_list add p 1 73
295ret and a eq get gt_list add p 2 78
296end
297fn gt_scanpin p ulong q ulong to ulong
298if gt_ispinpath p q
299ret 0
300end
301put gt_v 6 sub q p
302for i ulong sub q p
303put gt_path i get gt_list add p i
304end
305if not gt_load
306ret 0
307end
308n = get gt_v 1
309bad = ulong 0
310i = ulong 0
311while lt i n bound 9223372036854775807
312e = gt_hexrun i n
313if gt e i
314if gt_restates i e n
315bad = add bad 1
316gt_say gt_s_restate
317k = write 1 gt_path 0 get gt_v 6
318gt_say gt_nl
319end
320i = e
321else
322i = add i 1
323end
324end
325ret bad
326end
327fn gt_isword c uchar to bool
328dg = and ge c 48 le c 57
329lo = and ge c 97 le c 122
330up = and ge c 65 le c 90
331ret or or dg lo or up eq c 95
332end
333note the end of the run of lowercase hex digits starting at i (i itself when there is none or i is inside a word)
334fn gt_hexrun i ulong n ulong to ulong
335if gt i 0
336c = get gt_buf sub i 1
337if gt_isword c
338ret i
339end
340end
341e = i
342while lt e n bound 9223372036854775807
343if not gt_ishex get gt_buf e
344break
345end
346e = add e 1
347end
348ret e
349end
350note a whole hex word of at least 7 digits that is a prefix of the PIN revision or of the compiler sha256
351fn gt_restates s ulong e ulong n ulong to bool
352l = sub e s
353if lt l 7
354ret false
355end
356if lt e n
357c = get gt_buf e
358if gt_isword c
359ret false
360end
361end
362ret or gt_prefix s l 0 40 gt_prefix s l 64 64
363end
364fn gt_prefix s ulong l ulong o ulong m ulong to bool
365if gt l m
366ret false
367end
368for i ulong l
369if ne get gt_buf add s i get gt_pinv add o i
370ret false
371end
372end
373ret true
374end
375
376note ---- tokens of the current line [gt_v20, gt_v21) into gt_tok; count in gt_v[22] ----
377fn gt_tokens to void
378s = get gt_v 20
379e = get gt_v 21
380n = ulong 0
381p = s
382while lt p e bound 9223372036854775807
383while lt p e bound 9223372036854775807
384if ne get gt_file p 32
385break
386end
387p = add p 1
388end
389if ge p e
390break
391end
392q = p
393while lt q e bound 9223372036854775807
394if eq get gt_file q 32
395break
396end
397q = add q 1
398end
399put gt_tok mul n 2 p
400put gt_tok add mul n 2 1 q
401n = add n 1
402p = q
403end
404put gt_v 22 n
405end
406fn gt_tokis t ulong w view uchar * to bool
407s = get gt_tok mul t 2
408e = get gt_tok add mul t 2 1
409if ne sub e s len w
410ret false
411end
412for i ulong len w
413if ne get gt_file add s i get w i
414ret false
415end
416end
417ret true
418end
419fn gt_tokint t ulong to ulong
420s = get gt_tok mul t 2
421e = get gt_tok add mul t 2 1
422v = ulong 0
423for i ulong sub e s
424c = get gt_file add s i
425if or lt c 48 gt c 57
426ret 999999
427end
428v = add mul v 10 ulong sub c 48
429if gt v 999999
430ret 999999
431end
432end
433ret v
434end
435
436note ---- packet building in gt_pk (length gt_v[14], count gt_v[15]) ----
437fn gt_pkstart to void
438put gt_v 14 2
439put gt_v 15 0
440end
441fn gt_pkdone to void
442n = get gt_v 15
443put gt_pk 0 uchar and n 255
444put gt_pk 1 uchar shr n 8
445end
446fn gt_pkhead to ulong
447p = get gt_v 14
448put gt_v 15 add get gt_v 15 1
449ret p
450end
451fn gt_pkset p ulong n ulong to void
452put gt_pk p uchar and n 255
453put gt_pk add p 1 uchar shr n 8
454put gt_v 14 add add p 2 n
455end
456fn gt_pkt t view uchar * to void
457p = gt_pkhead
458for i ulong len t
459put gt_pk add add p 2 i get t i
460end
461gt_pkset p len t
462end
463fn gt_pktok t ulong to void
464s = get gt_tok mul t 2
465e = get gt_tok add mul t 2 1
466p = gt_pkhead
467for i ulong sub e s
468put gt_pk add add p 2 i get gt_file add s i
469end
470gt_pkset p sub e s
471end
472fn gt_pkpath to void
473p = gt_pkhead
474for i ulong get gt_v 6
475put gt_pk add add p 2 i get gt_path i
476end
477gt_pkset p get gt_v 6
478end
479fn gt_pkbin t ulong mut bool to void
480note "build/UNIT" (or "build/UNIT.mut") from token t
481gt_pset gt_buildp
482gt_paddtok t
483if mut
484gt_padd gt_mutsfx
485end
486gt_pkpath
487end
488
489fn gt_le4 b view uchar 4 to ulong
490lo = or ulong get b 0 shl ulong get b 1 8
491hi = or shl ulong get b 2 16 shl ulong get b 3 24
492ret or lo hi
493end
494fn gt_word o ulong to ulong
495lo = or ulong get gt_buf o shl ulong get gt_buf add o 1 8
496hi = or shl ulong get gt_buf add o 2 16 shl ulong get gt_buf add o 3 24
497ret or lo hi
498end
499note ---- run the packet with stdin /dev/null, stdout build/gate.out, stderr build/gate.err; exit status,
500note 1000+signal, 2000 timeout, 3000 I/O ----
501fn gt_exec to ulong
502gt_pkdone
503fi = fopen gt_null 0 len gt_null 0 0
504fo = fopen gt_outf 0 len gt_outf 577 420
505fe = fopen gt_errf 0 len gt_errf 577 420
506if or or lt fi 0 lt fo 0 lt fe 0
507ret 3000
508end
509pid = fork
510if lt pid 0
511ret 3000
512end
513if eq pid 0
514if lt dupfd int fi 0 0 0
515exit 126
516end
517if lt dupfd int fo 1 0 0
518exit 126
519end
520if lt dupfd int fe 2 0 0
521exit 126
522end
523r = execprog gt_pk 0 get gt_v 14
524exit 127
525end
526z = fclose int fi
527z = fclose int fo
528z = fclose int fe
529b = new uchar 4 0
530t0 = monons
531while true bound 9223372036854775807
532w = waitpid int pid b 0 4 1
533if eq w pid
534st = gt_le4 b
535if eq and st 127 0
536ret and shr st 8 255
537end
538ret add 1000 and st 127
539end
540if lt w 0
541if ne w -4
542ret 3000
543end
544end
545if gt sub monons t0 GT_LIMIT
546r = killpid int pid 9
547w = waitpid int pid b 0 4 0
548ret 2000
549end
550r = sleepns 2000000
551end
552ret 3000
553end
554
555note ---- last nonempty line of build/gate.out into gt_buf[gt_v30, gt_v31) ----
556fn gt_lastline to void
557gt_pset gt_outf
558put gt_v 30 0
559put gt_v 31 0
560if not gt_load
561ret
562end
563e = get gt_v 1
564while gt e 0 bound 9223372036854775807
565if ne get gt_buf sub e 1 10
566break
567end
568e = sub e 1
569end
570s = e
571while gt s 0 bound 9223372036854775807
572if eq get gt_buf sub s 1 10
573break
574end
575s = sub s 1
576end
577put gt_v 30 s
578put gt_v 31 e
579end
580fn gt_lastprefix t ulong to bool
581s = get gt_tok mul t 2
582e = get gt_tok add mul t 2 1
583ls = get gt_v 30
584lz = get gt_v 31
585if gt sub e s sub lz ls
586ret false
587end
588for i ulong sub e s
589if ne get gt_file add s i get gt_buf add ls i
590ret false
591end
592end
593ret true
594end
595fn gt_saylast to void
596k = write 1 gt_buf get gt_v 30 sub get gt_v 31 get gt_v 30
597end
598fn gt_sayerr to void
599gt_pset gt_errf
600if gt_load
601k = write 1 gt_buf 0 get gt_v 1
602end
603end
604
605note ---- build/boot UNIT [MUTFILE NAME] ----
606fn gt_boot unit ulong mutfile ulong name ulong mut bool to ulong
607gt_pkstart
608gt_pkt gt_t_boot
609gt_pktok unit
610if mut
611gt_pktok mutfile
612gt_pktok name
613end
614ret gt_exec
615end
616
617note ---- scan build/UNIT (or .mut) for the forbidden instruction classes; counts in gt_v[40..44] ----
618fn gt_scan unit ulong mut bool to bool
619gt_pset gt_buildp
620gt_paddtok unit
621if mut
622gt_padd gt_mutsfx
623end
624for i ulong 5
625put gt_v add 40 i 0
626end
627if not gt_load
628ret false
629end
630n = div get gt_v 1 4
631for i ulong n
632c = gt_class gt_word mul i 4
633if gt c 0
634put gt_v add 40 c add get gt_v add 40 c 1
635end
636end
637put gt_v 40 n
638ret true
639end
640note class of one AArch64 word: 1 conditional branch, 2 divide, 3 register-offset load/store, 4 BR/BLR, 0 other
641fn gt_class w ulong to ulong
642if eq and w 4278190096 1409286144
643ret 1
644end
645if eq and w 2113929216 872415232
646ret 1
647end
648if eq and w 2113929216 905969664
649ret 1
650end
651if eq and w 2145449984 448792576
652ret 2
653end
654if eq and w 991955968 941623296
655ret 3
656end
657if eq and w 4294966303 3592355840
658ret 4
659end
660if eq and w 4294966303 3594452992
661ret 4
662end
663ret 0
664end
665fn gt_scanclean to bool
666ret and and eq get gt_v 41 0 eq get gt_v 42 0 and eq get gt_v 43 0 eq get gt_v 44 0
667end
668fn gt_sayscan to void
669gt_say gt_s_ct
670gt_num get gt_v 40
671gt_say gt_s_cb
672gt_num get gt_v 41
673gt_say gt_s_dv
674gt_num get gt_v 42
675gt_say gt_s_rm
676gt_num get gt_v 43
677gt_say gt_s_ib
678gt_num get gt_v 44
679end
680
681note ---- one step; true when it passed ----
682fn gt_pass to bool
683gt_say gt_s_pass
684gt_sayline
685ret true
686end
687fn gt_fail to bool
688gt_say gt_s_fail
689gt_sayline
690ret false
691end
692fn gt_step_build to bool
693st = gt_boot 1 0 0 false
694if ne st 0
695gt_sayerr
696ret gt_fail
697end
698ret gt_pass
699end
700fn gt_step_run to bool
701nt = get gt_v 22
702if lt nt 4
703ret false
704end
705want = gt_tokint 2
706gt_pkstart
707gt_pkbin 1 false
708for t ulong sub nt 4
709gt_pktok add 4 t
710end
711st = gt_exec
712gt_lastline
713ok = eq st want
714if not gt_tokis 3 gt_w_dash
715if not gt_lastprefix 3
716ok = false
717end
718end
719if ok
720ret gt_pass
721end
722gt_say gt_s_fail
723gt_sayline
724gt_say gt_s_exit
725gt_num st
726gt_say gt_s_want
727gt_num want
728gt_say gt_s_last
729gt_saylast
730gt_say gt_nl
731gt_sayerr
732ret false
733end
734fn gt_step_mut to bool
735nt = get gt_v 22
736if lt nt 4
737ret false
738end
739put gt_v 51 add get gt_v 51 1
740st = gt_boot 2 3 1 true
741if ne st 0
742gt_say gt_s_fail
743gt_sayline
744gt_sayerr
745ret false
746end
747gt_pkstart
748gt_pkbin 2 true
749for t ulong sub nt 4
750gt_pktok add 4 t
751end
752st = gt_exec
753if eq st 0
754gt_say gt_s_surv
755gt_sayline
756ret false
757end
758put gt_v 50 add get gt_v 50 1
759gt_say gt_s_killed
760gt_saytok 1
761gt_say gt_s_exit
762gt_num st
763gt_say gt_nl
764ret true
765end
766fn gt_step_ctscan to bool
767st = gt_boot 1 0 0 false
768if ne st 0
769gt_sayerr
770ret gt_fail
771end
772if not gt_scan 1 false
773ret gt_fail
774end
775ok = gt_scanclean
776if ok
777gt_say gt_s_pass
778else
779gt_say gt_s_fail
780end
781k = write 1 gt_file get gt_v 20 sub get gt_v 21 get gt_v 20
782gt_sayscan
783gt_say gt_nl
784ret ok
785end
786fn gt_step_ctmut to bool
787put gt_v 51 add get gt_v 51 1
788st = gt_boot 2 3 1 true
789if ne st 0
790gt_say gt_s_fail
791gt_sayline
792gt_sayerr
793ret false
794end
795if not gt_scan 2 true
796ret gt_fail
797end
798if gt_scanclean
799gt_say gt_s_surv
800gt_sayline
801ret false
802end
803put gt_v 50 add get gt_v 50 1
804gt_say gt_s_killed
805gt_saytok 1
806gt_sayscan
807gt_say gt_nl
808ret true
809end
810fn gt_step to bool
811nt = get gt_v 22
812if and gt_tokis 0 gt_w_build eq nt 2
813ret gt_step_build
814end
815if gt_tokis 0 gt_w_run
816ret gt_step_run
817end
818if gt_tokis 0 gt_w_mut
819ret gt_step_mut
820end
821if and gt_tokis 0 gt_w_ctscan eq nt 2
822ret gt_step_ctscan
823end
824if and gt_tokis 0 gt_w_ctmut eq nt 4
825ret gt_step_ctmut
826end
827if and gt_tokis 0 gt_w_pincheck eq nt 1
828ret gt_step_pincheck
829end
830gt_say gt_s_bad
831gt_sayline
832ret false
833end
834
835fn main to int
836if not and gt_loadpin gt_pinok
837gt_say gt_s_notrun
838ret 2
839end
840if gt argcnt 1
841k = argread 1 gt_path 0 8192
842if le k 0
843ret 2
844end
845put gt_v 6 ulong k
846else
847gt_pset gt_defgate
848end
849if not gt_load
850gt_say gt_s_io
851k = write 1 gt_path 0 get gt_v 6
852gt_say gt_nl
853ret 1
854end
855n = get gt_v 1
856for i ulong n
857put gt_file i get gt_buf i
858end
859steps = ulong 0
860failed = ulong 0
861p = ulong 0
862while lt p n bound 9223372036854775807
863q = p
864while lt q n bound 9223372036854775807
865if eq get gt_file q 10
866break
867end
868q = add q 1
869end
870put gt_v 20 p
871put gt_v 21 q
872gt_tokens
873if gt get gt_v 22 0
874if not gt_tokis 0 gt_w_note
875steps = add steps 1
876if not gt_step
877failed = add failed 1
878end
879end
880end
881p = add q 1
882end
883gt_say gt_s_final
884if eq failed 0
885gt_say gt_s_pass
886else
887gt_say gt_s_fail
888end
889gt_say gt_s_steps
890gt_num steps
891gt_say gt_s_failed
892gt_num failed
893gt_say gt_s_mk
894gt_num get gt_v 50
895gt_say gt_s_slash
896gt_num get gt_v 51
897gt_say gt_nl
898if eq failed 0
899ret 0
900end
901ret 1
902end