1ec07fdf1Sdjm#!/usr/bin/env perl 2ec07fdf1Sdjm 3ec07fdf1Sdjm# ==================================================================== 4ec07fdf1Sdjm# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL 5ec07fdf1Sdjm# project. The module is, however, dual licensed under OpenSSL and 6ec07fdf1Sdjm# CRYPTOGAMS licenses depending on where you obtain it. For further 7ec07fdf1Sdjm# details see http://www.openssl.org/~appro/cryptogams/. 8ec07fdf1Sdjm# ==================================================================== 9ec07fdf1Sdjm 10ec07fdf1Sdjm# AES for MIPS 11ec07fdf1Sdjm 12ec07fdf1Sdjm# October 2010 13ec07fdf1Sdjm# 14ec07fdf1Sdjm# Code uses 1K[+256B] S-box and on single-issue core [such as R5000] 15ec07fdf1Sdjm# spends ~68 cycles per byte processed with 128-bit key. This is ~16% 16ec07fdf1Sdjm# faster than gcc-generated code, which is not very impressive. But 17ec07fdf1Sdjm# recall that compressed S-box requires extra processing, namely 18ec07fdf1Sdjm# additional rotations. Rotations are implemented with lwl/lwr pairs, 19ec07fdf1Sdjm# which is normally used for loading unaligned data. Another cool 20ec07fdf1Sdjm# thing about this module is its endian neutrality, which means that 21ec07fdf1Sdjm# it processes data without ever changing byte order... 22ec07fdf1Sdjm 23ec07fdf1Sdjm###################################################################### 24ec07fdf1Sdjm# There is a number of MIPS ABI in use, O32 and N32/64 are most 25ec07fdf1Sdjm# widely used. Then there is a new contender: NUBI. It appears that if 26ec07fdf1Sdjm# one picks the latter, it's possible to arrange code in ABI neutral 27ec07fdf1Sdjm# manner. Therefore let's stick to NUBI register layout: 28ec07fdf1Sdjm# 29ec07fdf1Sdjm($zero,$at,$t0,$t1,$t2)=map("\$$_",(0..2,24,25)); 30ec07fdf1Sdjm($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=map("\$$_",(4..11)); 31ec07fdf1Sdjm($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11)=map("\$$_",(12..23)); 32ec07fdf1Sdjm($gp,$tp,$sp,$fp,$ra)=map("\$$_",(3,28..31)); 33ec07fdf1Sdjm# 34ec07fdf1Sdjm# The return value is placed in $a0. Following coding rules facilitate 35ec07fdf1Sdjm# interoperability: 36ec07fdf1Sdjm# 37ec07fdf1Sdjm# - never ever touch $tp, "thread pointer", former $gp; 38ec07fdf1Sdjm# - copy return value to $t0, former $v0 [or to $a0 if you're adapting 39ec07fdf1Sdjm# old code]; 40ec07fdf1Sdjm# - on O32 populate $a4-$a7 with 'lw $aN,4*N($sp)' if necessary; 41ec07fdf1Sdjm# 42ec07fdf1Sdjm# For reference here is register layout for N32/64 MIPS ABIs: 43ec07fdf1Sdjm# 44ec07fdf1Sdjm# ($zero,$at,$v0,$v1)=map("\$$_",(0..3)); 45ec07fdf1Sdjm# ($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=map("\$$_",(4..11)); 46ec07fdf1Sdjm# ($t0,$t1,$t2,$t3,$t8,$t9)=map("\$$_",(12..15,24,25)); 47ec07fdf1Sdjm# ($s0,$s1,$s2,$s3,$s4,$s5,$s6,$s7)=map("\$$_",(16..23)); 48ec07fdf1Sdjm# ($gp,$sp,$fp,$ra)=map("\$$_",(28..31)); 49ec07fdf1Sdjm# 50ec07fdf1Sdjm$flavour = shift; # supported flavours are o32,n32,64,nubi32,nubi64 51ec07fdf1Sdjm 5257438458Smiodif ($flavour =~ /64/i) { 5357438458Smiod $LA="dla"; 5457438458Smiod} else { 5557438458Smiod $LA="la"; 5657438458Smiod} 5757438458Smiod 58ec07fdf1Sdjmif ($flavour =~ /64|n32/i) { 59ec07fdf1Sdjm $PTR_ADD="dadd"; # incidentally works even on n32 60ec07fdf1Sdjm $PTR_SUB="dsub"; # incidentally works even on n32 61ec07fdf1Sdjm $REG_S="sd"; 62ec07fdf1Sdjm $REG_L="ld"; 63ec07fdf1Sdjm $PTR_SLL="dsll"; # incidentally works even on n32 64ec07fdf1Sdjm $SZREG=8; 65ec07fdf1Sdjm} else { 66ec07fdf1Sdjm $PTR_ADD="add"; 67ec07fdf1Sdjm $PTR_SUB="sub"; 68ec07fdf1Sdjm $REG_S="sw"; 69ec07fdf1Sdjm $REG_L="lw"; 70ec07fdf1Sdjm $PTR_SLL="sll"; 71ec07fdf1Sdjm $SZREG=4; 72ec07fdf1Sdjm} 73ec07fdf1Sdjm$pf = ($flavour =~ /nubi/i) ? $t0 : $t2; 74ec07fdf1Sdjm# 75ec07fdf1Sdjm# <appro@openssl.org> 76ec07fdf1Sdjm# 77ec07fdf1Sdjm###################################################################### 78ec07fdf1Sdjm 79ec07fdf1Sdjm$big_endian=(`echo MIPSEL | $ENV{CC} -E -P -`=~/MIPSEL/)?1:0; 80ec07fdf1Sdjm 81ec07fdf1Sdjmfor (@ARGV) { $output=$_ if (/^\w[\w\-]*\.\w+$/); } 82ec07fdf1Sdjmopen STDOUT,">$output"; 83ec07fdf1Sdjm 84ec07fdf1Sdjmif (!defined($big_endian)) 85ec07fdf1Sdjm{ $big_endian=(unpack('L',pack('N',1))==1); } 86ec07fdf1Sdjm 87ec07fdf1Sdjmwhile (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {} 88ec07fdf1Sdjmopen STDOUT,">$output"; 89ec07fdf1Sdjm 90ec07fdf1Sdjmmy ($MSB,$LSB)=(0,3); # automatically converted to little-endian 91ec07fdf1Sdjm 92ec07fdf1Sdjm$code.=<<___; 93ec07fdf1Sdjm.text 94ec07fdf1Sdjm#if !defined(__vxworks) || defined(__pic__) 95ec07fdf1Sdjm.option pic2 96ec07fdf1Sdjm#endif 97ec07fdf1Sdjm.set noat 98ec07fdf1Sdjm___ 99ec07fdf1Sdjm 100ec07fdf1Sdjm{{{ 101ec07fdf1Sdjmmy $FRAMESIZE=16*$SZREG; 102ec07fdf1Sdjmmy $SAVED_REGS_MASK = ($flavour =~ /nubi/i) ? 0xc0fff008 : 0xc0ff0000; 103ec07fdf1Sdjm 104ec07fdf1Sdjmmy ($inp,$out,$key,$Tbl,$s0,$s1,$s2,$s3)=($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7); 105ec07fdf1Sdjmmy ($i0,$i1,$i2,$i3)=($at,$t0,$t1,$t2); 106ec07fdf1Sdjmmy ($t0,$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11) = map("\$$_",(12..23)); 107ec07fdf1Sdjmmy ($key0,$cnt)=($gp,$fp); 108ec07fdf1Sdjm 10971743258Sjmc# instruction ordering is "stolen" from output from MIPSpro assembler 110ec07fdf1Sdjm# invoked with -mips3 -O3 arguments... 111ec07fdf1Sdjm$code.=<<___; 112ec07fdf1Sdjm.align 5 113ec07fdf1Sdjm.ent _mips_AES_encrypt 114ec07fdf1Sdjm_mips_AES_encrypt: 115ec07fdf1Sdjm .frame $sp,0,$ra 116ec07fdf1Sdjm .set reorder 117ec07fdf1Sdjm lw $t0,0($key) 118ec07fdf1Sdjm lw $t1,4($key) 119ec07fdf1Sdjm lw $t2,8($key) 120ec07fdf1Sdjm lw $t3,12($key) 121ec07fdf1Sdjm lw $cnt,240($key) 122ec07fdf1Sdjm $PTR_ADD $key0,$key,16 123ec07fdf1Sdjm 124ec07fdf1Sdjm xor $s0,$t0 125ec07fdf1Sdjm xor $s1,$t1 126ec07fdf1Sdjm xor $s2,$t2 127ec07fdf1Sdjm xor $s3,$t3 128ec07fdf1Sdjm 129ec07fdf1Sdjm sub $cnt,1 130ec07fdf1Sdjm _xtr $i0,$s1,16-2 131ec07fdf1Sdjm.Loop_enc: 132ec07fdf1Sdjm _xtr $i1,$s2,16-2 133ec07fdf1Sdjm _xtr $i2,$s3,16-2 134ec07fdf1Sdjm _xtr $i3,$s0,16-2 135ec07fdf1Sdjm and $i0,0x3fc 136ec07fdf1Sdjm and $i1,0x3fc 137ec07fdf1Sdjm and $i2,0x3fc 138ec07fdf1Sdjm and $i3,0x3fc 139ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 140ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 141ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 142ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 143ec07fdf1Sdjm lwl $t0,3($i0) # Te1[s1>>16] 144ec07fdf1Sdjm lwl $t1,3($i1) # Te1[s2>>16] 145ec07fdf1Sdjm lwl $t2,3($i2) # Te1[s3>>16] 146ec07fdf1Sdjm lwl $t3,3($i3) # Te1[s0>>16] 147ec07fdf1Sdjm lwr $t0,2($i0) # Te1[s1>>16] 148ec07fdf1Sdjm lwr $t1,2($i1) # Te1[s2>>16] 149ec07fdf1Sdjm lwr $t2,2($i2) # Te1[s3>>16] 150ec07fdf1Sdjm lwr $t3,2($i3) # Te1[s0>>16] 151ec07fdf1Sdjm 152ec07fdf1Sdjm _xtr $i0,$s2,8-2 153ec07fdf1Sdjm _xtr $i1,$s3,8-2 154ec07fdf1Sdjm _xtr $i2,$s0,8-2 155ec07fdf1Sdjm _xtr $i3,$s1,8-2 156ec07fdf1Sdjm and $i0,0x3fc 157ec07fdf1Sdjm and $i1,0x3fc 158ec07fdf1Sdjm and $i2,0x3fc 159ec07fdf1Sdjm and $i3,0x3fc 160ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 161ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 162ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 163ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 164ec07fdf1Sdjm lwl $t4,2($i0) # Te2[s2>>8] 165ec07fdf1Sdjm lwl $t5,2($i1) # Te2[s3>>8] 166ec07fdf1Sdjm lwl $t6,2($i2) # Te2[s0>>8] 167ec07fdf1Sdjm lwl $t7,2($i3) # Te2[s1>>8] 168ec07fdf1Sdjm lwr $t4,1($i0) # Te2[s2>>8] 169ec07fdf1Sdjm lwr $t5,1($i1) # Te2[s3>>8] 170ec07fdf1Sdjm lwr $t6,1($i2) # Te2[s0>>8] 171ec07fdf1Sdjm lwr $t7,1($i3) # Te2[s1>>8] 172ec07fdf1Sdjm 173ec07fdf1Sdjm _xtr $i0,$s3,0-2 174ec07fdf1Sdjm _xtr $i1,$s0,0-2 175ec07fdf1Sdjm _xtr $i2,$s1,0-2 176ec07fdf1Sdjm _xtr $i3,$s2,0-2 177ec07fdf1Sdjm and $i0,0x3fc 178ec07fdf1Sdjm and $i1,0x3fc 179ec07fdf1Sdjm and $i2,0x3fc 180ec07fdf1Sdjm and $i3,0x3fc 181ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 182ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 183ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 184ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 185ec07fdf1Sdjm lwl $t8,1($i0) # Te3[s3] 186ec07fdf1Sdjm lwl $t9,1($i1) # Te3[s0] 187ec07fdf1Sdjm lwl $t10,1($i2) # Te3[s1] 188ec07fdf1Sdjm lwl $t11,1($i3) # Te3[s2] 189ec07fdf1Sdjm lwr $t8,0($i0) # Te3[s3] 190ec07fdf1Sdjm lwr $t9,0($i1) # Te3[s0] 191ec07fdf1Sdjm lwr $t10,0($i2) # Te3[s1] 192ec07fdf1Sdjm lwr $t11,0($i3) # Te3[s2] 193ec07fdf1Sdjm 194ec07fdf1Sdjm _xtr $i0,$s0,24-2 195ec07fdf1Sdjm _xtr $i1,$s1,24-2 196ec07fdf1Sdjm _xtr $i2,$s2,24-2 197ec07fdf1Sdjm _xtr $i3,$s3,24-2 198ec07fdf1Sdjm and $i0,0x3fc 199ec07fdf1Sdjm and $i1,0x3fc 200ec07fdf1Sdjm and $i2,0x3fc 201ec07fdf1Sdjm and $i3,0x3fc 202ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 203ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 204ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 205ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 206ec07fdf1Sdjm xor $t0,$t4 207ec07fdf1Sdjm xor $t1,$t5 208ec07fdf1Sdjm xor $t2,$t6 209ec07fdf1Sdjm xor $t3,$t7 210ec07fdf1Sdjm lw $t4,0($i0) # Te0[s0>>24] 211ec07fdf1Sdjm lw $t5,0($i1) # Te0[s1>>24] 212ec07fdf1Sdjm lw $t6,0($i2) # Te0[s2>>24] 213ec07fdf1Sdjm lw $t7,0($i3) # Te0[s3>>24] 214ec07fdf1Sdjm 215ec07fdf1Sdjm lw $s0,0($key0) 216ec07fdf1Sdjm lw $s1,4($key0) 217ec07fdf1Sdjm lw $s2,8($key0) 218ec07fdf1Sdjm lw $s3,12($key0) 219ec07fdf1Sdjm 220ec07fdf1Sdjm xor $t0,$t8 221ec07fdf1Sdjm xor $t1,$t9 222ec07fdf1Sdjm xor $t2,$t10 223ec07fdf1Sdjm xor $t3,$t11 224ec07fdf1Sdjm 225ec07fdf1Sdjm xor $t0,$t4 226ec07fdf1Sdjm xor $t1,$t5 227ec07fdf1Sdjm xor $t2,$t6 228ec07fdf1Sdjm xor $t3,$t7 229ec07fdf1Sdjm 230ec07fdf1Sdjm sub $cnt,1 231ec07fdf1Sdjm $PTR_ADD $key0,16 232ec07fdf1Sdjm xor $s0,$t0 233ec07fdf1Sdjm xor $s1,$t1 234ec07fdf1Sdjm xor $s2,$t2 235ec07fdf1Sdjm xor $s3,$t3 236ec07fdf1Sdjm .set noreorder 237ec07fdf1Sdjm bnez $cnt,.Loop_enc 238ec07fdf1Sdjm _xtr $i0,$s1,16-2 239ec07fdf1Sdjm 240ec07fdf1Sdjm .set reorder 241ec07fdf1Sdjm _xtr $i1,$s2,16-2 242ec07fdf1Sdjm _xtr $i2,$s3,16-2 243ec07fdf1Sdjm _xtr $i3,$s0,16-2 244ec07fdf1Sdjm and $i0,0x3fc 245ec07fdf1Sdjm and $i1,0x3fc 246ec07fdf1Sdjm and $i2,0x3fc 247ec07fdf1Sdjm and $i3,0x3fc 248ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 249ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 250ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 251ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 252ec07fdf1Sdjm lbu $t0,2($i0) # Te4[s1>>16] 253ec07fdf1Sdjm lbu $t1,2($i1) # Te4[s2>>16] 254ec07fdf1Sdjm lbu $t2,2($i2) # Te4[s3>>16] 255ec07fdf1Sdjm lbu $t3,2($i3) # Te4[s0>>16] 256ec07fdf1Sdjm 257ec07fdf1Sdjm _xtr $i0,$s2,8-2 258ec07fdf1Sdjm _xtr $i1,$s3,8-2 259ec07fdf1Sdjm _xtr $i2,$s0,8-2 260ec07fdf1Sdjm _xtr $i3,$s1,8-2 261ec07fdf1Sdjm and $i0,0x3fc 262ec07fdf1Sdjm and $i1,0x3fc 263ec07fdf1Sdjm and $i2,0x3fc 264ec07fdf1Sdjm and $i3,0x3fc 265ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 266ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 267ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 268ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 269ec07fdf1Sdjm lbu $t4,2($i0) # Te4[s2>>8] 270ec07fdf1Sdjm lbu $t5,2($i1) # Te4[s3>>8] 271ec07fdf1Sdjm lbu $t6,2($i2) # Te4[s0>>8] 272ec07fdf1Sdjm lbu $t7,2($i3) # Te4[s1>>8] 273ec07fdf1Sdjm 274ec07fdf1Sdjm _xtr $i0,$s0,24-2 275ec07fdf1Sdjm _xtr $i1,$s1,24-2 276ec07fdf1Sdjm _xtr $i2,$s2,24-2 277ec07fdf1Sdjm _xtr $i3,$s3,24-2 278ec07fdf1Sdjm and $i0,0x3fc 279ec07fdf1Sdjm and $i1,0x3fc 280ec07fdf1Sdjm and $i2,0x3fc 281ec07fdf1Sdjm and $i3,0x3fc 282ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 283ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 284ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 285ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 286ec07fdf1Sdjm lbu $t8,2($i0) # Te4[s0>>24] 287ec07fdf1Sdjm lbu $t9,2($i1) # Te4[s1>>24] 288ec07fdf1Sdjm lbu $t10,2($i2) # Te4[s2>>24] 289ec07fdf1Sdjm lbu $t11,2($i3) # Te4[s3>>24] 290ec07fdf1Sdjm 291ec07fdf1Sdjm _xtr $i0,$s3,0-2 292ec07fdf1Sdjm _xtr $i1,$s0,0-2 293ec07fdf1Sdjm _xtr $i2,$s1,0-2 294ec07fdf1Sdjm _xtr $i3,$s2,0-2 295ec07fdf1Sdjm and $i0,0x3fc 296ec07fdf1Sdjm and $i1,0x3fc 297ec07fdf1Sdjm and $i2,0x3fc 298ec07fdf1Sdjm and $i3,0x3fc 299ec07fdf1Sdjm 300ec07fdf1Sdjm _ins $t0,16 301ec07fdf1Sdjm _ins $t1,16 302ec07fdf1Sdjm _ins $t2,16 303ec07fdf1Sdjm _ins $t3,16 304ec07fdf1Sdjm 305ec07fdf1Sdjm _ins $t4,8 306ec07fdf1Sdjm _ins $t5,8 307ec07fdf1Sdjm _ins $t6,8 308ec07fdf1Sdjm _ins $t7,8 309ec07fdf1Sdjm 310ec07fdf1Sdjm xor $t0,$t4 311ec07fdf1Sdjm xor $t1,$t5 312ec07fdf1Sdjm xor $t2,$t6 313ec07fdf1Sdjm xor $t3,$t7 314ec07fdf1Sdjm 315ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 316ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 317ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 318ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 319ec07fdf1Sdjm lbu $t4,2($i0) # Te4[s3] 320ec07fdf1Sdjm lbu $t5,2($i1) # Te4[s0] 321ec07fdf1Sdjm lbu $t6,2($i2) # Te4[s1] 322ec07fdf1Sdjm lbu $t7,2($i3) # Te4[s2] 323ec07fdf1Sdjm 324ec07fdf1Sdjm _ins $t8,24 325ec07fdf1Sdjm _ins $t9,24 326ec07fdf1Sdjm _ins $t10,24 327ec07fdf1Sdjm _ins $t11,24 328ec07fdf1Sdjm 329ec07fdf1Sdjm lw $s0,0($key0) 330ec07fdf1Sdjm lw $s1,4($key0) 331ec07fdf1Sdjm lw $s2,8($key0) 332ec07fdf1Sdjm lw $s3,12($key0) 333ec07fdf1Sdjm 334ec07fdf1Sdjm xor $t0,$t8 335ec07fdf1Sdjm xor $t1,$t9 336ec07fdf1Sdjm xor $t2,$t10 337ec07fdf1Sdjm xor $t3,$t11 338ec07fdf1Sdjm 339ec07fdf1Sdjm _ins $t4,0 340ec07fdf1Sdjm _ins $t5,0 341ec07fdf1Sdjm _ins $t6,0 342ec07fdf1Sdjm _ins $t7,0 343ec07fdf1Sdjm 344ec07fdf1Sdjm xor $t0,$t4 345ec07fdf1Sdjm xor $t1,$t5 346ec07fdf1Sdjm xor $t2,$t6 347ec07fdf1Sdjm xor $t3,$t7 348ec07fdf1Sdjm 349ec07fdf1Sdjm xor $s0,$t0 350ec07fdf1Sdjm xor $s1,$t1 351ec07fdf1Sdjm xor $s2,$t2 352ec07fdf1Sdjm xor $s3,$t3 353ec07fdf1Sdjm 354ec07fdf1Sdjm jr $ra 355ec07fdf1Sdjm.end _mips_AES_encrypt 356ec07fdf1Sdjm 357ec07fdf1Sdjm.align 5 358*4a615b87Sjsing.globl aes_encrypt_internal 359*4a615b87Sjsing.ent aes_encrypt_internal 360*4a615b87Sjsingaes_encrypt_internal: 361ec07fdf1Sdjm .frame $sp,$FRAMESIZE,$ra 362ec07fdf1Sdjm .mask $SAVED_REGS_MASK,-$SZREG 363ec07fdf1Sdjm .set noreorder 364ec07fdf1Sdjm___ 365ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /o32/i); # o32 PIC-ification 366ec07fdf1Sdjm .cpload $pf 367ec07fdf1Sdjm___ 368ec07fdf1Sdjm$code.=<<___; 369ec07fdf1Sdjm $PTR_SUB $sp,$FRAMESIZE 370ec07fdf1Sdjm $REG_S $ra,$FRAMESIZE-1*$SZREG($sp) 371ec07fdf1Sdjm $REG_S $fp,$FRAMESIZE-2*$SZREG($sp) 372ec07fdf1Sdjm $REG_S $s11,$FRAMESIZE-3*$SZREG($sp) 373ec07fdf1Sdjm $REG_S $s10,$FRAMESIZE-4*$SZREG($sp) 374ec07fdf1Sdjm $REG_S $s9,$FRAMESIZE-5*$SZREG($sp) 375ec07fdf1Sdjm $REG_S $s8,$FRAMESIZE-6*$SZREG($sp) 376ec07fdf1Sdjm $REG_S $s7,$FRAMESIZE-7*$SZREG($sp) 377ec07fdf1Sdjm $REG_S $s6,$FRAMESIZE-8*$SZREG($sp) 378ec07fdf1Sdjm $REG_S $s5,$FRAMESIZE-9*$SZREG($sp) 379ec07fdf1Sdjm $REG_S $s4,$FRAMESIZE-10*$SZREG($sp) 380ec07fdf1Sdjm___ 381ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /nubi/i); # optimize non-nubi prologue 382ec07fdf1Sdjm $REG_S \$15,$FRAMESIZE-11*$SZREG($sp) 383ec07fdf1Sdjm $REG_S \$14,$FRAMESIZE-12*$SZREG($sp) 384ec07fdf1Sdjm $REG_S \$13,$FRAMESIZE-13*$SZREG($sp) 385ec07fdf1Sdjm $REG_S \$12,$FRAMESIZE-14*$SZREG($sp) 386ec07fdf1Sdjm $REG_S $gp,$FRAMESIZE-15*$SZREG($sp) 387ec07fdf1Sdjm___ 388ec07fdf1Sdjm$code.=<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification 389ec07fdf1Sdjm .cplocal $Tbl 390*4a615b87Sjsing .cpsetup $pf,$zero,aes_encrypt_internal 391ec07fdf1Sdjm___ 392ec07fdf1Sdjm$code.=<<___; 393ec07fdf1Sdjm .set reorder 39457438458Smiod $LA $Tbl,AES_Te # PIC-ified 'load address' 395ec07fdf1Sdjm 396ec07fdf1Sdjm lwl $s0,0+$MSB($inp) 397ec07fdf1Sdjm lwl $s1,4+$MSB($inp) 398ec07fdf1Sdjm lwl $s2,8+$MSB($inp) 399ec07fdf1Sdjm lwl $s3,12+$MSB($inp) 400ec07fdf1Sdjm lwr $s0,0+$LSB($inp) 401ec07fdf1Sdjm lwr $s1,4+$LSB($inp) 402ec07fdf1Sdjm lwr $s2,8+$LSB($inp) 403ec07fdf1Sdjm lwr $s3,12+$LSB($inp) 404ec07fdf1Sdjm 405ec07fdf1Sdjm bal _mips_AES_encrypt 406ec07fdf1Sdjm 407ec07fdf1Sdjm swr $s0,0+$LSB($out) 408ec07fdf1Sdjm swr $s1,4+$LSB($out) 409ec07fdf1Sdjm swr $s2,8+$LSB($out) 410ec07fdf1Sdjm swr $s3,12+$LSB($out) 411ec07fdf1Sdjm swl $s0,0+$MSB($out) 412ec07fdf1Sdjm swl $s1,4+$MSB($out) 413ec07fdf1Sdjm swl $s2,8+$MSB($out) 414ec07fdf1Sdjm swl $s3,12+$MSB($out) 415ec07fdf1Sdjm 416ec07fdf1Sdjm .set noreorder 417ec07fdf1Sdjm $REG_L $ra,$FRAMESIZE-1*$SZREG($sp) 418ec07fdf1Sdjm $REG_L $fp,$FRAMESIZE-2*$SZREG($sp) 419ec07fdf1Sdjm $REG_L $s11,$FRAMESIZE-3*$SZREG($sp) 420ec07fdf1Sdjm $REG_L $s10,$FRAMESIZE-4*$SZREG($sp) 421ec07fdf1Sdjm $REG_L $s9,$FRAMESIZE-5*$SZREG($sp) 422ec07fdf1Sdjm $REG_L $s8,$FRAMESIZE-6*$SZREG($sp) 423ec07fdf1Sdjm $REG_L $s7,$FRAMESIZE-7*$SZREG($sp) 424ec07fdf1Sdjm $REG_L $s6,$FRAMESIZE-8*$SZREG($sp) 425ec07fdf1Sdjm $REG_L $s5,$FRAMESIZE-9*$SZREG($sp) 426ec07fdf1Sdjm $REG_L $s4,$FRAMESIZE-10*$SZREG($sp) 427ec07fdf1Sdjm___ 428ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /nubi/i); 429ec07fdf1Sdjm $REG_L \$15,$FRAMESIZE-11*$SZREG($sp) 430ec07fdf1Sdjm $REG_L \$14,$FRAMESIZE-12*$SZREG($sp) 431ec07fdf1Sdjm $REG_L \$13,$FRAMESIZE-13*$SZREG($sp) 432ec07fdf1Sdjm $REG_L \$12,$FRAMESIZE-14*$SZREG($sp) 433ec07fdf1Sdjm $REG_L $gp,$FRAMESIZE-15*$SZREG($sp) 434ec07fdf1Sdjm___ 435ec07fdf1Sdjm$code.=<<___; 436ec07fdf1Sdjm jr $ra 437ec07fdf1Sdjm $PTR_ADD $sp,$FRAMESIZE 438*4a615b87Sjsing.end aes_encrypt_internal 439ec07fdf1Sdjm___ 440ec07fdf1Sdjm 441ec07fdf1Sdjm$code.=<<___; 442ec07fdf1Sdjm.align 5 443ec07fdf1Sdjm.ent _mips_AES_decrypt 444ec07fdf1Sdjm_mips_AES_decrypt: 445ec07fdf1Sdjm .frame $sp,0,$ra 446ec07fdf1Sdjm .set reorder 447ec07fdf1Sdjm lw $t0,0($key) 448ec07fdf1Sdjm lw $t1,4($key) 449ec07fdf1Sdjm lw $t2,8($key) 450ec07fdf1Sdjm lw $t3,12($key) 451ec07fdf1Sdjm lw $cnt,240($key) 452ec07fdf1Sdjm $PTR_ADD $key0,$key,16 453ec07fdf1Sdjm 454ec07fdf1Sdjm xor $s0,$t0 455ec07fdf1Sdjm xor $s1,$t1 456ec07fdf1Sdjm xor $s2,$t2 457ec07fdf1Sdjm xor $s3,$t3 458ec07fdf1Sdjm 459ec07fdf1Sdjm sub $cnt,1 460ec07fdf1Sdjm _xtr $i0,$s3,16-2 461ec07fdf1Sdjm.Loop_dec: 462ec07fdf1Sdjm _xtr $i1,$s0,16-2 463ec07fdf1Sdjm _xtr $i2,$s1,16-2 464ec07fdf1Sdjm _xtr $i3,$s2,16-2 465ec07fdf1Sdjm and $i0,0x3fc 466ec07fdf1Sdjm and $i1,0x3fc 467ec07fdf1Sdjm and $i2,0x3fc 468ec07fdf1Sdjm and $i3,0x3fc 469ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 470ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 471ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 472ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 473ec07fdf1Sdjm lwl $t0,3($i0) # Td1[s3>>16] 474ec07fdf1Sdjm lwl $t1,3($i1) # Td1[s0>>16] 475ec07fdf1Sdjm lwl $t2,3($i2) # Td1[s1>>16] 476ec07fdf1Sdjm lwl $t3,3($i3) # Td1[s2>>16] 477ec07fdf1Sdjm lwr $t0,2($i0) # Td1[s3>>16] 478ec07fdf1Sdjm lwr $t1,2($i1) # Td1[s0>>16] 479ec07fdf1Sdjm lwr $t2,2($i2) # Td1[s1>>16] 480ec07fdf1Sdjm lwr $t3,2($i3) # Td1[s2>>16] 481ec07fdf1Sdjm 482ec07fdf1Sdjm _xtr $i0,$s2,8-2 483ec07fdf1Sdjm _xtr $i1,$s3,8-2 484ec07fdf1Sdjm _xtr $i2,$s0,8-2 485ec07fdf1Sdjm _xtr $i3,$s1,8-2 486ec07fdf1Sdjm and $i0,0x3fc 487ec07fdf1Sdjm and $i1,0x3fc 488ec07fdf1Sdjm and $i2,0x3fc 489ec07fdf1Sdjm and $i3,0x3fc 490ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 491ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 492ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 493ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 494ec07fdf1Sdjm lwl $t4,2($i0) # Td2[s2>>8] 495ec07fdf1Sdjm lwl $t5,2($i1) # Td2[s3>>8] 496ec07fdf1Sdjm lwl $t6,2($i2) # Td2[s0>>8] 497ec07fdf1Sdjm lwl $t7,2($i3) # Td2[s1>>8] 498ec07fdf1Sdjm lwr $t4,1($i0) # Td2[s2>>8] 499ec07fdf1Sdjm lwr $t5,1($i1) # Td2[s3>>8] 500ec07fdf1Sdjm lwr $t6,1($i2) # Td2[s0>>8] 501ec07fdf1Sdjm lwr $t7,1($i3) # Td2[s1>>8] 502ec07fdf1Sdjm 503ec07fdf1Sdjm _xtr $i0,$s1,0-2 504ec07fdf1Sdjm _xtr $i1,$s2,0-2 505ec07fdf1Sdjm _xtr $i2,$s3,0-2 506ec07fdf1Sdjm _xtr $i3,$s0,0-2 507ec07fdf1Sdjm and $i0,0x3fc 508ec07fdf1Sdjm and $i1,0x3fc 509ec07fdf1Sdjm and $i2,0x3fc 510ec07fdf1Sdjm and $i3,0x3fc 511ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 512ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 513ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 514ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 515ec07fdf1Sdjm lwl $t8,1($i0) # Td3[s1] 516ec07fdf1Sdjm lwl $t9,1($i1) # Td3[s2] 517ec07fdf1Sdjm lwl $t10,1($i2) # Td3[s3] 518ec07fdf1Sdjm lwl $t11,1($i3) # Td3[s0] 519ec07fdf1Sdjm lwr $t8,0($i0) # Td3[s1] 520ec07fdf1Sdjm lwr $t9,0($i1) # Td3[s2] 521ec07fdf1Sdjm lwr $t10,0($i2) # Td3[s3] 522ec07fdf1Sdjm lwr $t11,0($i3) # Td3[s0] 523ec07fdf1Sdjm 524ec07fdf1Sdjm _xtr $i0,$s0,24-2 525ec07fdf1Sdjm _xtr $i1,$s1,24-2 526ec07fdf1Sdjm _xtr $i2,$s2,24-2 527ec07fdf1Sdjm _xtr $i3,$s3,24-2 528ec07fdf1Sdjm and $i0,0x3fc 529ec07fdf1Sdjm and $i1,0x3fc 530ec07fdf1Sdjm and $i2,0x3fc 531ec07fdf1Sdjm and $i3,0x3fc 532ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 533ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 534ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 535ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 536ec07fdf1Sdjm 537ec07fdf1Sdjm xor $t0,$t4 538ec07fdf1Sdjm xor $t1,$t5 539ec07fdf1Sdjm xor $t2,$t6 540ec07fdf1Sdjm xor $t3,$t7 541ec07fdf1Sdjm 542ec07fdf1Sdjm 543ec07fdf1Sdjm lw $t4,0($i0) # Td0[s0>>24] 544ec07fdf1Sdjm lw $t5,0($i1) # Td0[s1>>24] 545ec07fdf1Sdjm lw $t6,0($i2) # Td0[s2>>24] 546ec07fdf1Sdjm lw $t7,0($i3) # Td0[s3>>24] 547ec07fdf1Sdjm 548ec07fdf1Sdjm lw $s0,0($key0) 549ec07fdf1Sdjm lw $s1,4($key0) 550ec07fdf1Sdjm lw $s2,8($key0) 551ec07fdf1Sdjm lw $s3,12($key0) 552ec07fdf1Sdjm 553ec07fdf1Sdjm xor $t0,$t8 554ec07fdf1Sdjm xor $t1,$t9 555ec07fdf1Sdjm xor $t2,$t10 556ec07fdf1Sdjm xor $t3,$t11 557ec07fdf1Sdjm 558ec07fdf1Sdjm xor $t0,$t4 559ec07fdf1Sdjm xor $t1,$t5 560ec07fdf1Sdjm xor $t2,$t6 561ec07fdf1Sdjm xor $t3,$t7 562ec07fdf1Sdjm 563ec07fdf1Sdjm sub $cnt,1 564ec07fdf1Sdjm $PTR_ADD $key0,16 565ec07fdf1Sdjm xor $s0,$t0 566ec07fdf1Sdjm xor $s1,$t1 567ec07fdf1Sdjm xor $s2,$t2 568ec07fdf1Sdjm xor $s3,$t3 569ec07fdf1Sdjm .set noreorder 570ec07fdf1Sdjm bnez $cnt,.Loop_dec 571ec07fdf1Sdjm _xtr $i0,$s3,16-2 572ec07fdf1Sdjm 573ec07fdf1Sdjm .set reorder 574ec07fdf1Sdjm lw $t4,1024($Tbl) # prefetch Td4 575ec07fdf1Sdjm lw $t5,1024+32($Tbl) 576ec07fdf1Sdjm lw $t6,1024+64($Tbl) 577ec07fdf1Sdjm lw $t7,1024+96($Tbl) 578ec07fdf1Sdjm lw $t8,1024+128($Tbl) 579ec07fdf1Sdjm lw $t9,1024+160($Tbl) 580ec07fdf1Sdjm lw $t10,1024+192($Tbl) 581ec07fdf1Sdjm lw $t11,1024+224($Tbl) 582ec07fdf1Sdjm 583ec07fdf1Sdjm _xtr $i0,$s3,16 584ec07fdf1Sdjm _xtr $i1,$s0,16 585ec07fdf1Sdjm _xtr $i2,$s1,16 586ec07fdf1Sdjm _xtr $i3,$s2,16 587ec07fdf1Sdjm and $i0,0xff 588ec07fdf1Sdjm and $i1,0xff 589ec07fdf1Sdjm and $i2,0xff 590ec07fdf1Sdjm and $i3,0xff 591ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 592ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 593ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 594ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 595ec07fdf1Sdjm lbu $t0,1024($i0) # Td4[s3>>16] 596ec07fdf1Sdjm lbu $t1,1024($i1) # Td4[s0>>16] 597ec07fdf1Sdjm lbu $t2,1024($i2) # Td4[s1>>16] 598ec07fdf1Sdjm lbu $t3,1024($i3) # Td4[s2>>16] 599ec07fdf1Sdjm 600ec07fdf1Sdjm _xtr $i0,$s2,8 601ec07fdf1Sdjm _xtr $i1,$s3,8 602ec07fdf1Sdjm _xtr $i2,$s0,8 603ec07fdf1Sdjm _xtr $i3,$s1,8 604ec07fdf1Sdjm and $i0,0xff 605ec07fdf1Sdjm and $i1,0xff 606ec07fdf1Sdjm and $i2,0xff 607ec07fdf1Sdjm and $i3,0xff 608ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 609ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 610ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 611ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 612ec07fdf1Sdjm lbu $t4,1024($i0) # Td4[s2>>8] 613ec07fdf1Sdjm lbu $t5,1024($i1) # Td4[s3>>8] 614ec07fdf1Sdjm lbu $t6,1024($i2) # Td4[s0>>8] 615ec07fdf1Sdjm lbu $t7,1024($i3) # Td4[s1>>8] 616ec07fdf1Sdjm 617ec07fdf1Sdjm _xtr $i0,$s0,24 618ec07fdf1Sdjm _xtr $i1,$s1,24 619ec07fdf1Sdjm _xtr $i2,$s2,24 620ec07fdf1Sdjm _xtr $i3,$s3,24 621ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 622ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 623ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 624ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 625ec07fdf1Sdjm lbu $t8,1024($i0) # Td4[s0>>24] 626ec07fdf1Sdjm lbu $t9,1024($i1) # Td4[s1>>24] 627ec07fdf1Sdjm lbu $t10,1024($i2) # Td4[s2>>24] 628ec07fdf1Sdjm lbu $t11,1024($i3) # Td4[s3>>24] 629ec07fdf1Sdjm 630ec07fdf1Sdjm _xtr $i0,$s1,0 631ec07fdf1Sdjm _xtr $i1,$s2,0 632ec07fdf1Sdjm _xtr $i2,$s3,0 633ec07fdf1Sdjm _xtr $i3,$s0,0 634ec07fdf1Sdjm 635ec07fdf1Sdjm _ins $t0,16 636ec07fdf1Sdjm _ins $t1,16 637ec07fdf1Sdjm _ins $t2,16 638ec07fdf1Sdjm _ins $t3,16 639ec07fdf1Sdjm 640ec07fdf1Sdjm _ins $t4,8 641ec07fdf1Sdjm _ins $t5,8 642ec07fdf1Sdjm _ins $t6,8 643ec07fdf1Sdjm _ins $t7,8 644ec07fdf1Sdjm 645ec07fdf1Sdjm xor $t0,$t4 646ec07fdf1Sdjm xor $t1,$t5 647ec07fdf1Sdjm xor $t2,$t6 648ec07fdf1Sdjm xor $t3,$t7 649ec07fdf1Sdjm 650ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 651ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 652ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 653ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 654ec07fdf1Sdjm lbu $t4,1024($i0) # Td4[s1] 655ec07fdf1Sdjm lbu $t5,1024($i1) # Td4[s2] 656ec07fdf1Sdjm lbu $t6,1024($i2) # Td4[s3] 657ec07fdf1Sdjm lbu $t7,1024($i3) # Td4[s0] 658ec07fdf1Sdjm 659ec07fdf1Sdjm _ins $t8,24 660ec07fdf1Sdjm _ins $t9,24 661ec07fdf1Sdjm _ins $t10,24 662ec07fdf1Sdjm _ins $t11,24 663ec07fdf1Sdjm 664ec07fdf1Sdjm lw $s0,0($key0) 665ec07fdf1Sdjm lw $s1,4($key0) 666ec07fdf1Sdjm lw $s2,8($key0) 667ec07fdf1Sdjm lw $s3,12($key0) 668ec07fdf1Sdjm 669ec07fdf1Sdjm _ins $t4,0 670ec07fdf1Sdjm _ins $t5,0 671ec07fdf1Sdjm _ins $t6,0 672ec07fdf1Sdjm _ins $t7,0 673ec07fdf1Sdjm 674ec07fdf1Sdjm 675ec07fdf1Sdjm xor $t0,$t8 676ec07fdf1Sdjm xor $t1,$t9 677ec07fdf1Sdjm xor $t2,$t10 678ec07fdf1Sdjm xor $t3,$t11 679ec07fdf1Sdjm 680ec07fdf1Sdjm xor $t0,$t4 681ec07fdf1Sdjm xor $t1,$t5 682ec07fdf1Sdjm xor $t2,$t6 683ec07fdf1Sdjm xor $t3,$t7 684ec07fdf1Sdjm 685ec07fdf1Sdjm xor $s0,$t0 686ec07fdf1Sdjm xor $s1,$t1 687ec07fdf1Sdjm xor $s2,$t2 688ec07fdf1Sdjm xor $s3,$t3 689ec07fdf1Sdjm 690ec07fdf1Sdjm jr $ra 691ec07fdf1Sdjm.end _mips_AES_decrypt 692ec07fdf1Sdjm 693ec07fdf1Sdjm.align 5 694*4a615b87Sjsing.globl aes_decrypt_internal 695*4a615b87Sjsing.ent aes_decrypt_internal 696*4a615b87Sjsingaes_decrypt_internal: 697ec07fdf1Sdjm .frame $sp,$FRAMESIZE,$ra 698ec07fdf1Sdjm .mask $SAVED_REGS_MASK,-$SZREG 699ec07fdf1Sdjm .set noreorder 700ec07fdf1Sdjm___ 701ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /o32/i); # o32 PIC-ification 702ec07fdf1Sdjm .cpload $pf 703ec07fdf1Sdjm___ 704ec07fdf1Sdjm$code.=<<___; 705ec07fdf1Sdjm $PTR_SUB $sp,$FRAMESIZE 706ec07fdf1Sdjm $REG_S $ra,$FRAMESIZE-1*$SZREG($sp) 707ec07fdf1Sdjm $REG_S $fp,$FRAMESIZE-2*$SZREG($sp) 708ec07fdf1Sdjm $REG_S $s11,$FRAMESIZE-3*$SZREG($sp) 709ec07fdf1Sdjm $REG_S $s10,$FRAMESIZE-4*$SZREG($sp) 710ec07fdf1Sdjm $REG_S $s9,$FRAMESIZE-5*$SZREG($sp) 711ec07fdf1Sdjm $REG_S $s8,$FRAMESIZE-6*$SZREG($sp) 712ec07fdf1Sdjm $REG_S $s7,$FRAMESIZE-7*$SZREG($sp) 713ec07fdf1Sdjm $REG_S $s6,$FRAMESIZE-8*$SZREG($sp) 714ec07fdf1Sdjm $REG_S $s5,$FRAMESIZE-9*$SZREG($sp) 715ec07fdf1Sdjm $REG_S $s4,$FRAMESIZE-10*$SZREG($sp) 716ec07fdf1Sdjm___ 717ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /nubi/i); # optimize non-nubi prologue 718ec07fdf1Sdjm $REG_S \$15,$FRAMESIZE-11*$SZREG($sp) 719ec07fdf1Sdjm $REG_S \$14,$FRAMESIZE-12*$SZREG($sp) 720ec07fdf1Sdjm $REG_S \$13,$FRAMESIZE-13*$SZREG($sp) 721ec07fdf1Sdjm $REG_S \$12,$FRAMESIZE-14*$SZREG($sp) 722ec07fdf1Sdjm $REG_S $gp,$FRAMESIZE-15*$SZREG($sp) 723ec07fdf1Sdjm___ 724ec07fdf1Sdjm$code.=<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification 725ec07fdf1Sdjm .cplocal $Tbl 726*4a615b87Sjsing .cpsetup $pf,$zero,aes_decrypt_internal 727ec07fdf1Sdjm___ 728ec07fdf1Sdjm$code.=<<___; 729ec07fdf1Sdjm .set reorder 73057438458Smiod $LA $Tbl,AES_Td # PIC-ified 'load address' 731ec07fdf1Sdjm 732ec07fdf1Sdjm lwl $s0,0+$MSB($inp) 733ec07fdf1Sdjm lwl $s1,4+$MSB($inp) 734ec07fdf1Sdjm lwl $s2,8+$MSB($inp) 735ec07fdf1Sdjm lwl $s3,12+$MSB($inp) 736ec07fdf1Sdjm lwr $s0,0+$LSB($inp) 737ec07fdf1Sdjm lwr $s1,4+$LSB($inp) 738ec07fdf1Sdjm lwr $s2,8+$LSB($inp) 739ec07fdf1Sdjm lwr $s3,12+$LSB($inp) 740ec07fdf1Sdjm 741ec07fdf1Sdjm bal _mips_AES_decrypt 742ec07fdf1Sdjm 743ec07fdf1Sdjm swr $s0,0+$LSB($out) 744ec07fdf1Sdjm swr $s1,4+$LSB($out) 745ec07fdf1Sdjm swr $s2,8+$LSB($out) 746ec07fdf1Sdjm swr $s3,12+$LSB($out) 747ec07fdf1Sdjm swl $s0,0+$MSB($out) 748ec07fdf1Sdjm swl $s1,4+$MSB($out) 749ec07fdf1Sdjm swl $s2,8+$MSB($out) 750ec07fdf1Sdjm swl $s3,12+$MSB($out) 751ec07fdf1Sdjm 752ec07fdf1Sdjm .set noreorder 753ec07fdf1Sdjm $REG_L $ra,$FRAMESIZE-1*$SZREG($sp) 754ec07fdf1Sdjm $REG_L $fp,$FRAMESIZE-2*$SZREG($sp) 755ec07fdf1Sdjm $REG_L $s11,$FRAMESIZE-3*$SZREG($sp) 756ec07fdf1Sdjm $REG_L $s10,$FRAMESIZE-4*$SZREG($sp) 757ec07fdf1Sdjm $REG_L $s9,$FRAMESIZE-5*$SZREG($sp) 758ec07fdf1Sdjm $REG_L $s8,$FRAMESIZE-6*$SZREG($sp) 759ec07fdf1Sdjm $REG_L $s7,$FRAMESIZE-7*$SZREG($sp) 760ec07fdf1Sdjm $REG_L $s6,$FRAMESIZE-8*$SZREG($sp) 761ec07fdf1Sdjm $REG_L $s5,$FRAMESIZE-9*$SZREG($sp) 762ec07fdf1Sdjm $REG_L $s4,$FRAMESIZE-10*$SZREG($sp) 763ec07fdf1Sdjm___ 764ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /nubi/i); 765ec07fdf1Sdjm $REG_L \$15,$FRAMESIZE-11*$SZREG($sp) 766ec07fdf1Sdjm $REG_L \$14,$FRAMESIZE-12*$SZREG($sp) 767ec07fdf1Sdjm $REG_L \$13,$FRAMESIZE-13*$SZREG($sp) 768ec07fdf1Sdjm $REG_L \$12,$FRAMESIZE-14*$SZREG($sp) 769ec07fdf1Sdjm $REG_L $gp,$FRAMESIZE-15*$SZREG($sp) 770ec07fdf1Sdjm___ 771ec07fdf1Sdjm$code.=<<___; 772ec07fdf1Sdjm jr $ra 773ec07fdf1Sdjm $PTR_ADD $sp,$FRAMESIZE 774*4a615b87Sjsing.end aes_decrypt_internal 775ec07fdf1Sdjm___ 776ec07fdf1Sdjm}}} 777ec07fdf1Sdjm 778ec07fdf1Sdjm{{{ 779ec07fdf1Sdjmmy $FRAMESIZE=8*$SZREG; 780ec07fdf1Sdjmmy $SAVED_REGS_MASK = ($flavour =~ /nubi/i) ? 0xc000f008 : 0xc0000000; 781ec07fdf1Sdjm 782ec07fdf1Sdjmmy ($inp,$bits,$key,$Tbl)=($a0,$a1,$a2,$a3); 783ec07fdf1Sdjmmy ($rk0,$rk1,$rk2,$rk3,$rk4,$rk5,$rk6,$rk7)=($a4,$a5,$a6,$a7,$s0,$s1,$s2,$s3); 784ec07fdf1Sdjmmy ($i0,$i1,$i2,$i3)=($at,$t0,$t1,$t2); 785ec07fdf1Sdjmmy ($rcon,$cnt)=($gp,$fp); 786ec07fdf1Sdjm 787ec07fdf1Sdjm$code.=<<___; 788ec07fdf1Sdjm.align 5 789ec07fdf1Sdjm.ent _mips_AES_set_encrypt_key 790ec07fdf1Sdjm_mips_AES_set_encrypt_key: 791ec07fdf1Sdjm .frame $sp,0,$ra 792ec07fdf1Sdjm .set noreorder 793ec07fdf1Sdjm beqz $inp,.Lekey_done 794ec07fdf1Sdjm li $t0,-1 795ec07fdf1Sdjm beqz $key,.Lekey_done 796ec07fdf1Sdjm $PTR_ADD $rcon,$Tbl,1024+256 797ec07fdf1Sdjm 798ec07fdf1Sdjm .set reorder 799ec07fdf1Sdjm lwl $rk0,0+$MSB($inp) # load 128 bits 800ec07fdf1Sdjm lwl $rk1,4+$MSB($inp) 801ec07fdf1Sdjm lwl $rk2,8+$MSB($inp) 802ec07fdf1Sdjm lwl $rk3,12+$MSB($inp) 803ec07fdf1Sdjm li $at,128 804ec07fdf1Sdjm lwr $rk0,0+$LSB($inp) 805ec07fdf1Sdjm lwr $rk1,4+$LSB($inp) 806ec07fdf1Sdjm lwr $rk2,8+$LSB($inp) 807ec07fdf1Sdjm lwr $rk3,12+$LSB($inp) 808ec07fdf1Sdjm .set noreorder 809ec07fdf1Sdjm beq $bits,$at,.L128bits 810ec07fdf1Sdjm li $cnt,10 811ec07fdf1Sdjm 812ec07fdf1Sdjm .set reorder 813ec07fdf1Sdjm lwl $rk4,16+$MSB($inp) # load 192 bits 814ec07fdf1Sdjm lwl $rk5,20+$MSB($inp) 815ec07fdf1Sdjm li $at,192 816ec07fdf1Sdjm lwr $rk4,16+$LSB($inp) 817ec07fdf1Sdjm lwr $rk5,20+$LSB($inp) 818ec07fdf1Sdjm .set noreorder 819ec07fdf1Sdjm beq $bits,$at,.L192bits 820ec07fdf1Sdjm li $cnt,8 821ec07fdf1Sdjm 822ec07fdf1Sdjm .set reorder 823ec07fdf1Sdjm lwl $rk6,24+$MSB($inp) # load 256 bits 824ec07fdf1Sdjm lwl $rk7,28+$MSB($inp) 825ec07fdf1Sdjm li $at,256 826ec07fdf1Sdjm lwr $rk6,24+$LSB($inp) 827ec07fdf1Sdjm lwr $rk7,28+$LSB($inp) 828ec07fdf1Sdjm .set noreorder 829ec07fdf1Sdjm beq $bits,$at,.L256bits 830ec07fdf1Sdjm li $cnt,7 831ec07fdf1Sdjm 832ec07fdf1Sdjm b .Lekey_done 833ec07fdf1Sdjm li $t0,-2 834ec07fdf1Sdjm 835ec07fdf1Sdjm.align 4 836ec07fdf1Sdjm.L128bits: 837ec07fdf1Sdjm .set reorder 838ec07fdf1Sdjm srl $i0,$rk3,16 839ec07fdf1Sdjm srl $i1,$rk3,8 840ec07fdf1Sdjm and $i0,0xff 841ec07fdf1Sdjm and $i1,0xff 842ec07fdf1Sdjm and $i2,$rk3,0xff 843ec07fdf1Sdjm srl $i3,$rk3,24 844ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 845ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 846ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 847ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 848ec07fdf1Sdjm lbu $i0,1024($i0) 849ec07fdf1Sdjm lbu $i1,1024($i1) 850ec07fdf1Sdjm lbu $i2,1024($i2) 851ec07fdf1Sdjm lbu $i3,1024($i3) 852ec07fdf1Sdjm 853ec07fdf1Sdjm sw $rk0,0($key) 854ec07fdf1Sdjm sw $rk1,4($key) 855ec07fdf1Sdjm sw $rk2,8($key) 856ec07fdf1Sdjm sw $rk3,12($key) 857ec07fdf1Sdjm sub $cnt,1 858ec07fdf1Sdjm $PTR_ADD $key,16 859ec07fdf1Sdjm 860ec07fdf1Sdjm _bias $i0,24 861ec07fdf1Sdjm _bias $i1,16 862ec07fdf1Sdjm _bias $i2,8 863ec07fdf1Sdjm _bias $i3,0 864ec07fdf1Sdjm 865ec07fdf1Sdjm xor $rk0,$i0 866ec07fdf1Sdjm lw $i0,0($rcon) 867ec07fdf1Sdjm xor $rk0,$i1 868ec07fdf1Sdjm xor $rk0,$i2 869ec07fdf1Sdjm xor $rk0,$i3 870ec07fdf1Sdjm xor $rk0,$i0 871ec07fdf1Sdjm 872ec07fdf1Sdjm xor $rk1,$rk0 873ec07fdf1Sdjm xor $rk2,$rk1 874ec07fdf1Sdjm xor $rk3,$rk2 875ec07fdf1Sdjm 876ec07fdf1Sdjm .set noreorder 877ec07fdf1Sdjm bnez $cnt,.L128bits 878ec07fdf1Sdjm $PTR_ADD $rcon,4 879ec07fdf1Sdjm 880ec07fdf1Sdjm sw $rk0,0($key) 881ec07fdf1Sdjm sw $rk1,4($key) 882ec07fdf1Sdjm sw $rk2,8($key) 883ec07fdf1Sdjm li $cnt,10 884ec07fdf1Sdjm sw $rk3,12($key) 885ec07fdf1Sdjm li $t0,0 886ec07fdf1Sdjm sw $cnt,80($key) 887ec07fdf1Sdjm b .Lekey_done 888ec07fdf1Sdjm $PTR_SUB $key,10*16 889ec07fdf1Sdjm 890ec07fdf1Sdjm.align 4 891ec07fdf1Sdjm.L192bits: 892ec07fdf1Sdjm .set reorder 893ec07fdf1Sdjm srl $i0,$rk5,16 894ec07fdf1Sdjm srl $i1,$rk5,8 895ec07fdf1Sdjm and $i0,0xff 896ec07fdf1Sdjm and $i1,0xff 897ec07fdf1Sdjm and $i2,$rk5,0xff 898ec07fdf1Sdjm srl $i3,$rk5,24 899ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 900ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 901ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 902ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 903ec07fdf1Sdjm lbu $i0,1024($i0) 904ec07fdf1Sdjm lbu $i1,1024($i1) 905ec07fdf1Sdjm lbu $i2,1024($i2) 906ec07fdf1Sdjm lbu $i3,1024($i3) 907ec07fdf1Sdjm 908ec07fdf1Sdjm sw $rk0,0($key) 909ec07fdf1Sdjm sw $rk1,4($key) 910ec07fdf1Sdjm sw $rk2,8($key) 911ec07fdf1Sdjm sw $rk3,12($key) 912ec07fdf1Sdjm sw $rk4,16($key) 913ec07fdf1Sdjm sw $rk5,20($key) 914ec07fdf1Sdjm sub $cnt,1 915ec07fdf1Sdjm $PTR_ADD $key,24 916ec07fdf1Sdjm 917ec07fdf1Sdjm _bias $i0,24 918ec07fdf1Sdjm _bias $i1,16 919ec07fdf1Sdjm _bias $i2,8 920ec07fdf1Sdjm _bias $i3,0 921ec07fdf1Sdjm 922ec07fdf1Sdjm xor $rk0,$i0 923ec07fdf1Sdjm lw $i0,0($rcon) 924ec07fdf1Sdjm xor $rk0,$i1 925ec07fdf1Sdjm xor $rk0,$i2 926ec07fdf1Sdjm xor $rk0,$i3 927ec07fdf1Sdjm xor $rk0,$i0 928ec07fdf1Sdjm 929ec07fdf1Sdjm xor $rk1,$rk0 930ec07fdf1Sdjm xor $rk2,$rk1 931ec07fdf1Sdjm xor $rk3,$rk2 932ec07fdf1Sdjm xor $rk4,$rk3 933ec07fdf1Sdjm xor $rk5,$rk4 934ec07fdf1Sdjm 935ec07fdf1Sdjm .set noreorder 936ec07fdf1Sdjm bnez $cnt,.L192bits 937ec07fdf1Sdjm $PTR_ADD $rcon,4 938ec07fdf1Sdjm 939ec07fdf1Sdjm sw $rk0,0($key) 940ec07fdf1Sdjm sw $rk1,4($key) 941ec07fdf1Sdjm sw $rk2,8($key) 942ec07fdf1Sdjm li $cnt,12 943ec07fdf1Sdjm sw $rk3,12($key) 944ec07fdf1Sdjm li $t0,0 945ec07fdf1Sdjm sw $cnt,48($key) 946ec07fdf1Sdjm b .Lekey_done 947ec07fdf1Sdjm $PTR_SUB $key,12*16 948ec07fdf1Sdjm 949ec07fdf1Sdjm.align 4 950ec07fdf1Sdjm.L256bits: 951ec07fdf1Sdjm .set reorder 952ec07fdf1Sdjm srl $i0,$rk7,16 953ec07fdf1Sdjm srl $i1,$rk7,8 954ec07fdf1Sdjm and $i0,0xff 955ec07fdf1Sdjm and $i1,0xff 956ec07fdf1Sdjm and $i2,$rk7,0xff 957ec07fdf1Sdjm srl $i3,$rk7,24 958ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 959ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 960ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 961ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 962ec07fdf1Sdjm lbu $i0,1024($i0) 963ec07fdf1Sdjm lbu $i1,1024($i1) 964ec07fdf1Sdjm lbu $i2,1024($i2) 965ec07fdf1Sdjm lbu $i3,1024($i3) 966ec07fdf1Sdjm 967ec07fdf1Sdjm sw $rk0,0($key) 968ec07fdf1Sdjm sw $rk1,4($key) 969ec07fdf1Sdjm sw $rk2,8($key) 970ec07fdf1Sdjm sw $rk3,12($key) 971ec07fdf1Sdjm sw $rk4,16($key) 972ec07fdf1Sdjm sw $rk5,20($key) 973ec07fdf1Sdjm sw $rk6,24($key) 974ec07fdf1Sdjm sw $rk7,28($key) 975ec07fdf1Sdjm sub $cnt,1 976ec07fdf1Sdjm 977ec07fdf1Sdjm _bias $i0,24 978ec07fdf1Sdjm _bias $i1,16 979ec07fdf1Sdjm _bias $i2,8 980ec07fdf1Sdjm _bias $i3,0 981ec07fdf1Sdjm 982ec07fdf1Sdjm xor $rk0,$i0 983ec07fdf1Sdjm lw $i0,0($rcon) 984ec07fdf1Sdjm xor $rk0,$i1 985ec07fdf1Sdjm xor $rk0,$i2 986ec07fdf1Sdjm xor $rk0,$i3 987ec07fdf1Sdjm xor $rk0,$i0 988ec07fdf1Sdjm 989ec07fdf1Sdjm xor $rk1,$rk0 990ec07fdf1Sdjm xor $rk2,$rk1 991ec07fdf1Sdjm xor $rk3,$rk2 992ec07fdf1Sdjm beqz $cnt,.L256bits_done 993ec07fdf1Sdjm 994ec07fdf1Sdjm srl $i0,$rk3,24 995ec07fdf1Sdjm srl $i1,$rk3,16 996ec07fdf1Sdjm srl $i2,$rk3,8 997ec07fdf1Sdjm and $i3,$rk3,0xff 998ec07fdf1Sdjm and $i1,0xff 999ec07fdf1Sdjm and $i2,0xff 1000ec07fdf1Sdjm $PTR_ADD $i0,$Tbl 1001ec07fdf1Sdjm $PTR_ADD $i1,$Tbl 1002ec07fdf1Sdjm $PTR_ADD $i2,$Tbl 1003ec07fdf1Sdjm $PTR_ADD $i3,$Tbl 1004ec07fdf1Sdjm lbu $i0,1024($i0) 1005ec07fdf1Sdjm lbu $i1,1024($i1) 1006ec07fdf1Sdjm lbu $i2,1024($i2) 1007ec07fdf1Sdjm lbu $i3,1024($i3) 1008ec07fdf1Sdjm sll $i0,24 1009ec07fdf1Sdjm sll $i1,16 1010ec07fdf1Sdjm sll $i2,8 1011ec07fdf1Sdjm 1012ec07fdf1Sdjm xor $rk4,$i0 1013ec07fdf1Sdjm xor $rk4,$i1 1014ec07fdf1Sdjm xor $rk4,$i2 1015ec07fdf1Sdjm xor $rk4,$i3 1016ec07fdf1Sdjm 1017ec07fdf1Sdjm xor $rk5,$rk4 1018ec07fdf1Sdjm xor $rk6,$rk5 1019ec07fdf1Sdjm xor $rk7,$rk6 1020ec07fdf1Sdjm 1021ec07fdf1Sdjm $PTR_ADD $key,32 1022ec07fdf1Sdjm .set noreorder 1023ec07fdf1Sdjm b .L256bits 1024ec07fdf1Sdjm $PTR_ADD $rcon,4 1025ec07fdf1Sdjm 1026ec07fdf1Sdjm.L256bits_done: 1027ec07fdf1Sdjm sw $rk0,32($key) 1028ec07fdf1Sdjm sw $rk1,36($key) 1029ec07fdf1Sdjm sw $rk2,40($key) 1030ec07fdf1Sdjm li $cnt,14 1031ec07fdf1Sdjm sw $rk3,44($key) 1032ec07fdf1Sdjm li $t0,0 1033ec07fdf1Sdjm sw $cnt,48($key) 1034ec07fdf1Sdjm $PTR_SUB $key,12*16 1035ec07fdf1Sdjm 1036ec07fdf1Sdjm.Lekey_done: 1037ec07fdf1Sdjm jr $ra 1038ec07fdf1Sdjm nop 1039ec07fdf1Sdjm.end _mips_AES_set_encrypt_key 1040ec07fdf1Sdjm 10414efebcfaSjsing.globl aes_set_encrypt_key_internal 10424efebcfaSjsing.ent aes_set_encrypt_key_internal 10434efebcfaSjsingaes_set_encrypt_key_internal: 1044ec07fdf1Sdjm .frame $sp,$FRAMESIZE,$ra 1045ec07fdf1Sdjm .mask $SAVED_REGS_MASK,-$SZREG 1046ec07fdf1Sdjm .set noreorder 1047ec07fdf1Sdjm___ 1048ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /o32/i); # o32 PIC-ification 1049ec07fdf1Sdjm .cpload $pf 1050ec07fdf1Sdjm___ 1051ec07fdf1Sdjm$code.=<<___; 1052ec07fdf1Sdjm $PTR_SUB $sp,$FRAMESIZE 1053ec07fdf1Sdjm $REG_S $ra,$FRAMESIZE-1*$SZREG($sp) 1054ec07fdf1Sdjm $REG_S $fp,$FRAMESIZE-2*$SZREG($sp) 1055ec07fdf1Sdjm___ 1056ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /nubi/i); # optimize non-nubi prologue 1057ec07fdf1Sdjm $REG_S $s3,$FRAMESIZE-3*$SZREG($sp) 1058ec07fdf1Sdjm $REG_S $s2,$FRAMESIZE-4*$SZREG($sp) 1059ec07fdf1Sdjm $REG_S $s1,$FRAMESIZE-5*$SZREG($sp) 1060ec07fdf1Sdjm $REG_S $s0,$FRAMESIZE-6*$SZREG($sp) 1061ec07fdf1Sdjm $REG_S $gp,$FRAMESIZE-7*$SZREG($sp) 1062ec07fdf1Sdjm___ 1063ec07fdf1Sdjm$code.=<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification 1064ec07fdf1Sdjm .cplocal $Tbl 10654efebcfaSjsing .cpsetup $pf,$zero,aes_set_encrypt_key_internal 1066ec07fdf1Sdjm___ 1067ec07fdf1Sdjm$code.=<<___; 1068ec07fdf1Sdjm .set reorder 106957438458Smiod $LA $Tbl,AES_Te # PIC-ified 'load address' 1070ec07fdf1Sdjm 1071ec07fdf1Sdjm bal _mips_AES_set_encrypt_key 1072ec07fdf1Sdjm 1073ec07fdf1Sdjm .set noreorder 1074ec07fdf1Sdjm move $a0,$t0 1075ec07fdf1Sdjm $REG_L $ra,$FRAMESIZE-1*$SZREG($sp) 1076ec07fdf1Sdjm $REG_L $fp,$FRAMESIZE-2*$SZREG($sp) 1077ec07fdf1Sdjm___ 1078ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /nubi/i); 1079ec07fdf1Sdjm $REG_L $s3,$FRAMESIZE-11*$SZREG($sp) 1080ec07fdf1Sdjm $REG_L $s2,$FRAMESIZE-12*$SZREG($sp) 1081ec07fdf1Sdjm $REG_L $s1,$FRAMESIZE-13*$SZREG($sp) 1082ec07fdf1Sdjm $REG_L $s0,$FRAMESIZE-14*$SZREG($sp) 1083ec07fdf1Sdjm $REG_L $gp,$FRAMESIZE-15*$SZREG($sp) 1084ec07fdf1Sdjm___ 1085ec07fdf1Sdjm$code.=<<___; 1086ec07fdf1Sdjm jr $ra 1087ec07fdf1Sdjm $PTR_ADD $sp,$FRAMESIZE 10884efebcfaSjsing.end aes_set_encrypt_key_internal 1089ec07fdf1Sdjm___ 1090ec07fdf1Sdjm 1091ec07fdf1Sdjmmy ($head,$tail)=($inp,$bits); 1092ec07fdf1Sdjmmy ($tp1,$tp2,$tp4,$tp8,$tp9,$tpb,$tpd,$tpe)=($a4,$a5,$a6,$a7,$s0,$s1,$s2,$s3); 1093ec07fdf1Sdjmmy ($m,$x80808080,$x7f7f7f7f,$x1b1b1b1b)=($at,$t0,$t1,$t2); 1094ec07fdf1Sdjm$code.=<<___; 1095ec07fdf1Sdjm.align 5 10964efebcfaSjsing.globl aes_set_decrypt_key_internal 10974efebcfaSjsing.ent aes_set_decrypt_key_internal 10984efebcfaSjsingaes_set_decrypt_key_internal: 1099ec07fdf1Sdjm .frame $sp,$FRAMESIZE,$ra 1100ec07fdf1Sdjm .mask $SAVED_REGS_MASK,-$SZREG 1101ec07fdf1Sdjm .set noreorder 1102ec07fdf1Sdjm___ 1103ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /o32/i); # o32 PIC-ification 1104ec07fdf1Sdjm .cpload $pf 1105ec07fdf1Sdjm___ 1106ec07fdf1Sdjm$code.=<<___; 1107ec07fdf1Sdjm $PTR_SUB $sp,$FRAMESIZE 1108ec07fdf1Sdjm $REG_S $ra,$FRAMESIZE-1*$SZREG($sp) 1109ec07fdf1Sdjm $REG_S $fp,$FRAMESIZE-2*$SZREG($sp) 1110ec07fdf1Sdjm___ 1111ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /nubi/i); # optimize non-nubi prologue 1112ec07fdf1Sdjm $REG_S $s3,$FRAMESIZE-3*$SZREG($sp) 1113ec07fdf1Sdjm $REG_S $s2,$FRAMESIZE-4*$SZREG($sp) 1114ec07fdf1Sdjm $REG_S $s1,$FRAMESIZE-5*$SZREG($sp) 1115ec07fdf1Sdjm $REG_S $s0,$FRAMESIZE-6*$SZREG($sp) 1116ec07fdf1Sdjm $REG_S $gp,$FRAMESIZE-7*$SZREG($sp) 1117ec07fdf1Sdjm___ 1118ec07fdf1Sdjm$code.=<<___ if ($flavour !~ /o32/i); # non-o32 PIC-ification 1119ec07fdf1Sdjm .cplocal $Tbl 11204efebcfaSjsing .cpsetup $pf,$zero,aes_set_decrypt_key_internal 1121ec07fdf1Sdjm___ 1122ec07fdf1Sdjm$code.=<<___; 1123ec07fdf1Sdjm .set reorder 112457438458Smiod $LA $Tbl,AES_Te # PIC-ified 'load address' 1125ec07fdf1Sdjm 1126ec07fdf1Sdjm bal _mips_AES_set_encrypt_key 1127ec07fdf1Sdjm 1128ec07fdf1Sdjm bltz $t0,.Ldkey_done 1129ec07fdf1Sdjm 1130ec07fdf1Sdjm sll $at,$cnt,4 1131ec07fdf1Sdjm $PTR_ADD $head,$key,0 1132ec07fdf1Sdjm $PTR_ADD $tail,$key,$at 1133ec07fdf1Sdjm.align 4 1134ec07fdf1Sdjm.Lswap: 1135ec07fdf1Sdjm lw $rk0,0($head) 1136ec07fdf1Sdjm lw $rk1,4($head) 1137ec07fdf1Sdjm lw $rk2,8($head) 1138ec07fdf1Sdjm lw $rk3,12($head) 1139ec07fdf1Sdjm lw $rk4,0($tail) 1140ec07fdf1Sdjm lw $rk5,4($tail) 1141ec07fdf1Sdjm lw $rk6,8($tail) 1142ec07fdf1Sdjm lw $rk7,12($tail) 1143ec07fdf1Sdjm sw $rk0,0($tail) 1144ec07fdf1Sdjm sw $rk1,4($tail) 1145ec07fdf1Sdjm sw $rk2,8($tail) 1146ec07fdf1Sdjm sw $rk3,12($tail) 1147ec07fdf1Sdjm $PTR_ADD $head,16 1148ec07fdf1Sdjm $PTR_SUB $tail,16 1149ec07fdf1Sdjm sw $rk4,-16($head) 1150ec07fdf1Sdjm sw $rk5,-12($head) 1151ec07fdf1Sdjm sw $rk6,-8($head) 1152ec07fdf1Sdjm sw $rk7,-4($head) 1153ec07fdf1Sdjm bne $head,$tail,.Lswap 1154ec07fdf1Sdjm 1155ec07fdf1Sdjm lw $tp1,16($key) # modulo-scheduled 1156ec07fdf1Sdjm lui $x80808080,0x8080 1157ec07fdf1Sdjm sub $cnt,1 1158ec07fdf1Sdjm or $x80808080,0x8080 1159ec07fdf1Sdjm sll $cnt,2 1160ec07fdf1Sdjm $PTR_ADD $key,16 1161ec07fdf1Sdjm lui $x1b1b1b1b,0x1b1b 1162ec07fdf1Sdjm nor $x7f7f7f7f,$zero,$x80808080 1163ec07fdf1Sdjm or $x1b1b1b1b,0x1b1b 1164ec07fdf1Sdjm.align 4 1165ec07fdf1Sdjm.Lmix: 1166ec07fdf1Sdjm and $m,$tp1,$x80808080 1167ec07fdf1Sdjm and $tp2,$tp1,$x7f7f7f7f 1168ec07fdf1Sdjm srl $tp4,$m,7 1169ec07fdf1Sdjm addu $tp2,$tp2 # tp2<<1 1170ec07fdf1Sdjm subu $m,$tp4 1171ec07fdf1Sdjm and $m,$x1b1b1b1b 1172ec07fdf1Sdjm xor $tp2,$m 1173ec07fdf1Sdjm 1174ec07fdf1Sdjm and $m,$tp2,$x80808080 1175ec07fdf1Sdjm and $tp4,$tp2,$x7f7f7f7f 1176ec07fdf1Sdjm srl $tp8,$m,7 1177ec07fdf1Sdjm addu $tp4,$tp4 # tp4<<1 1178ec07fdf1Sdjm subu $m,$tp8 1179ec07fdf1Sdjm and $m,$x1b1b1b1b 1180ec07fdf1Sdjm xor $tp4,$m 1181ec07fdf1Sdjm 1182ec07fdf1Sdjm and $m,$tp4,$x80808080 1183ec07fdf1Sdjm and $tp8,$tp4,$x7f7f7f7f 1184ec07fdf1Sdjm srl $tp9,$m,7 1185ec07fdf1Sdjm addu $tp8,$tp8 # tp8<<1 1186ec07fdf1Sdjm subu $m,$tp9 1187ec07fdf1Sdjm and $m,$x1b1b1b1b 1188ec07fdf1Sdjm xor $tp8,$m 1189ec07fdf1Sdjm 1190ec07fdf1Sdjm xor $tp9,$tp8,$tp1 1191ec07fdf1Sdjm xor $tpe,$tp8,$tp4 1192ec07fdf1Sdjm xor $tpb,$tp9,$tp2 1193ec07fdf1Sdjm xor $tpd,$tp9,$tp4 1194ec07fdf1Sdjm 1195ec07fdf1Sdjm _ror $tp1,$tpd,16 1196ec07fdf1Sdjm xor $tpe,$tp2 1197ec07fdf1Sdjm _ror $tp2,$tpd,-16 1198ec07fdf1Sdjm xor $tpe,$tp1 1199ec07fdf1Sdjm _ror $tp1,$tp9,8 1200ec07fdf1Sdjm xor $tpe,$tp2 1201ec07fdf1Sdjm _ror $tp2,$tp9,-24 1202ec07fdf1Sdjm xor $tpe,$tp1 1203ec07fdf1Sdjm _ror $tp1,$tpb,24 1204ec07fdf1Sdjm xor $tpe,$tp2 1205ec07fdf1Sdjm _ror $tp2,$tpb,-8 1206ec07fdf1Sdjm xor $tpe,$tp1 1207ec07fdf1Sdjm lw $tp1,4($key) # modulo-scheduled 1208ec07fdf1Sdjm xor $tpe,$tp2 1209ec07fdf1Sdjm sub $cnt,1 1210ec07fdf1Sdjm sw $tpe,0($key) 1211ec07fdf1Sdjm $PTR_ADD $key,4 1212ec07fdf1Sdjm bnez $cnt,.Lmix 1213ec07fdf1Sdjm 1214ec07fdf1Sdjm li $t0,0 1215ec07fdf1Sdjm.Ldkey_done: 1216ec07fdf1Sdjm .set noreorder 1217ec07fdf1Sdjm move $a0,$t0 1218ec07fdf1Sdjm $REG_L $ra,$FRAMESIZE-1*$SZREG($sp) 1219ec07fdf1Sdjm $REG_L $fp,$FRAMESIZE-2*$SZREG($sp) 1220ec07fdf1Sdjm___ 1221ec07fdf1Sdjm$code.=<<___ if ($flavour =~ /nubi/i); 1222ec07fdf1Sdjm $REG_L $s3,$FRAMESIZE-11*$SZREG($sp) 1223ec07fdf1Sdjm $REG_L $s2,$FRAMESIZE-12*$SZREG($sp) 1224ec07fdf1Sdjm $REG_L $s1,$FRAMESIZE-13*$SZREG($sp) 1225ec07fdf1Sdjm $REG_L $s0,$FRAMESIZE-14*$SZREG($sp) 1226ec07fdf1Sdjm $REG_L $gp,$FRAMESIZE-15*$SZREG($sp) 1227ec07fdf1Sdjm___ 1228ec07fdf1Sdjm$code.=<<___; 1229ec07fdf1Sdjm jr $ra 1230ec07fdf1Sdjm $PTR_ADD $sp,$FRAMESIZE 12314efebcfaSjsing.end aes_set_decrypt_key_internal 1232ec07fdf1Sdjm___ 1233ec07fdf1Sdjm}}} 1234ec07fdf1Sdjm 1235ec07fdf1Sdjm###################################################################### 1236ec07fdf1Sdjm# Tables are kept in endian-neutral manner 1237ec07fdf1Sdjm$code.=<<___; 1238ec07fdf1Sdjm.rdata 1239ec07fdf1Sdjm.align 6 1240ec07fdf1SdjmAES_Te: 1241ec07fdf1Sdjm.byte 0xc6,0x63,0x63,0xa5, 0xf8,0x7c,0x7c,0x84 # Te0 1242ec07fdf1Sdjm.byte 0xee,0x77,0x77,0x99, 0xf6,0x7b,0x7b,0x8d 1243ec07fdf1Sdjm.byte 0xff,0xf2,0xf2,0x0d, 0xd6,0x6b,0x6b,0xbd 1244ec07fdf1Sdjm.byte 0xde,0x6f,0x6f,0xb1, 0x91,0xc5,0xc5,0x54 1245ec07fdf1Sdjm.byte 0x60,0x30,0x30,0x50, 0x02,0x01,0x01,0x03 1246ec07fdf1Sdjm.byte 0xce,0x67,0x67,0xa9, 0x56,0x2b,0x2b,0x7d 1247ec07fdf1Sdjm.byte 0xe7,0xfe,0xfe,0x19, 0xb5,0xd7,0xd7,0x62 1248ec07fdf1Sdjm.byte 0x4d,0xab,0xab,0xe6, 0xec,0x76,0x76,0x9a 1249ec07fdf1Sdjm.byte 0x8f,0xca,0xca,0x45, 0x1f,0x82,0x82,0x9d 1250ec07fdf1Sdjm.byte 0x89,0xc9,0xc9,0x40, 0xfa,0x7d,0x7d,0x87 1251ec07fdf1Sdjm.byte 0xef,0xfa,0xfa,0x15, 0xb2,0x59,0x59,0xeb 1252ec07fdf1Sdjm.byte 0x8e,0x47,0x47,0xc9, 0xfb,0xf0,0xf0,0x0b 1253ec07fdf1Sdjm.byte 0x41,0xad,0xad,0xec, 0xb3,0xd4,0xd4,0x67 1254ec07fdf1Sdjm.byte 0x5f,0xa2,0xa2,0xfd, 0x45,0xaf,0xaf,0xea 1255ec07fdf1Sdjm.byte 0x23,0x9c,0x9c,0xbf, 0x53,0xa4,0xa4,0xf7 1256ec07fdf1Sdjm.byte 0xe4,0x72,0x72,0x96, 0x9b,0xc0,0xc0,0x5b 1257ec07fdf1Sdjm.byte 0x75,0xb7,0xb7,0xc2, 0xe1,0xfd,0xfd,0x1c 1258ec07fdf1Sdjm.byte 0x3d,0x93,0x93,0xae, 0x4c,0x26,0x26,0x6a 1259ec07fdf1Sdjm.byte 0x6c,0x36,0x36,0x5a, 0x7e,0x3f,0x3f,0x41 1260ec07fdf1Sdjm.byte 0xf5,0xf7,0xf7,0x02, 0x83,0xcc,0xcc,0x4f 1261ec07fdf1Sdjm.byte 0x68,0x34,0x34,0x5c, 0x51,0xa5,0xa5,0xf4 1262ec07fdf1Sdjm.byte 0xd1,0xe5,0xe5,0x34, 0xf9,0xf1,0xf1,0x08 1263ec07fdf1Sdjm.byte 0xe2,0x71,0x71,0x93, 0xab,0xd8,0xd8,0x73 1264ec07fdf1Sdjm.byte 0x62,0x31,0x31,0x53, 0x2a,0x15,0x15,0x3f 1265ec07fdf1Sdjm.byte 0x08,0x04,0x04,0x0c, 0x95,0xc7,0xc7,0x52 1266ec07fdf1Sdjm.byte 0x46,0x23,0x23,0x65, 0x9d,0xc3,0xc3,0x5e 1267ec07fdf1Sdjm.byte 0x30,0x18,0x18,0x28, 0x37,0x96,0x96,0xa1 1268ec07fdf1Sdjm.byte 0x0a,0x05,0x05,0x0f, 0x2f,0x9a,0x9a,0xb5 1269ec07fdf1Sdjm.byte 0x0e,0x07,0x07,0x09, 0x24,0x12,0x12,0x36 1270ec07fdf1Sdjm.byte 0x1b,0x80,0x80,0x9b, 0xdf,0xe2,0xe2,0x3d 1271ec07fdf1Sdjm.byte 0xcd,0xeb,0xeb,0x26, 0x4e,0x27,0x27,0x69 1272ec07fdf1Sdjm.byte 0x7f,0xb2,0xb2,0xcd, 0xea,0x75,0x75,0x9f 1273ec07fdf1Sdjm.byte 0x12,0x09,0x09,0x1b, 0x1d,0x83,0x83,0x9e 1274ec07fdf1Sdjm.byte 0x58,0x2c,0x2c,0x74, 0x34,0x1a,0x1a,0x2e 1275ec07fdf1Sdjm.byte 0x36,0x1b,0x1b,0x2d, 0xdc,0x6e,0x6e,0xb2 1276ec07fdf1Sdjm.byte 0xb4,0x5a,0x5a,0xee, 0x5b,0xa0,0xa0,0xfb 1277ec07fdf1Sdjm.byte 0xa4,0x52,0x52,0xf6, 0x76,0x3b,0x3b,0x4d 1278ec07fdf1Sdjm.byte 0xb7,0xd6,0xd6,0x61, 0x7d,0xb3,0xb3,0xce 1279ec07fdf1Sdjm.byte 0x52,0x29,0x29,0x7b, 0xdd,0xe3,0xe3,0x3e 1280ec07fdf1Sdjm.byte 0x5e,0x2f,0x2f,0x71, 0x13,0x84,0x84,0x97 1281ec07fdf1Sdjm.byte 0xa6,0x53,0x53,0xf5, 0xb9,0xd1,0xd1,0x68 1282ec07fdf1Sdjm.byte 0x00,0x00,0x00,0x00, 0xc1,0xed,0xed,0x2c 1283ec07fdf1Sdjm.byte 0x40,0x20,0x20,0x60, 0xe3,0xfc,0xfc,0x1f 1284ec07fdf1Sdjm.byte 0x79,0xb1,0xb1,0xc8, 0xb6,0x5b,0x5b,0xed 1285ec07fdf1Sdjm.byte 0xd4,0x6a,0x6a,0xbe, 0x8d,0xcb,0xcb,0x46 1286ec07fdf1Sdjm.byte 0x67,0xbe,0xbe,0xd9, 0x72,0x39,0x39,0x4b 1287ec07fdf1Sdjm.byte 0x94,0x4a,0x4a,0xde, 0x98,0x4c,0x4c,0xd4 1288ec07fdf1Sdjm.byte 0xb0,0x58,0x58,0xe8, 0x85,0xcf,0xcf,0x4a 1289ec07fdf1Sdjm.byte 0xbb,0xd0,0xd0,0x6b, 0xc5,0xef,0xef,0x2a 1290ec07fdf1Sdjm.byte 0x4f,0xaa,0xaa,0xe5, 0xed,0xfb,0xfb,0x16 1291ec07fdf1Sdjm.byte 0x86,0x43,0x43,0xc5, 0x9a,0x4d,0x4d,0xd7 1292ec07fdf1Sdjm.byte 0x66,0x33,0x33,0x55, 0x11,0x85,0x85,0x94 1293ec07fdf1Sdjm.byte 0x8a,0x45,0x45,0xcf, 0xe9,0xf9,0xf9,0x10 1294ec07fdf1Sdjm.byte 0x04,0x02,0x02,0x06, 0xfe,0x7f,0x7f,0x81 1295ec07fdf1Sdjm.byte 0xa0,0x50,0x50,0xf0, 0x78,0x3c,0x3c,0x44 1296ec07fdf1Sdjm.byte 0x25,0x9f,0x9f,0xba, 0x4b,0xa8,0xa8,0xe3 1297ec07fdf1Sdjm.byte 0xa2,0x51,0x51,0xf3, 0x5d,0xa3,0xa3,0xfe 1298ec07fdf1Sdjm.byte 0x80,0x40,0x40,0xc0, 0x05,0x8f,0x8f,0x8a 1299ec07fdf1Sdjm.byte 0x3f,0x92,0x92,0xad, 0x21,0x9d,0x9d,0xbc 1300ec07fdf1Sdjm.byte 0x70,0x38,0x38,0x48, 0xf1,0xf5,0xf5,0x04 1301ec07fdf1Sdjm.byte 0x63,0xbc,0xbc,0xdf, 0x77,0xb6,0xb6,0xc1 1302ec07fdf1Sdjm.byte 0xaf,0xda,0xda,0x75, 0x42,0x21,0x21,0x63 1303ec07fdf1Sdjm.byte 0x20,0x10,0x10,0x30, 0xe5,0xff,0xff,0x1a 1304ec07fdf1Sdjm.byte 0xfd,0xf3,0xf3,0x0e, 0xbf,0xd2,0xd2,0x6d 1305ec07fdf1Sdjm.byte 0x81,0xcd,0xcd,0x4c, 0x18,0x0c,0x0c,0x14 1306ec07fdf1Sdjm.byte 0x26,0x13,0x13,0x35, 0xc3,0xec,0xec,0x2f 1307ec07fdf1Sdjm.byte 0xbe,0x5f,0x5f,0xe1, 0x35,0x97,0x97,0xa2 1308ec07fdf1Sdjm.byte 0x88,0x44,0x44,0xcc, 0x2e,0x17,0x17,0x39 1309ec07fdf1Sdjm.byte 0x93,0xc4,0xc4,0x57, 0x55,0xa7,0xa7,0xf2 1310ec07fdf1Sdjm.byte 0xfc,0x7e,0x7e,0x82, 0x7a,0x3d,0x3d,0x47 1311ec07fdf1Sdjm.byte 0xc8,0x64,0x64,0xac, 0xba,0x5d,0x5d,0xe7 1312ec07fdf1Sdjm.byte 0x32,0x19,0x19,0x2b, 0xe6,0x73,0x73,0x95 1313ec07fdf1Sdjm.byte 0xc0,0x60,0x60,0xa0, 0x19,0x81,0x81,0x98 1314ec07fdf1Sdjm.byte 0x9e,0x4f,0x4f,0xd1, 0xa3,0xdc,0xdc,0x7f 1315ec07fdf1Sdjm.byte 0x44,0x22,0x22,0x66, 0x54,0x2a,0x2a,0x7e 1316ec07fdf1Sdjm.byte 0x3b,0x90,0x90,0xab, 0x0b,0x88,0x88,0x83 1317ec07fdf1Sdjm.byte 0x8c,0x46,0x46,0xca, 0xc7,0xee,0xee,0x29 1318ec07fdf1Sdjm.byte 0x6b,0xb8,0xb8,0xd3, 0x28,0x14,0x14,0x3c 1319ec07fdf1Sdjm.byte 0xa7,0xde,0xde,0x79, 0xbc,0x5e,0x5e,0xe2 1320ec07fdf1Sdjm.byte 0x16,0x0b,0x0b,0x1d, 0xad,0xdb,0xdb,0x76 1321ec07fdf1Sdjm.byte 0xdb,0xe0,0xe0,0x3b, 0x64,0x32,0x32,0x56 1322ec07fdf1Sdjm.byte 0x74,0x3a,0x3a,0x4e, 0x14,0x0a,0x0a,0x1e 1323ec07fdf1Sdjm.byte 0x92,0x49,0x49,0xdb, 0x0c,0x06,0x06,0x0a 1324ec07fdf1Sdjm.byte 0x48,0x24,0x24,0x6c, 0xb8,0x5c,0x5c,0xe4 1325ec07fdf1Sdjm.byte 0x9f,0xc2,0xc2,0x5d, 0xbd,0xd3,0xd3,0x6e 1326ec07fdf1Sdjm.byte 0x43,0xac,0xac,0xef, 0xc4,0x62,0x62,0xa6 1327ec07fdf1Sdjm.byte 0x39,0x91,0x91,0xa8, 0x31,0x95,0x95,0xa4 1328ec07fdf1Sdjm.byte 0xd3,0xe4,0xe4,0x37, 0xf2,0x79,0x79,0x8b 1329ec07fdf1Sdjm.byte 0xd5,0xe7,0xe7,0x32, 0x8b,0xc8,0xc8,0x43 1330ec07fdf1Sdjm.byte 0x6e,0x37,0x37,0x59, 0xda,0x6d,0x6d,0xb7 1331ec07fdf1Sdjm.byte 0x01,0x8d,0x8d,0x8c, 0xb1,0xd5,0xd5,0x64 1332ec07fdf1Sdjm.byte 0x9c,0x4e,0x4e,0xd2, 0x49,0xa9,0xa9,0xe0 1333ec07fdf1Sdjm.byte 0xd8,0x6c,0x6c,0xb4, 0xac,0x56,0x56,0xfa 1334ec07fdf1Sdjm.byte 0xf3,0xf4,0xf4,0x07, 0xcf,0xea,0xea,0x25 1335ec07fdf1Sdjm.byte 0xca,0x65,0x65,0xaf, 0xf4,0x7a,0x7a,0x8e 1336ec07fdf1Sdjm.byte 0x47,0xae,0xae,0xe9, 0x10,0x08,0x08,0x18 1337ec07fdf1Sdjm.byte 0x6f,0xba,0xba,0xd5, 0xf0,0x78,0x78,0x88 1338ec07fdf1Sdjm.byte 0x4a,0x25,0x25,0x6f, 0x5c,0x2e,0x2e,0x72 1339ec07fdf1Sdjm.byte 0x38,0x1c,0x1c,0x24, 0x57,0xa6,0xa6,0xf1 1340ec07fdf1Sdjm.byte 0x73,0xb4,0xb4,0xc7, 0x97,0xc6,0xc6,0x51 1341ec07fdf1Sdjm.byte 0xcb,0xe8,0xe8,0x23, 0xa1,0xdd,0xdd,0x7c 1342ec07fdf1Sdjm.byte 0xe8,0x74,0x74,0x9c, 0x3e,0x1f,0x1f,0x21 1343ec07fdf1Sdjm.byte 0x96,0x4b,0x4b,0xdd, 0x61,0xbd,0xbd,0xdc 1344ec07fdf1Sdjm.byte 0x0d,0x8b,0x8b,0x86, 0x0f,0x8a,0x8a,0x85 1345ec07fdf1Sdjm.byte 0xe0,0x70,0x70,0x90, 0x7c,0x3e,0x3e,0x42 1346ec07fdf1Sdjm.byte 0x71,0xb5,0xb5,0xc4, 0xcc,0x66,0x66,0xaa 1347ec07fdf1Sdjm.byte 0x90,0x48,0x48,0xd8, 0x06,0x03,0x03,0x05 1348ec07fdf1Sdjm.byte 0xf7,0xf6,0xf6,0x01, 0x1c,0x0e,0x0e,0x12 1349ec07fdf1Sdjm.byte 0xc2,0x61,0x61,0xa3, 0x6a,0x35,0x35,0x5f 1350ec07fdf1Sdjm.byte 0xae,0x57,0x57,0xf9, 0x69,0xb9,0xb9,0xd0 1351ec07fdf1Sdjm.byte 0x17,0x86,0x86,0x91, 0x99,0xc1,0xc1,0x58 1352ec07fdf1Sdjm.byte 0x3a,0x1d,0x1d,0x27, 0x27,0x9e,0x9e,0xb9 1353ec07fdf1Sdjm.byte 0xd9,0xe1,0xe1,0x38, 0xeb,0xf8,0xf8,0x13 1354ec07fdf1Sdjm.byte 0x2b,0x98,0x98,0xb3, 0x22,0x11,0x11,0x33 1355ec07fdf1Sdjm.byte 0xd2,0x69,0x69,0xbb, 0xa9,0xd9,0xd9,0x70 1356ec07fdf1Sdjm.byte 0x07,0x8e,0x8e,0x89, 0x33,0x94,0x94,0xa7 1357ec07fdf1Sdjm.byte 0x2d,0x9b,0x9b,0xb6, 0x3c,0x1e,0x1e,0x22 1358ec07fdf1Sdjm.byte 0x15,0x87,0x87,0x92, 0xc9,0xe9,0xe9,0x20 1359ec07fdf1Sdjm.byte 0x87,0xce,0xce,0x49, 0xaa,0x55,0x55,0xff 1360ec07fdf1Sdjm.byte 0x50,0x28,0x28,0x78, 0xa5,0xdf,0xdf,0x7a 1361ec07fdf1Sdjm.byte 0x03,0x8c,0x8c,0x8f, 0x59,0xa1,0xa1,0xf8 1362ec07fdf1Sdjm.byte 0x09,0x89,0x89,0x80, 0x1a,0x0d,0x0d,0x17 1363ec07fdf1Sdjm.byte 0x65,0xbf,0xbf,0xda, 0xd7,0xe6,0xe6,0x31 1364ec07fdf1Sdjm.byte 0x84,0x42,0x42,0xc6, 0xd0,0x68,0x68,0xb8 1365ec07fdf1Sdjm.byte 0x82,0x41,0x41,0xc3, 0x29,0x99,0x99,0xb0 1366ec07fdf1Sdjm.byte 0x5a,0x2d,0x2d,0x77, 0x1e,0x0f,0x0f,0x11 1367ec07fdf1Sdjm.byte 0x7b,0xb0,0xb0,0xcb, 0xa8,0x54,0x54,0xfc 1368ec07fdf1Sdjm.byte 0x6d,0xbb,0xbb,0xd6, 0x2c,0x16,0x16,0x3a 1369ec07fdf1Sdjm 1370ec07fdf1Sdjm.byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5 # Te4 1371ec07fdf1Sdjm.byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76 1372ec07fdf1Sdjm.byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0 1373ec07fdf1Sdjm.byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0 1374ec07fdf1Sdjm.byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc 1375ec07fdf1Sdjm.byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15 1376ec07fdf1Sdjm.byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a 1377ec07fdf1Sdjm.byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75 1378ec07fdf1Sdjm.byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0 1379ec07fdf1Sdjm.byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84 1380ec07fdf1Sdjm.byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b 1381ec07fdf1Sdjm.byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf 1382ec07fdf1Sdjm.byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85 1383ec07fdf1Sdjm.byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8 1384ec07fdf1Sdjm.byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5 1385ec07fdf1Sdjm.byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2 1386ec07fdf1Sdjm.byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17 1387ec07fdf1Sdjm.byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73 1388ec07fdf1Sdjm.byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88 1389ec07fdf1Sdjm.byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb 1390ec07fdf1Sdjm.byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c 1391ec07fdf1Sdjm.byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79 1392ec07fdf1Sdjm.byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9 1393ec07fdf1Sdjm.byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08 1394ec07fdf1Sdjm.byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6 1395ec07fdf1Sdjm.byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a 1396ec07fdf1Sdjm.byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e 1397ec07fdf1Sdjm.byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e 1398ec07fdf1Sdjm.byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94 1399ec07fdf1Sdjm.byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf 1400ec07fdf1Sdjm.byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68 1401ec07fdf1Sdjm.byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 1402ec07fdf1Sdjm 1403ec07fdf1Sdjm.byte 0x01,0x00,0x00,0x00, 0x02,0x00,0x00,0x00 # rcon 1404ec07fdf1Sdjm.byte 0x04,0x00,0x00,0x00, 0x08,0x00,0x00,0x00 1405ec07fdf1Sdjm.byte 0x10,0x00,0x00,0x00, 0x20,0x00,0x00,0x00 1406ec07fdf1Sdjm.byte 0x40,0x00,0x00,0x00, 0x80,0x00,0x00,0x00 1407ec07fdf1Sdjm.byte 0x1B,0x00,0x00,0x00, 0x36,0x00,0x00,0x00 1408ec07fdf1Sdjm 1409ec07fdf1Sdjm.align 6 1410ec07fdf1SdjmAES_Td: 1411ec07fdf1Sdjm.byte 0x51,0xf4,0xa7,0x50, 0x7e,0x41,0x65,0x53 # Td0 1412ec07fdf1Sdjm.byte 0x1a,0x17,0xa4,0xc3, 0x3a,0x27,0x5e,0x96 1413ec07fdf1Sdjm.byte 0x3b,0xab,0x6b,0xcb, 0x1f,0x9d,0x45,0xf1 1414ec07fdf1Sdjm.byte 0xac,0xfa,0x58,0xab, 0x4b,0xe3,0x03,0x93 1415ec07fdf1Sdjm.byte 0x20,0x30,0xfa,0x55, 0xad,0x76,0x6d,0xf6 1416ec07fdf1Sdjm.byte 0x88,0xcc,0x76,0x91, 0xf5,0x02,0x4c,0x25 1417ec07fdf1Sdjm.byte 0x4f,0xe5,0xd7,0xfc, 0xc5,0x2a,0xcb,0xd7 1418ec07fdf1Sdjm.byte 0x26,0x35,0x44,0x80, 0xb5,0x62,0xa3,0x8f 1419ec07fdf1Sdjm.byte 0xde,0xb1,0x5a,0x49, 0x25,0xba,0x1b,0x67 1420ec07fdf1Sdjm.byte 0x45,0xea,0x0e,0x98, 0x5d,0xfe,0xc0,0xe1 1421ec07fdf1Sdjm.byte 0xc3,0x2f,0x75,0x02, 0x81,0x4c,0xf0,0x12 1422ec07fdf1Sdjm.byte 0x8d,0x46,0x97,0xa3, 0x6b,0xd3,0xf9,0xc6 1423ec07fdf1Sdjm.byte 0x03,0x8f,0x5f,0xe7, 0x15,0x92,0x9c,0x95 1424ec07fdf1Sdjm.byte 0xbf,0x6d,0x7a,0xeb, 0x95,0x52,0x59,0xda 1425ec07fdf1Sdjm.byte 0xd4,0xbe,0x83,0x2d, 0x58,0x74,0x21,0xd3 1426ec07fdf1Sdjm.byte 0x49,0xe0,0x69,0x29, 0x8e,0xc9,0xc8,0x44 1427ec07fdf1Sdjm.byte 0x75,0xc2,0x89,0x6a, 0xf4,0x8e,0x79,0x78 1428ec07fdf1Sdjm.byte 0x99,0x58,0x3e,0x6b, 0x27,0xb9,0x71,0xdd 1429ec07fdf1Sdjm.byte 0xbe,0xe1,0x4f,0xb6, 0xf0,0x88,0xad,0x17 1430ec07fdf1Sdjm.byte 0xc9,0x20,0xac,0x66, 0x7d,0xce,0x3a,0xb4 1431ec07fdf1Sdjm.byte 0x63,0xdf,0x4a,0x18, 0xe5,0x1a,0x31,0x82 1432ec07fdf1Sdjm.byte 0x97,0x51,0x33,0x60, 0x62,0x53,0x7f,0x45 1433ec07fdf1Sdjm.byte 0xb1,0x64,0x77,0xe0, 0xbb,0x6b,0xae,0x84 1434ec07fdf1Sdjm.byte 0xfe,0x81,0xa0,0x1c, 0xf9,0x08,0x2b,0x94 1435ec07fdf1Sdjm.byte 0x70,0x48,0x68,0x58, 0x8f,0x45,0xfd,0x19 1436ec07fdf1Sdjm.byte 0x94,0xde,0x6c,0x87, 0x52,0x7b,0xf8,0xb7 1437ec07fdf1Sdjm.byte 0xab,0x73,0xd3,0x23, 0x72,0x4b,0x02,0xe2 1438ec07fdf1Sdjm.byte 0xe3,0x1f,0x8f,0x57, 0x66,0x55,0xab,0x2a 1439ec07fdf1Sdjm.byte 0xb2,0xeb,0x28,0x07, 0x2f,0xb5,0xc2,0x03 1440ec07fdf1Sdjm.byte 0x86,0xc5,0x7b,0x9a, 0xd3,0x37,0x08,0xa5 1441ec07fdf1Sdjm.byte 0x30,0x28,0x87,0xf2, 0x23,0xbf,0xa5,0xb2 1442ec07fdf1Sdjm.byte 0x02,0x03,0x6a,0xba, 0xed,0x16,0x82,0x5c 1443ec07fdf1Sdjm.byte 0x8a,0xcf,0x1c,0x2b, 0xa7,0x79,0xb4,0x92 1444ec07fdf1Sdjm.byte 0xf3,0x07,0xf2,0xf0, 0x4e,0x69,0xe2,0xa1 1445ec07fdf1Sdjm.byte 0x65,0xda,0xf4,0xcd, 0x06,0x05,0xbe,0xd5 1446ec07fdf1Sdjm.byte 0xd1,0x34,0x62,0x1f, 0xc4,0xa6,0xfe,0x8a 1447ec07fdf1Sdjm.byte 0x34,0x2e,0x53,0x9d, 0xa2,0xf3,0x55,0xa0 1448ec07fdf1Sdjm.byte 0x05,0x8a,0xe1,0x32, 0xa4,0xf6,0xeb,0x75 1449ec07fdf1Sdjm.byte 0x0b,0x83,0xec,0x39, 0x40,0x60,0xef,0xaa 1450ec07fdf1Sdjm.byte 0x5e,0x71,0x9f,0x06, 0xbd,0x6e,0x10,0x51 1451ec07fdf1Sdjm.byte 0x3e,0x21,0x8a,0xf9, 0x96,0xdd,0x06,0x3d 1452ec07fdf1Sdjm.byte 0xdd,0x3e,0x05,0xae, 0x4d,0xe6,0xbd,0x46 1453ec07fdf1Sdjm.byte 0x91,0x54,0x8d,0xb5, 0x71,0xc4,0x5d,0x05 1454ec07fdf1Sdjm.byte 0x04,0x06,0xd4,0x6f, 0x60,0x50,0x15,0xff 1455ec07fdf1Sdjm.byte 0x19,0x98,0xfb,0x24, 0xd6,0xbd,0xe9,0x97 1456ec07fdf1Sdjm.byte 0x89,0x40,0x43,0xcc, 0x67,0xd9,0x9e,0x77 1457ec07fdf1Sdjm.byte 0xb0,0xe8,0x42,0xbd, 0x07,0x89,0x8b,0x88 1458ec07fdf1Sdjm.byte 0xe7,0x19,0x5b,0x38, 0x79,0xc8,0xee,0xdb 1459ec07fdf1Sdjm.byte 0xa1,0x7c,0x0a,0x47, 0x7c,0x42,0x0f,0xe9 1460ec07fdf1Sdjm.byte 0xf8,0x84,0x1e,0xc9, 0x00,0x00,0x00,0x00 1461ec07fdf1Sdjm.byte 0x09,0x80,0x86,0x83, 0x32,0x2b,0xed,0x48 1462ec07fdf1Sdjm.byte 0x1e,0x11,0x70,0xac, 0x6c,0x5a,0x72,0x4e 1463ec07fdf1Sdjm.byte 0xfd,0x0e,0xff,0xfb, 0x0f,0x85,0x38,0x56 1464ec07fdf1Sdjm.byte 0x3d,0xae,0xd5,0x1e, 0x36,0x2d,0x39,0x27 1465ec07fdf1Sdjm.byte 0x0a,0x0f,0xd9,0x64, 0x68,0x5c,0xa6,0x21 1466ec07fdf1Sdjm.byte 0x9b,0x5b,0x54,0xd1, 0x24,0x36,0x2e,0x3a 1467ec07fdf1Sdjm.byte 0x0c,0x0a,0x67,0xb1, 0x93,0x57,0xe7,0x0f 1468ec07fdf1Sdjm.byte 0xb4,0xee,0x96,0xd2, 0x1b,0x9b,0x91,0x9e 1469ec07fdf1Sdjm.byte 0x80,0xc0,0xc5,0x4f, 0x61,0xdc,0x20,0xa2 1470ec07fdf1Sdjm.byte 0x5a,0x77,0x4b,0x69, 0x1c,0x12,0x1a,0x16 1471ec07fdf1Sdjm.byte 0xe2,0x93,0xba,0x0a, 0xc0,0xa0,0x2a,0xe5 1472ec07fdf1Sdjm.byte 0x3c,0x22,0xe0,0x43, 0x12,0x1b,0x17,0x1d 1473ec07fdf1Sdjm.byte 0x0e,0x09,0x0d,0x0b, 0xf2,0x8b,0xc7,0xad 1474ec07fdf1Sdjm.byte 0x2d,0xb6,0xa8,0xb9, 0x14,0x1e,0xa9,0xc8 1475ec07fdf1Sdjm.byte 0x57,0xf1,0x19,0x85, 0xaf,0x75,0x07,0x4c 1476ec07fdf1Sdjm.byte 0xee,0x99,0xdd,0xbb, 0xa3,0x7f,0x60,0xfd 1477ec07fdf1Sdjm.byte 0xf7,0x01,0x26,0x9f, 0x5c,0x72,0xf5,0xbc 1478ec07fdf1Sdjm.byte 0x44,0x66,0x3b,0xc5, 0x5b,0xfb,0x7e,0x34 1479ec07fdf1Sdjm.byte 0x8b,0x43,0x29,0x76, 0xcb,0x23,0xc6,0xdc 1480ec07fdf1Sdjm.byte 0xb6,0xed,0xfc,0x68, 0xb8,0xe4,0xf1,0x63 1481ec07fdf1Sdjm.byte 0xd7,0x31,0xdc,0xca, 0x42,0x63,0x85,0x10 1482ec07fdf1Sdjm.byte 0x13,0x97,0x22,0x40, 0x84,0xc6,0x11,0x20 1483ec07fdf1Sdjm.byte 0x85,0x4a,0x24,0x7d, 0xd2,0xbb,0x3d,0xf8 1484ec07fdf1Sdjm.byte 0xae,0xf9,0x32,0x11, 0xc7,0x29,0xa1,0x6d 1485ec07fdf1Sdjm.byte 0x1d,0x9e,0x2f,0x4b, 0xdc,0xb2,0x30,0xf3 1486ec07fdf1Sdjm.byte 0x0d,0x86,0x52,0xec, 0x77,0xc1,0xe3,0xd0 1487ec07fdf1Sdjm.byte 0x2b,0xb3,0x16,0x6c, 0xa9,0x70,0xb9,0x99 1488ec07fdf1Sdjm.byte 0x11,0x94,0x48,0xfa, 0x47,0xe9,0x64,0x22 1489ec07fdf1Sdjm.byte 0xa8,0xfc,0x8c,0xc4, 0xa0,0xf0,0x3f,0x1a 1490ec07fdf1Sdjm.byte 0x56,0x7d,0x2c,0xd8, 0x22,0x33,0x90,0xef 1491ec07fdf1Sdjm.byte 0x87,0x49,0x4e,0xc7, 0xd9,0x38,0xd1,0xc1 1492ec07fdf1Sdjm.byte 0x8c,0xca,0xa2,0xfe, 0x98,0xd4,0x0b,0x36 1493ec07fdf1Sdjm.byte 0xa6,0xf5,0x81,0xcf, 0xa5,0x7a,0xde,0x28 1494ec07fdf1Sdjm.byte 0xda,0xb7,0x8e,0x26, 0x3f,0xad,0xbf,0xa4 1495ec07fdf1Sdjm.byte 0x2c,0x3a,0x9d,0xe4, 0x50,0x78,0x92,0x0d 1496ec07fdf1Sdjm.byte 0x6a,0x5f,0xcc,0x9b, 0x54,0x7e,0x46,0x62 1497ec07fdf1Sdjm.byte 0xf6,0x8d,0x13,0xc2, 0x90,0xd8,0xb8,0xe8 1498ec07fdf1Sdjm.byte 0x2e,0x39,0xf7,0x5e, 0x82,0xc3,0xaf,0xf5 1499ec07fdf1Sdjm.byte 0x9f,0x5d,0x80,0xbe, 0x69,0xd0,0x93,0x7c 1500ec07fdf1Sdjm.byte 0x6f,0xd5,0x2d,0xa9, 0xcf,0x25,0x12,0xb3 1501ec07fdf1Sdjm.byte 0xc8,0xac,0x99,0x3b, 0x10,0x18,0x7d,0xa7 1502ec07fdf1Sdjm.byte 0xe8,0x9c,0x63,0x6e, 0xdb,0x3b,0xbb,0x7b 1503ec07fdf1Sdjm.byte 0xcd,0x26,0x78,0x09, 0x6e,0x59,0x18,0xf4 1504ec07fdf1Sdjm.byte 0xec,0x9a,0xb7,0x01, 0x83,0x4f,0x9a,0xa8 1505ec07fdf1Sdjm.byte 0xe6,0x95,0x6e,0x65, 0xaa,0xff,0xe6,0x7e 1506ec07fdf1Sdjm.byte 0x21,0xbc,0xcf,0x08, 0xef,0x15,0xe8,0xe6 1507ec07fdf1Sdjm.byte 0xba,0xe7,0x9b,0xd9, 0x4a,0x6f,0x36,0xce 1508ec07fdf1Sdjm.byte 0xea,0x9f,0x09,0xd4, 0x29,0xb0,0x7c,0xd6 1509ec07fdf1Sdjm.byte 0x31,0xa4,0xb2,0xaf, 0x2a,0x3f,0x23,0x31 1510ec07fdf1Sdjm.byte 0xc6,0xa5,0x94,0x30, 0x35,0xa2,0x66,0xc0 1511ec07fdf1Sdjm.byte 0x74,0x4e,0xbc,0x37, 0xfc,0x82,0xca,0xa6 1512ec07fdf1Sdjm.byte 0xe0,0x90,0xd0,0xb0, 0x33,0xa7,0xd8,0x15 1513ec07fdf1Sdjm.byte 0xf1,0x04,0x98,0x4a, 0x41,0xec,0xda,0xf7 1514ec07fdf1Sdjm.byte 0x7f,0xcd,0x50,0x0e, 0x17,0x91,0xf6,0x2f 1515ec07fdf1Sdjm.byte 0x76,0x4d,0xd6,0x8d, 0x43,0xef,0xb0,0x4d 1516ec07fdf1Sdjm.byte 0xcc,0xaa,0x4d,0x54, 0xe4,0x96,0x04,0xdf 1517ec07fdf1Sdjm.byte 0x9e,0xd1,0xb5,0xe3, 0x4c,0x6a,0x88,0x1b 1518ec07fdf1Sdjm.byte 0xc1,0x2c,0x1f,0xb8, 0x46,0x65,0x51,0x7f 1519ec07fdf1Sdjm.byte 0x9d,0x5e,0xea,0x04, 0x01,0x8c,0x35,0x5d 1520ec07fdf1Sdjm.byte 0xfa,0x87,0x74,0x73, 0xfb,0x0b,0x41,0x2e 1521ec07fdf1Sdjm.byte 0xb3,0x67,0x1d,0x5a, 0x92,0xdb,0xd2,0x52 1522ec07fdf1Sdjm.byte 0xe9,0x10,0x56,0x33, 0x6d,0xd6,0x47,0x13 1523ec07fdf1Sdjm.byte 0x9a,0xd7,0x61,0x8c, 0x37,0xa1,0x0c,0x7a 1524ec07fdf1Sdjm.byte 0x59,0xf8,0x14,0x8e, 0xeb,0x13,0x3c,0x89 1525ec07fdf1Sdjm.byte 0xce,0xa9,0x27,0xee, 0xb7,0x61,0xc9,0x35 1526ec07fdf1Sdjm.byte 0xe1,0x1c,0xe5,0xed, 0x7a,0x47,0xb1,0x3c 1527ec07fdf1Sdjm.byte 0x9c,0xd2,0xdf,0x59, 0x55,0xf2,0x73,0x3f 1528ec07fdf1Sdjm.byte 0x18,0x14,0xce,0x79, 0x73,0xc7,0x37,0xbf 1529ec07fdf1Sdjm.byte 0x53,0xf7,0xcd,0xea, 0x5f,0xfd,0xaa,0x5b 1530ec07fdf1Sdjm.byte 0xdf,0x3d,0x6f,0x14, 0x78,0x44,0xdb,0x86 1531ec07fdf1Sdjm.byte 0xca,0xaf,0xf3,0x81, 0xb9,0x68,0xc4,0x3e 1532ec07fdf1Sdjm.byte 0x38,0x24,0x34,0x2c, 0xc2,0xa3,0x40,0x5f 1533ec07fdf1Sdjm.byte 0x16,0x1d,0xc3,0x72, 0xbc,0xe2,0x25,0x0c 1534ec07fdf1Sdjm.byte 0x28,0x3c,0x49,0x8b, 0xff,0x0d,0x95,0x41 1535ec07fdf1Sdjm.byte 0x39,0xa8,0x01,0x71, 0x08,0x0c,0xb3,0xde 1536ec07fdf1Sdjm.byte 0xd8,0xb4,0xe4,0x9c, 0x64,0x56,0xc1,0x90 1537ec07fdf1Sdjm.byte 0x7b,0xcb,0x84,0x61, 0xd5,0x32,0xb6,0x70 1538ec07fdf1Sdjm.byte 0x48,0x6c,0x5c,0x74, 0xd0,0xb8,0x57,0x42 1539ec07fdf1Sdjm 1540ec07fdf1Sdjm.byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38 # Td4 1541ec07fdf1Sdjm.byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb 1542ec07fdf1Sdjm.byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87 1543ec07fdf1Sdjm.byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb 1544ec07fdf1Sdjm.byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d 1545ec07fdf1Sdjm.byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e 1546ec07fdf1Sdjm.byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2 1547ec07fdf1Sdjm.byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25 1548ec07fdf1Sdjm.byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16 1549ec07fdf1Sdjm.byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92 1550ec07fdf1Sdjm.byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda 1551ec07fdf1Sdjm.byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84 1552ec07fdf1Sdjm.byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a 1553ec07fdf1Sdjm.byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06 1554ec07fdf1Sdjm.byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02 1555ec07fdf1Sdjm.byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b 1556ec07fdf1Sdjm.byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea 1557ec07fdf1Sdjm.byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73 1558ec07fdf1Sdjm.byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85 1559ec07fdf1Sdjm.byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e 1560ec07fdf1Sdjm.byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89 1561ec07fdf1Sdjm.byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b 1562ec07fdf1Sdjm.byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20 1563ec07fdf1Sdjm.byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4 1564ec07fdf1Sdjm.byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31 1565ec07fdf1Sdjm.byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f 1566ec07fdf1Sdjm.byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d 1567ec07fdf1Sdjm.byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef 1568ec07fdf1Sdjm.byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0 1569ec07fdf1Sdjm.byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61 1570ec07fdf1Sdjm.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26 1571ec07fdf1Sdjm.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d 1572ec07fdf1Sdjm___ 1573ec07fdf1Sdjm 1574ec07fdf1Sdjmforeach (split("\n",$code)) { 1575ec07fdf1Sdjm s/\`([^\`]*)\`/eval $1/ge; 1576ec07fdf1Sdjm 1577ec07fdf1Sdjm # made-up _instructions, _xtr, _ins, _ror and _bias, cope 1578ec07fdf1Sdjm # with byte order dependencies... 1579ec07fdf1Sdjm if (/^\s+_/) { 1580ec07fdf1Sdjm s/(_[a-z]+\s+)(\$[0-9]+),([^,]+)(#.*)*$/$1$2,$2,$3/; 1581ec07fdf1Sdjm 1582ec07fdf1Sdjm s/_xtr\s+(\$[0-9]+),(\$[0-9]+),([0-9]+(\-2)*)/ 1583ec07fdf1Sdjm sprintf("srl\t$1,$2,%d",$big_endian ? eval($3) 1584ec07fdf1Sdjm : eval("24-$3"))/e or 1585ec07fdf1Sdjm s/_ins\s+(\$[0-9]+),(\$[0-9]+),([0-9]+)/ 1586ec07fdf1Sdjm sprintf("sll\t$1,$2,%d",$big_endian ? eval($3) 1587ec07fdf1Sdjm : eval("24-$3"))/e or 1588ec07fdf1Sdjm s/_ror\s+(\$[0-9]+),(\$[0-9]+),(\-?[0-9]+)/ 1589ec07fdf1Sdjm sprintf("srl\t$1,$2,%d",$big_endian ? eval($3) 1590ec07fdf1Sdjm : eval("$3*-1"))/e or 1591ec07fdf1Sdjm s/_bias\s+(\$[0-9]+),(\$[0-9]+),([0-9]+)/ 1592ec07fdf1Sdjm sprintf("sll\t$1,$2,%d",$big_endian ? eval($3) 1593ec07fdf1Sdjm : eval("($3-16)&31"))/e; 1594ec07fdf1Sdjm 1595ec07fdf1Sdjm s/srl\s+(\$[0-9]+),(\$[0-9]+),\-([0-9]+)/ 1596ec07fdf1Sdjm sprintf("sll\t$1,$2,$3")/e or 1597ec07fdf1Sdjm s/srl\s+(\$[0-9]+),(\$[0-9]+),0/ 1598ec07fdf1Sdjm sprintf("and\t$1,$2,0xff")/e or 1599ec07fdf1Sdjm s/(sll\s+\$[0-9]+,\$[0-9]+,0)/#$1/; 1600ec07fdf1Sdjm } 1601ec07fdf1Sdjm 1602ec07fdf1Sdjm # convert lwl/lwr and swr/swl to little-endian order 1603ec07fdf1Sdjm if (!$big_endian && /^\s+[sl]w[lr]\s+/) { 1604ec07fdf1Sdjm s/([sl]wl.*)([0-9]+)\((\$[0-9]+)\)/ 1605ec07fdf1Sdjm sprintf("$1%d($3)",eval("$2-$2%4+($2%4-1)&3"))/e or 1606ec07fdf1Sdjm s/([sl]wr.*)([0-9]+)\((\$[0-9]+)\)/ 1607ec07fdf1Sdjm sprintf("$1%d($3)",eval("$2-$2%4+($2%4+1)&3"))/e; 1608ec07fdf1Sdjm } 1609ec07fdf1Sdjm 1610ec07fdf1Sdjm print $_,"\n"; 1611ec07fdf1Sdjm} 1612ec07fdf1Sdjm 1613ec07fdf1Sdjmclose STDOUT; 1614