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.
23 # void RC4(RC4_KEY *key,size_t len,const void *inp,void *out)
49 llgc $TX[0],2($XX[0],$key)
56 for ($i=0;$i<8;$i++) {
58 la $YY,0($YY,$TX[0]) # $i
63 $code.=<<___ if ($i==1);
66 $code.=<<___ if ($i>1);
72 stc $TX[0],2($YY,$key)
73 llgc $TX[1],2($XX[1],$key)
74 stc $TY,2($XX[0],$key)
82 push(@TX,shift(@TX)); push(@XX,shift(@XX)); # "rotate" registers
106 stc $TX[0],2($YY,$key)
107 stc $TY,2($XX[0],$key)
115 llgc $TX[0],2($XX[0],$key)
128 .string "RC4 for s390x, CRYPTOGAMS by <appro\@openssl.org>"
133 # void RC4_set_key(RC4_KEY *key,unsigned int len,const void *inp)
147 .type RC4_set_key,\@function
156 stc $idx,2($idx,$key)
166 llgc $acc,2+256($ikey,$key)
167 llgc $dat,0($iinp,$inp)
174 llgc $dat,2($idx,$key)
175 stc $dat,2+256-1($ikey,$key)
176 stc $acc,2($idx,$key)
185 .size RC4_set_key,.-RC4_set_key
190 # const char *RC4_options()
193 .type RC4_options,\@function
198 .size RC4_options,.-RC4_options
202 .string "rc4(8x,char)"