2 # Copyright 2014-2018 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
10 # ====================================================================
11 # Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
12 # project. The module is, however, dual licensed under OpenSSL and
13 # CRYPTOGAMS licenses depending on where you obtain it. For further
14 # details see http://www.openssl.org/~appro/cryptogams/.
15 # ====================================================================
17 # GHASH for ARMv8 Crypto Extension, 64-bit polynomial multiplication.
21 # Initial version was developed in tight cooperation with Ard
22 # Biesheuvel of Linaro from bits-n-pieces from other assembly modules.
23 # Just like aesv8-armx.pl this module supports both AArch32 and
24 # AArch64 execution modes.
28 # Implement 2x aggregated reduction [see ghash-x86.pl for background
33 # AArch64 register bank to "accommodate" 4x aggregated reduction and
34 # improve performance by 20-70% depending on processor.
36 # Current performance in cycles per processed byte:
38 # 64-bit PMULL 32-bit PMULL 32-bit NEON(*)
39 # Apple A7 0.58 0.92 5.62
40 # Cortex-A53 0.85 1.01 8.39
41 # Cortex-A57 0.73 1.17 7.61
42 # Denver 0.51 0.65 6.02
43 # Mongoose 0.65 1.10 8.06
47 # (*) presented for reference/comparison purposes;
52 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
53 ( $xlate="${dir}arm-xlate.pl" and -f $xlate ) or
54 ( $xlate="${dir}../../perlasm/arm-xlate.pl" and -f $xlate) or
55 die "can't locate arm-xlate.pl";
57 open OUT,"| \"$^X\" $xlate $flavour $output";
60 $Xi="x0"; # argument block
68 my ($Xl,$Xm,$Xh,$IN)=map("q$_",(0..3));
69 my ($t0,$t1,$t2,$xC2,$H,$Hhl,$H2)=map("q$_",(8..14));
70 my $_byte = ($flavour =~ /win/ ? "DCB" : ".byte");
75 #if __ARM_MAX_ARCH__>=7
77 $code.=".arch armv8-a+crypto\n.text\n" if ($flavour =~ /64/);
78 $code.=<<___ if ($flavour !~ /64/);
83 # define INST(a,b,c,d) $_byte c,0xef,a,b
86 # define INST(a,b,c,d) $_byte a,b,c,0xf2
92 ################################################################################
93 # void gcm_init_v8(u128 Htable[16],const u64 H[2]);
95 # input: 128-bit H - secret parameter E(K,0^128)
96 # output: precomputed table filled with degrees of twisted H;
97 # H is twisted to handle reverse bitness of GHASH;
98 # only few of 16 slots of Htable[16] are used;
99 # data is opaque to outside world (which allows to
100 # optimize the code independently);
104 .type gcm_init_v8,%function
107 vld1.64 {$t1},[x1] @ load input H
109 vshl.i64 $xC2,$xC2,#57 @ 0xc2.0
110 vext.8 $IN,$t1,$t1,#8
111 vshr.u64 $t2,$xC2,#63
113 vext.8 $t0,$t2,$xC2,#8 @ t0=0xc2....01
115 vshr.s32 $t1,$t1,#31 @ broadcast carry bit
118 vext.8 $t2,$t2,$t2,#8
120 vorr $IN,$IN,$t2 @ H<<<=1
121 veor $H,$IN,$t0 @ twisted H
122 vst1.64 {$H},[x0],#16 @ store Htable[0]
125 vext.8 $t0,$H,$H,#8 @ Karatsuba pre-processing
128 vpmull2.p64 $Xh,$H,$H
129 vpmull.p64 $Xm,$t0,$t0
131 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
135 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase
137 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
138 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
141 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase
142 vpmull.p64 $Xl,$Xl,$xC2
146 vext.8 $t1,$H2,$H2,#8 @ Karatsuba pre-processing
148 vext.8 $Hhl,$t0,$t1,#8 @ pack Karatsuba pre-processed
149 vst1.64 {$Hhl-$H2},[x0],#32 @ store Htable[1..2]
151 if ($flavour =~ /64/) {
152 my ($t3,$Yl,$Ym,$Yh) = map("q$_",(4..7));
155 @ calculate H^3 and H^4
156 vpmull.p64 $Xl,$H, $H2
157 vpmull.p64 $Yl,$H2,$H2
158 vpmull2.p64 $Xh,$H, $H2
159 vpmull2.p64 $Yh,$H2,$H2
160 vpmull.p64 $Xm,$t0,$t1
161 vpmull.p64 $Ym,$t1,$t1
163 vext.8 $t0,$Xl,$Xh,#8 @ Karatsuba post-processing
164 vext.8 $t1,$Yl,$Yh,#8
170 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase
172 vpmull.p64 $t3,$Yl,$xC2
174 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
176 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
181 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase
182 vext.8 $t3,$Yl,$Yl,#8
183 vpmull.p64 $Xl,$Xl,$xC2
184 vpmull.p64 $Yl,$Yl,$xC2
187 veor $H, $Xl,$t2 @ H^3
188 veor $H2,$Yl,$t3 @ H^4
190 vext.8 $t0,$H, $H,#8 @ Karatsuba pre-processing
191 vext.8 $t1,$H2,$H2,#8
194 vext.8 $Hhl,$t0,$t1,#8 @ pack Karatsuba pre-processed
195 vst1.64 {$H-$H2},[x0] @ store Htable[3..5]
200 .size gcm_init_v8,.-gcm_init_v8
202 ################################################################################
203 # void gcm_gmult_v8(u64 Xi[2],const u128 Htable[16]);
205 # input: Xi - current hash value;
206 # Htable - table precomputed in gcm_init_v8;
207 # output: Xi - next hash value Xi;
211 .type gcm_gmult_v8,%function
214 vld1.64 {$t1},[$Xi] @ load Xi
216 vld1.64 {$H-$Hhl},[$Htbl] @ load twisted H, ...
217 vshl.u64 $xC2,$xC2,#57
221 vext.8 $IN,$t1,$t1,#8
223 vpmull.p64 $Xl,$H,$IN @ H.lo·Xi.lo
224 veor $t1,$t1,$IN @ Karatsuba pre-processing
225 vpmull2.p64 $Xh,$H,$IN @ H.hi·Xi.hi
226 vpmull.p64 $Xm,$Hhl,$t1 @ (H.lo+H.hi)·(Xi.lo+Xi.hi)
228 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
232 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction
234 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
235 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
238 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction
239 vpmull.p64 $Xl,$Xl,$xC2
246 vext.8 $Xl,$Xl,$Xl,#8
247 vst1.64 {$Xl},[$Xi] @ write out Xi
250 .size gcm_gmult_v8,.-gcm_gmult_v8
252 ################################################################################
253 # void gcm_ghash_v8(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len);
255 # input: table precomputed in gcm_init_v8;
256 # current hash value Xi;
257 # pointer to input data;
258 # length of input data in bytes, but divisible by block size;
259 # output: next hash value Xi;
263 .type gcm_ghash_v8,%function
267 $code.=<<___ if ($flavour =~ /64/);
269 b.hs .Lgcm_ghash_v8_4x
271 $code.=<<___ if ($flavour !~ /64/);
272 vstmdb sp!,{d8-d15} @ 32-bit ABI says so
275 vld1.64 {$Xl},[$Xi] @ load [rotated] Xi
276 @ "[rotated]" means that
277 @ loaded value would have
278 @ to be rotated in order to
279 @ make it appear as in
280 @ algorithm specification
281 subs $len,$len,#32 @ see if $len is 32 or larger
282 mov $inc,#16 @ $inc is used as post-
283 @ increment for input pointer;
284 @ as loop is modulo-scheduled
285 @ $inc is zeroed just in time
286 @ to preclude overstepping
287 @ inp[len], which means that
288 @ last block[s] are actually
289 @ loaded twice, but last
290 @ copy is not processed
291 vld1.64 {$H-$Hhl},[$Htbl],#32 @ load twisted H, ..., H^2
293 vld1.64 {$H2},[$Htbl]
294 cclr $inc,eq @ is it time to zero $inc?
295 vext.8 $Xl,$Xl,$Xl,#8 @ rotate Xi
296 vld1.64 {$t0},[$inp],#16 @ load [rotated] I[0]
297 vshl.u64 $xC2,$xC2,#57 @ compose 0xc2.0 constant
302 vext.8 $IN,$t0,$t0,#8 @ rotate I[0]
303 b.lo .Lodd_tail_v8 @ $len was less than 32
305 { my ($Xln,$Xmn,$Xhn,$In) = map("q$_",(4..7));
307 # Xi+2 =[H*(Ii+1 + Xi+1)] mod P =
308 # [(H*Ii+1) + (H*Xi+1)] mod P =
309 # [(H*Ii+1) + H^2*(Ii+Xi)] mod P
312 vld1.64 {$t1},[$inp],$inc @ load [rotated] I[1]
316 vext.8 $In,$t1,$t1,#8
317 veor $IN,$IN,$Xl @ I[i]^=Xi
318 vpmull.p64 $Xln,$H,$In @ H·Ii+1
319 veor $t1,$t1,$In @ Karatsuba pre-processing
320 vpmull2.p64 $Xhn,$H,$In
325 vext.8 $t2,$IN,$IN,#8
326 subs $len,$len,#32 @ is there more data?
327 vpmull.p64 $Xl,$H2,$IN @ H^2.lo·Xi.lo
328 cclr $inc,lo @ is it time to zero $inc?
330 vpmull.p64 $Xmn,$Hhl,$t1
331 veor $t2,$t2,$IN @ Karatsuba pre-processing
332 vpmull2.p64 $Xh,$H2,$IN @ H^2.hi·Xi.hi
333 veor $Xl,$Xl,$Xln @ accumulate
334 vpmull2.p64 $Xm,$Hhl,$t2 @ (H^2.lo+H^2.hi)·(Xi.lo+Xi.hi)
335 vld1.64 {$t0},[$inp],$inc @ load [rotated] I[i+2]
338 cclr $inc,eq @ is it time to zero $inc?
341 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
344 vld1.64 {$t1},[$inp],$inc @ load [rotated] I[i+3]
349 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction
354 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
355 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
356 vext.8 $In,$t1,$t1,#8
357 vext.8 $IN,$t0,$t0,#8
359 vpmull.p64 $Xln,$H,$In @ H·Ii+1
360 veor $IN,$IN,$Xh @ accumulate $IN early
362 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction
363 vpmull.p64 $Xl,$Xl,$xC2
365 veor $t1,$t1,$In @ Karatsuba pre-processing
367 vpmull2.p64 $Xhn,$H,$In
368 b.hs .Loop_mod2x_v8 @ there was at least 32 more bytes
371 vext.8 $IN,$t0,$t0,#8 @ re-construct $IN
372 adds $len,$len,#32 @ re-construct $len
373 veor $Xl,$Xl,$Xh @ re-construct $Xl
374 b.eq .Ldone_v8 @ is $len zero?
379 vext.8 $t2,$Xl,$Xl,#8
380 veor $IN,$IN,$Xl @ inp^=Xi
381 veor $t1,$t0,$t2 @ $t1 is rotated inp^Xi
383 vpmull.p64 $Xl,$H,$IN @ H.lo·Xi.lo
384 veor $t1,$t1,$IN @ Karatsuba pre-processing
385 vpmull2.p64 $Xh,$H,$IN @ H.hi·Xi.hi
386 vpmull.p64 $Xm,$Hhl,$t1 @ (H.lo+H.hi)·(Xi.lo+Xi.hi)
388 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
392 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction
394 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
395 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
398 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction
399 vpmull.p64 $Xl,$Xl,$xC2
407 vext.8 $Xl,$Xl,$Xl,#8
408 vst1.64 {$Xl},[$Xi] @ write out Xi
411 $code.=<<___ if ($flavour !~ /64/);
412 vldmia sp!,{d8-d15} @ 32-bit ABI says so
416 .size gcm_ghash_v8,.-gcm_ghash_v8
419 if ($flavour =~ /64/) { # 4x subroutine
421 $I1,$I2,$I3,$H3,$H34,$H4,$Yl,$Ym,$Yh) = map("q$_",(4..7,15..23));
424 .type gcm_ghash_v8_4x,%function
428 vld1.64 {$Xl},[$Xi] @ load [rotated] Xi
429 vld1.64 {$H-$H2},[$Htbl],#48 @ load twisted H, ..., H^2
431 vld1.64 {$H3-$H4},[$Htbl] @ load twisted H^3, ..., H^4
432 vshl.u64 $xC2,$xC2,#57 @ compose 0xc2.0 constant
434 vld1.64 {$I0-$j3},[$inp],#64
442 vext.8 $I3,$j3,$j3,#8
443 vext.8 $I2,$j2,$j2,#8
444 vext.8 $I1,$j1,$j1,#8
446 vpmull.p64 $Yl,$H,$I3 @ H·Ii+3
448 vpmull2.p64 $Yh,$H,$I3
449 vpmull.p64 $Ym,$Hhl,$j3
451 vpmull.p64 $t0,$H2,$I2 @ H^2·Ii+2
453 vpmull2.p64 $I2,$H2,$I2
454 vpmull2.p64 $j2,$Hhl,$j2
460 vpmull.p64 $j3,$H3,$I1 @ H^3·Ii+1
462 vpmull2.p64 $I1,$H3,$I1
463 vpmull.p64 $j1,$H34,$j1
477 vld1.64 {$I0-$j3},[$inp],#64
478 vext.8 $IN,$t0,$t0,#8
486 vpmull.p64 $Xl,$H4,$IN @ H^4·(Xi+Ii)
488 vpmull2.p64 $Xh,$H4,$IN
489 vext.8 $I3,$j3,$j3,#8
490 vpmull2.p64 $Xm,$H34,$t0
494 vext.8 $I2,$j2,$j2,#8
496 vext.8 $I1,$j1,$j1,#8
498 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
500 vpmull.p64 $Yl,$H,$I3 @ H·Ii+3
503 vpmull2.p64 $Yh,$H,$I3
505 vpmull.p64 $Ym,$Hhl,$j3
507 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction
508 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
509 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
510 vpmull.p64 $t0,$H2,$I2 @ H^2·Ii+2
512 vpmull2.p64 $I2,$H2,$I2
514 vpmull2.p64 $j2,$Hhl,$j2
520 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction
521 vpmull.p64 $Xl,$Xl,$xC2
522 vpmull.p64 $j3,$H3,$I1 @ H^3·Ii+1
525 vpmull2.p64 $I1,$H3,$I1
526 vpmull.p64 $j1,$H34,$j1
531 vext.8 $Xl,$Xl,$Xl,#8
539 vext.8 $IN,$t0,$t0,#8
541 vpmull.p64 $Xl,$H4,$IN @ H^4·(Xi+Ii)
543 vpmull2.p64 $Xh,$H4,$IN
544 vpmull2.p64 $Xm,$H34,$t0
557 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
560 vld1.64 {$I0-$j2},[$inp]
568 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction
569 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
570 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
571 vext.8 $I2,$j2,$j2,#8
572 vext.8 $I1,$j1,$j1,#8
575 vpmull.p64 $Yl,$H,$I2 @ H·Ii+2
578 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction
579 vpmull.p64 $Xl,$Xl,$xC2
581 vpmull2.p64 $Yh,$H,$I2
582 vpmull.p64 $Ym,$Hhl,$j2
584 vpmull.p64 $j3,$H2,$I1 @ H^2·Ii+1
586 vext.8 $Xl,$Xl,$Xl,#8
588 vpmull2.p64 $I1,$H2,$I1
590 vpmull2.p64 $j1,$Hhl,$j1
591 vext.8 $IN,$t0,$t0,#8
597 vpmull.p64 $Xl,$H3,$IN @ H^3·(Xi+Ii)
599 vpmull2.p64 $Xh,$H3,$IN
600 vpmull.p64 $Xm,$H34,$t0
609 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
612 vld1.64 {$I0-$j1},[$inp]
619 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction
620 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
621 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
622 vext.8 $I1,$j1,$j1,#8
625 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction
626 vpmull.p64 $Xl,$Xl,$xC2
629 vext.8 $Xl,$Xl,$Xl,#8
631 vpmull.p64 $Yl,$H,$I1 @ H·Ii+1
635 vext.8 $IN,$t0,$t0,#8
637 vpmull2.p64 $Yh,$H,$I1
638 vpmull.p64 $Ym,$Hhl,$j1
640 vpmull.p64 $Xl,$H2,$IN @ H^2·(Xi+Ii)
642 vpmull2.p64 $Xh,$H2,$IN
643 vpmull2.p64 $Xm,$Hhl,$t0
652 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
661 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction
662 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
663 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
666 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction
667 vpmull.p64 $Xl,$Xl,$xC2
670 vext.8 $Xl,$Xl,$Xl,#8
673 vext.8 $IN,$t0,$t0,#8
675 vpmull.p64 $Xl,$H,$IN
677 vpmull2.p64 $Xh,$H,$IN
678 vpmull.p64 $Xm,$Hhl,$t0
681 vext.8 $t1,$Xl,$Xh,#8 @ Karatsuba post-processing
686 vpmull.p64 $t2,$Xl,$xC2 @ 1st phase of reduction
687 vmov $Xh#lo,$Xm#hi @ Xh|Xm - 256-bit result
688 vmov $Xm#hi,$Xl#lo @ Xm is rotated Xl
691 vext.8 $t2,$Xl,$Xl,#8 @ 2nd phase of reduction
692 vpmull.p64 $Xl,$Xl,$xC2
695 vext.8 $Xl,$Xl,$Xl,#8
700 vst1.64 {$Xl},[$Xi] @ write out Xi
703 .size gcm_ghash_v8_4x,.-gcm_ghash_v8_4x
710 .asciz "GHASH for ARMv8, CRYPTOGAMS by <appro\@openssl.org>"
715 if ($flavour =~ /64/) { ######## 64-bit code
719 $arg =~ m/q([0-9]+)#(lo|hi),\s*q([0-9]+)#(lo|hi)/o &&
720 sprintf "ins v%d.d[%d],v%d.d[%d]",$1<8?$1:$1+8,($2 eq "lo")?0:1,
721 $3<8?$3:$3+8,($4 eq "lo")?0:1;
723 foreach(split("\n",$code)) {
724 s/cclr\s+([wx])([^,]+),\s*([a-z]+)/csel $1$2,$1zr,$1$2,$3/o or
725 s/vmov\.i8/movi/o or # fix up legacy mnemonics
726 s/vmov\s+(.*)/unvmov($1)/geo or
728 s/vshr\.s/sshr\.s/o or
730 s/^(\s+)v/$1/o or # strip off v prefix
733 s/\bq([0-9]+)\b/"v".($1<8?$1:$1+8).".16b"/geo; # old->new registers
734 s/@\s/\/\//o; # old->new style commentary
736 # fix up remaining legacy suffixes
738 s/\.[uis]?32//o and s/\.16b/\.4s/go;
739 m/\.p64/o and s/\.16b/\.1q/o; # 1st pmull argument
740 m/l\.p64/o and s/\.16b/\.1d/go; # 2nd and 3rd pmull arguments
741 s/\.[uisp]?64//o and s/\.16b/\.2d/go;
742 s/\.[42]([sd])\[([0-3])\]/\.$1\[$2\]/o;
746 } else { ######## 32-bit code
750 $arg =~ m/q([0-9]+),\s*q([0-9]+)\[([0-3])\]/o &&
751 sprintf "vdup.32 q%d,d%d[%d]",$1,2*$2+($3>>1),$3&1;
754 my ($mnemonic,$arg)=@_;
756 if ($arg =~ m/q([0-9]+),\s*q([0-9]+),\s*q([0-9]+)/o) {
757 my $word = 0xf2a00e00|(($1&7)<<13)|(($1&8)<<19)
758 |(($2&7)<<17)|(($2&8)<<4)
759 |(($3&7)<<1) |(($3&8)<<2);
760 $word |= 0x00010001 if ($mnemonic =~ "2");
761 # since ARMv7 instructions are always encoded little-endian.
762 # correct solution is to use .inst directive, but older
763 # assemblers don't implement it:-(
764 sprintf "INST(0x%02x,0x%02x,0x%02x,0x%02x)\t@ %s %s",
765 $word&0xff,($word>>8)&0xff,
766 ($word>>16)&0xff,($word>>24)&0xff,
771 foreach(split("\n",$code)) {
772 s/\b[wx]([0-9]+)\b/r$1/go; # new->old registers
773 s/\bv([0-9])\.[12468]+[bsd]\b/q$1/go; # new->old registers
774 s/\/\/\s?/@ /o; # new->old style commentary
776 # fix up remaining new-style suffixes
779 s/cclr\s+([^,]+),\s*([a-z]+)/mov.$2 $1,#0/o or
780 s/vdup\.32\s+(.*)/unvdup32($1)/geo or
781 s/v?(pmull2?)\.p64\s+(.*)/unvpmullp64($1,$2)/geo or
782 s/\bq([0-9]+)#(lo|hi)/sprintf "d%d",2*$1+($2 eq "hi")/geo or
784 s/^(\s+)ret/$1bx\tlr/o;
786 if (s/^(\s+)mov\.([a-z]+)/$1mov$2/) {
794 close STDOUT; # enforce flush