3 # ====================================================================
4 # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
5 # project. The module is, however, dual licensed under OpenSSL and
6 # CRYPTOGAMS licenses depending on where you obtain it. For further
7 # details see http://www.openssl.org/~appro/cryptogams/.
8 # ====================================================================
12 # Performance is 2x of gcc 3.4.6 on z10. Coding "secret" is to
13 # "cluster" Address Generation Interlocks, so that one pipeline stall
14 # resolves several dependencies.
16 while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {}
17 open STDOUT,">$output";
26 # void RC4(RC4_KEY *key,size_t len,const void *inp,void *out)
52 llgc $TX[0],2($XX[0],$key)
59 for ($i=0;$i<8;$i++) {
61 la $YY,0($YY,$TX[0]) # $i
66 $code.=<<___ if ($i==1);
69 $code.=<<___ if ($i>1);
75 stc $TX[0],2($YY,$key)
76 llgc $TX[1],2($XX[1],$key)
77 stc $TY,2($XX[0],$key)
85 push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers
109 stc $TX[0],2($YY,$key)
110 stc $TY,2($XX[0],$key)
118 llgc $TX[0],2($XX[0],$key)
131 .string "RC4 for s390x, CRYPTOGAMS by <appro\@openssl.org>"
136 # void RC4_set_key(RC4_KEY *key,unsigned int len,const void *inp)
150 .type RC4_set_key,\@function
159 stc $idx,2($idx,$key)
169 llgc $acc,2+256($ikey,$key)
170 llgc $dat,0($iinp,$inp)
177 llgc $dat,2($idx,$key)
178 stc $dat,2+256-1($ikey,$key)
179 stc $acc,2($idx,$key)
188 .size RC4_set_key,.-RC4_set_key
193 # const char *RC4_options()
196 .type RC4_options,\@function
201 .size RC4_options,.-RC4_options
205 .string "rc4(8x,char)"
209 close STDOUT; # force flush