1e1051a39Sopenharmony_ci#! /usr/bin/env perl 2e1051a39Sopenharmony_ci# Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci# 4e1051a39Sopenharmony_ci# Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci# this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci# in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci# https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci# ==================================================================== 11e1051a39Sopenharmony_ci# Written by Andy Polyakov <appro@openssl.org> for the OpenSSL 12e1051a39Sopenharmony_ci# project. The module is, however, dual licensed under OpenSSL and 13e1051a39Sopenharmony_ci# CRYPTOGAMS licenses depending on where you obtain it. For further 14e1051a39Sopenharmony_ci# details see http://www.openssl.org/~appro/cryptogams/. 15e1051a39Sopenharmony_ci# ==================================================================== 16e1051a39Sopenharmony_ci 17e1051a39Sopenharmony_ci# Needs more work: key setup, CBC routine... 18e1051a39Sopenharmony_ci# 19e1051a39Sopenharmony_ci# ppc_AES_[en|de]crypt perform at 18 cycles per byte processed with 20e1051a39Sopenharmony_ci# 128-bit key, which is ~40% better than 64-bit code generated by gcc 21e1051a39Sopenharmony_ci# 4.0. But these are not the ones currently used! Their "compact" 22e1051a39Sopenharmony_ci# counterparts are, for security reason. ppc_AES_encrypt_compact runs 23e1051a39Sopenharmony_ci# at 1/2 of ppc_AES_encrypt speed, while ppc_AES_decrypt_compact - 24e1051a39Sopenharmony_ci# at 1/3 of ppc_AES_decrypt. 25e1051a39Sopenharmony_ci 26e1051a39Sopenharmony_ci# February 2010 27e1051a39Sopenharmony_ci# 28e1051a39Sopenharmony_ci# Rescheduling instructions to favour Power6 pipeline gave 10% 29e1051a39Sopenharmony_ci# performance improvement on the platform in question (and marginal 30e1051a39Sopenharmony_ci# improvement even on others). It should be noted that Power6 fails 31e1051a39Sopenharmony_ci# to process byte in 18 cycles, only in 23, because it fails to issue 32e1051a39Sopenharmony_ci# 4 load instructions in two cycles, only in 3. As result non-compact 33e1051a39Sopenharmony_ci# block subroutines are 25% slower than one would expect. Compact 34e1051a39Sopenharmony_ci# functions scale better, because they have pure computational part, 35e1051a39Sopenharmony_ci# which scales perfectly with clock frequency. To be specific 36e1051a39Sopenharmony_ci# ppc_AES_encrypt_compact operates at 42 cycles per byte, while 37e1051a39Sopenharmony_ci# ppc_AES_decrypt_compact - at 55 (in 64-bit build). 38e1051a39Sopenharmony_ci 39e1051a39Sopenharmony_ci# $output is the last argument if it looks like a file (it has an extension) 40e1051a39Sopenharmony_ci# $flavour is the first argument if it doesn't look like a file 41e1051a39Sopenharmony_ci$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef; 42e1051a39Sopenharmony_ci$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef; 43e1051a39Sopenharmony_ci 44e1051a39Sopenharmony_ciif ($flavour =~ /64/) { 45e1051a39Sopenharmony_ci $SIZE_T =8; 46e1051a39Sopenharmony_ci $LRSAVE =2*$SIZE_T; 47e1051a39Sopenharmony_ci $STU ="stdu"; 48e1051a39Sopenharmony_ci $POP ="ld"; 49e1051a39Sopenharmony_ci $PUSH ="std"; 50e1051a39Sopenharmony_ci} elsif ($flavour =~ /32/) { 51e1051a39Sopenharmony_ci $SIZE_T =4; 52e1051a39Sopenharmony_ci $LRSAVE =$SIZE_T; 53e1051a39Sopenharmony_ci $STU ="stwu"; 54e1051a39Sopenharmony_ci $POP ="lwz"; 55e1051a39Sopenharmony_ci $PUSH ="stw"; 56e1051a39Sopenharmony_ci} else { die "nonsense $flavour"; } 57e1051a39Sopenharmony_ci 58e1051a39Sopenharmony_ci$LITTLE_ENDIAN = ($flavour=~/le$/) ? $SIZE_T : 0; 59e1051a39Sopenharmony_ci 60e1051a39Sopenharmony_ci$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; 61e1051a39Sopenharmony_ci( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or 62e1051a39Sopenharmony_ci( $xlate="${dir}../../perlasm/ppc-xlate.pl" and -f $xlate) or 63e1051a39Sopenharmony_cidie "can't locate ppc-xlate.pl"; 64e1051a39Sopenharmony_ci 65e1051a39Sopenharmony_ciopen STDOUT,"| $^X $xlate $flavour \"$output\"" 66e1051a39Sopenharmony_ci or die "can't call $xlate: $!"; 67e1051a39Sopenharmony_ci 68e1051a39Sopenharmony_ci$FRAME=32*$SIZE_T; 69e1051a39Sopenharmony_ci 70e1051a39Sopenharmony_cisub _data_word() 71e1051a39Sopenharmony_ci{ my $i; 72e1051a39Sopenharmony_ci while(defined($i=shift)) { $code.=sprintf"\t.long\t0x%08x,0x%08x\n",$i,$i; } 73e1051a39Sopenharmony_ci} 74e1051a39Sopenharmony_ci 75e1051a39Sopenharmony_ci$sp="r1"; 76e1051a39Sopenharmony_ci$toc="r2"; 77e1051a39Sopenharmony_ci$inp="r3"; 78e1051a39Sopenharmony_ci$out="r4"; 79e1051a39Sopenharmony_ci$key="r5"; 80e1051a39Sopenharmony_ci 81e1051a39Sopenharmony_ci$Tbl0="r3"; 82e1051a39Sopenharmony_ci$Tbl1="r6"; 83e1051a39Sopenharmony_ci$Tbl2="r7"; 84e1051a39Sopenharmony_ci$Tbl3=$out; # stay away from "r2"; $out is offloaded to stack 85e1051a39Sopenharmony_ci 86e1051a39Sopenharmony_ci$s0="r8"; 87e1051a39Sopenharmony_ci$s1="r9"; 88e1051a39Sopenharmony_ci$s2="r10"; 89e1051a39Sopenharmony_ci$s3="r11"; 90e1051a39Sopenharmony_ci 91e1051a39Sopenharmony_ci$t0="r12"; 92e1051a39Sopenharmony_ci$t1="r0"; # stay away from "r13"; 93e1051a39Sopenharmony_ci$t2="r14"; 94e1051a39Sopenharmony_ci$t3="r15"; 95e1051a39Sopenharmony_ci 96e1051a39Sopenharmony_ci$acc00="r16"; 97e1051a39Sopenharmony_ci$acc01="r17"; 98e1051a39Sopenharmony_ci$acc02="r18"; 99e1051a39Sopenharmony_ci$acc03="r19"; 100e1051a39Sopenharmony_ci 101e1051a39Sopenharmony_ci$acc04="r20"; 102e1051a39Sopenharmony_ci$acc05="r21"; 103e1051a39Sopenharmony_ci$acc06="r22"; 104e1051a39Sopenharmony_ci$acc07="r23"; 105e1051a39Sopenharmony_ci 106e1051a39Sopenharmony_ci$acc08="r24"; 107e1051a39Sopenharmony_ci$acc09="r25"; 108e1051a39Sopenharmony_ci$acc10="r26"; 109e1051a39Sopenharmony_ci$acc11="r27"; 110e1051a39Sopenharmony_ci 111e1051a39Sopenharmony_ci$acc12="r28"; 112e1051a39Sopenharmony_ci$acc13="r29"; 113e1051a39Sopenharmony_ci$acc14="r30"; 114e1051a39Sopenharmony_ci$acc15="r31"; 115e1051a39Sopenharmony_ci 116e1051a39Sopenharmony_ci$mask80=$Tbl2; 117e1051a39Sopenharmony_ci$mask1b=$Tbl3; 118e1051a39Sopenharmony_ci 119e1051a39Sopenharmony_ci$code.=<<___; 120e1051a39Sopenharmony_ci.machine "any" 121e1051a39Sopenharmony_ci.text 122e1051a39Sopenharmony_ci 123e1051a39Sopenharmony_ci.align 7 124e1051a39Sopenharmony_ciLAES_Te: 125e1051a39Sopenharmony_ci mflr r0 126e1051a39Sopenharmony_ci bcl 20,31,\$+4 127e1051a39Sopenharmony_ci mflr $Tbl0 ; vvvvv "distance" between . and 1st data entry 128e1051a39Sopenharmony_ci addi $Tbl0,$Tbl0,`128-8` 129e1051a39Sopenharmony_ci mtlr r0 130e1051a39Sopenharmony_ci blr 131e1051a39Sopenharmony_ci .long 0 132e1051a39Sopenharmony_ci .byte 0,12,0x14,0,0,0,0,0 133e1051a39Sopenharmony_ci .space `64-9*4` 134e1051a39Sopenharmony_ciLAES_Td: 135e1051a39Sopenharmony_ci mflr r0 136e1051a39Sopenharmony_ci bcl 20,31,\$+4 137e1051a39Sopenharmony_ci mflr $Tbl0 ; vvvvvvvv "distance" between . and 1st data entry 138e1051a39Sopenharmony_ci addi $Tbl0,$Tbl0,`128-64-8+2048+256` 139e1051a39Sopenharmony_ci mtlr r0 140e1051a39Sopenharmony_ci blr 141e1051a39Sopenharmony_ci .long 0 142e1051a39Sopenharmony_ci .byte 0,12,0x14,0,0,0,0,0 143e1051a39Sopenharmony_ci .space `128-64-9*4` 144e1051a39Sopenharmony_ci___ 145e1051a39Sopenharmony_ci&_data_word( 146e1051a39Sopenharmony_ci 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 147e1051a39Sopenharmony_ci 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 148e1051a39Sopenharmony_ci 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 149e1051a39Sopenharmony_ci 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 150e1051a39Sopenharmony_ci 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 151e1051a39Sopenharmony_ci 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 152e1051a39Sopenharmony_ci 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 153e1051a39Sopenharmony_ci 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 154e1051a39Sopenharmony_ci 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 155e1051a39Sopenharmony_ci 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 156e1051a39Sopenharmony_ci 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 157e1051a39Sopenharmony_ci 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 158e1051a39Sopenharmony_ci 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 159e1051a39Sopenharmony_ci 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 160e1051a39Sopenharmony_ci 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 161e1051a39Sopenharmony_ci 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 162e1051a39Sopenharmony_ci 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 163e1051a39Sopenharmony_ci 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 164e1051a39Sopenharmony_ci 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 165e1051a39Sopenharmony_ci 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 166e1051a39Sopenharmony_ci 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 167e1051a39Sopenharmony_ci 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 168e1051a39Sopenharmony_ci 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 169e1051a39Sopenharmony_ci 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 170e1051a39Sopenharmony_ci 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 171e1051a39Sopenharmony_ci 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 172e1051a39Sopenharmony_ci 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 173e1051a39Sopenharmony_ci 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 174e1051a39Sopenharmony_ci 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 175e1051a39Sopenharmony_ci 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 176e1051a39Sopenharmony_ci 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 177e1051a39Sopenharmony_ci 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 178e1051a39Sopenharmony_ci 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 179e1051a39Sopenharmony_ci 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 180e1051a39Sopenharmony_ci 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 181e1051a39Sopenharmony_ci 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 182e1051a39Sopenharmony_ci 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 183e1051a39Sopenharmony_ci 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 184e1051a39Sopenharmony_ci 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 185e1051a39Sopenharmony_ci 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 186e1051a39Sopenharmony_ci 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 187e1051a39Sopenharmony_ci 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 188e1051a39Sopenharmony_ci 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 189e1051a39Sopenharmony_ci 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 190e1051a39Sopenharmony_ci 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 191e1051a39Sopenharmony_ci 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 192e1051a39Sopenharmony_ci 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 193e1051a39Sopenharmony_ci 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 194e1051a39Sopenharmony_ci 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 195e1051a39Sopenharmony_ci 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 196e1051a39Sopenharmony_ci 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 197e1051a39Sopenharmony_ci 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 198e1051a39Sopenharmony_ci 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 199e1051a39Sopenharmony_ci 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 200e1051a39Sopenharmony_ci 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 201e1051a39Sopenharmony_ci 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 202e1051a39Sopenharmony_ci 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 203e1051a39Sopenharmony_ci 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 204e1051a39Sopenharmony_ci 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 205e1051a39Sopenharmony_ci 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 206e1051a39Sopenharmony_ci 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 207e1051a39Sopenharmony_ci 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 208e1051a39Sopenharmony_ci 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 209e1051a39Sopenharmony_ci 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a); 210e1051a39Sopenharmony_ci$code.=<<___; 211e1051a39Sopenharmony_ci.byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5 212e1051a39Sopenharmony_ci.byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76 213e1051a39Sopenharmony_ci.byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0 214e1051a39Sopenharmony_ci.byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0 215e1051a39Sopenharmony_ci.byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc 216e1051a39Sopenharmony_ci.byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15 217e1051a39Sopenharmony_ci.byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a 218e1051a39Sopenharmony_ci.byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75 219e1051a39Sopenharmony_ci.byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0 220e1051a39Sopenharmony_ci.byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84 221e1051a39Sopenharmony_ci.byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b 222e1051a39Sopenharmony_ci.byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf 223e1051a39Sopenharmony_ci.byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85 224e1051a39Sopenharmony_ci.byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8 225e1051a39Sopenharmony_ci.byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5 226e1051a39Sopenharmony_ci.byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2 227e1051a39Sopenharmony_ci.byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17 228e1051a39Sopenharmony_ci.byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73 229e1051a39Sopenharmony_ci.byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88 230e1051a39Sopenharmony_ci.byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb 231e1051a39Sopenharmony_ci.byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c 232e1051a39Sopenharmony_ci.byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79 233e1051a39Sopenharmony_ci.byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9 234e1051a39Sopenharmony_ci.byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08 235e1051a39Sopenharmony_ci.byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6 236e1051a39Sopenharmony_ci.byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a 237e1051a39Sopenharmony_ci.byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e 238e1051a39Sopenharmony_ci.byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e 239e1051a39Sopenharmony_ci.byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94 240e1051a39Sopenharmony_ci.byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf 241e1051a39Sopenharmony_ci.byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68 242e1051a39Sopenharmony_ci.byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 243e1051a39Sopenharmony_ci___ 244e1051a39Sopenharmony_ci&_data_word( 245e1051a39Sopenharmony_ci 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 246e1051a39Sopenharmony_ci 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 247e1051a39Sopenharmony_ci 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 248e1051a39Sopenharmony_ci 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 249e1051a39Sopenharmony_ci 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 250e1051a39Sopenharmony_ci 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 251e1051a39Sopenharmony_ci 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 252e1051a39Sopenharmony_ci 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 253e1051a39Sopenharmony_ci 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 254e1051a39Sopenharmony_ci 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 255e1051a39Sopenharmony_ci 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 256e1051a39Sopenharmony_ci 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 257e1051a39Sopenharmony_ci 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 258e1051a39Sopenharmony_ci 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 259e1051a39Sopenharmony_ci 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 260e1051a39Sopenharmony_ci 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 261e1051a39Sopenharmony_ci 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 262e1051a39Sopenharmony_ci 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 263e1051a39Sopenharmony_ci 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 264e1051a39Sopenharmony_ci 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 265e1051a39Sopenharmony_ci 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 266e1051a39Sopenharmony_ci 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 267e1051a39Sopenharmony_ci 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 268e1051a39Sopenharmony_ci 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 269e1051a39Sopenharmony_ci 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 270e1051a39Sopenharmony_ci 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 271e1051a39Sopenharmony_ci 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 272e1051a39Sopenharmony_ci 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 273e1051a39Sopenharmony_ci 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 274e1051a39Sopenharmony_ci 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 275e1051a39Sopenharmony_ci 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 276e1051a39Sopenharmony_ci 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 277e1051a39Sopenharmony_ci 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 278e1051a39Sopenharmony_ci 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 279e1051a39Sopenharmony_ci 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 280e1051a39Sopenharmony_ci 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 281e1051a39Sopenharmony_ci 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 282e1051a39Sopenharmony_ci 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 283e1051a39Sopenharmony_ci 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 284e1051a39Sopenharmony_ci 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 285e1051a39Sopenharmony_ci 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 286e1051a39Sopenharmony_ci 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 287e1051a39Sopenharmony_ci 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 288e1051a39Sopenharmony_ci 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 289e1051a39Sopenharmony_ci 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 290e1051a39Sopenharmony_ci 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 291e1051a39Sopenharmony_ci 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 292e1051a39Sopenharmony_ci 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 293e1051a39Sopenharmony_ci 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 294e1051a39Sopenharmony_ci 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 295e1051a39Sopenharmony_ci 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 296e1051a39Sopenharmony_ci 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 297e1051a39Sopenharmony_ci 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 298e1051a39Sopenharmony_ci 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 299e1051a39Sopenharmony_ci 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 300e1051a39Sopenharmony_ci 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 301e1051a39Sopenharmony_ci 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 302e1051a39Sopenharmony_ci 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 303e1051a39Sopenharmony_ci 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 304e1051a39Sopenharmony_ci 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 305e1051a39Sopenharmony_ci 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 306e1051a39Sopenharmony_ci 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 307e1051a39Sopenharmony_ci 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 308e1051a39Sopenharmony_ci 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742); 309e1051a39Sopenharmony_ci$code.=<<___; 310e1051a39Sopenharmony_ci.byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38 311e1051a39Sopenharmony_ci.byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb 312e1051a39Sopenharmony_ci.byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87 313e1051a39Sopenharmony_ci.byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb 314e1051a39Sopenharmony_ci.byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d 315e1051a39Sopenharmony_ci.byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e 316e1051a39Sopenharmony_ci.byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2 317e1051a39Sopenharmony_ci.byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25 318e1051a39Sopenharmony_ci.byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16 319e1051a39Sopenharmony_ci.byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92 320e1051a39Sopenharmony_ci.byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda 321e1051a39Sopenharmony_ci.byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84 322e1051a39Sopenharmony_ci.byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a 323e1051a39Sopenharmony_ci.byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06 324e1051a39Sopenharmony_ci.byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02 325e1051a39Sopenharmony_ci.byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b 326e1051a39Sopenharmony_ci.byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea 327e1051a39Sopenharmony_ci.byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73 328e1051a39Sopenharmony_ci.byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85 329e1051a39Sopenharmony_ci.byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e 330e1051a39Sopenharmony_ci.byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89 331e1051a39Sopenharmony_ci.byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b 332e1051a39Sopenharmony_ci.byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20 333e1051a39Sopenharmony_ci.byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4 334e1051a39Sopenharmony_ci.byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31 335e1051a39Sopenharmony_ci.byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f 336e1051a39Sopenharmony_ci.byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d 337e1051a39Sopenharmony_ci.byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef 338e1051a39Sopenharmony_ci.byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0 339e1051a39Sopenharmony_ci.byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61 340e1051a39Sopenharmony_ci.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26 341e1051a39Sopenharmony_ci.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d 342e1051a39Sopenharmony_ci 343e1051a39Sopenharmony_ci 344e1051a39Sopenharmony_ci.globl .AES_encrypt 345e1051a39Sopenharmony_ci.align 7 346e1051a39Sopenharmony_ci.AES_encrypt: 347e1051a39Sopenharmony_ci $STU $sp,-$FRAME($sp) 348e1051a39Sopenharmony_ci mflr r0 349e1051a39Sopenharmony_ci 350e1051a39Sopenharmony_ci $PUSH $out,`$FRAME-$SIZE_T*19`($sp) 351e1051a39Sopenharmony_ci $PUSH r14,`$FRAME-$SIZE_T*18`($sp) 352e1051a39Sopenharmony_ci $PUSH r15,`$FRAME-$SIZE_T*17`($sp) 353e1051a39Sopenharmony_ci $PUSH r16,`$FRAME-$SIZE_T*16`($sp) 354e1051a39Sopenharmony_ci $PUSH r17,`$FRAME-$SIZE_T*15`($sp) 355e1051a39Sopenharmony_ci $PUSH r18,`$FRAME-$SIZE_T*14`($sp) 356e1051a39Sopenharmony_ci $PUSH r19,`$FRAME-$SIZE_T*13`($sp) 357e1051a39Sopenharmony_ci $PUSH r20,`$FRAME-$SIZE_T*12`($sp) 358e1051a39Sopenharmony_ci $PUSH r21,`$FRAME-$SIZE_T*11`($sp) 359e1051a39Sopenharmony_ci $PUSH r22,`$FRAME-$SIZE_T*10`($sp) 360e1051a39Sopenharmony_ci $PUSH r23,`$FRAME-$SIZE_T*9`($sp) 361e1051a39Sopenharmony_ci $PUSH r24,`$FRAME-$SIZE_T*8`($sp) 362e1051a39Sopenharmony_ci $PUSH r25,`$FRAME-$SIZE_T*7`($sp) 363e1051a39Sopenharmony_ci $PUSH r26,`$FRAME-$SIZE_T*6`($sp) 364e1051a39Sopenharmony_ci $PUSH r27,`$FRAME-$SIZE_T*5`($sp) 365e1051a39Sopenharmony_ci $PUSH r28,`$FRAME-$SIZE_T*4`($sp) 366e1051a39Sopenharmony_ci $PUSH r29,`$FRAME-$SIZE_T*3`($sp) 367e1051a39Sopenharmony_ci $PUSH r30,`$FRAME-$SIZE_T*2`($sp) 368e1051a39Sopenharmony_ci $PUSH r31,`$FRAME-$SIZE_T*1`($sp) 369e1051a39Sopenharmony_ci $PUSH r0,`$FRAME+$LRSAVE`($sp) 370e1051a39Sopenharmony_ci 371e1051a39Sopenharmony_ci andi. $t0,$inp,3 372e1051a39Sopenharmony_ci andi. $t1,$out,3 373e1051a39Sopenharmony_ci or. $t0,$t0,$t1 374e1051a39Sopenharmony_ci bne Lenc_unaligned 375e1051a39Sopenharmony_ci 376e1051a39Sopenharmony_ciLenc_unaligned_ok: 377e1051a39Sopenharmony_ci___ 378e1051a39Sopenharmony_ci$code.=<<___ if (!$LITTLE_ENDIAN); 379e1051a39Sopenharmony_ci lwz $s0,0($inp) 380e1051a39Sopenharmony_ci lwz $s1,4($inp) 381e1051a39Sopenharmony_ci lwz $s2,8($inp) 382e1051a39Sopenharmony_ci lwz $s3,12($inp) 383e1051a39Sopenharmony_ci___ 384e1051a39Sopenharmony_ci$code.=<<___ if ($LITTLE_ENDIAN); 385e1051a39Sopenharmony_ci lwz $t0,0($inp) 386e1051a39Sopenharmony_ci lwz $t1,4($inp) 387e1051a39Sopenharmony_ci lwz $t2,8($inp) 388e1051a39Sopenharmony_ci lwz $t3,12($inp) 389e1051a39Sopenharmony_ci rotlwi $s0,$t0,8 390e1051a39Sopenharmony_ci rotlwi $s1,$t1,8 391e1051a39Sopenharmony_ci rotlwi $s2,$t2,8 392e1051a39Sopenharmony_ci rotlwi $s3,$t3,8 393e1051a39Sopenharmony_ci rlwimi $s0,$t0,24,0,7 394e1051a39Sopenharmony_ci rlwimi $s1,$t1,24,0,7 395e1051a39Sopenharmony_ci rlwimi $s2,$t2,24,0,7 396e1051a39Sopenharmony_ci rlwimi $s3,$t3,24,0,7 397e1051a39Sopenharmony_ci rlwimi $s0,$t0,24,16,23 398e1051a39Sopenharmony_ci rlwimi $s1,$t1,24,16,23 399e1051a39Sopenharmony_ci rlwimi $s2,$t2,24,16,23 400e1051a39Sopenharmony_ci rlwimi $s3,$t3,24,16,23 401e1051a39Sopenharmony_ci___ 402e1051a39Sopenharmony_ci$code.=<<___; 403e1051a39Sopenharmony_ci bl LAES_Te 404e1051a39Sopenharmony_ci bl Lppc_AES_encrypt_compact 405e1051a39Sopenharmony_ci $POP $out,`$FRAME-$SIZE_T*19`($sp) 406e1051a39Sopenharmony_ci___ 407e1051a39Sopenharmony_ci$code.=<<___ if ($LITTLE_ENDIAN); 408e1051a39Sopenharmony_ci rotlwi $t0,$s0,8 409e1051a39Sopenharmony_ci rotlwi $t1,$s1,8 410e1051a39Sopenharmony_ci rotlwi $t2,$s2,8 411e1051a39Sopenharmony_ci rotlwi $t3,$s3,8 412e1051a39Sopenharmony_ci rlwimi $t0,$s0,24,0,7 413e1051a39Sopenharmony_ci rlwimi $t1,$s1,24,0,7 414e1051a39Sopenharmony_ci rlwimi $t2,$s2,24,0,7 415e1051a39Sopenharmony_ci rlwimi $t3,$s3,24,0,7 416e1051a39Sopenharmony_ci rlwimi $t0,$s0,24,16,23 417e1051a39Sopenharmony_ci rlwimi $t1,$s1,24,16,23 418e1051a39Sopenharmony_ci rlwimi $t2,$s2,24,16,23 419e1051a39Sopenharmony_ci rlwimi $t3,$s3,24,16,23 420e1051a39Sopenharmony_ci stw $t0,0($out) 421e1051a39Sopenharmony_ci stw $t1,4($out) 422e1051a39Sopenharmony_ci stw $t2,8($out) 423e1051a39Sopenharmony_ci stw $t3,12($out) 424e1051a39Sopenharmony_ci___ 425e1051a39Sopenharmony_ci$code.=<<___ if (!$LITTLE_ENDIAN); 426e1051a39Sopenharmony_ci stw $s0,0($out) 427e1051a39Sopenharmony_ci stw $s1,4($out) 428e1051a39Sopenharmony_ci stw $s2,8($out) 429e1051a39Sopenharmony_ci stw $s3,12($out) 430e1051a39Sopenharmony_ci___ 431e1051a39Sopenharmony_ci$code.=<<___; 432e1051a39Sopenharmony_ci b Lenc_done 433e1051a39Sopenharmony_ci 434e1051a39Sopenharmony_ciLenc_unaligned: 435e1051a39Sopenharmony_ci subfic $t0,$inp,4096 436e1051a39Sopenharmony_ci subfic $t1,$out,4096 437e1051a39Sopenharmony_ci andi. $t0,$t0,4096-16 438e1051a39Sopenharmony_ci beq Lenc_xpage 439e1051a39Sopenharmony_ci andi. $t1,$t1,4096-16 440e1051a39Sopenharmony_ci bne Lenc_unaligned_ok 441e1051a39Sopenharmony_ci 442e1051a39Sopenharmony_ciLenc_xpage: 443e1051a39Sopenharmony_ci lbz $acc00,0($inp) 444e1051a39Sopenharmony_ci lbz $acc01,1($inp) 445e1051a39Sopenharmony_ci lbz $acc02,2($inp) 446e1051a39Sopenharmony_ci lbz $s0,3($inp) 447e1051a39Sopenharmony_ci lbz $acc04,4($inp) 448e1051a39Sopenharmony_ci lbz $acc05,5($inp) 449e1051a39Sopenharmony_ci lbz $acc06,6($inp) 450e1051a39Sopenharmony_ci lbz $s1,7($inp) 451e1051a39Sopenharmony_ci lbz $acc08,8($inp) 452e1051a39Sopenharmony_ci lbz $acc09,9($inp) 453e1051a39Sopenharmony_ci lbz $acc10,10($inp) 454e1051a39Sopenharmony_ci insrwi $s0,$acc00,8,0 455e1051a39Sopenharmony_ci lbz $s2,11($inp) 456e1051a39Sopenharmony_ci insrwi $s1,$acc04,8,0 457e1051a39Sopenharmony_ci lbz $acc12,12($inp) 458e1051a39Sopenharmony_ci insrwi $s0,$acc01,8,8 459e1051a39Sopenharmony_ci lbz $acc13,13($inp) 460e1051a39Sopenharmony_ci insrwi $s1,$acc05,8,8 461e1051a39Sopenharmony_ci lbz $acc14,14($inp) 462e1051a39Sopenharmony_ci insrwi $s0,$acc02,8,16 463e1051a39Sopenharmony_ci lbz $s3,15($inp) 464e1051a39Sopenharmony_ci insrwi $s1,$acc06,8,16 465e1051a39Sopenharmony_ci insrwi $s2,$acc08,8,0 466e1051a39Sopenharmony_ci insrwi $s3,$acc12,8,0 467e1051a39Sopenharmony_ci insrwi $s2,$acc09,8,8 468e1051a39Sopenharmony_ci insrwi $s3,$acc13,8,8 469e1051a39Sopenharmony_ci insrwi $s2,$acc10,8,16 470e1051a39Sopenharmony_ci insrwi $s3,$acc14,8,16 471e1051a39Sopenharmony_ci 472e1051a39Sopenharmony_ci bl LAES_Te 473e1051a39Sopenharmony_ci bl Lppc_AES_encrypt_compact 474e1051a39Sopenharmony_ci $POP $out,`$FRAME-$SIZE_T*19`($sp) 475e1051a39Sopenharmony_ci 476e1051a39Sopenharmony_ci extrwi $acc00,$s0,8,0 477e1051a39Sopenharmony_ci extrwi $acc01,$s0,8,8 478e1051a39Sopenharmony_ci stb $acc00,0($out) 479e1051a39Sopenharmony_ci extrwi $acc02,$s0,8,16 480e1051a39Sopenharmony_ci stb $acc01,1($out) 481e1051a39Sopenharmony_ci stb $acc02,2($out) 482e1051a39Sopenharmony_ci extrwi $acc04,$s1,8,0 483e1051a39Sopenharmony_ci stb $s0,3($out) 484e1051a39Sopenharmony_ci extrwi $acc05,$s1,8,8 485e1051a39Sopenharmony_ci stb $acc04,4($out) 486e1051a39Sopenharmony_ci extrwi $acc06,$s1,8,16 487e1051a39Sopenharmony_ci stb $acc05,5($out) 488e1051a39Sopenharmony_ci stb $acc06,6($out) 489e1051a39Sopenharmony_ci extrwi $acc08,$s2,8,0 490e1051a39Sopenharmony_ci stb $s1,7($out) 491e1051a39Sopenharmony_ci extrwi $acc09,$s2,8,8 492e1051a39Sopenharmony_ci stb $acc08,8($out) 493e1051a39Sopenharmony_ci extrwi $acc10,$s2,8,16 494e1051a39Sopenharmony_ci stb $acc09,9($out) 495e1051a39Sopenharmony_ci stb $acc10,10($out) 496e1051a39Sopenharmony_ci extrwi $acc12,$s3,8,0 497e1051a39Sopenharmony_ci stb $s2,11($out) 498e1051a39Sopenharmony_ci extrwi $acc13,$s3,8,8 499e1051a39Sopenharmony_ci stb $acc12,12($out) 500e1051a39Sopenharmony_ci extrwi $acc14,$s3,8,16 501e1051a39Sopenharmony_ci stb $acc13,13($out) 502e1051a39Sopenharmony_ci stb $acc14,14($out) 503e1051a39Sopenharmony_ci stb $s3,15($out) 504e1051a39Sopenharmony_ci 505e1051a39Sopenharmony_ciLenc_done: 506e1051a39Sopenharmony_ci $POP r0,`$FRAME+$LRSAVE`($sp) 507e1051a39Sopenharmony_ci $POP r14,`$FRAME-$SIZE_T*18`($sp) 508e1051a39Sopenharmony_ci $POP r15,`$FRAME-$SIZE_T*17`($sp) 509e1051a39Sopenharmony_ci $POP r16,`$FRAME-$SIZE_T*16`($sp) 510e1051a39Sopenharmony_ci $POP r17,`$FRAME-$SIZE_T*15`($sp) 511e1051a39Sopenharmony_ci $POP r18,`$FRAME-$SIZE_T*14`($sp) 512e1051a39Sopenharmony_ci $POP r19,`$FRAME-$SIZE_T*13`($sp) 513e1051a39Sopenharmony_ci $POP r20,`$FRAME-$SIZE_T*12`($sp) 514e1051a39Sopenharmony_ci $POP r21,`$FRAME-$SIZE_T*11`($sp) 515e1051a39Sopenharmony_ci $POP r22,`$FRAME-$SIZE_T*10`($sp) 516e1051a39Sopenharmony_ci $POP r23,`$FRAME-$SIZE_T*9`($sp) 517e1051a39Sopenharmony_ci $POP r24,`$FRAME-$SIZE_T*8`($sp) 518e1051a39Sopenharmony_ci $POP r25,`$FRAME-$SIZE_T*7`($sp) 519e1051a39Sopenharmony_ci $POP r26,`$FRAME-$SIZE_T*6`($sp) 520e1051a39Sopenharmony_ci $POP r27,`$FRAME-$SIZE_T*5`($sp) 521e1051a39Sopenharmony_ci $POP r28,`$FRAME-$SIZE_T*4`($sp) 522e1051a39Sopenharmony_ci $POP r29,`$FRAME-$SIZE_T*3`($sp) 523e1051a39Sopenharmony_ci $POP r30,`$FRAME-$SIZE_T*2`($sp) 524e1051a39Sopenharmony_ci $POP r31,`$FRAME-$SIZE_T*1`($sp) 525e1051a39Sopenharmony_ci mtlr r0 526e1051a39Sopenharmony_ci addi $sp,$sp,$FRAME 527e1051a39Sopenharmony_ci blr 528e1051a39Sopenharmony_ci .long 0 529e1051a39Sopenharmony_ci .byte 0,12,4,1,0x80,18,3,0 530e1051a39Sopenharmony_ci .long 0 531e1051a39Sopenharmony_ci 532e1051a39Sopenharmony_ci.align 5 533e1051a39Sopenharmony_ciLppc_AES_encrypt: 534e1051a39Sopenharmony_ci lwz $acc00,240($key) 535e1051a39Sopenharmony_ci addi $Tbl1,$Tbl0,3 536e1051a39Sopenharmony_ci lwz $t0,0($key) 537e1051a39Sopenharmony_ci addi $Tbl2,$Tbl0,2 538e1051a39Sopenharmony_ci lwz $t1,4($key) 539e1051a39Sopenharmony_ci addi $Tbl3,$Tbl0,1 540e1051a39Sopenharmony_ci lwz $t2,8($key) 541e1051a39Sopenharmony_ci addi $acc00,$acc00,-1 542e1051a39Sopenharmony_ci lwz $t3,12($key) 543e1051a39Sopenharmony_ci addi $key,$key,16 544e1051a39Sopenharmony_ci xor $s0,$s0,$t0 545e1051a39Sopenharmony_ci xor $s1,$s1,$t1 546e1051a39Sopenharmony_ci xor $s2,$s2,$t2 547e1051a39Sopenharmony_ci xor $s3,$s3,$t3 548e1051a39Sopenharmony_ci mtctr $acc00 549e1051a39Sopenharmony_ci.align 4 550e1051a39Sopenharmony_ciLenc_loop: 551e1051a39Sopenharmony_ci rlwinm $acc00,$s0,`32-24+3`,21,28 552e1051a39Sopenharmony_ci rlwinm $acc01,$s1,`32-24+3`,21,28 553e1051a39Sopenharmony_ci rlwinm $acc02,$s2,`32-24+3`,21,28 554e1051a39Sopenharmony_ci rlwinm $acc03,$s3,`32-24+3`,21,28 555e1051a39Sopenharmony_ci lwz $t0,0($key) 556e1051a39Sopenharmony_ci rlwinm $acc04,$s1,`32-16+3`,21,28 557e1051a39Sopenharmony_ci lwz $t1,4($key) 558e1051a39Sopenharmony_ci rlwinm $acc05,$s2,`32-16+3`,21,28 559e1051a39Sopenharmony_ci lwz $t2,8($key) 560e1051a39Sopenharmony_ci rlwinm $acc06,$s3,`32-16+3`,21,28 561e1051a39Sopenharmony_ci lwz $t3,12($key) 562e1051a39Sopenharmony_ci rlwinm $acc07,$s0,`32-16+3`,21,28 563e1051a39Sopenharmony_ci lwzx $acc00,$Tbl0,$acc00 564e1051a39Sopenharmony_ci rlwinm $acc08,$s2,`32-8+3`,21,28 565e1051a39Sopenharmony_ci lwzx $acc01,$Tbl0,$acc01 566e1051a39Sopenharmony_ci rlwinm $acc09,$s3,`32-8+3`,21,28 567e1051a39Sopenharmony_ci lwzx $acc02,$Tbl0,$acc02 568e1051a39Sopenharmony_ci rlwinm $acc10,$s0,`32-8+3`,21,28 569e1051a39Sopenharmony_ci lwzx $acc03,$Tbl0,$acc03 570e1051a39Sopenharmony_ci rlwinm $acc11,$s1,`32-8+3`,21,28 571e1051a39Sopenharmony_ci lwzx $acc04,$Tbl1,$acc04 572e1051a39Sopenharmony_ci rlwinm $acc12,$s3,`0+3`,21,28 573e1051a39Sopenharmony_ci lwzx $acc05,$Tbl1,$acc05 574e1051a39Sopenharmony_ci rlwinm $acc13,$s0,`0+3`,21,28 575e1051a39Sopenharmony_ci lwzx $acc06,$Tbl1,$acc06 576e1051a39Sopenharmony_ci rlwinm $acc14,$s1,`0+3`,21,28 577e1051a39Sopenharmony_ci lwzx $acc07,$Tbl1,$acc07 578e1051a39Sopenharmony_ci rlwinm $acc15,$s2,`0+3`,21,28 579e1051a39Sopenharmony_ci lwzx $acc08,$Tbl2,$acc08 580e1051a39Sopenharmony_ci xor $t0,$t0,$acc00 581e1051a39Sopenharmony_ci lwzx $acc09,$Tbl2,$acc09 582e1051a39Sopenharmony_ci xor $t1,$t1,$acc01 583e1051a39Sopenharmony_ci lwzx $acc10,$Tbl2,$acc10 584e1051a39Sopenharmony_ci xor $t2,$t2,$acc02 585e1051a39Sopenharmony_ci lwzx $acc11,$Tbl2,$acc11 586e1051a39Sopenharmony_ci xor $t3,$t3,$acc03 587e1051a39Sopenharmony_ci lwzx $acc12,$Tbl3,$acc12 588e1051a39Sopenharmony_ci xor $t0,$t0,$acc04 589e1051a39Sopenharmony_ci lwzx $acc13,$Tbl3,$acc13 590e1051a39Sopenharmony_ci xor $t1,$t1,$acc05 591e1051a39Sopenharmony_ci lwzx $acc14,$Tbl3,$acc14 592e1051a39Sopenharmony_ci xor $t2,$t2,$acc06 593e1051a39Sopenharmony_ci lwzx $acc15,$Tbl3,$acc15 594e1051a39Sopenharmony_ci xor $t3,$t3,$acc07 595e1051a39Sopenharmony_ci xor $t0,$t0,$acc08 596e1051a39Sopenharmony_ci xor $t1,$t1,$acc09 597e1051a39Sopenharmony_ci xor $t2,$t2,$acc10 598e1051a39Sopenharmony_ci xor $t3,$t3,$acc11 599e1051a39Sopenharmony_ci xor $s0,$t0,$acc12 600e1051a39Sopenharmony_ci xor $s1,$t1,$acc13 601e1051a39Sopenharmony_ci xor $s2,$t2,$acc14 602e1051a39Sopenharmony_ci xor $s3,$t3,$acc15 603e1051a39Sopenharmony_ci addi $key,$key,16 604e1051a39Sopenharmony_ci bdnz Lenc_loop 605e1051a39Sopenharmony_ci 606e1051a39Sopenharmony_ci addi $Tbl2,$Tbl0,2048 607e1051a39Sopenharmony_ci nop 608e1051a39Sopenharmony_ci lwz $t0,0($key) 609e1051a39Sopenharmony_ci rlwinm $acc00,$s0,`32-24`,24,31 610e1051a39Sopenharmony_ci lwz $t1,4($key) 611e1051a39Sopenharmony_ci rlwinm $acc01,$s1,`32-24`,24,31 612e1051a39Sopenharmony_ci lwz $t2,8($key) 613e1051a39Sopenharmony_ci rlwinm $acc02,$s2,`32-24`,24,31 614e1051a39Sopenharmony_ci lwz $t3,12($key) 615e1051a39Sopenharmony_ci rlwinm $acc03,$s3,`32-24`,24,31 616e1051a39Sopenharmony_ci lwz $acc08,`2048+0`($Tbl0) ! prefetch Te4 617e1051a39Sopenharmony_ci rlwinm $acc04,$s1,`32-16`,24,31 618e1051a39Sopenharmony_ci lwz $acc09,`2048+32`($Tbl0) 619e1051a39Sopenharmony_ci rlwinm $acc05,$s2,`32-16`,24,31 620e1051a39Sopenharmony_ci lwz $acc10,`2048+64`($Tbl0) 621e1051a39Sopenharmony_ci rlwinm $acc06,$s3,`32-16`,24,31 622e1051a39Sopenharmony_ci lwz $acc11,`2048+96`($Tbl0) 623e1051a39Sopenharmony_ci rlwinm $acc07,$s0,`32-16`,24,31 624e1051a39Sopenharmony_ci lwz $acc12,`2048+128`($Tbl0) 625e1051a39Sopenharmony_ci rlwinm $acc08,$s2,`32-8`,24,31 626e1051a39Sopenharmony_ci lwz $acc13,`2048+160`($Tbl0) 627e1051a39Sopenharmony_ci rlwinm $acc09,$s3,`32-8`,24,31 628e1051a39Sopenharmony_ci lwz $acc14,`2048+192`($Tbl0) 629e1051a39Sopenharmony_ci rlwinm $acc10,$s0,`32-8`,24,31 630e1051a39Sopenharmony_ci lwz $acc15,`2048+224`($Tbl0) 631e1051a39Sopenharmony_ci rlwinm $acc11,$s1,`32-8`,24,31 632e1051a39Sopenharmony_ci lbzx $acc00,$Tbl2,$acc00 633e1051a39Sopenharmony_ci rlwinm $acc12,$s3,`0`,24,31 634e1051a39Sopenharmony_ci lbzx $acc01,$Tbl2,$acc01 635e1051a39Sopenharmony_ci rlwinm $acc13,$s0,`0`,24,31 636e1051a39Sopenharmony_ci lbzx $acc02,$Tbl2,$acc02 637e1051a39Sopenharmony_ci rlwinm $acc14,$s1,`0`,24,31 638e1051a39Sopenharmony_ci lbzx $acc03,$Tbl2,$acc03 639e1051a39Sopenharmony_ci rlwinm $acc15,$s2,`0`,24,31 640e1051a39Sopenharmony_ci lbzx $acc04,$Tbl2,$acc04 641e1051a39Sopenharmony_ci rlwinm $s0,$acc00,24,0,7 642e1051a39Sopenharmony_ci lbzx $acc05,$Tbl2,$acc05 643e1051a39Sopenharmony_ci rlwinm $s1,$acc01,24,0,7 644e1051a39Sopenharmony_ci lbzx $acc06,$Tbl2,$acc06 645e1051a39Sopenharmony_ci rlwinm $s2,$acc02,24,0,7 646e1051a39Sopenharmony_ci lbzx $acc07,$Tbl2,$acc07 647e1051a39Sopenharmony_ci rlwinm $s3,$acc03,24,0,7 648e1051a39Sopenharmony_ci lbzx $acc08,$Tbl2,$acc08 649e1051a39Sopenharmony_ci rlwimi $s0,$acc04,16,8,15 650e1051a39Sopenharmony_ci lbzx $acc09,$Tbl2,$acc09 651e1051a39Sopenharmony_ci rlwimi $s1,$acc05,16,8,15 652e1051a39Sopenharmony_ci lbzx $acc10,$Tbl2,$acc10 653e1051a39Sopenharmony_ci rlwimi $s2,$acc06,16,8,15 654e1051a39Sopenharmony_ci lbzx $acc11,$Tbl2,$acc11 655e1051a39Sopenharmony_ci rlwimi $s3,$acc07,16,8,15 656e1051a39Sopenharmony_ci lbzx $acc12,$Tbl2,$acc12 657e1051a39Sopenharmony_ci rlwimi $s0,$acc08,8,16,23 658e1051a39Sopenharmony_ci lbzx $acc13,$Tbl2,$acc13 659e1051a39Sopenharmony_ci rlwimi $s1,$acc09,8,16,23 660e1051a39Sopenharmony_ci lbzx $acc14,$Tbl2,$acc14 661e1051a39Sopenharmony_ci rlwimi $s2,$acc10,8,16,23 662e1051a39Sopenharmony_ci lbzx $acc15,$Tbl2,$acc15 663e1051a39Sopenharmony_ci rlwimi $s3,$acc11,8,16,23 664e1051a39Sopenharmony_ci or $s0,$s0,$acc12 665e1051a39Sopenharmony_ci or $s1,$s1,$acc13 666e1051a39Sopenharmony_ci or $s2,$s2,$acc14 667e1051a39Sopenharmony_ci or $s3,$s3,$acc15 668e1051a39Sopenharmony_ci xor $s0,$s0,$t0 669e1051a39Sopenharmony_ci xor $s1,$s1,$t1 670e1051a39Sopenharmony_ci xor $s2,$s2,$t2 671e1051a39Sopenharmony_ci xor $s3,$s3,$t3 672e1051a39Sopenharmony_ci blr 673e1051a39Sopenharmony_ci .long 0 674e1051a39Sopenharmony_ci .byte 0,12,0x14,0,0,0,0,0 675e1051a39Sopenharmony_ci 676e1051a39Sopenharmony_ci.align 4 677e1051a39Sopenharmony_ciLppc_AES_encrypt_compact: 678e1051a39Sopenharmony_ci lwz $acc00,240($key) 679e1051a39Sopenharmony_ci addi $Tbl1,$Tbl0,2048 680e1051a39Sopenharmony_ci lwz $t0,0($key) 681e1051a39Sopenharmony_ci lis $mask80,0x8080 682e1051a39Sopenharmony_ci lwz $t1,4($key) 683e1051a39Sopenharmony_ci lis $mask1b,0x1b1b 684e1051a39Sopenharmony_ci lwz $t2,8($key) 685e1051a39Sopenharmony_ci ori $mask80,$mask80,0x8080 686e1051a39Sopenharmony_ci lwz $t3,12($key) 687e1051a39Sopenharmony_ci ori $mask1b,$mask1b,0x1b1b 688e1051a39Sopenharmony_ci addi $key,$key,16 689e1051a39Sopenharmony_ci mtctr $acc00 690e1051a39Sopenharmony_ci.align 4 691e1051a39Sopenharmony_ciLenc_compact_loop: 692e1051a39Sopenharmony_ci xor $s0,$s0,$t0 693e1051a39Sopenharmony_ci xor $s1,$s1,$t1 694e1051a39Sopenharmony_ci rlwinm $acc00,$s0,`32-24`,24,31 695e1051a39Sopenharmony_ci xor $s2,$s2,$t2 696e1051a39Sopenharmony_ci rlwinm $acc01,$s1,`32-24`,24,31 697e1051a39Sopenharmony_ci xor $s3,$s3,$t3 698e1051a39Sopenharmony_ci rlwinm $acc02,$s2,`32-24`,24,31 699e1051a39Sopenharmony_ci rlwinm $acc03,$s3,`32-24`,24,31 700e1051a39Sopenharmony_ci rlwinm $acc04,$s1,`32-16`,24,31 701e1051a39Sopenharmony_ci rlwinm $acc05,$s2,`32-16`,24,31 702e1051a39Sopenharmony_ci rlwinm $acc06,$s3,`32-16`,24,31 703e1051a39Sopenharmony_ci rlwinm $acc07,$s0,`32-16`,24,31 704e1051a39Sopenharmony_ci lbzx $acc00,$Tbl1,$acc00 705e1051a39Sopenharmony_ci rlwinm $acc08,$s2,`32-8`,24,31 706e1051a39Sopenharmony_ci lbzx $acc01,$Tbl1,$acc01 707e1051a39Sopenharmony_ci rlwinm $acc09,$s3,`32-8`,24,31 708e1051a39Sopenharmony_ci lbzx $acc02,$Tbl1,$acc02 709e1051a39Sopenharmony_ci rlwinm $acc10,$s0,`32-8`,24,31 710e1051a39Sopenharmony_ci lbzx $acc03,$Tbl1,$acc03 711e1051a39Sopenharmony_ci rlwinm $acc11,$s1,`32-8`,24,31 712e1051a39Sopenharmony_ci lbzx $acc04,$Tbl1,$acc04 713e1051a39Sopenharmony_ci rlwinm $acc12,$s3,`0`,24,31 714e1051a39Sopenharmony_ci lbzx $acc05,$Tbl1,$acc05 715e1051a39Sopenharmony_ci rlwinm $acc13,$s0,`0`,24,31 716e1051a39Sopenharmony_ci lbzx $acc06,$Tbl1,$acc06 717e1051a39Sopenharmony_ci rlwinm $acc14,$s1,`0`,24,31 718e1051a39Sopenharmony_ci lbzx $acc07,$Tbl1,$acc07 719e1051a39Sopenharmony_ci rlwinm $acc15,$s2,`0`,24,31 720e1051a39Sopenharmony_ci lbzx $acc08,$Tbl1,$acc08 721e1051a39Sopenharmony_ci rlwinm $s0,$acc00,24,0,7 722e1051a39Sopenharmony_ci lbzx $acc09,$Tbl1,$acc09 723e1051a39Sopenharmony_ci rlwinm $s1,$acc01,24,0,7 724e1051a39Sopenharmony_ci lbzx $acc10,$Tbl1,$acc10 725e1051a39Sopenharmony_ci rlwinm $s2,$acc02,24,0,7 726e1051a39Sopenharmony_ci lbzx $acc11,$Tbl1,$acc11 727e1051a39Sopenharmony_ci rlwinm $s3,$acc03,24,0,7 728e1051a39Sopenharmony_ci lbzx $acc12,$Tbl1,$acc12 729e1051a39Sopenharmony_ci rlwimi $s0,$acc04,16,8,15 730e1051a39Sopenharmony_ci lbzx $acc13,$Tbl1,$acc13 731e1051a39Sopenharmony_ci rlwimi $s1,$acc05,16,8,15 732e1051a39Sopenharmony_ci lbzx $acc14,$Tbl1,$acc14 733e1051a39Sopenharmony_ci rlwimi $s2,$acc06,16,8,15 734e1051a39Sopenharmony_ci lbzx $acc15,$Tbl1,$acc15 735e1051a39Sopenharmony_ci rlwimi $s3,$acc07,16,8,15 736e1051a39Sopenharmony_ci rlwimi $s0,$acc08,8,16,23 737e1051a39Sopenharmony_ci rlwimi $s1,$acc09,8,16,23 738e1051a39Sopenharmony_ci rlwimi $s2,$acc10,8,16,23 739e1051a39Sopenharmony_ci rlwimi $s3,$acc11,8,16,23 740e1051a39Sopenharmony_ci lwz $t0,0($key) 741e1051a39Sopenharmony_ci or $s0,$s0,$acc12 742e1051a39Sopenharmony_ci lwz $t1,4($key) 743e1051a39Sopenharmony_ci or $s1,$s1,$acc13 744e1051a39Sopenharmony_ci lwz $t2,8($key) 745e1051a39Sopenharmony_ci or $s2,$s2,$acc14 746e1051a39Sopenharmony_ci lwz $t3,12($key) 747e1051a39Sopenharmony_ci or $s3,$s3,$acc15 748e1051a39Sopenharmony_ci 749e1051a39Sopenharmony_ci addi $key,$key,16 750e1051a39Sopenharmony_ci bdz Lenc_compact_done 751e1051a39Sopenharmony_ci 752e1051a39Sopenharmony_ci and $acc00,$s0,$mask80 # r1=r0&0x80808080 753e1051a39Sopenharmony_ci and $acc01,$s1,$mask80 754e1051a39Sopenharmony_ci and $acc02,$s2,$mask80 755e1051a39Sopenharmony_ci and $acc03,$s3,$mask80 756e1051a39Sopenharmony_ci srwi $acc04,$acc00,7 # r1>>7 757e1051a39Sopenharmony_ci andc $acc08,$s0,$mask80 # r0&0x7f7f7f7f 758e1051a39Sopenharmony_ci srwi $acc05,$acc01,7 759e1051a39Sopenharmony_ci andc $acc09,$s1,$mask80 760e1051a39Sopenharmony_ci srwi $acc06,$acc02,7 761e1051a39Sopenharmony_ci andc $acc10,$s2,$mask80 762e1051a39Sopenharmony_ci srwi $acc07,$acc03,7 763e1051a39Sopenharmony_ci andc $acc11,$s3,$mask80 764e1051a39Sopenharmony_ci sub $acc00,$acc00,$acc04 # r1-(r1>>7) 765e1051a39Sopenharmony_ci sub $acc01,$acc01,$acc05 766e1051a39Sopenharmony_ci sub $acc02,$acc02,$acc06 767e1051a39Sopenharmony_ci sub $acc03,$acc03,$acc07 768e1051a39Sopenharmony_ci add $acc08,$acc08,$acc08 # (r0&0x7f7f7f7f)<<1 769e1051a39Sopenharmony_ci add $acc09,$acc09,$acc09 770e1051a39Sopenharmony_ci add $acc10,$acc10,$acc10 771e1051a39Sopenharmony_ci add $acc11,$acc11,$acc11 772e1051a39Sopenharmony_ci and $acc00,$acc00,$mask1b # (r1-(r1>>7))&0x1b1b1b1b 773e1051a39Sopenharmony_ci and $acc01,$acc01,$mask1b 774e1051a39Sopenharmony_ci and $acc02,$acc02,$mask1b 775e1051a39Sopenharmony_ci and $acc03,$acc03,$mask1b 776e1051a39Sopenharmony_ci xor $acc00,$acc00,$acc08 # r2 777e1051a39Sopenharmony_ci xor $acc01,$acc01,$acc09 778e1051a39Sopenharmony_ci rotlwi $acc12,$s0,16 # ROTATE(r0,16) 779e1051a39Sopenharmony_ci xor $acc02,$acc02,$acc10 780e1051a39Sopenharmony_ci rotlwi $acc13,$s1,16 781e1051a39Sopenharmony_ci xor $acc03,$acc03,$acc11 782e1051a39Sopenharmony_ci rotlwi $acc14,$s2,16 783e1051a39Sopenharmony_ci 784e1051a39Sopenharmony_ci xor $s0,$s0,$acc00 # r0^r2 785e1051a39Sopenharmony_ci rotlwi $acc15,$s3,16 786e1051a39Sopenharmony_ci xor $s1,$s1,$acc01 787e1051a39Sopenharmony_ci rotrwi $s0,$s0,24 # ROTATE(r2^r0,24) 788e1051a39Sopenharmony_ci xor $s2,$s2,$acc02 789e1051a39Sopenharmony_ci rotrwi $s1,$s1,24 790e1051a39Sopenharmony_ci xor $s3,$s3,$acc03 791e1051a39Sopenharmony_ci rotrwi $s2,$s2,24 792e1051a39Sopenharmony_ci xor $s0,$s0,$acc00 # ROTATE(r2^r0,24)^r2 793e1051a39Sopenharmony_ci rotrwi $s3,$s3,24 794e1051a39Sopenharmony_ci xor $s1,$s1,$acc01 795e1051a39Sopenharmony_ci xor $s2,$s2,$acc02 796e1051a39Sopenharmony_ci xor $s3,$s3,$acc03 797e1051a39Sopenharmony_ci rotlwi $acc08,$acc12,8 # ROTATE(r0,24) 798e1051a39Sopenharmony_ci xor $s0,$s0,$acc12 # 799e1051a39Sopenharmony_ci rotlwi $acc09,$acc13,8 800e1051a39Sopenharmony_ci xor $s1,$s1,$acc13 801e1051a39Sopenharmony_ci rotlwi $acc10,$acc14,8 802e1051a39Sopenharmony_ci xor $s2,$s2,$acc14 803e1051a39Sopenharmony_ci rotlwi $acc11,$acc15,8 804e1051a39Sopenharmony_ci xor $s3,$s3,$acc15 805e1051a39Sopenharmony_ci xor $s0,$s0,$acc08 # 806e1051a39Sopenharmony_ci xor $s1,$s1,$acc09 807e1051a39Sopenharmony_ci xor $s2,$s2,$acc10 808e1051a39Sopenharmony_ci xor $s3,$s3,$acc11 809e1051a39Sopenharmony_ci 810e1051a39Sopenharmony_ci b Lenc_compact_loop 811e1051a39Sopenharmony_ci.align 4 812e1051a39Sopenharmony_ciLenc_compact_done: 813e1051a39Sopenharmony_ci xor $s0,$s0,$t0 814e1051a39Sopenharmony_ci xor $s1,$s1,$t1 815e1051a39Sopenharmony_ci xor $s2,$s2,$t2 816e1051a39Sopenharmony_ci xor $s3,$s3,$t3 817e1051a39Sopenharmony_ci blr 818e1051a39Sopenharmony_ci .long 0 819e1051a39Sopenharmony_ci .byte 0,12,0x14,0,0,0,0,0 820e1051a39Sopenharmony_ci.size .AES_encrypt,.-.AES_encrypt 821e1051a39Sopenharmony_ci 822e1051a39Sopenharmony_ci.globl .AES_decrypt 823e1051a39Sopenharmony_ci.align 7 824e1051a39Sopenharmony_ci.AES_decrypt: 825e1051a39Sopenharmony_ci $STU $sp,-$FRAME($sp) 826e1051a39Sopenharmony_ci mflr r0 827e1051a39Sopenharmony_ci 828e1051a39Sopenharmony_ci $PUSH $out,`$FRAME-$SIZE_T*19`($sp) 829e1051a39Sopenharmony_ci $PUSH r14,`$FRAME-$SIZE_T*18`($sp) 830e1051a39Sopenharmony_ci $PUSH r15,`$FRAME-$SIZE_T*17`($sp) 831e1051a39Sopenharmony_ci $PUSH r16,`$FRAME-$SIZE_T*16`($sp) 832e1051a39Sopenharmony_ci $PUSH r17,`$FRAME-$SIZE_T*15`($sp) 833e1051a39Sopenharmony_ci $PUSH r18,`$FRAME-$SIZE_T*14`($sp) 834e1051a39Sopenharmony_ci $PUSH r19,`$FRAME-$SIZE_T*13`($sp) 835e1051a39Sopenharmony_ci $PUSH r20,`$FRAME-$SIZE_T*12`($sp) 836e1051a39Sopenharmony_ci $PUSH r21,`$FRAME-$SIZE_T*11`($sp) 837e1051a39Sopenharmony_ci $PUSH r22,`$FRAME-$SIZE_T*10`($sp) 838e1051a39Sopenharmony_ci $PUSH r23,`$FRAME-$SIZE_T*9`($sp) 839e1051a39Sopenharmony_ci $PUSH r24,`$FRAME-$SIZE_T*8`($sp) 840e1051a39Sopenharmony_ci $PUSH r25,`$FRAME-$SIZE_T*7`($sp) 841e1051a39Sopenharmony_ci $PUSH r26,`$FRAME-$SIZE_T*6`($sp) 842e1051a39Sopenharmony_ci $PUSH r27,`$FRAME-$SIZE_T*5`($sp) 843e1051a39Sopenharmony_ci $PUSH r28,`$FRAME-$SIZE_T*4`($sp) 844e1051a39Sopenharmony_ci $PUSH r29,`$FRAME-$SIZE_T*3`($sp) 845e1051a39Sopenharmony_ci $PUSH r30,`$FRAME-$SIZE_T*2`($sp) 846e1051a39Sopenharmony_ci $PUSH r31,`$FRAME-$SIZE_T*1`($sp) 847e1051a39Sopenharmony_ci $PUSH r0,`$FRAME+$LRSAVE`($sp) 848e1051a39Sopenharmony_ci 849e1051a39Sopenharmony_ci andi. $t0,$inp,3 850e1051a39Sopenharmony_ci andi. $t1,$out,3 851e1051a39Sopenharmony_ci or. $t0,$t0,$t1 852e1051a39Sopenharmony_ci bne Ldec_unaligned 853e1051a39Sopenharmony_ci 854e1051a39Sopenharmony_ciLdec_unaligned_ok: 855e1051a39Sopenharmony_ci___ 856e1051a39Sopenharmony_ci$code.=<<___ if (!$LITTLE_ENDIAN); 857e1051a39Sopenharmony_ci lwz $s0,0($inp) 858e1051a39Sopenharmony_ci lwz $s1,4($inp) 859e1051a39Sopenharmony_ci lwz $s2,8($inp) 860e1051a39Sopenharmony_ci lwz $s3,12($inp) 861e1051a39Sopenharmony_ci___ 862e1051a39Sopenharmony_ci$code.=<<___ if ($LITTLE_ENDIAN); 863e1051a39Sopenharmony_ci lwz $t0,0($inp) 864e1051a39Sopenharmony_ci lwz $t1,4($inp) 865e1051a39Sopenharmony_ci lwz $t2,8($inp) 866e1051a39Sopenharmony_ci lwz $t3,12($inp) 867e1051a39Sopenharmony_ci rotlwi $s0,$t0,8 868e1051a39Sopenharmony_ci rotlwi $s1,$t1,8 869e1051a39Sopenharmony_ci rotlwi $s2,$t2,8 870e1051a39Sopenharmony_ci rotlwi $s3,$t3,8 871e1051a39Sopenharmony_ci rlwimi $s0,$t0,24,0,7 872e1051a39Sopenharmony_ci rlwimi $s1,$t1,24,0,7 873e1051a39Sopenharmony_ci rlwimi $s2,$t2,24,0,7 874e1051a39Sopenharmony_ci rlwimi $s3,$t3,24,0,7 875e1051a39Sopenharmony_ci rlwimi $s0,$t0,24,16,23 876e1051a39Sopenharmony_ci rlwimi $s1,$t1,24,16,23 877e1051a39Sopenharmony_ci rlwimi $s2,$t2,24,16,23 878e1051a39Sopenharmony_ci rlwimi $s3,$t3,24,16,23 879e1051a39Sopenharmony_ci___ 880e1051a39Sopenharmony_ci$code.=<<___; 881e1051a39Sopenharmony_ci bl LAES_Td 882e1051a39Sopenharmony_ci bl Lppc_AES_decrypt_compact 883e1051a39Sopenharmony_ci $POP $out,`$FRAME-$SIZE_T*19`($sp) 884e1051a39Sopenharmony_ci___ 885e1051a39Sopenharmony_ci$code.=<<___ if ($LITTLE_ENDIAN); 886e1051a39Sopenharmony_ci rotlwi $t0,$s0,8 887e1051a39Sopenharmony_ci rotlwi $t1,$s1,8 888e1051a39Sopenharmony_ci rotlwi $t2,$s2,8 889e1051a39Sopenharmony_ci rotlwi $t3,$s3,8 890e1051a39Sopenharmony_ci rlwimi $t0,$s0,24,0,7 891e1051a39Sopenharmony_ci rlwimi $t1,$s1,24,0,7 892e1051a39Sopenharmony_ci rlwimi $t2,$s2,24,0,7 893e1051a39Sopenharmony_ci rlwimi $t3,$s3,24,0,7 894e1051a39Sopenharmony_ci rlwimi $t0,$s0,24,16,23 895e1051a39Sopenharmony_ci rlwimi $t1,$s1,24,16,23 896e1051a39Sopenharmony_ci rlwimi $t2,$s2,24,16,23 897e1051a39Sopenharmony_ci rlwimi $t3,$s3,24,16,23 898e1051a39Sopenharmony_ci stw $t0,0($out) 899e1051a39Sopenharmony_ci stw $t1,4($out) 900e1051a39Sopenharmony_ci stw $t2,8($out) 901e1051a39Sopenharmony_ci stw $t3,12($out) 902e1051a39Sopenharmony_ci___ 903e1051a39Sopenharmony_ci$code.=<<___ if (!$LITTLE_ENDIAN); 904e1051a39Sopenharmony_ci stw $s0,0($out) 905e1051a39Sopenharmony_ci stw $s1,4($out) 906e1051a39Sopenharmony_ci stw $s2,8($out) 907e1051a39Sopenharmony_ci stw $s3,12($out) 908e1051a39Sopenharmony_ci___ 909e1051a39Sopenharmony_ci$code.=<<___; 910e1051a39Sopenharmony_ci b Ldec_done 911e1051a39Sopenharmony_ci 912e1051a39Sopenharmony_ciLdec_unaligned: 913e1051a39Sopenharmony_ci subfic $t0,$inp,4096 914e1051a39Sopenharmony_ci subfic $t1,$out,4096 915e1051a39Sopenharmony_ci andi. $t0,$t0,4096-16 916e1051a39Sopenharmony_ci beq Ldec_xpage 917e1051a39Sopenharmony_ci andi. $t1,$t1,4096-16 918e1051a39Sopenharmony_ci bne Ldec_unaligned_ok 919e1051a39Sopenharmony_ci 920e1051a39Sopenharmony_ciLdec_xpage: 921e1051a39Sopenharmony_ci lbz $acc00,0($inp) 922e1051a39Sopenharmony_ci lbz $acc01,1($inp) 923e1051a39Sopenharmony_ci lbz $acc02,2($inp) 924e1051a39Sopenharmony_ci lbz $s0,3($inp) 925e1051a39Sopenharmony_ci lbz $acc04,4($inp) 926e1051a39Sopenharmony_ci lbz $acc05,5($inp) 927e1051a39Sopenharmony_ci lbz $acc06,6($inp) 928e1051a39Sopenharmony_ci lbz $s1,7($inp) 929e1051a39Sopenharmony_ci lbz $acc08,8($inp) 930e1051a39Sopenharmony_ci lbz $acc09,9($inp) 931e1051a39Sopenharmony_ci lbz $acc10,10($inp) 932e1051a39Sopenharmony_ci insrwi $s0,$acc00,8,0 933e1051a39Sopenharmony_ci lbz $s2,11($inp) 934e1051a39Sopenharmony_ci insrwi $s1,$acc04,8,0 935e1051a39Sopenharmony_ci lbz $acc12,12($inp) 936e1051a39Sopenharmony_ci insrwi $s0,$acc01,8,8 937e1051a39Sopenharmony_ci lbz $acc13,13($inp) 938e1051a39Sopenharmony_ci insrwi $s1,$acc05,8,8 939e1051a39Sopenharmony_ci lbz $acc14,14($inp) 940e1051a39Sopenharmony_ci insrwi $s0,$acc02,8,16 941e1051a39Sopenharmony_ci lbz $s3,15($inp) 942e1051a39Sopenharmony_ci insrwi $s1,$acc06,8,16 943e1051a39Sopenharmony_ci insrwi $s2,$acc08,8,0 944e1051a39Sopenharmony_ci insrwi $s3,$acc12,8,0 945e1051a39Sopenharmony_ci insrwi $s2,$acc09,8,8 946e1051a39Sopenharmony_ci insrwi $s3,$acc13,8,8 947e1051a39Sopenharmony_ci insrwi $s2,$acc10,8,16 948e1051a39Sopenharmony_ci insrwi $s3,$acc14,8,16 949e1051a39Sopenharmony_ci 950e1051a39Sopenharmony_ci bl LAES_Td 951e1051a39Sopenharmony_ci bl Lppc_AES_decrypt_compact 952e1051a39Sopenharmony_ci $POP $out,`$FRAME-$SIZE_T*19`($sp) 953e1051a39Sopenharmony_ci 954e1051a39Sopenharmony_ci extrwi $acc00,$s0,8,0 955e1051a39Sopenharmony_ci extrwi $acc01,$s0,8,8 956e1051a39Sopenharmony_ci stb $acc00,0($out) 957e1051a39Sopenharmony_ci extrwi $acc02,$s0,8,16 958e1051a39Sopenharmony_ci stb $acc01,1($out) 959e1051a39Sopenharmony_ci stb $acc02,2($out) 960e1051a39Sopenharmony_ci extrwi $acc04,$s1,8,0 961e1051a39Sopenharmony_ci stb $s0,3($out) 962e1051a39Sopenharmony_ci extrwi $acc05,$s1,8,8 963e1051a39Sopenharmony_ci stb $acc04,4($out) 964e1051a39Sopenharmony_ci extrwi $acc06,$s1,8,16 965e1051a39Sopenharmony_ci stb $acc05,5($out) 966e1051a39Sopenharmony_ci stb $acc06,6($out) 967e1051a39Sopenharmony_ci extrwi $acc08,$s2,8,0 968e1051a39Sopenharmony_ci stb $s1,7($out) 969e1051a39Sopenharmony_ci extrwi $acc09,$s2,8,8 970e1051a39Sopenharmony_ci stb $acc08,8($out) 971e1051a39Sopenharmony_ci extrwi $acc10,$s2,8,16 972e1051a39Sopenharmony_ci stb $acc09,9($out) 973e1051a39Sopenharmony_ci stb $acc10,10($out) 974e1051a39Sopenharmony_ci extrwi $acc12,$s3,8,0 975e1051a39Sopenharmony_ci stb $s2,11($out) 976e1051a39Sopenharmony_ci extrwi $acc13,$s3,8,8 977e1051a39Sopenharmony_ci stb $acc12,12($out) 978e1051a39Sopenharmony_ci extrwi $acc14,$s3,8,16 979e1051a39Sopenharmony_ci stb $acc13,13($out) 980e1051a39Sopenharmony_ci stb $acc14,14($out) 981e1051a39Sopenharmony_ci stb $s3,15($out) 982e1051a39Sopenharmony_ci 983e1051a39Sopenharmony_ciLdec_done: 984e1051a39Sopenharmony_ci $POP r0,`$FRAME+$LRSAVE`($sp) 985e1051a39Sopenharmony_ci $POP r14,`$FRAME-$SIZE_T*18`($sp) 986e1051a39Sopenharmony_ci $POP r15,`$FRAME-$SIZE_T*17`($sp) 987e1051a39Sopenharmony_ci $POP r16,`$FRAME-$SIZE_T*16`($sp) 988e1051a39Sopenharmony_ci $POP r17,`$FRAME-$SIZE_T*15`($sp) 989e1051a39Sopenharmony_ci $POP r18,`$FRAME-$SIZE_T*14`($sp) 990e1051a39Sopenharmony_ci $POP r19,`$FRAME-$SIZE_T*13`($sp) 991e1051a39Sopenharmony_ci $POP r20,`$FRAME-$SIZE_T*12`($sp) 992e1051a39Sopenharmony_ci $POP r21,`$FRAME-$SIZE_T*11`($sp) 993e1051a39Sopenharmony_ci $POP r22,`$FRAME-$SIZE_T*10`($sp) 994e1051a39Sopenharmony_ci $POP r23,`$FRAME-$SIZE_T*9`($sp) 995e1051a39Sopenharmony_ci $POP r24,`$FRAME-$SIZE_T*8`($sp) 996e1051a39Sopenharmony_ci $POP r25,`$FRAME-$SIZE_T*7`($sp) 997e1051a39Sopenharmony_ci $POP r26,`$FRAME-$SIZE_T*6`($sp) 998e1051a39Sopenharmony_ci $POP r27,`$FRAME-$SIZE_T*5`($sp) 999e1051a39Sopenharmony_ci $POP r28,`$FRAME-$SIZE_T*4`($sp) 1000e1051a39Sopenharmony_ci $POP r29,`$FRAME-$SIZE_T*3`($sp) 1001e1051a39Sopenharmony_ci $POP r30,`$FRAME-$SIZE_T*2`($sp) 1002e1051a39Sopenharmony_ci $POP r31,`$FRAME-$SIZE_T*1`($sp) 1003e1051a39Sopenharmony_ci mtlr r0 1004e1051a39Sopenharmony_ci addi $sp,$sp,$FRAME 1005e1051a39Sopenharmony_ci blr 1006e1051a39Sopenharmony_ci .long 0 1007e1051a39Sopenharmony_ci .byte 0,12,4,1,0x80,18,3,0 1008e1051a39Sopenharmony_ci .long 0 1009e1051a39Sopenharmony_ci 1010e1051a39Sopenharmony_ci.align 5 1011e1051a39Sopenharmony_ciLppc_AES_decrypt: 1012e1051a39Sopenharmony_ci lwz $acc00,240($key) 1013e1051a39Sopenharmony_ci addi $Tbl1,$Tbl0,3 1014e1051a39Sopenharmony_ci lwz $t0,0($key) 1015e1051a39Sopenharmony_ci addi $Tbl2,$Tbl0,2 1016e1051a39Sopenharmony_ci lwz $t1,4($key) 1017e1051a39Sopenharmony_ci addi $Tbl3,$Tbl0,1 1018e1051a39Sopenharmony_ci lwz $t2,8($key) 1019e1051a39Sopenharmony_ci addi $acc00,$acc00,-1 1020e1051a39Sopenharmony_ci lwz $t3,12($key) 1021e1051a39Sopenharmony_ci addi $key,$key,16 1022e1051a39Sopenharmony_ci xor $s0,$s0,$t0 1023e1051a39Sopenharmony_ci xor $s1,$s1,$t1 1024e1051a39Sopenharmony_ci xor $s2,$s2,$t2 1025e1051a39Sopenharmony_ci xor $s3,$s3,$t3 1026e1051a39Sopenharmony_ci mtctr $acc00 1027e1051a39Sopenharmony_ci.align 4 1028e1051a39Sopenharmony_ciLdec_loop: 1029e1051a39Sopenharmony_ci rlwinm $acc00,$s0,`32-24+3`,21,28 1030e1051a39Sopenharmony_ci rlwinm $acc01,$s1,`32-24+3`,21,28 1031e1051a39Sopenharmony_ci rlwinm $acc02,$s2,`32-24+3`,21,28 1032e1051a39Sopenharmony_ci rlwinm $acc03,$s3,`32-24+3`,21,28 1033e1051a39Sopenharmony_ci lwz $t0,0($key) 1034e1051a39Sopenharmony_ci rlwinm $acc04,$s3,`32-16+3`,21,28 1035e1051a39Sopenharmony_ci lwz $t1,4($key) 1036e1051a39Sopenharmony_ci rlwinm $acc05,$s0,`32-16+3`,21,28 1037e1051a39Sopenharmony_ci lwz $t2,8($key) 1038e1051a39Sopenharmony_ci rlwinm $acc06,$s1,`32-16+3`,21,28 1039e1051a39Sopenharmony_ci lwz $t3,12($key) 1040e1051a39Sopenharmony_ci rlwinm $acc07,$s2,`32-16+3`,21,28 1041e1051a39Sopenharmony_ci lwzx $acc00,$Tbl0,$acc00 1042e1051a39Sopenharmony_ci rlwinm $acc08,$s2,`32-8+3`,21,28 1043e1051a39Sopenharmony_ci lwzx $acc01,$Tbl0,$acc01 1044e1051a39Sopenharmony_ci rlwinm $acc09,$s3,`32-8+3`,21,28 1045e1051a39Sopenharmony_ci lwzx $acc02,$Tbl0,$acc02 1046e1051a39Sopenharmony_ci rlwinm $acc10,$s0,`32-8+3`,21,28 1047e1051a39Sopenharmony_ci lwzx $acc03,$Tbl0,$acc03 1048e1051a39Sopenharmony_ci rlwinm $acc11,$s1,`32-8+3`,21,28 1049e1051a39Sopenharmony_ci lwzx $acc04,$Tbl1,$acc04 1050e1051a39Sopenharmony_ci rlwinm $acc12,$s1,`0+3`,21,28 1051e1051a39Sopenharmony_ci lwzx $acc05,$Tbl1,$acc05 1052e1051a39Sopenharmony_ci rlwinm $acc13,$s2,`0+3`,21,28 1053e1051a39Sopenharmony_ci lwzx $acc06,$Tbl1,$acc06 1054e1051a39Sopenharmony_ci rlwinm $acc14,$s3,`0+3`,21,28 1055e1051a39Sopenharmony_ci lwzx $acc07,$Tbl1,$acc07 1056e1051a39Sopenharmony_ci rlwinm $acc15,$s0,`0+3`,21,28 1057e1051a39Sopenharmony_ci lwzx $acc08,$Tbl2,$acc08 1058e1051a39Sopenharmony_ci xor $t0,$t0,$acc00 1059e1051a39Sopenharmony_ci lwzx $acc09,$Tbl2,$acc09 1060e1051a39Sopenharmony_ci xor $t1,$t1,$acc01 1061e1051a39Sopenharmony_ci lwzx $acc10,$Tbl2,$acc10 1062e1051a39Sopenharmony_ci xor $t2,$t2,$acc02 1063e1051a39Sopenharmony_ci lwzx $acc11,$Tbl2,$acc11 1064e1051a39Sopenharmony_ci xor $t3,$t3,$acc03 1065e1051a39Sopenharmony_ci lwzx $acc12,$Tbl3,$acc12 1066e1051a39Sopenharmony_ci xor $t0,$t0,$acc04 1067e1051a39Sopenharmony_ci lwzx $acc13,$Tbl3,$acc13 1068e1051a39Sopenharmony_ci xor $t1,$t1,$acc05 1069e1051a39Sopenharmony_ci lwzx $acc14,$Tbl3,$acc14 1070e1051a39Sopenharmony_ci xor $t2,$t2,$acc06 1071e1051a39Sopenharmony_ci lwzx $acc15,$Tbl3,$acc15 1072e1051a39Sopenharmony_ci xor $t3,$t3,$acc07 1073e1051a39Sopenharmony_ci xor $t0,$t0,$acc08 1074e1051a39Sopenharmony_ci xor $t1,$t1,$acc09 1075e1051a39Sopenharmony_ci xor $t2,$t2,$acc10 1076e1051a39Sopenharmony_ci xor $t3,$t3,$acc11 1077e1051a39Sopenharmony_ci xor $s0,$t0,$acc12 1078e1051a39Sopenharmony_ci xor $s1,$t1,$acc13 1079e1051a39Sopenharmony_ci xor $s2,$t2,$acc14 1080e1051a39Sopenharmony_ci xor $s3,$t3,$acc15 1081e1051a39Sopenharmony_ci addi $key,$key,16 1082e1051a39Sopenharmony_ci bdnz Ldec_loop 1083e1051a39Sopenharmony_ci 1084e1051a39Sopenharmony_ci addi $Tbl2,$Tbl0,2048 1085e1051a39Sopenharmony_ci nop 1086e1051a39Sopenharmony_ci lwz $t0,0($key) 1087e1051a39Sopenharmony_ci rlwinm $acc00,$s0,`32-24`,24,31 1088e1051a39Sopenharmony_ci lwz $t1,4($key) 1089e1051a39Sopenharmony_ci rlwinm $acc01,$s1,`32-24`,24,31 1090e1051a39Sopenharmony_ci lwz $t2,8($key) 1091e1051a39Sopenharmony_ci rlwinm $acc02,$s2,`32-24`,24,31 1092e1051a39Sopenharmony_ci lwz $t3,12($key) 1093e1051a39Sopenharmony_ci rlwinm $acc03,$s3,`32-24`,24,31 1094e1051a39Sopenharmony_ci lwz $acc08,`2048+0`($Tbl0) ! prefetch Td4 1095e1051a39Sopenharmony_ci rlwinm $acc04,$s3,`32-16`,24,31 1096e1051a39Sopenharmony_ci lwz $acc09,`2048+32`($Tbl0) 1097e1051a39Sopenharmony_ci rlwinm $acc05,$s0,`32-16`,24,31 1098e1051a39Sopenharmony_ci lwz $acc10,`2048+64`($Tbl0) 1099e1051a39Sopenharmony_ci lbzx $acc00,$Tbl2,$acc00 1100e1051a39Sopenharmony_ci lwz $acc11,`2048+96`($Tbl0) 1101e1051a39Sopenharmony_ci lbzx $acc01,$Tbl2,$acc01 1102e1051a39Sopenharmony_ci lwz $acc12,`2048+128`($Tbl0) 1103e1051a39Sopenharmony_ci rlwinm $acc06,$s1,`32-16`,24,31 1104e1051a39Sopenharmony_ci lwz $acc13,`2048+160`($Tbl0) 1105e1051a39Sopenharmony_ci rlwinm $acc07,$s2,`32-16`,24,31 1106e1051a39Sopenharmony_ci lwz $acc14,`2048+192`($Tbl0) 1107e1051a39Sopenharmony_ci rlwinm $acc08,$s2,`32-8`,24,31 1108e1051a39Sopenharmony_ci lwz $acc15,`2048+224`($Tbl0) 1109e1051a39Sopenharmony_ci rlwinm $acc09,$s3,`32-8`,24,31 1110e1051a39Sopenharmony_ci lbzx $acc02,$Tbl2,$acc02 1111e1051a39Sopenharmony_ci rlwinm $acc10,$s0,`32-8`,24,31 1112e1051a39Sopenharmony_ci lbzx $acc03,$Tbl2,$acc03 1113e1051a39Sopenharmony_ci rlwinm $acc11,$s1,`32-8`,24,31 1114e1051a39Sopenharmony_ci lbzx $acc04,$Tbl2,$acc04 1115e1051a39Sopenharmony_ci rlwinm $acc12,$s1,`0`,24,31 1116e1051a39Sopenharmony_ci lbzx $acc05,$Tbl2,$acc05 1117e1051a39Sopenharmony_ci rlwinm $acc13,$s2,`0`,24,31 1118e1051a39Sopenharmony_ci lbzx $acc06,$Tbl2,$acc06 1119e1051a39Sopenharmony_ci rlwinm $acc14,$s3,`0`,24,31 1120e1051a39Sopenharmony_ci lbzx $acc07,$Tbl2,$acc07 1121e1051a39Sopenharmony_ci rlwinm $acc15,$s0,`0`,24,31 1122e1051a39Sopenharmony_ci lbzx $acc08,$Tbl2,$acc08 1123e1051a39Sopenharmony_ci rlwinm $s0,$acc00,24,0,7 1124e1051a39Sopenharmony_ci lbzx $acc09,$Tbl2,$acc09 1125e1051a39Sopenharmony_ci rlwinm $s1,$acc01,24,0,7 1126e1051a39Sopenharmony_ci lbzx $acc10,$Tbl2,$acc10 1127e1051a39Sopenharmony_ci rlwinm $s2,$acc02,24,0,7 1128e1051a39Sopenharmony_ci lbzx $acc11,$Tbl2,$acc11 1129e1051a39Sopenharmony_ci rlwinm $s3,$acc03,24,0,7 1130e1051a39Sopenharmony_ci lbzx $acc12,$Tbl2,$acc12 1131e1051a39Sopenharmony_ci rlwimi $s0,$acc04,16,8,15 1132e1051a39Sopenharmony_ci lbzx $acc13,$Tbl2,$acc13 1133e1051a39Sopenharmony_ci rlwimi $s1,$acc05,16,8,15 1134e1051a39Sopenharmony_ci lbzx $acc14,$Tbl2,$acc14 1135e1051a39Sopenharmony_ci rlwimi $s2,$acc06,16,8,15 1136e1051a39Sopenharmony_ci lbzx $acc15,$Tbl2,$acc15 1137e1051a39Sopenharmony_ci rlwimi $s3,$acc07,16,8,15 1138e1051a39Sopenharmony_ci rlwimi $s0,$acc08,8,16,23 1139e1051a39Sopenharmony_ci rlwimi $s1,$acc09,8,16,23 1140e1051a39Sopenharmony_ci rlwimi $s2,$acc10,8,16,23 1141e1051a39Sopenharmony_ci rlwimi $s3,$acc11,8,16,23 1142e1051a39Sopenharmony_ci or $s0,$s0,$acc12 1143e1051a39Sopenharmony_ci or $s1,$s1,$acc13 1144e1051a39Sopenharmony_ci or $s2,$s2,$acc14 1145e1051a39Sopenharmony_ci or $s3,$s3,$acc15 1146e1051a39Sopenharmony_ci xor $s0,$s0,$t0 1147e1051a39Sopenharmony_ci xor $s1,$s1,$t1 1148e1051a39Sopenharmony_ci xor $s2,$s2,$t2 1149e1051a39Sopenharmony_ci xor $s3,$s3,$t3 1150e1051a39Sopenharmony_ci blr 1151e1051a39Sopenharmony_ci .long 0 1152e1051a39Sopenharmony_ci .byte 0,12,0x14,0,0,0,0,0 1153e1051a39Sopenharmony_ci 1154e1051a39Sopenharmony_ci.align 4 1155e1051a39Sopenharmony_ciLppc_AES_decrypt_compact: 1156e1051a39Sopenharmony_ci lwz $acc00,240($key) 1157e1051a39Sopenharmony_ci addi $Tbl1,$Tbl0,2048 1158e1051a39Sopenharmony_ci lwz $t0,0($key) 1159e1051a39Sopenharmony_ci lis $mask80,0x8080 1160e1051a39Sopenharmony_ci lwz $t1,4($key) 1161e1051a39Sopenharmony_ci lis $mask1b,0x1b1b 1162e1051a39Sopenharmony_ci lwz $t2,8($key) 1163e1051a39Sopenharmony_ci ori $mask80,$mask80,0x8080 1164e1051a39Sopenharmony_ci lwz $t3,12($key) 1165e1051a39Sopenharmony_ci ori $mask1b,$mask1b,0x1b1b 1166e1051a39Sopenharmony_ci addi $key,$key,16 1167e1051a39Sopenharmony_ci___ 1168e1051a39Sopenharmony_ci$code.=<<___ if ($SIZE_T==8); 1169e1051a39Sopenharmony_ci insrdi $mask80,$mask80,32,0 1170e1051a39Sopenharmony_ci insrdi $mask1b,$mask1b,32,0 1171e1051a39Sopenharmony_ci___ 1172e1051a39Sopenharmony_ci$code.=<<___; 1173e1051a39Sopenharmony_ci mtctr $acc00 1174e1051a39Sopenharmony_ci.align 4 1175e1051a39Sopenharmony_ciLdec_compact_loop: 1176e1051a39Sopenharmony_ci xor $s0,$s0,$t0 1177e1051a39Sopenharmony_ci xor $s1,$s1,$t1 1178e1051a39Sopenharmony_ci rlwinm $acc00,$s0,`32-24`,24,31 1179e1051a39Sopenharmony_ci xor $s2,$s2,$t2 1180e1051a39Sopenharmony_ci rlwinm $acc01,$s1,`32-24`,24,31 1181e1051a39Sopenharmony_ci xor $s3,$s3,$t3 1182e1051a39Sopenharmony_ci rlwinm $acc02,$s2,`32-24`,24,31 1183e1051a39Sopenharmony_ci rlwinm $acc03,$s3,`32-24`,24,31 1184e1051a39Sopenharmony_ci rlwinm $acc04,$s3,`32-16`,24,31 1185e1051a39Sopenharmony_ci rlwinm $acc05,$s0,`32-16`,24,31 1186e1051a39Sopenharmony_ci rlwinm $acc06,$s1,`32-16`,24,31 1187e1051a39Sopenharmony_ci rlwinm $acc07,$s2,`32-16`,24,31 1188e1051a39Sopenharmony_ci lbzx $acc00,$Tbl1,$acc00 1189e1051a39Sopenharmony_ci rlwinm $acc08,$s2,`32-8`,24,31 1190e1051a39Sopenharmony_ci lbzx $acc01,$Tbl1,$acc01 1191e1051a39Sopenharmony_ci rlwinm $acc09,$s3,`32-8`,24,31 1192e1051a39Sopenharmony_ci lbzx $acc02,$Tbl1,$acc02 1193e1051a39Sopenharmony_ci rlwinm $acc10,$s0,`32-8`,24,31 1194e1051a39Sopenharmony_ci lbzx $acc03,$Tbl1,$acc03 1195e1051a39Sopenharmony_ci rlwinm $acc11,$s1,`32-8`,24,31 1196e1051a39Sopenharmony_ci lbzx $acc04,$Tbl1,$acc04 1197e1051a39Sopenharmony_ci rlwinm $acc12,$s1,`0`,24,31 1198e1051a39Sopenharmony_ci lbzx $acc05,$Tbl1,$acc05 1199e1051a39Sopenharmony_ci rlwinm $acc13,$s2,`0`,24,31 1200e1051a39Sopenharmony_ci lbzx $acc06,$Tbl1,$acc06 1201e1051a39Sopenharmony_ci rlwinm $acc14,$s3,`0`,24,31 1202e1051a39Sopenharmony_ci lbzx $acc07,$Tbl1,$acc07 1203e1051a39Sopenharmony_ci rlwinm $acc15,$s0,`0`,24,31 1204e1051a39Sopenharmony_ci lbzx $acc08,$Tbl1,$acc08 1205e1051a39Sopenharmony_ci rlwinm $s0,$acc00,24,0,7 1206e1051a39Sopenharmony_ci lbzx $acc09,$Tbl1,$acc09 1207e1051a39Sopenharmony_ci rlwinm $s1,$acc01,24,0,7 1208e1051a39Sopenharmony_ci lbzx $acc10,$Tbl1,$acc10 1209e1051a39Sopenharmony_ci rlwinm $s2,$acc02,24,0,7 1210e1051a39Sopenharmony_ci lbzx $acc11,$Tbl1,$acc11 1211e1051a39Sopenharmony_ci rlwinm $s3,$acc03,24,0,7 1212e1051a39Sopenharmony_ci lbzx $acc12,$Tbl1,$acc12 1213e1051a39Sopenharmony_ci rlwimi $s0,$acc04,16,8,15 1214e1051a39Sopenharmony_ci lbzx $acc13,$Tbl1,$acc13 1215e1051a39Sopenharmony_ci rlwimi $s1,$acc05,16,8,15 1216e1051a39Sopenharmony_ci lbzx $acc14,$Tbl1,$acc14 1217e1051a39Sopenharmony_ci rlwimi $s2,$acc06,16,8,15 1218e1051a39Sopenharmony_ci lbzx $acc15,$Tbl1,$acc15 1219e1051a39Sopenharmony_ci rlwimi $s3,$acc07,16,8,15 1220e1051a39Sopenharmony_ci rlwimi $s0,$acc08,8,16,23 1221e1051a39Sopenharmony_ci rlwimi $s1,$acc09,8,16,23 1222e1051a39Sopenharmony_ci rlwimi $s2,$acc10,8,16,23 1223e1051a39Sopenharmony_ci rlwimi $s3,$acc11,8,16,23 1224e1051a39Sopenharmony_ci lwz $t0,0($key) 1225e1051a39Sopenharmony_ci or $s0,$s0,$acc12 1226e1051a39Sopenharmony_ci lwz $t1,4($key) 1227e1051a39Sopenharmony_ci or $s1,$s1,$acc13 1228e1051a39Sopenharmony_ci lwz $t2,8($key) 1229e1051a39Sopenharmony_ci or $s2,$s2,$acc14 1230e1051a39Sopenharmony_ci lwz $t3,12($key) 1231e1051a39Sopenharmony_ci or $s3,$s3,$acc15 1232e1051a39Sopenharmony_ci 1233e1051a39Sopenharmony_ci addi $key,$key,16 1234e1051a39Sopenharmony_ci bdz Ldec_compact_done 1235e1051a39Sopenharmony_ci___ 1236e1051a39Sopenharmony_ci$code.=<<___ if ($SIZE_T==8); 1237e1051a39Sopenharmony_ci # vectorized permutation improves decrypt performance by 10% 1238e1051a39Sopenharmony_ci insrdi $s0,$s1,32,0 1239e1051a39Sopenharmony_ci insrdi $s2,$s3,32,0 1240e1051a39Sopenharmony_ci 1241e1051a39Sopenharmony_ci and $acc00,$s0,$mask80 # r1=r0&0x80808080 1242e1051a39Sopenharmony_ci and $acc02,$s2,$mask80 1243e1051a39Sopenharmony_ci srdi $acc04,$acc00,7 # r1>>7 1244e1051a39Sopenharmony_ci srdi $acc06,$acc02,7 1245e1051a39Sopenharmony_ci andc $acc08,$s0,$mask80 # r0&0x7f7f7f7f 1246e1051a39Sopenharmony_ci andc $acc10,$s2,$mask80 1247e1051a39Sopenharmony_ci sub $acc00,$acc00,$acc04 # r1-(r1>>7) 1248e1051a39Sopenharmony_ci sub $acc02,$acc02,$acc06 1249e1051a39Sopenharmony_ci add $acc08,$acc08,$acc08 # (r0&0x7f7f7f7f)<<1 1250e1051a39Sopenharmony_ci add $acc10,$acc10,$acc10 1251e1051a39Sopenharmony_ci and $acc00,$acc00,$mask1b # (r1-(r1>>7))&0x1b1b1b1b 1252e1051a39Sopenharmony_ci and $acc02,$acc02,$mask1b 1253e1051a39Sopenharmony_ci xor $acc00,$acc00,$acc08 # r2 1254e1051a39Sopenharmony_ci xor $acc02,$acc02,$acc10 1255e1051a39Sopenharmony_ci 1256e1051a39Sopenharmony_ci and $acc04,$acc00,$mask80 # r1=r2&0x80808080 1257e1051a39Sopenharmony_ci and $acc06,$acc02,$mask80 1258e1051a39Sopenharmony_ci srdi $acc08,$acc04,7 # r1>>7 1259e1051a39Sopenharmony_ci srdi $acc10,$acc06,7 1260e1051a39Sopenharmony_ci andc $acc12,$acc00,$mask80 # r2&0x7f7f7f7f 1261e1051a39Sopenharmony_ci andc $acc14,$acc02,$mask80 1262e1051a39Sopenharmony_ci sub $acc04,$acc04,$acc08 # r1-(r1>>7) 1263e1051a39Sopenharmony_ci sub $acc06,$acc06,$acc10 1264e1051a39Sopenharmony_ci add $acc12,$acc12,$acc12 # (r2&0x7f7f7f7f)<<1 1265e1051a39Sopenharmony_ci add $acc14,$acc14,$acc14 1266e1051a39Sopenharmony_ci and $acc04,$acc04,$mask1b # (r1-(r1>>7))&0x1b1b1b1b 1267e1051a39Sopenharmony_ci and $acc06,$acc06,$mask1b 1268e1051a39Sopenharmony_ci xor $acc04,$acc04,$acc12 # r4 1269e1051a39Sopenharmony_ci xor $acc06,$acc06,$acc14 1270e1051a39Sopenharmony_ci 1271e1051a39Sopenharmony_ci and $acc08,$acc04,$mask80 # r1=r4&0x80808080 1272e1051a39Sopenharmony_ci and $acc10,$acc06,$mask80 1273e1051a39Sopenharmony_ci srdi $acc12,$acc08,7 # r1>>7 1274e1051a39Sopenharmony_ci srdi $acc14,$acc10,7 1275e1051a39Sopenharmony_ci sub $acc08,$acc08,$acc12 # r1-(r1>>7) 1276e1051a39Sopenharmony_ci sub $acc10,$acc10,$acc14 1277e1051a39Sopenharmony_ci andc $acc12,$acc04,$mask80 # r4&0x7f7f7f7f 1278e1051a39Sopenharmony_ci andc $acc14,$acc06,$mask80 1279e1051a39Sopenharmony_ci add $acc12,$acc12,$acc12 # (r4&0x7f7f7f7f)<<1 1280e1051a39Sopenharmony_ci add $acc14,$acc14,$acc14 1281e1051a39Sopenharmony_ci and $acc08,$acc08,$mask1b # (r1-(r1>>7))&0x1b1b1b1b 1282e1051a39Sopenharmony_ci and $acc10,$acc10,$mask1b 1283e1051a39Sopenharmony_ci xor $acc08,$acc08,$acc12 # r8 1284e1051a39Sopenharmony_ci xor $acc10,$acc10,$acc14 1285e1051a39Sopenharmony_ci 1286e1051a39Sopenharmony_ci xor $acc00,$acc00,$s0 # r2^r0 1287e1051a39Sopenharmony_ci xor $acc02,$acc02,$s2 1288e1051a39Sopenharmony_ci xor $acc04,$acc04,$s0 # r4^r0 1289e1051a39Sopenharmony_ci xor $acc06,$acc06,$s2 1290e1051a39Sopenharmony_ci 1291e1051a39Sopenharmony_ci extrdi $acc01,$acc00,32,0 1292e1051a39Sopenharmony_ci extrdi $acc03,$acc02,32,0 1293e1051a39Sopenharmony_ci extrdi $acc05,$acc04,32,0 1294e1051a39Sopenharmony_ci extrdi $acc07,$acc06,32,0 1295e1051a39Sopenharmony_ci extrdi $acc09,$acc08,32,0 1296e1051a39Sopenharmony_ci extrdi $acc11,$acc10,32,0 1297e1051a39Sopenharmony_ci___ 1298e1051a39Sopenharmony_ci$code.=<<___ if ($SIZE_T==4); 1299e1051a39Sopenharmony_ci and $acc00,$s0,$mask80 # r1=r0&0x80808080 1300e1051a39Sopenharmony_ci and $acc01,$s1,$mask80 1301e1051a39Sopenharmony_ci and $acc02,$s2,$mask80 1302e1051a39Sopenharmony_ci and $acc03,$s3,$mask80 1303e1051a39Sopenharmony_ci srwi $acc04,$acc00,7 # r1>>7 1304e1051a39Sopenharmony_ci andc $acc08,$s0,$mask80 # r0&0x7f7f7f7f 1305e1051a39Sopenharmony_ci srwi $acc05,$acc01,7 1306e1051a39Sopenharmony_ci andc $acc09,$s1,$mask80 1307e1051a39Sopenharmony_ci srwi $acc06,$acc02,7 1308e1051a39Sopenharmony_ci andc $acc10,$s2,$mask80 1309e1051a39Sopenharmony_ci srwi $acc07,$acc03,7 1310e1051a39Sopenharmony_ci andc $acc11,$s3,$mask80 1311e1051a39Sopenharmony_ci sub $acc00,$acc00,$acc04 # r1-(r1>>7) 1312e1051a39Sopenharmony_ci sub $acc01,$acc01,$acc05 1313e1051a39Sopenharmony_ci sub $acc02,$acc02,$acc06 1314e1051a39Sopenharmony_ci sub $acc03,$acc03,$acc07 1315e1051a39Sopenharmony_ci add $acc08,$acc08,$acc08 # (r0&0x7f7f7f7f)<<1 1316e1051a39Sopenharmony_ci add $acc09,$acc09,$acc09 1317e1051a39Sopenharmony_ci add $acc10,$acc10,$acc10 1318e1051a39Sopenharmony_ci add $acc11,$acc11,$acc11 1319e1051a39Sopenharmony_ci and $acc00,$acc00,$mask1b # (r1-(r1>>7))&0x1b1b1b1b 1320e1051a39Sopenharmony_ci and $acc01,$acc01,$mask1b 1321e1051a39Sopenharmony_ci and $acc02,$acc02,$mask1b 1322e1051a39Sopenharmony_ci and $acc03,$acc03,$mask1b 1323e1051a39Sopenharmony_ci xor $acc00,$acc00,$acc08 # r2 1324e1051a39Sopenharmony_ci xor $acc01,$acc01,$acc09 1325e1051a39Sopenharmony_ci xor $acc02,$acc02,$acc10 1326e1051a39Sopenharmony_ci xor $acc03,$acc03,$acc11 1327e1051a39Sopenharmony_ci 1328e1051a39Sopenharmony_ci and $acc04,$acc00,$mask80 # r1=r2&0x80808080 1329e1051a39Sopenharmony_ci and $acc05,$acc01,$mask80 1330e1051a39Sopenharmony_ci and $acc06,$acc02,$mask80 1331e1051a39Sopenharmony_ci and $acc07,$acc03,$mask80 1332e1051a39Sopenharmony_ci srwi $acc08,$acc04,7 # r1>>7 1333e1051a39Sopenharmony_ci andc $acc12,$acc00,$mask80 # r2&0x7f7f7f7f 1334e1051a39Sopenharmony_ci srwi $acc09,$acc05,7 1335e1051a39Sopenharmony_ci andc $acc13,$acc01,$mask80 1336e1051a39Sopenharmony_ci srwi $acc10,$acc06,7 1337e1051a39Sopenharmony_ci andc $acc14,$acc02,$mask80 1338e1051a39Sopenharmony_ci srwi $acc11,$acc07,7 1339e1051a39Sopenharmony_ci andc $acc15,$acc03,$mask80 1340e1051a39Sopenharmony_ci sub $acc04,$acc04,$acc08 # r1-(r1>>7) 1341e1051a39Sopenharmony_ci sub $acc05,$acc05,$acc09 1342e1051a39Sopenharmony_ci sub $acc06,$acc06,$acc10 1343e1051a39Sopenharmony_ci sub $acc07,$acc07,$acc11 1344e1051a39Sopenharmony_ci add $acc12,$acc12,$acc12 # (r2&0x7f7f7f7f)<<1 1345e1051a39Sopenharmony_ci add $acc13,$acc13,$acc13 1346e1051a39Sopenharmony_ci add $acc14,$acc14,$acc14 1347e1051a39Sopenharmony_ci add $acc15,$acc15,$acc15 1348e1051a39Sopenharmony_ci and $acc04,$acc04,$mask1b # (r1-(r1>>7))&0x1b1b1b1b 1349e1051a39Sopenharmony_ci and $acc05,$acc05,$mask1b 1350e1051a39Sopenharmony_ci and $acc06,$acc06,$mask1b 1351e1051a39Sopenharmony_ci and $acc07,$acc07,$mask1b 1352e1051a39Sopenharmony_ci xor $acc04,$acc04,$acc12 # r4 1353e1051a39Sopenharmony_ci xor $acc05,$acc05,$acc13 1354e1051a39Sopenharmony_ci xor $acc06,$acc06,$acc14 1355e1051a39Sopenharmony_ci xor $acc07,$acc07,$acc15 1356e1051a39Sopenharmony_ci 1357e1051a39Sopenharmony_ci and $acc08,$acc04,$mask80 # r1=r4&0x80808080 1358e1051a39Sopenharmony_ci and $acc09,$acc05,$mask80 1359e1051a39Sopenharmony_ci srwi $acc12,$acc08,7 # r1>>7 1360e1051a39Sopenharmony_ci and $acc10,$acc06,$mask80 1361e1051a39Sopenharmony_ci srwi $acc13,$acc09,7 1362e1051a39Sopenharmony_ci and $acc11,$acc07,$mask80 1363e1051a39Sopenharmony_ci srwi $acc14,$acc10,7 1364e1051a39Sopenharmony_ci sub $acc08,$acc08,$acc12 # r1-(r1>>7) 1365e1051a39Sopenharmony_ci srwi $acc15,$acc11,7 1366e1051a39Sopenharmony_ci sub $acc09,$acc09,$acc13 1367e1051a39Sopenharmony_ci sub $acc10,$acc10,$acc14 1368e1051a39Sopenharmony_ci sub $acc11,$acc11,$acc15 1369e1051a39Sopenharmony_ci andc $acc12,$acc04,$mask80 # r4&0x7f7f7f7f 1370e1051a39Sopenharmony_ci andc $acc13,$acc05,$mask80 1371e1051a39Sopenharmony_ci andc $acc14,$acc06,$mask80 1372e1051a39Sopenharmony_ci andc $acc15,$acc07,$mask80 1373e1051a39Sopenharmony_ci add $acc12,$acc12,$acc12 # (r4&0x7f7f7f7f)<<1 1374e1051a39Sopenharmony_ci add $acc13,$acc13,$acc13 1375e1051a39Sopenharmony_ci add $acc14,$acc14,$acc14 1376e1051a39Sopenharmony_ci add $acc15,$acc15,$acc15 1377e1051a39Sopenharmony_ci and $acc08,$acc08,$mask1b # (r1-(r1>>7))&0x1b1b1b1b 1378e1051a39Sopenharmony_ci and $acc09,$acc09,$mask1b 1379e1051a39Sopenharmony_ci and $acc10,$acc10,$mask1b 1380e1051a39Sopenharmony_ci and $acc11,$acc11,$mask1b 1381e1051a39Sopenharmony_ci xor $acc08,$acc08,$acc12 # r8 1382e1051a39Sopenharmony_ci xor $acc09,$acc09,$acc13 1383e1051a39Sopenharmony_ci xor $acc10,$acc10,$acc14 1384e1051a39Sopenharmony_ci xor $acc11,$acc11,$acc15 1385e1051a39Sopenharmony_ci 1386e1051a39Sopenharmony_ci xor $acc00,$acc00,$s0 # r2^r0 1387e1051a39Sopenharmony_ci xor $acc01,$acc01,$s1 1388e1051a39Sopenharmony_ci xor $acc02,$acc02,$s2 1389e1051a39Sopenharmony_ci xor $acc03,$acc03,$s3 1390e1051a39Sopenharmony_ci xor $acc04,$acc04,$s0 # r4^r0 1391e1051a39Sopenharmony_ci xor $acc05,$acc05,$s1 1392e1051a39Sopenharmony_ci xor $acc06,$acc06,$s2 1393e1051a39Sopenharmony_ci xor $acc07,$acc07,$s3 1394e1051a39Sopenharmony_ci___ 1395e1051a39Sopenharmony_ci$code.=<<___; 1396e1051a39Sopenharmony_ci rotrwi $s0,$s0,8 # = ROTATE(r0,8) 1397e1051a39Sopenharmony_ci rotrwi $s1,$s1,8 1398e1051a39Sopenharmony_ci xor $s0,$s0,$acc00 # ^= r2^r0 1399e1051a39Sopenharmony_ci rotrwi $s2,$s2,8 1400e1051a39Sopenharmony_ci xor $s1,$s1,$acc01 1401e1051a39Sopenharmony_ci rotrwi $s3,$s3,8 1402e1051a39Sopenharmony_ci xor $s2,$s2,$acc02 1403e1051a39Sopenharmony_ci xor $s3,$s3,$acc03 1404e1051a39Sopenharmony_ci xor $acc00,$acc00,$acc08 1405e1051a39Sopenharmony_ci xor $acc01,$acc01,$acc09 1406e1051a39Sopenharmony_ci xor $acc02,$acc02,$acc10 1407e1051a39Sopenharmony_ci xor $acc03,$acc03,$acc11 1408e1051a39Sopenharmony_ci xor $s0,$s0,$acc04 # ^= r4^r0 1409e1051a39Sopenharmony_ci rotrwi $acc00,$acc00,24 1410e1051a39Sopenharmony_ci xor $s1,$s1,$acc05 1411e1051a39Sopenharmony_ci rotrwi $acc01,$acc01,24 1412e1051a39Sopenharmony_ci xor $s2,$s2,$acc06 1413e1051a39Sopenharmony_ci rotrwi $acc02,$acc02,24 1414e1051a39Sopenharmony_ci xor $s3,$s3,$acc07 1415e1051a39Sopenharmony_ci rotrwi $acc03,$acc03,24 1416e1051a39Sopenharmony_ci xor $acc04,$acc04,$acc08 1417e1051a39Sopenharmony_ci xor $acc05,$acc05,$acc09 1418e1051a39Sopenharmony_ci xor $acc06,$acc06,$acc10 1419e1051a39Sopenharmony_ci xor $acc07,$acc07,$acc11 1420e1051a39Sopenharmony_ci xor $s0,$s0,$acc08 # ^= r8 [^((r4^r0)^(r2^r0)=r4^r2)] 1421e1051a39Sopenharmony_ci rotrwi $acc04,$acc04,16 1422e1051a39Sopenharmony_ci xor $s1,$s1,$acc09 1423e1051a39Sopenharmony_ci rotrwi $acc05,$acc05,16 1424e1051a39Sopenharmony_ci xor $s2,$s2,$acc10 1425e1051a39Sopenharmony_ci rotrwi $acc06,$acc06,16 1426e1051a39Sopenharmony_ci xor $s3,$s3,$acc11 1427e1051a39Sopenharmony_ci rotrwi $acc07,$acc07,16 1428e1051a39Sopenharmony_ci xor $s0,$s0,$acc00 # ^= ROTATE(r8^r2^r0,24) 1429e1051a39Sopenharmony_ci rotrwi $acc08,$acc08,8 1430e1051a39Sopenharmony_ci xor $s1,$s1,$acc01 1431e1051a39Sopenharmony_ci rotrwi $acc09,$acc09,8 1432e1051a39Sopenharmony_ci xor $s2,$s2,$acc02 1433e1051a39Sopenharmony_ci rotrwi $acc10,$acc10,8 1434e1051a39Sopenharmony_ci xor $s3,$s3,$acc03 1435e1051a39Sopenharmony_ci rotrwi $acc11,$acc11,8 1436e1051a39Sopenharmony_ci xor $s0,$s0,$acc04 # ^= ROTATE(r8^r4^r0,16) 1437e1051a39Sopenharmony_ci xor $s1,$s1,$acc05 1438e1051a39Sopenharmony_ci xor $s2,$s2,$acc06 1439e1051a39Sopenharmony_ci xor $s3,$s3,$acc07 1440e1051a39Sopenharmony_ci xor $s0,$s0,$acc08 # ^= ROTATE(r8,8) 1441e1051a39Sopenharmony_ci xor $s1,$s1,$acc09 1442e1051a39Sopenharmony_ci xor $s2,$s2,$acc10 1443e1051a39Sopenharmony_ci xor $s3,$s3,$acc11 1444e1051a39Sopenharmony_ci 1445e1051a39Sopenharmony_ci b Ldec_compact_loop 1446e1051a39Sopenharmony_ci.align 4 1447e1051a39Sopenharmony_ciLdec_compact_done: 1448e1051a39Sopenharmony_ci xor $s0,$s0,$t0 1449e1051a39Sopenharmony_ci xor $s1,$s1,$t1 1450e1051a39Sopenharmony_ci xor $s2,$s2,$t2 1451e1051a39Sopenharmony_ci xor $s3,$s3,$t3 1452e1051a39Sopenharmony_ci blr 1453e1051a39Sopenharmony_ci .long 0 1454e1051a39Sopenharmony_ci .byte 0,12,0x14,0,0,0,0,0 1455e1051a39Sopenharmony_ci.size .AES_decrypt,.-.AES_decrypt 1456e1051a39Sopenharmony_ci 1457e1051a39Sopenharmony_ci.asciz "AES for PPC, CRYPTOGAMS by <appro\@openssl.org>" 1458e1051a39Sopenharmony_ci.align 7 1459e1051a39Sopenharmony_ci___ 1460e1051a39Sopenharmony_ci 1461e1051a39Sopenharmony_ci$code =~ s/\`([^\`]*)\`/eval $1/gem; 1462e1051a39Sopenharmony_ciprint $code; 1463e1051a39Sopenharmony_ciclose STDOUT or die "error closing STDOUT: $!"; 1464