1.machine "any" 2 3.text 4 5.align 7 6rcon: 7.byte 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01 8.byte 0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1b 9.byte 0x0c,0x0f,0x0e,0x0d,0x0c,0x0f,0x0e,0x0d,0x0c,0x0f,0x0e,0x0d,0x0c,0x0f,0x0e,0x0d 10.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 11Lconsts: 12 mflr 0 13 bcl 20,31,$+4 14 mflr 6 15 addi 6,6,-0x48 16 mtlr 0 17 blr 18.long 0 19.byte 0,12,0x14,0,0,0,0,0 20.byte 65,69,83,32,102,111,114,32,80,111,119,101,114,73,83,65,32,50,46,48,55,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 21.align 2 22 23.globl aes_hw_set_encrypt_key 24.align 5 25aes_hw_set_encrypt_key: 26Lset_encrypt_key: 27 mflr 11 28 std 11,16(1) 29 30 li 6,-1 31 cmpldi 3,0 32 beq- Lenc_key_abort 33 cmpldi 5,0 34 beq- Lenc_key_abort 35 li 6,-2 36 cmpwi 4,128 37 blt- Lenc_key_abort 38 cmpwi 4,256 39 bgt- Lenc_key_abort 40 andi. 0,4,0x3f 41 bne- Lenc_key_abort 42 43 lis 0,0xfff0 44 mfspr 12,256 45 mtspr 256,0 46 47 bl Lconsts 48 mtlr 11 49 50 neg 9,3 51 lvx 1,0,3 52 addi 3,3,15 53 lvsr 3,0,9 54 li 8,0x20 55 cmpwi 4,192 56 lvx 2,0,3 57 vspltisb 5,0x0f 58 lvx 4,0,6 59 vxor 3,3,5 60 lvx 5,8,6 61 addi 6,6,0x10 62 vperm 1,1,2,3 63 li 7,8 64 vxor 0,0,0 65 mtctr 7 66 67 lvsl 8,0,5 68 vspltisb 9,-1 69 lvx 10,0,5 70 vperm 9,9,0,8 71 72 blt Loop128 73 addi 3,3,8 74 beq L192 75 addi 3,3,8 76 b L256 77 78.align 4 79Loop128: 80 vperm 3,1,1,5 81 vsldoi 6,0,1,12 82 vperm 11,1,1,8 83 vsel 7,10,11,9 84 vor 10,11,11 85 .long 0x10632509 86 stvx 7,0,5 87 addi 5,5,16 88 89 vxor 1,1,6 90 vsldoi 6,0,6,12 91 vxor 1,1,6 92 vsldoi 6,0,6,12 93 vxor 1,1,6 94 vadduwm 4,4,4 95 vxor 1,1,3 96 bc 16,0,Loop128 97 98 lvx 4,0,6 99 100 vperm 3,1,1,5 101 vsldoi 6,0,1,12 102 vperm 11,1,1,8 103 vsel 7,10,11,9 104 vor 10,11,11 105 .long 0x10632509 106 stvx 7,0,5 107 addi 5,5,16 108 109 vxor 1,1,6 110 vsldoi 6,0,6,12 111 vxor 1,1,6 112 vsldoi 6,0,6,12 113 vxor 1,1,6 114 vadduwm 4,4,4 115 vxor 1,1,3 116 117 vperm 3,1,1,5 118 vsldoi 6,0,1,12 119 vperm 11,1,1,8 120 vsel 7,10,11,9 121 vor 10,11,11 122 .long 0x10632509 123 stvx 7,0,5 124 addi 5,5,16 125 126 vxor 1,1,6 127 vsldoi 6,0,6,12 128 vxor 1,1,6 129 vsldoi 6,0,6,12 130 vxor 1,1,6 131 vxor 1,1,3 132 vperm 11,1,1,8 133 vsel 7,10,11,9 134 vor 10,11,11 135 stvx 7,0,5 136 137 addi 3,5,15 138 addi 5,5,0x50 139 140 li 8,10 141 b Ldone 142 143.align 4 144L192: 145 lvx 6,0,3 146 li 7,4 147 vperm 11,1,1,8 148 vsel 7,10,11,9 149 vor 10,11,11 150 stvx 7,0,5 151 addi 5,5,16 152 vperm 2,2,6,3 153 vspltisb 3,8 154 mtctr 7 155 vsububm 5,5,3 156 157Loop192: 158 vperm 3,2,2,5 159 vsldoi 6,0,1,12 160 .long 0x10632509 161 162 vxor 1,1,6 163 vsldoi 6,0,6,12 164 vxor 1,1,6 165 vsldoi 6,0,6,12 166 vxor 1,1,6 167 168 vsldoi 7,0,2,8 169 vspltw 6,1,3 170 vxor 6,6,2 171 vsldoi 2,0,2,12 172 vadduwm 4,4,4 173 vxor 2,2,6 174 vxor 1,1,3 175 vxor 2,2,3 176 vsldoi 7,7,1,8 177 178 vperm 3,2,2,5 179 vsldoi 6,0,1,12 180 vperm 11,7,7,8 181 vsel 7,10,11,9 182 vor 10,11,11 183 .long 0x10632509 184 stvx 7,0,5 185 addi 5,5,16 186 187 vsldoi 7,1,2,8 188 vxor 1,1,6 189 vsldoi 6,0,6,12 190 vperm 11,7,7,8 191 vsel 7,10,11,9 192 vor 10,11,11 193 vxor 1,1,6 194 vsldoi 6,0,6,12 195 vxor 1,1,6 196 stvx 7,0,5 197 addi 5,5,16 198 199 vspltw 6,1,3 200 vxor 6,6,2 201 vsldoi 2,0,2,12 202 vadduwm 4,4,4 203 vxor 2,2,6 204 vxor 1,1,3 205 vxor 2,2,3 206 vperm 11,1,1,8 207 vsel 7,10,11,9 208 vor 10,11,11 209 stvx 7,0,5 210 addi 3,5,15 211 addi 5,5,16 212 bc 16,0,Loop192 213 214 li 8,12 215 addi 5,5,0x20 216 b Ldone 217 218.align 4 219L256: 220 lvx 6,0,3 221 li 7,7 222 li 8,14 223 vperm 11,1,1,8 224 vsel 7,10,11,9 225 vor 10,11,11 226 stvx 7,0,5 227 addi 5,5,16 228 vperm 2,2,6,3 229 mtctr 7 230 231Loop256: 232 vperm 3,2,2,5 233 vsldoi 6,0,1,12 234 vperm 11,2,2,8 235 vsel 7,10,11,9 236 vor 10,11,11 237 .long 0x10632509 238 stvx 7,0,5 239 addi 5,5,16 240 241 vxor 1,1,6 242 vsldoi 6,0,6,12 243 vxor 1,1,6 244 vsldoi 6,0,6,12 245 vxor 1,1,6 246 vadduwm 4,4,4 247 vxor 1,1,3 248 vperm 11,1,1,8 249 vsel 7,10,11,9 250 vor 10,11,11 251 stvx 7,0,5 252 addi 3,5,15 253 addi 5,5,16 254 bdz Ldone 255 256 vspltw 3,1,3 257 vsldoi 6,0,2,12 258 .long 0x106305C8 259 260 vxor 2,2,6 261 vsldoi 6,0,6,12 262 vxor 2,2,6 263 vsldoi 6,0,6,12 264 vxor 2,2,6 265 266 vxor 2,2,3 267 b Loop256 268 269.align 4 270Ldone: 271 lvx 2,0,3 272 vsel 2,10,2,9 273 stvx 2,0,3 274 li 6,0 275 mtspr 256,12 276 stw 8,0(5) 277 278Lenc_key_abort: 279 mr 3,6 280 blr 281.long 0 282.byte 0,12,0x14,1,0,0,3,0 283.long 0 284 285 286.globl aes_hw_set_decrypt_key 287.align 5 288aes_hw_set_decrypt_key: 289 stdu 1,-64(1) 290 mflr 10 291 std 10,64+16(1) 292 bl Lset_encrypt_key 293 mtlr 10 294 295 cmpwi 3,0 296 bne- Ldec_key_abort 297 298 slwi 7,8,4 299 subi 3,5,240 300 srwi 8,8,1 301 add 5,3,7 302 mtctr 8 303 304Ldeckey: 305 lwz 0, 0(3) 306 lwz 6, 4(3) 307 lwz 7, 8(3) 308 lwz 8, 12(3) 309 addi 3,3,16 310 lwz 9, 0(5) 311 lwz 10,4(5) 312 lwz 11,8(5) 313 lwz 12,12(5) 314 stw 0, 0(5) 315 stw 6, 4(5) 316 stw 7, 8(5) 317 stw 8, 12(5) 318 subi 5,5,16 319 stw 9, -16(3) 320 stw 10,-12(3) 321 stw 11,-8(3) 322 stw 12,-4(3) 323 bc 16,0,Ldeckey 324 325 xor 3,3,3 326Ldec_key_abort: 327 addi 1,1,64 328 blr 329.long 0 330.byte 0,12,4,1,0x80,0,3,0 331.long 0 332 333.globl aes_hw_encrypt 334.align 5 335aes_hw_encrypt: 336 lwz 6,240(5) 337 lis 0,0xfc00 338 mfspr 12,256 339 li 7,15 340 mtspr 256,0 341 342 lvx 0,0,3 343 neg 11,4 344 lvx 1,7,3 345 lvsl 2,0,3 346 vspltisb 4,0x0f 347 lvsr 3,0,11 348 vxor 2,2,4 349 li 7,16 350 vperm 0,0,1,2 351 lvx 1,0,5 352 lvsr 5,0,5 353 srwi 6,6,1 354 lvx 2,7,5 355 addi 7,7,16 356 subi 6,6,1 357 vperm 1,2,1,5 358 359 vxor 0,0,1 360 lvx 1,7,5 361 addi 7,7,16 362 mtctr 6 363 364Loop_enc: 365 vperm 2,1,2,5 366 .long 0x10001508 367 lvx 2,7,5 368 addi 7,7,16 369 vperm 1,2,1,5 370 .long 0x10000D08 371 lvx 1,7,5 372 addi 7,7,16 373 bc 16,0,Loop_enc 374 375 vperm 2,1,2,5 376 .long 0x10001508 377 lvx 2,7,5 378 vperm 1,2,1,5 379 .long 0x10000D09 380 381 vspltisb 2,-1 382 vxor 1,1,1 383 li 7,15 384 vperm 2,2,1,3 385 vxor 3,3,4 386 lvx 1,0,4 387 vperm 0,0,0,3 388 vsel 1,1,0,2 389 lvx 4,7,4 390 stvx 1,0,4 391 vsel 0,0,4,2 392 stvx 0,7,4 393 394 mtspr 256,12 395 blr 396.long 0 397.byte 0,12,0x14,0,0,0,3,0 398.long 0 399 400.globl aes_hw_decrypt 401.align 5 402aes_hw_decrypt: 403 lwz 6,240(5) 404 lis 0,0xfc00 405 mfspr 12,256 406 li 7,15 407 mtspr 256,0 408 409 lvx 0,0,3 410 neg 11,4 411 lvx 1,7,3 412 lvsl 2,0,3 413 vspltisb 4,0x0f 414 lvsr 3,0,11 415 vxor 2,2,4 416 li 7,16 417 vperm 0,0,1,2 418 lvx 1,0,5 419 lvsr 5,0,5 420 srwi 6,6,1 421 lvx 2,7,5 422 addi 7,7,16 423 subi 6,6,1 424 vperm 1,2,1,5 425 426 vxor 0,0,1 427 lvx 1,7,5 428 addi 7,7,16 429 mtctr 6 430 431Loop_dec: 432 vperm 2,1,2,5 433 .long 0x10001548 434 lvx 2,7,5 435 addi 7,7,16 436 vperm 1,2,1,5 437 .long 0x10000D48 438 lvx 1,7,5 439 addi 7,7,16 440 bc 16,0,Loop_dec 441 442 vperm 2,1,2,5 443 .long 0x10001548 444 lvx 2,7,5 445 vperm 1,2,1,5 446 .long 0x10000D49 447 448 vspltisb 2,-1 449 vxor 1,1,1 450 li 7,15 451 vperm 2,2,1,3 452 vxor 3,3,4 453 lvx 1,0,4 454 vperm 0,0,0,3 455 vsel 1,1,0,2 456 lvx 4,7,4 457 stvx 1,0,4 458 vsel 0,0,4,2 459 stvx 0,7,4 460 461 mtspr 256,12 462 blr 463.long 0 464.byte 0,12,0x14,0,0,0,3,0 465.long 0 466 467.globl aes_hw_cbc_encrypt 468.align 5 469aes_hw_cbc_encrypt: 470 cmpldi 5,16 471 bclr 14,0 472 473 cmpwi 8,0 474 lis 0,0xffe0 475 mfspr 12,256 476 mtspr 256,0 477 478 li 10,15 479 vxor 0,0,0 480 vspltisb 3,0x0f 481 482 lvx 4,0,7 483 lvsl 6,0,7 484 lvx 5,10,7 485 vxor 6,6,3 486 vperm 4,4,5,6 487 488 neg 11,3 489 lvsr 10,0,6 490 lwz 9,240(6) 491 492 lvsr 6,0,11 493 lvx 5,0,3 494 addi 3,3,15 495 vxor 6,6,3 496 497 lvsl 8,0,4 498 vspltisb 9,-1 499 lvx 7,0,4 500 vperm 9,9,0,8 501 vxor 8,8,3 502 503 srwi 9,9,1 504 li 10,16 505 subi 9,9,1 506 beq Lcbc_dec 507 508Lcbc_enc: 509 vor 2,5,5 510 lvx 5,0,3 511 addi 3,3,16 512 mtctr 9 513 subi 5,5,16 514 515 lvx 0,0,6 516 vperm 2,2,5,6 517 lvx 1,10,6 518 addi 10,10,16 519 vperm 0,1,0,10 520 vxor 2,2,0 521 lvx 0,10,6 522 addi 10,10,16 523 vxor 2,2,4 524 525Loop_cbc_enc: 526 vperm 1,0,1,10 527 .long 0x10420D08 528 lvx 1,10,6 529 addi 10,10,16 530 vperm 0,1,0,10 531 .long 0x10420508 532 lvx 0,10,6 533 addi 10,10,16 534 bc 16,0,Loop_cbc_enc 535 536 vperm 1,0,1,10 537 .long 0x10420D08 538 lvx 1,10,6 539 li 10,16 540 vperm 0,1,0,10 541 .long 0x10820509 542 cmpldi 5,16 543 544 vperm 3,4,4,8 545 vsel 2,7,3,9 546 vor 7,3,3 547 stvx 2,0,4 548 addi 4,4,16 549 bge Lcbc_enc 550 551 b Lcbc_done 552 553.align 4 554Lcbc_dec: 555 cmpldi 5,128 556 bge _aesp8_cbc_decrypt8x 557 vor 3,5,5 558 lvx 5,0,3 559 addi 3,3,16 560 mtctr 9 561 subi 5,5,16 562 563 lvx 0,0,6 564 vperm 3,3,5,6 565 lvx 1,10,6 566 addi 10,10,16 567 vperm 0,1,0,10 568 vxor 2,3,0 569 lvx 0,10,6 570 addi 10,10,16 571 572Loop_cbc_dec: 573 vperm 1,0,1,10 574 .long 0x10420D48 575 lvx 1,10,6 576 addi 10,10,16 577 vperm 0,1,0,10 578 .long 0x10420548 579 lvx 0,10,6 580 addi 10,10,16 581 bc 16,0,Loop_cbc_dec 582 583 vperm 1,0,1,10 584 .long 0x10420D48 585 lvx 1,10,6 586 li 10,16 587 vperm 0,1,0,10 588 .long 0x10420549 589 cmpldi 5,16 590 591 vxor 2,2,4 592 vor 4,3,3 593 vperm 3,2,2,8 594 vsel 2,7,3,9 595 vor 7,3,3 596 stvx 2,0,4 597 addi 4,4,16 598 bge Lcbc_dec 599 600Lcbc_done: 601 addi 4,4,-1 602 lvx 2,0,4 603 vsel 2,7,2,9 604 stvx 2,0,4 605 606 neg 8,7 607 li 10,15 608 vxor 0,0,0 609 vspltisb 9,-1 610 vspltisb 3,0x0f 611 lvsr 8,0,8 612 vperm 9,9,0,8 613 vxor 8,8,3 614 lvx 7,0,7 615 vperm 4,4,4,8 616 vsel 2,7,4,9 617 lvx 5,10,7 618 stvx 2,0,7 619 vsel 2,4,5,9 620 stvx 2,10,7 621 622 mtspr 256,12 623 blr 624.long 0 625.byte 0,12,0x14,0,0,0,6,0 626.long 0 627.align 5 628_aesp8_cbc_decrypt8x: 629 stdu 1,-448(1) 630 li 10,207 631 li 11,223 632 stvx 20,10,1 633 addi 10,10,32 634 stvx 21,11,1 635 addi 11,11,32 636 stvx 22,10,1 637 addi 10,10,32 638 stvx 23,11,1 639 addi 11,11,32 640 stvx 24,10,1 641 addi 10,10,32 642 stvx 25,11,1 643 addi 11,11,32 644 stvx 26,10,1 645 addi 10,10,32 646 stvx 27,11,1 647 addi 11,11,32 648 stvx 28,10,1 649 addi 10,10,32 650 stvx 29,11,1 651 addi 11,11,32 652 stvx 30,10,1 653 stvx 31,11,1 654 li 0,-1 655 stw 12,396(1) 656 li 8,0x10 657 std 26,400(1) 658 li 26,0x20 659 std 27,408(1) 660 li 27,0x30 661 std 28,416(1) 662 li 28,0x40 663 std 29,424(1) 664 li 29,0x50 665 std 30,432(1) 666 li 30,0x60 667 std 31,440(1) 668 li 31,0x70 669 mtspr 256,0 670 671 subi 9,9,3 672 subi 5,5,128 673 674 lvx 23,0,6 675 lvx 30,8,6 676 addi 6,6,0x20 677 lvx 31,0,6 678 vperm 23,30,23,10 679 addi 11,1,64+15 680 mtctr 9 681 682Load_cbc_dec_key: 683 vperm 24,31,30,10 684 lvx 30,8,6 685 addi 6,6,0x20 686 stvx 24,0,11 687 vperm 25,30,31,10 688 lvx 31,0,6 689 stvx 25,8,11 690 addi 11,11,0x20 691 bc 16,0,Load_cbc_dec_key 692 693 lvx 26,8,6 694 vperm 24,31,30,10 695 lvx 27,26,6 696 stvx 24,0,11 697 vperm 25,26,31,10 698 lvx 28,27,6 699 stvx 25,8,11 700 addi 11,1,64+15 701 vperm 26,27,26,10 702 lvx 29,28,6 703 vperm 27,28,27,10 704 lvx 30,29,6 705 vperm 28,29,28,10 706 lvx 31,30,6 707 vperm 29,30,29,10 708 lvx 14,31,6 709 vperm 30,31,30,10 710 lvx 24,0,11 711 vperm 31,14,31,10 712 lvx 25,8,11 713 714 715 716 subi 3,3,15 717 718 li 10,8 719 .long 0x7C001E99 720 lvsl 6,0,10 721 vspltisb 3,0x0f 722 .long 0x7C281E99 723 vxor 6,6,3 724 .long 0x7C5A1E99 725 vperm 0,0,0,6 726 .long 0x7C7B1E99 727 vperm 1,1,1,6 728 .long 0x7D5C1E99 729 vperm 2,2,2,6 730 vxor 14,0,23 731 .long 0x7D7D1E99 732 vperm 3,3,3,6 733 vxor 15,1,23 734 .long 0x7D9E1E99 735 vperm 10,10,10,6 736 vxor 16,2,23 737 .long 0x7DBF1E99 738 addi 3,3,0x80 739 vperm 11,11,11,6 740 vxor 17,3,23 741 vperm 12,12,12,6 742 vxor 18,10,23 743 vperm 13,13,13,6 744 vxor 19,11,23 745 vxor 20,12,23 746 vxor 21,13,23 747 748 mtctr 9 749 b Loop_cbc_dec8x 750.align 5 751Loop_cbc_dec8x: 752 .long 0x11CEC548 753 .long 0x11EFC548 754 .long 0x1210C548 755 .long 0x1231C548 756 .long 0x1252C548 757 .long 0x1273C548 758 .long 0x1294C548 759 .long 0x12B5C548 760 lvx 24,26,11 761 addi 11,11,0x20 762 763 .long 0x11CECD48 764 .long 0x11EFCD48 765 .long 0x1210CD48 766 .long 0x1231CD48 767 .long 0x1252CD48 768 .long 0x1273CD48 769 .long 0x1294CD48 770 .long 0x12B5CD48 771 lvx 25,8,11 772 bc 16,0,Loop_cbc_dec8x 773 774 subic 5,5,128 775 .long 0x11CEC548 776 .long 0x11EFC548 777 .long 0x1210C548 778 .long 0x1231C548 779 .long 0x1252C548 780 .long 0x1273C548 781 .long 0x1294C548 782 .long 0x12B5C548 783 784 subfe. 0,0,0 785 .long 0x11CECD48 786 .long 0x11EFCD48 787 .long 0x1210CD48 788 .long 0x1231CD48 789 .long 0x1252CD48 790 .long 0x1273CD48 791 .long 0x1294CD48 792 .long 0x12B5CD48 793 794 and 0,0,5 795 .long 0x11CED548 796 .long 0x11EFD548 797 .long 0x1210D548 798 .long 0x1231D548 799 .long 0x1252D548 800 .long 0x1273D548 801 .long 0x1294D548 802 .long 0x12B5D548 803 804 add 3,3,0 805 806 807 808 .long 0x11CEDD48 809 .long 0x11EFDD48 810 .long 0x1210DD48 811 .long 0x1231DD48 812 .long 0x1252DD48 813 .long 0x1273DD48 814 .long 0x1294DD48 815 .long 0x12B5DD48 816 817 addi 11,1,64+15 818 .long 0x11CEE548 819 .long 0x11EFE548 820 .long 0x1210E548 821 .long 0x1231E548 822 .long 0x1252E548 823 .long 0x1273E548 824 .long 0x1294E548 825 .long 0x12B5E548 826 lvx 24,0,11 827 828 .long 0x11CEED48 829 .long 0x11EFED48 830 .long 0x1210ED48 831 .long 0x1231ED48 832 .long 0x1252ED48 833 .long 0x1273ED48 834 .long 0x1294ED48 835 .long 0x12B5ED48 836 lvx 25,8,11 837 838 .long 0x11CEF548 839 vxor 4,4,31 840 .long 0x11EFF548 841 vxor 0,0,31 842 .long 0x1210F548 843 vxor 1,1,31 844 .long 0x1231F548 845 vxor 2,2,31 846 .long 0x1252F548 847 vxor 3,3,31 848 .long 0x1273F548 849 vxor 10,10,31 850 .long 0x1294F548 851 vxor 11,11,31 852 .long 0x12B5F548 853 vxor 12,12,31 854 855 .long 0x11CE2549 856 .long 0x11EF0549 857 .long 0x7C001E99 858 .long 0x12100D49 859 .long 0x7C281E99 860 .long 0x12311549 861 vperm 0,0,0,6 862 .long 0x7C5A1E99 863 .long 0x12521D49 864 vperm 1,1,1,6 865 .long 0x7C7B1E99 866 .long 0x12735549 867 vperm 2,2,2,6 868 .long 0x7D5C1E99 869 .long 0x12945D49 870 vperm 3,3,3,6 871 .long 0x7D7D1E99 872 .long 0x12B56549 873 vperm 10,10,10,6 874 .long 0x7D9E1E99 875 vor 4,13,13 876 vperm 11,11,11,6 877 .long 0x7DBF1E99 878 addi 3,3,0x80 879 880 vperm 14,14,14,6 881 vperm 15,15,15,6 882 .long 0x7DC02799 883 vperm 12,12,12,6 884 vxor 14,0,23 885 vperm 16,16,16,6 886 .long 0x7DE82799 887 vperm 13,13,13,6 888 vxor 15,1,23 889 vperm 17,17,17,6 890 .long 0x7E1A2799 891 vxor 16,2,23 892 vperm 18,18,18,6 893 .long 0x7E3B2799 894 vxor 17,3,23 895 vperm 19,19,19,6 896 .long 0x7E5C2799 897 vxor 18,10,23 898 vperm 20,20,20,6 899 .long 0x7E7D2799 900 vxor 19,11,23 901 vperm 21,21,21,6 902 .long 0x7E9E2799 903 vxor 20,12,23 904 .long 0x7EBF2799 905 addi 4,4,0x80 906 vxor 21,13,23 907 908 mtctr 9 909 beq Loop_cbc_dec8x 910 911 addic. 5,5,128 912 beq Lcbc_dec8x_done 913 nop 914 nop 915 916Loop_cbc_dec8x_tail: 917 .long 0x11EFC548 918 .long 0x1210C548 919 .long 0x1231C548 920 .long 0x1252C548 921 .long 0x1273C548 922 .long 0x1294C548 923 .long 0x12B5C548 924 lvx 24,26,11 925 addi 11,11,0x20 926 927 .long 0x11EFCD48 928 .long 0x1210CD48 929 .long 0x1231CD48 930 .long 0x1252CD48 931 .long 0x1273CD48 932 .long 0x1294CD48 933 .long 0x12B5CD48 934 lvx 25,8,11 935 bc 16,0,Loop_cbc_dec8x_tail 936 937 .long 0x11EFC548 938 .long 0x1210C548 939 .long 0x1231C548 940 .long 0x1252C548 941 .long 0x1273C548 942 .long 0x1294C548 943 .long 0x12B5C548 944 945 .long 0x11EFCD48 946 .long 0x1210CD48 947 .long 0x1231CD48 948 .long 0x1252CD48 949 .long 0x1273CD48 950 .long 0x1294CD48 951 .long 0x12B5CD48 952 953 .long 0x11EFD548 954 .long 0x1210D548 955 .long 0x1231D548 956 .long 0x1252D548 957 .long 0x1273D548 958 .long 0x1294D548 959 .long 0x12B5D548 960 961 .long 0x11EFDD48 962 .long 0x1210DD48 963 .long 0x1231DD48 964 .long 0x1252DD48 965 .long 0x1273DD48 966 .long 0x1294DD48 967 .long 0x12B5DD48 968 969 .long 0x11EFE548 970 .long 0x1210E548 971 .long 0x1231E548 972 .long 0x1252E548 973 .long 0x1273E548 974 .long 0x1294E548 975 .long 0x12B5E548 976 977 .long 0x11EFED48 978 .long 0x1210ED48 979 .long 0x1231ED48 980 .long 0x1252ED48 981 .long 0x1273ED48 982 .long 0x1294ED48 983 .long 0x12B5ED48 984 985 .long 0x11EFF548 986 vxor 4,4,31 987 .long 0x1210F548 988 vxor 1,1,31 989 .long 0x1231F548 990 vxor 2,2,31 991 .long 0x1252F548 992 vxor 3,3,31 993 .long 0x1273F548 994 vxor 10,10,31 995 .long 0x1294F548 996 vxor 11,11,31 997 .long 0x12B5F548 998 vxor 12,12,31 999 1000 cmplwi 5,32 1001 blt Lcbc_dec8x_one 1002 nop 1003 beq Lcbc_dec8x_two 1004 cmplwi 5,64 1005 blt Lcbc_dec8x_three 1006 nop 1007 beq Lcbc_dec8x_four 1008 cmplwi 5,96 1009 blt Lcbc_dec8x_five 1010 nop 1011 beq Lcbc_dec8x_six 1012 1013Lcbc_dec8x_seven: 1014 .long 0x11EF2549 1015 .long 0x12100D49 1016 .long 0x12311549 1017 .long 0x12521D49 1018 .long 0x12735549 1019 .long 0x12945D49 1020 .long 0x12B56549 1021 vor 4,13,13 1022 1023 vperm 15,15,15,6 1024 vperm 16,16,16,6 1025 .long 0x7DE02799 1026 vperm 17,17,17,6 1027 .long 0x7E082799 1028 vperm 18,18,18,6 1029 .long 0x7E3A2799 1030 vperm 19,19,19,6 1031 .long 0x7E5B2799 1032 vperm 20,20,20,6 1033 .long 0x7E7C2799 1034 vperm 21,21,21,6 1035 .long 0x7E9D2799 1036 .long 0x7EBE2799 1037 addi 4,4,0x70 1038 b Lcbc_dec8x_done 1039 1040.align 5 1041Lcbc_dec8x_six: 1042 .long 0x12102549 1043 .long 0x12311549 1044 .long 0x12521D49 1045 .long 0x12735549 1046 .long 0x12945D49 1047 .long 0x12B56549 1048 vor 4,13,13 1049 1050 vperm 16,16,16,6 1051 vperm 17,17,17,6 1052 .long 0x7E002799 1053 vperm 18,18,18,6 1054 .long 0x7E282799 1055 vperm 19,19,19,6 1056 .long 0x7E5A2799 1057 vperm 20,20,20,6 1058 .long 0x7E7B2799 1059 vperm 21,21,21,6 1060 .long 0x7E9C2799 1061 .long 0x7EBD2799 1062 addi 4,4,0x60 1063 b Lcbc_dec8x_done 1064 1065.align 5 1066Lcbc_dec8x_five: 1067 .long 0x12312549 1068 .long 0x12521D49 1069 .long 0x12735549 1070 .long 0x12945D49 1071 .long 0x12B56549 1072 vor 4,13,13 1073 1074 vperm 17,17,17,6 1075 vperm 18,18,18,6 1076 .long 0x7E202799 1077 vperm 19,19,19,6 1078 .long 0x7E482799 1079 vperm 20,20,20,6 1080 .long 0x7E7A2799 1081 vperm 21,21,21,6 1082 .long 0x7E9B2799 1083 .long 0x7EBC2799 1084 addi 4,4,0x50 1085 b Lcbc_dec8x_done 1086 1087.align 5 1088Lcbc_dec8x_four: 1089 .long 0x12522549 1090 .long 0x12735549 1091 .long 0x12945D49 1092 .long 0x12B56549 1093 vor 4,13,13 1094 1095 vperm 18,18,18,6 1096 vperm 19,19,19,6 1097 .long 0x7E402799 1098 vperm 20,20,20,6 1099 .long 0x7E682799 1100 vperm 21,21,21,6 1101 .long 0x7E9A2799 1102 .long 0x7EBB2799 1103 addi 4,4,0x40 1104 b Lcbc_dec8x_done 1105 1106.align 5 1107Lcbc_dec8x_three: 1108 .long 0x12732549 1109 .long 0x12945D49 1110 .long 0x12B56549 1111 vor 4,13,13 1112 1113 vperm 19,19,19,6 1114 vperm 20,20,20,6 1115 .long 0x7E602799 1116 vperm 21,21,21,6 1117 .long 0x7E882799 1118 .long 0x7EBA2799 1119 addi 4,4,0x30 1120 b Lcbc_dec8x_done 1121 1122.align 5 1123Lcbc_dec8x_two: 1124 .long 0x12942549 1125 .long 0x12B56549 1126 vor 4,13,13 1127 1128 vperm 20,20,20,6 1129 vperm 21,21,21,6 1130 .long 0x7E802799 1131 .long 0x7EA82799 1132 addi 4,4,0x20 1133 b Lcbc_dec8x_done 1134 1135.align 5 1136Lcbc_dec8x_one: 1137 .long 0x12B52549 1138 vor 4,13,13 1139 1140 vperm 21,21,21,6 1141 .long 0x7EA02799 1142 addi 4,4,0x10 1143 1144Lcbc_dec8x_done: 1145 vperm 4,4,4,6 1146 .long 0x7C803F99 1147 1148 li 10,79 1149 li 11,95 1150 stvx 6,10,1 1151 addi 10,10,32 1152 stvx 6,11,1 1153 addi 11,11,32 1154 stvx 6,10,1 1155 addi 10,10,32 1156 stvx 6,11,1 1157 addi 11,11,32 1158 stvx 6,10,1 1159 addi 10,10,32 1160 stvx 6,11,1 1161 addi 11,11,32 1162 stvx 6,10,1 1163 addi 10,10,32 1164 stvx 6,11,1 1165 addi 11,11,32 1166 1167 mtspr 256,12 1168 lvx 20,10,1 1169 addi 10,10,32 1170 lvx 21,11,1 1171 addi 11,11,32 1172 lvx 22,10,1 1173 addi 10,10,32 1174 lvx 23,11,1 1175 addi 11,11,32 1176 lvx 24,10,1 1177 addi 10,10,32 1178 lvx 25,11,1 1179 addi 11,11,32 1180 lvx 26,10,1 1181 addi 10,10,32 1182 lvx 27,11,1 1183 addi 11,11,32 1184 lvx 28,10,1 1185 addi 10,10,32 1186 lvx 29,11,1 1187 addi 11,11,32 1188 lvx 30,10,1 1189 lvx 31,11,1 1190 ld 26,400(1) 1191 ld 27,408(1) 1192 ld 28,416(1) 1193 ld 29,424(1) 1194 ld 30,432(1) 1195 ld 31,440(1) 1196 addi 1,1,448 1197 blr 1198.long 0 1199.byte 0,12,0x04,0,0x80,6,6,0 1200.long 0 1201 1202.globl aes_hw_ctr32_encrypt_blocks 1203.align 5 1204aes_hw_ctr32_encrypt_blocks: 1205 cmpldi 5,1 1206 bclr 14,0 1207 1208 lis 0,0xfff0 1209 mfspr 12,256 1210 mtspr 256,0 1211 1212 li 10,15 1213 vxor 0,0,0 1214 vspltisb 3,0x0f 1215 1216 lvx 4,0,7 1217 lvsl 6,0,7 1218 lvx 5,10,7 1219 vspltisb 11,1 1220 vxor 6,6,3 1221 vperm 4,4,5,6 1222 vsldoi 11,0,11,1 1223 1224 neg 11,3 1225 lvsr 10,0,6 1226 lwz 9,240(6) 1227 1228 lvsr 6,0,11 1229 lvx 5,0,3 1230 addi 3,3,15 1231 vxor 6,6,3 1232 1233 srwi 9,9,1 1234 li 10,16 1235 subi 9,9,1 1236 1237 cmpldi 5,8 1238 bge _aesp8_ctr32_encrypt8x 1239 1240 lvsl 8,0,4 1241 vspltisb 9,-1 1242 lvx 7,0,4 1243 vperm 9,9,0,8 1244 vxor 8,8,3 1245 1246 lvx 0,0,6 1247 mtctr 9 1248 lvx 1,10,6 1249 addi 10,10,16 1250 vperm 0,1,0,10 1251 vxor 2,4,0 1252 lvx 0,10,6 1253 addi 10,10,16 1254 b Loop_ctr32_enc 1255 1256.align 5 1257Loop_ctr32_enc: 1258 vperm 1,0,1,10 1259 .long 0x10420D08 1260 lvx 1,10,6 1261 addi 10,10,16 1262 vperm 0,1,0,10 1263 .long 0x10420508 1264 lvx 0,10,6 1265 addi 10,10,16 1266 bc 16,0,Loop_ctr32_enc 1267 1268 vadduwm 4,4,11 1269 vor 3,5,5 1270 lvx 5,0,3 1271 addi 3,3,16 1272 subic. 5,5,1 1273 1274 vperm 1,0,1,10 1275 .long 0x10420D08 1276 lvx 1,10,6 1277 vperm 3,3,5,6 1278 li 10,16 1279 vperm 1,1,0,10 1280 lvx 0,0,6 1281 vxor 3,3,1 1282 .long 0x10421D09 1283 1284 lvx 1,10,6 1285 addi 10,10,16 1286 vperm 2,2,2,8 1287 vsel 3,7,2,9 1288 mtctr 9 1289 vperm 0,1,0,10 1290 vor 7,2,2 1291 vxor 2,4,0 1292 lvx 0,10,6 1293 addi 10,10,16 1294 stvx 3,0,4 1295 addi 4,4,16 1296 bne Loop_ctr32_enc 1297 1298 addi 4,4,-1 1299 lvx 2,0,4 1300 vsel 2,7,2,9 1301 stvx 2,0,4 1302 1303 mtspr 256,12 1304 blr 1305.long 0 1306.byte 0,12,0x14,0,0,0,6,0 1307.long 0 1308.align 5 1309_aesp8_ctr32_encrypt8x: 1310 stdu 1,-448(1) 1311 li 10,207 1312 li 11,223 1313 stvx 20,10,1 1314 addi 10,10,32 1315 stvx 21,11,1 1316 addi 11,11,32 1317 stvx 22,10,1 1318 addi 10,10,32 1319 stvx 23,11,1 1320 addi 11,11,32 1321 stvx 24,10,1 1322 addi 10,10,32 1323 stvx 25,11,1 1324 addi 11,11,32 1325 stvx 26,10,1 1326 addi 10,10,32 1327 stvx 27,11,1 1328 addi 11,11,32 1329 stvx 28,10,1 1330 addi 10,10,32 1331 stvx 29,11,1 1332 addi 11,11,32 1333 stvx 30,10,1 1334 stvx 31,11,1 1335 li 0,-1 1336 stw 12,396(1) 1337 li 8,0x10 1338 std 26,400(1) 1339 li 26,0x20 1340 std 27,408(1) 1341 li 27,0x30 1342 std 28,416(1) 1343 li 28,0x40 1344 std 29,424(1) 1345 li 29,0x50 1346 std 30,432(1) 1347 li 30,0x60 1348 std 31,440(1) 1349 li 31,0x70 1350 mtspr 256,0 1351 1352 subi 9,9,3 1353 1354 lvx 23,0,6 1355 lvx 30,8,6 1356 addi 6,6,0x20 1357 lvx 31,0,6 1358 vperm 23,30,23,10 1359 addi 11,1,64+15 1360 mtctr 9 1361 1362Load_ctr32_enc_key: 1363 vperm 24,31,30,10 1364 lvx 30,8,6 1365 addi 6,6,0x20 1366 stvx 24,0,11 1367 vperm 25,30,31,10 1368 lvx 31,0,6 1369 stvx 25,8,11 1370 addi 11,11,0x20 1371 bc 16,0,Load_ctr32_enc_key 1372 1373 lvx 26,8,6 1374 vperm 24,31,30,10 1375 lvx 27,26,6 1376 stvx 24,0,11 1377 vperm 25,26,31,10 1378 lvx 28,27,6 1379 stvx 25,8,11 1380 addi 11,1,64+15 1381 vperm 26,27,26,10 1382 lvx 29,28,6 1383 vperm 27,28,27,10 1384 lvx 30,29,6 1385 vperm 28,29,28,10 1386 lvx 31,30,6 1387 vperm 29,30,29,10 1388 lvx 15,31,6 1389 vperm 30,31,30,10 1390 lvx 24,0,11 1391 vperm 31,15,31,10 1392 lvx 25,8,11 1393 1394 vadduwm 7,11,11 1395 subi 3,3,15 1396 sldi 5,5,4 1397 1398 vadduwm 16,4,11 1399 vadduwm 17,4,7 1400 vxor 15,4,23 1401 li 10,8 1402 vadduwm 18,16,7 1403 vxor 16,16,23 1404 lvsl 6,0,10 1405 vadduwm 19,17,7 1406 vxor 17,17,23 1407 vspltisb 3,0x0f 1408 vadduwm 20,18,7 1409 vxor 18,18,23 1410 vxor 6,6,3 1411 vadduwm 21,19,7 1412 vxor 19,19,23 1413 vadduwm 22,20,7 1414 vxor 20,20,23 1415 vadduwm 4,21,7 1416 vxor 21,21,23 1417 vxor 22,22,23 1418 1419 mtctr 9 1420 b Loop_ctr32_enc8x 1421.align 5 1422Loop_ctr32_enc8x: 1423 .long 0x11EFC508 1424 .long 0x1210C508 1425 .long 0x1231C508 1426 .long 0x1252C508 1427 .long 0x1273C508 1428 .long 0x1294C508 1429 .long 0x12B5C508 1430 .long 0x12D6C508 1431Loop_ctr32_enc8x_middle: 1432 lvx 24,26,11 1433 addi 11,11,0x20 1434 1435 .long 0x11EFCD08 1436 .long 0x1210CD08 1437 .long 0x1231CD08 1438 .long 0x1252CD08 1439 .long 0x1273CD08 1440 .long 0x1294CD08 1441 .long 0x12B5CD08 1442 .long 0x12D6CD08 1443 lvx 25,8,11 1444 bc 16,0,Loop_ctr32_enc8x 1445 1446 subic 11,5,256 1447 .long 0x11EFC508 1448 .long 0x1210C508 1449 .long 0x1231C508 1450 .long 0x1252C508 1451 .long 0x1273C508 1452 .long 0x1294C508 1453 .long 0x12B5C508 1454 .long 0x12D6C508 1455 1456 subfe 0,0,0 1457 .long 0x11EFCD08 1458 .long 0x1210CD08 1459 .long 0x1231CD08 1460 .long 0x1252CD08 1461 .long 0x1273CD08 1462 .long 0x1294CD08 1463 .long 0x12B5CD08 1464 .long 0x12D6CD08 1465 1466 and 0,0,11 1467 addi 11,1,64+15 1468 .long 0x11EFD508 1469 .long 0x1210D508 1470 .long 0x1231D508 1471 .long 0x1252D508 1472 .long 0x1273D508 1473 .long 0x1294D508 1474 .long 0x12B5D508 1475 .long 0x12D6D508 1476 lvx 24,0,11 1477 1478 subic 5,5,129 1479 .long 0x11EFDD08 1480 addi 5,5,1 1481 .long 0x1210DD08 1482 .long 0x1231DD08 1483 .long 0x1252DD08 1484 .long 0x1273DD08 1485 .long 0x1294DD08 1486 .long 0x12B5DD08 1487 .long 0x12D6DD08 1488 lvx 25,8,11 1489 1490 .long 0x11EFE508 1491 .long 0x7C001E99 1492 .long 0x1210E508 1493 .long 0x7C281E99 1494 .long 0x1231E508 1495 .long 0x7C5A1E99 1496 .long 0x1252E508 1497 .long 0x7C7B1E99 1498 .long 0x1273E508 1499 .long 0x7D5C1E99 1500 .long 0x1294E508 1501 .long 0x7D9D1E99 1502 .long 0x12B5E508 1503 .long 0x7DBE1E99 1504 .long 0x12D6E508 1505 .long 0x7DDF1E99 1506 addi 3,3,0x80 1507 1508 .long 0x11EFED08 1509 vperm 0,0,0,6 1510 .long 0x1210ED08 1511 vperm 1,1,1,6 1512 .long 0x1231ED08 1513 vperm 2,2,2,6 1514 .long 0x1252ED08 1515 vperm 3,3,3,6 1516 .long 0x1273ED08 1517 vperm 10,10,10,6 1518 .long 0x1294ED08 1519 vperm 12,12,12,6 1520 .long 0x12B5ED08 1521 vperm 13,13,13,6 1522 .long 0x12D6ED08 1523 vperm 14,14,14,6 1524 1525 add 3,3,0 1526 1527 1528 1529 subfe. 0,0,0 1530 .long 0x11EFF508 1531 vxor 0,0,31 1532 .long 0x1210F508 1533 vxor 1,1,31 1534 .long 0x1231F508 1535 vxor 2,2,31 1536 .long 0x1252F508 1537 vxor 3,3,31 1538 .long 0x1273F508 1539 vxor 10,10,31 1540 .long 0x1294F508 1541 vxor 12,12,31 1542 .long 0x12B5F508 1543 vxor 13,13,31 1544 .long 0x12D6F508 1545 vxor 14,14,31 1546 1547 bne Lctr32_enc8x_break 1548 1549 .long 0x100F0509 1550 .long 0x10300D09 1551 vadduwm 16,4,11 1552 .long 0x10511509 1553 vadduwm 17,4,7 1554 vxor 15,4,23 1555 .long 0x10721D09 1556 vadduwm 18,16,7 1557 vxor 16,16,23 1558 .long 0x11535509 1559 vadduwm 19,17,7 1560 vxor 17,17,23 1561 .long 0x11946509 1562 vadduwm 20,18,7 1563 vxor 18,18,23 1564 .long 0x11B56D09 1565 vadduwm 21,19,7 1566 vxor 19,19,23 1567 .long 0x11D67509 1568 vadduwm 22,20,7 1569 vxor 20,20,23 1570 vperm 0,0,0,6 1571 vadduwm 4,21,7 1572 vxor 21,21,23 1573 vperm 1,1,1,6 1574 vxor 22,22,23 1575 mtctr 9 1576 1577 .long 0x11EFC508 1578 .long 0x7C002799 1579 vperm 2,2,2,6 1580 .long 0x1210C508 1581 .long 0x7C282799 1582 vperm 3,3,3,6 1583 .long 0x1231C508 1584 .long 0x7C5A2799 1585 vperm 10,10,10,6 1586 .long 0x1252C508 1587 .long 0x7C7B2799 1588 vperm 12,12,12,6 1589 .long 0x1273C508 1590 .long 0x7D5C2799 1591 vperm 13,13,13,6 1592 .long 0x1294C508 1593 .long 0x7D9D2799 1594 vperm 14,14,14,6 1595 .long 0x12B5C508 1596 .long 0x7DBE2799 1597 .long 0x12D6C508 1598 .long 0x7DDF2799 1599 addi 4,4,0x80 1600 1601 b Loop_ctr32_enc8x_middle 1602 1603.align 5 1604Lctr32_enc8x_break: 1605 cmpwi 5,-0x60 1606 blt Lctr32_enc8x_one 1607 nop 1608 beq Lctr32_enc8x_two 1609 cmpwi 5,-0x40 1610 blt Lctr32_enc8x_three 1611 nop 1612 beq Lctr32_enc8x_four 1613 cmpwi 5,-0x20 1614 blt Lctr32_enc8x_five 1615 nop 1616 beq Lctr32_enc8x_six 1617 cmpwi 5,0x00 1618 blt Lctr32_enc8x_seven 1619 1620Lctr32_enc8x_eight: 1621 .long 0x11EF0509 1622 .long 0x12100D09 1623 .long 0x12311509 1624 .long 0x12521D09 1625 .long 0x12735509 1626 .long 0x12946509 1627 .long 0x12B56D09 1628 .long 0x12D67509 1629 1630 vperm 15,15,15,6 1631 vperm 16,16,16,6 1632 .long 0x7DE02799 1633 vperm 17,17,17,6 1634 .long 0x7E082799 1635 vperm 18,18,18,6 1636 .long 0x7E3A2799 1637 vperm 19,19,19,6 1638 .long 0x7E5B2799 1639 vperm 20,20,20,6 1640 .long 0x7E7C2799 1641 vperm 21,21,21,6 1642 .long 0x7E9D2799 1643 vperm 22,22,22,6 1644 .long 0x7EBE2799 1645 .long 0x7EDF2799 1646 addi 4,4,0x80 1647 b Lctr32_enc8x_done 1648 1649.align 5 1650Lctr32_enc8x_seven: 1651 .long 0x11EF0D09 1652 .long 0x12101509 1653 .long 0x12311D09 1654 .long 0x12525509 1655 .long 0x12736509 1656 .long 0x12946D09 1657 .long 0x12B57509 1658 1659 vperm 15,15,15,6 1660 vperm 16,16,16,6 1661 .long 0x7DE02799 1662 vperm 17,17,17,6 1663 .long 0x7E082799 1664 vperm 18,18,18,6 1665 .long 0x7E3A2799 1666 vperm 19,19,19,6 1667 .long 0x7E5B2799 1668 vperm 20,20,20,6 1669 .long 0x7E7C2799 1670 vperm 21,21,21,6 1671 .long 0x7E9D2799 1672 .long 0x7EBE2799 1673 addi 4,4,0x70 1674 b Lctr32_enc8x_done 1675 1676.align 5 1677Lctr32_enc8x_six: 1678 .long 0x11EF1509 1679 .long 0x12101D09 1680 .long 0x12315509 1681 .long 0x12526509 1682 .long 0x12736D09 1683 .long 0x12947509 1684 1685 vperm 15,15,15,6 1686 vperm 16,16,16,6 1687 .long 0x7DE02799 1688 vperm 17,17,17,6 1689 .long 0x7E082799 1690 vperm 18,18,18,6 1691 .long 0x7E3A2799 1692 vperm 19,19,19,6 1693 .long 0x7E5B2799 1694 vperm 20,20,20,6 1695 .long 0x7E7C2799 1696 .long 0x7E9D2799 1697 addi 4,4,0x60 1698 b Lctr32_enc8x_done 1699 1700.align 5 1701Lctr32_enc8x_five: 1702 .long 0x11EF1D09 1703 .long 0x12105509 1704 .long 0x12316509 1705 .long 0x12526D09 1706 .long 0x12737509 1707 1708 vperm 15,15,15,6 1709 vperm 16,16,16,6 1710 .long 0x7DE02799 1711 vperm 17,17,17,6 1712 .long 0x7E082799 1713 vperm 18,18,18,6 1714 .long 0x7E3A2799 1715 vperm 19,19,19,6 1716 .long 0x7E5B2799 1717 .long 0x7E7C2799 1718 addi 4,4,0x50 1719 b Lctr32_enc8x_done 1720 1721.align 5 1722Lctr32_enc8x_four: 1723 .long 0x11EF5509 1724 .long 0x12106509 1725 .long 0x12316D09 1726 .long 0x12527509 1727 1728 vperm 15,15,15,6 1729 vperm 16,16,16,6 1730 .long 0x7DE02799 1731 vperm 17,17,17,6 1732 .long 0x7E082799 1733 vperm 18,18,18,6 1734 .long 0x7E3A2799 1735 .long 0x7E5B2799 1736 addi 4,4,0x40 1737 b Lctr32_enc8x_done 1738 1739.align 5 1740Lctr32_enc8x_three: 1741 .long 0x11EF6509 1742 .long 0x12106D09 1743 .long 0x12317509 1744 1745 vperm 15,15,15,6 1746 vperm 16,16,16,6 1747 .long 0x7DE02799 1748 vperm 17,17,17,6 1749 .long 0x7E082799 1750 .long 0x7E3A2799 1751 addi 4,4,0x30 1752 b Lcbc_dec8x_done 1753 1754.align 5 1755Lctr32_enc8x_two: 1756 .long 0x11EF6D09 1757 .long 0x12107509 1758 1759 vperm 15,15,15,6 1760 vperm 16,16,16,6 1761 .long 0x7DE02799 1762 .long 0x7E082799 1763 addi 4,4,0x20 1764 b Lcbc_dec8x_done 1765 1766.align 5 1767Lctr32_enc8x_one: 1768 .long 0x11EF7509 1769 1770 vperm 15,15,15,6 1771 .long 0x7DE02799 1772 addi 4,4,0x10 1773 1774Lctr32_enc8x_done: 1775 li 10,79 1776 li 11,95 1777 stvx 6,10,1 1778 addi 10,10,32 1779 stvx 6,11,1 1780 addi 11,11,32 1781 stvx 6,10,1 1782 addi 10,10,32 1783 stvx 6,11,1 1784 addi 11,11,32 1785 stvx 6,10,1 1786 addi 10,10,32 1787 stvx 6,11,1 1788 addi 11,11,32 1789 stvx 6,10,1 1790 addi 10,10,32 1791 stvx 6,11,1 1792 addi 11,11,32 1793 1794 mtspr 256,12 1795 lvx 20,10,1 1796 addi 10,10,32 1797 lvx 21,11,1 1798 addi 11,11,32 1799 lvx 22,10,1 1800 addi 10,10,32 1801 lvx 23,11,1 1802 addi 11,11,32 1803 lvx 24,10,1 1804 addi 10,10,32 1805 lvx 25,11,1 1806 addi 11,11,32 1807 lvx 26,10,1 1808 addi 10,10,32 1809 lvx 27,11,1 1810 addi 11,11,32 1811 lvx 28,10,1 1812 addi 10,10,32 1813 lvx 29,11,1 1814 addi 11,11,32 1815 lvx 30,10,1 1816 lvx 31,11,1 1817 ld 26,400(1) 1818 ld 27,408(1) 1819 ld 28,416(1) 1820 ld 29,424(1) 1821 ld 30,432(1) 1822 ld 31,440(1) 1823 addi 1,1,448 1824 blr 1825.long 0 1826.byte 0,12,0x04,0,0x80,6,6,0 1827.long 0 1828 1829.globl aes_hw_xts_encrypt 1830.align 5 1831aes_hw_xts_encrypt: 1832 mr 10,3 1833 li 3,-1 1834 cmpldi 5,16 1835 bclr 14,0 1836 1837 lis 0,0xfff0 1838 mfspr 12,256 1839 li 11,0 1840 mtspr 256,0 1841 1842 vspltisb 9,0x07 1843 lvsl 6,11,11 1844 vspltisb 11,0x0f 1845 vxor 6,6,9 1846 1847 li 3,15 1848 lvx 8,0,8 1849 lvsl 5,0,8 1850 lvx 4,3,8 1851 vxor 5,5,11 1852 vperm 8,8,4,5 1853 1854 neg 11,10 1855 lvsr 5,0,11 1856 lvx 2,0,10 1857 addi 10,10,15 1858 vxor 5,5,11 1859 1860 cmpldi 7,0 1861 beq Lxts_enc_no_key2 1862 1863 lvsr 7,0,7 1864 lwz 9,240(7) 1865 srwi 9,9,1 1866 subi 9,9,1 1867 li 3,16 1868 1869 lvx 0,0,7 1870 lvx 1,3,7 1871 addi 3,3,16 1872 vperm 0,1,0,7 1873 vxor 8,8,0 1874 lvx 0,3,7 1875 addi 3,3,16 1876 mtctr 9 1877 1878Ltweak_xts_enc: 1879 vperm 1,0,1,7 1880 .long 0x11080D08 1881 lvx 1,3,7 1882 addi 3,3,16 1883 vperm 0,1,0,7 1884 .long 0x11080508 1885 lvx 0,3,7 1886 addi 3,3,16 1887 bc 16,0,Ltweak_xts_enc 1888 1889 vperm 1,0,1,7 1890 .long 0x11080D08 1891 lvx 1,3,7 1892 vperm 0,1,0,7 1893 .long 0x11080509 1894 1895 li 8,0 1896 b Lxts_enc 1897 1898Lxts_enc_no_key2: 1899 li 3,-16 1900 and 5,5,3 1901 1902 1903Lxts_enc: 1904 lvx 4,0,10 1905 addi 10,10,16 1906 1907 lvsr 7,0,6 1908 lwz 9,240(6) 1909 srwi 9,9,1 1910 subi 9,9,1 1911 li 3,16 1912 1913 vslb 10,9,9 1914 vor 10,10,9 1915 vspltisb 11,1 1916 vsldoi 10,10,11,15 1917 1918 cmpldi 5,96 1919 bge _aesp8_xts_encrypt6x 1920 1921 andi. 7,5,15 1922 subic 0,5,32 1923 subi 7,7,16 1924 subfe 0,0,0 1925 and 0,0,7 1926 add 10,10,0 1927 1928 lvx 0,0,6 1929 lvx 1,3,6 1930 addi 3,3,16 1931 vperm 2,2,4,5 1932 vperm 0,1,0,7 1933 vxor 2,2,8 1934 vxor 2,2,0 1935 lvx 0,3,6 1936 addi 3,3,16 1937 mtctr 9 1938 b Loop_xts_enc 1939 1940.align 5 1941Loop_xts_enc: 1942 vperm 1,0,1,7 1943 .long 0x10420D08 1944 lvx 1,3,6 1945 addi 3,3,16 1946 vperm 0,1,0,7 1947 .long 0x10420508 1948 lvx 0,3,6 1949 addi 3,3,16 1950 bc 16,0,Loop_xts_enc 1951 1952 vperm 1,0,1,7 1953 .long 0x10420D08 1954 lvx 1,3,6 1955 li 3,16 1956 vperm 0,1,0,7 1957 vxor 0,0,8 1958 .long 0x10620509 1959 1960 vperm 11,3,3,6 1961 1962 .long 0x7D602799 1963 1964 addi 4,4,16 1965 1966 subic. 5,5,16 1967 beq Lxts_enc_done 1968 1969 vor 2,4,4 1970 lvx 4,0,10 1971 addi 10,10,16 1972 lvx 0,0,6 1973 lvx 1,3,6 1974 addi 3,3,16 1975 1976 subic 0,5,32 1977 subfe 0,0,0 1978 and 0,0,7 1979 add 10,10,0 1980 1981 vsrab 11,8,9 1982 vaddubm 8,8,8 1983 vsldoi 11,11,11,15 1984 vand 11,11,10 1985 vxor 8,8,11 1986 1987 vperm 2,2,4,5 1988 vperm 0,1,0,7 1989 vxor 2,2,8 1990 vxor 3,3,0 1991 vxor 2,2,0 1992 lvx 0,3,6 1993 addi 3,3,16 1994 1995 mtctr 9 1996 cmpldi 5,16 1997 bge Loop_xts_enc 1998 1999 vxor 3,3,8 2000 lvsr 5,0,5 2001 vxor 4,4,4 2002 vspltisb 11,-1 2003 vperm 4,4,11,5 2004 vsel 2,2,3,4 2005 2006 subi 11,4,17 2007 subi 4,4,16 2008 mtctr 5 2009 li 5,16 2010Loop_xts_enc_steal: 2011 lbzu 0,1(11) 2012 stb 0,16(11) 2013 bc 16,0,Loop_xts_enc_steal 2014 2015 mtctr 9 2016 b Loop_xts_enc 2017 2018Lxts_enc_done: 2019 cmpldi 8,0 2020 beq Lxts_enc_ret 2021 2022 vsrab 11,8,9 2023 vaddubm 8,8,8 2024 vsldoi 11,11,11,15 2025 vand 11,11,10 2026 vxor 8,8,11 2027 2028 vperm 8,8,8,6 2029 .long 0x7D004799 2030 2031Lxts_enc_ret: 2032 mtspr 256,12 2033 li 3,0 2034 blr 2035.long 0 2036.byte 0,12,0x04,0,0x80,6,6,0 2037.long 0 2038 2039 2040.globl aes_hw_xts_decrypt 2041.align 5 2042aes_hw_xts_decrypt: 2043 mr 10,3 2044 li 3,-1 2045 cmpldi 5,16 2046 bclr 14,0 2047 2048 lis 0,0xfff8 2049 mfspr 12,256 2050 li 11,0 2051 mtspr 256,0 2052 2053 andi. 0,5,15 2054 neg 0,0 2055 andi. 0,0,16 2056 sub 5,5,0 2057 2058 vspltisb 9,0x07 2059 lvsl 6,11,11 2060 vspltisb 11,0x0f 2061 vxor 6,6,9 2062 2063 li 3,15 2064 lvx 8,0,8 2065 lvsl 5,0,8 2066 lvx 4,3,8 2067 vxor 5,5,11 2068 vperm 8,8,4,5 2069 2070 neg 11,10 2071 lvsr 5,0,11 2072 lvx 2,0,10 2073 addi 10,10,15 2074 vxor 5,5,11 2075 2076 cmpldi 7,0 2077 beq Lxts_dec_no_key2 2078 2079 lvsr 7,0,7 2080 lwz 9,240(7) 2081 srwi 9,9,1 2082 subi 9,9,1 2083 li 3,16 2084 2085 lvx 0,0,7 2086 lvx 1,3,7 2087 addi 3,3,16 2088 vperm 0,1,0,7 2089 vxor 8,8,0 2090 lvx 0,3,7 2091 addi 3,3,16 2092 mtctr 9 2093 2094Ltweak_xts_dec: 2095 vperm 1,0,1,7 2096 .long 0x11080D08 2097 lvx 1,3,7 2098 addi 3,3,16 2099 vperm 0,1,0,7 2100 .long 0x11080508 2101 lvx 0,3,7 2102 addi 3,3,16 2103 bc 16,0,Ltweak_xts_dec 2104 2105 vperm 1,0,1,7 2106 .long 0x11080D08 2107 lvx 1,3,7 2108 vperm 0,1,0,7 2109 .long 0x11080509 2110 2111 li 8,0 2112 b Lxts_dec 2113 2114Lxts_dec_no_key2: 2115 neg 3,5 2116 andi. 3,3,15 2117 add 5,5,3 2118 2119 2120Lxts_dec: 2121 lvx 4,0,10 2122 addi 10,10,16 2123 2124 lvsr 7,0,6 2125 lwz 9,240(6) 2126 srwi 9,9,1 2127 subi 9,9,1 2128 li 3,16 2129 2130 vslb 10,9,9 2131 vor 10,10,9 2132 vspltisb 11,1 2133 vsldoi 10,10,11,15 2134 2135 cmpldi 5,96 2136 bge _aesp8_xts_decrypt6x 2137 2138 lvx 0,0,6 2139 lvx 1,3,6 2140 addi 3,3,16 2141 vperm 2,2,4,5 2142 vperm 0,1,0,7 2143 vxor 2,2,8 2144 vxor 2,2,0 2145 lvx 0,3,6 2146 addi 3,3,16 2147 mtctr 9 2148 2149 cmpldi 5,16 2150 blt Ltail_xts_dec 2151 2152 2153.align 5 2154Loop_xts_dec: 2155 vperm 1,0,1,7 2156 .long 0x10420D48 2157 lvx 1,3,6 2158 addi 3,3,16 2159 vperm 0,1,0,7 2160 .long 0x10420548 2161 lvx 0,3,6 2162 addi 3,3,16 2163 bc 16,0,Loop_xts_dec 2164 2165 vperm 1,0,1,7 2166 .long 0x10420D48 2167 lvx 1,3,6 2168 li 3,16 2169 vperm 0,1,0,7 2170 vxor 0,0,8 2171 .long 0x10620549 2172 2173 vperm 11,3,3,6 2174 2175 .long 0x7D602799 2176 2177 addi 4,4,16 2178 2179 subic. 5,5,16 2180 beq Lxts_dec_done 2181 2182 vor 2,4,4 2183 lvx 4,0,10 2184 addi 10,10,16 2185 lvx 0,0,6 2186 lvx 1,3,6 2187 addi 3,3,16 2188 2189 vsrab 11,8,9 2190 vaddubm 8,8,8 2191 vsldoi 11,11,11,15 2192 vand 11,11,10 2193 vxor 8,8,11 2194 2195 vperm 2,2,4,5 2196 vperm 0,1,0,7 2197 vxor 2,2,8 2198 vxor 2,2,0 2199 lvx 0,3,6 2200 addi 3,3,16 2201 2202 mtctr 9 2203 cmpldi 5,16 2204 bge Loop_xts_dec 2205 2206Ltail_xts_dec: 2207 vsrab 11,8,9 2208 vaddubm 12,8,8 2209 vsldoi 11,11,11,15 2210 vand 11,11,10 2211 vxor 12,12,11 2212 2213 subi 10,10,16 2214 add 10,10,5 2215 2216 vxor 2,2,8 2217 vxor 2,2,12 2218 2219Loop_xts_dec_short: 2220 vperm 1,0,1,7 2221 .long 0x10420D48 2222 lvx 1,3,6 2223 addi 3,3,16 2224 vperm 0,1,0,7 2225 .long 0x10420548 2226 lvx 0,3,6 2227 addi 3,3,16 2228 bc 16,0,Loop_xts_dec_short 2229 2230 vperm 1,0,1,7 2231 .long 0x10420D48 2232 lvx 1,3,6 2233 li 3,16 2234 vperm 0,1,0,7 2235 vxor 0,0,12 2236 .long 0x10620549 2237 2238 vperm 11,3,3,6 2239 2240 .long 0x7D602799 2241 2242 2243 vor 2,4,4 2244 lvx 4,0,10 2245 2246 lvx 0,0,6 2247 lvx 1,3,6 2248 addi 3,3,16 2249 vperm 2,2,4,5 2250 vperm 0,1,0,7 2251 2252 lvsr 5,0,5 2253 vxor 4,4,4 2254 vspltisb 11,-1 2255 vperm 4,4,11,5 2256 vsel 2,2,3,4 2257 2258 vxor 0,0,8 2259 vxor 2,2,0 2260 lvx 0,3,6 2261 addi 3,3,16 2262 2263 subi 11,4,1 2264 mtctr 5 2265 li 5,16 2266Loop_xts_dec_steal: 2267 lbzu 0,1(11) 2268 stb 0,16(11) 2269 bc 16,0,Loop_xts_dec_steal 2270 2271 mtctr 9 2272 b Loop_xts_dec 2273 2274Lxts_dec_done: 2275 cmpldi 8,0 2276 beq Lxts_dec_ret 2277 2278 vsrab 11,8,9 2279 vaddubm 8,8,8 2280 vsldoi 11,11,11,15 2281 vand 11,11,10 2282 vxor 8,8,11 2283 2284 vperm 8,8,8,6 2285 .long 0x7D004799 2286 2287Lxts_dec_ret: 2288 mtspr 256,12 2289 li 3,0 2290 blr 2291.long 0 2292.byte 0,12,0x04,0,0x80,6,6,0 2293.long 0 2294 2295.align 5 2296_aesp8_xts_encrypt6x: 2297 stdu 1,-448(1) 2298 mflr 11 2299 li 7,207 2300 li 3,223 2301 std 11,464(1) 2302 stvx 20,7,1 2303 addi 7,7,32 2304 stvx 21,3,1 2305 addi 3,3,32 2306 stvx 22,7,1 2307 addi 7,7,32 2308 stvx 23,3,1 2309 addi 3,3,32 2310 stvx 24,7,1 2311 addi 7,7,32 2312 stvx 25,3,1 2313 addi 3,3,32 2314 stvx 26,7,1 2315 addi 7,7,32 2316 stvx 27,3,1 2317 addi 3,3,32 2318 stvx 28,7,1 2319 addi 7,7,32 2320 stvx 29,3,1 2321 addi 3,3,32 2322 stvx 30,7,1 2323 stvx 31,3,1 2324 li 0,-1 2325 stw 12,396(1) 2326 li 3,0x10 2327 std 26,400(1) 2328 li 26,0x20 2329 std 27,408(1) 2330 li 27,0x30 2331 std 28,416(1) 2332 li 28,0x40 2333 std 29,424(1) 2334 li 29,0x50 2335 std 30,432(1) 2336 li 30,0x60 2337 std 31,440(1) 2338 li 31,0x70 2339 mtspr 256,0 2340 2341 subi 9,9,3 2342 2343 lvx 23,0,6 2344 lvx 30,3,6 2345 addi 6,6,0x20 2346 lvx 31,0,6 2347 vperm 23,30,23,7 2348 addi 7,1,64+15 2349 mtctr 9 2350 2351Load_xts_enc_key: 2352 vperm 24,31,30,7 2353 lvx 30,3,6 2354 addi 6,6,0x20 2355 stvx 24,0,7 2356 vperm 25,30,31,7 2357 lvx 31,0,6 2358 stvx 25,3,7 2359 addi 7,7,0x20 2360 bc 16,0,Load_xts_enc_key 2361 2362 lvx 26,3,6 2363 vperm 24,31,30,7 2364 lvx 27,26,6 2365 stvx 24,0,7 2366 vperm 25,26,31,7 2367 lvx 28,27,6 2368 stvx 25,3,7 2369 addi 7,1,64+15 2370 vperm 26,27,26,7 2371 lvx 29,28,6 2372 vperm 27,28,27,7 2373 lvx 30,29,6 2374 vperm 28,29,28,7 2375 lvx 31,30,6 2376 vperm 29,30,29,7 2377 lvx 22,31,6 2378 vperm 30,31,30,7 2379 lvx 24,0,7 2380 vperm 31,22,31,7 2381 lvx 25,3,7 2382 2383 vperm 0,2,4,5 2384 subi 10,10,31 2385 vxor 17,8,23 2386 vsrab 11,8,9 2387 vaddubm 8,8,8 2388 vsldoi 11,11,11,15 2389 vand 11,11,10 2390 vxor 7,0,17 2391 vxor 8,8,11 2392 2393 .long 0x7C235699 2394 vxor 18,8,23 2395 vsrab 11,8,9 2396 vaddubm 8,8,8 2397 vsldoi 11,11,11,15 2398 vperm 1,1,1,6 2399 vand 11,11,10 2400 vxor 12,1,18 2401 vxor 8,8,11 2402 2403 .long 0x7C5A5699 2404 andi. 31,5,15 2405 vxor 19,8,23 2406 vsrab 11,8,9 2407 vaddubm 8,8,8 2408 vsldoi 11,11,11,15 2409 vperm 2,2,2,6 2410 vand 11,11,10 2411 vxor 13,2,19 2412 vxor 8,8,11 2413 2414 .long 0x7C7B5699 2415 sub 5,5,31 2416 vxor 20,8,23 2417 vsrab 11,8,9 2418 vaddubm 8,8,8 2419 vsldoi 11,11,11,15 2420 vperm 3,3,3,6 2421 vand 11,11,10 2422 vxor 14,3,20 2423 vxor 8,8,11 2424 2425 .long 0x7C9C5699 2426 subi 5,5,0x60 2427 vxor 21,8,23 2428 vsrab 11,8,9 2429 vaddubm 8,8,8 2430 vsldoi 11,11,11,15 2431 vperm 4,4,4,6 2432 vand 11,11,10 2433 vxor 15,4,21 2434 vxor 8,8,11 2435 2436 .long 0x7CBD5699 2437 addi 10,10,0x60 2438 vxor 22,8,23 2439 vsrab 11,8,9 2440 vaddubm 8,8,8 2441 vsldoi 11,11,11,15 2442 vperm 5,5,5,6 2443 vand 11,11,10 2444 vxor 16,5,22 2445 vxor 8,8,11 2446 2447 vxor 31,31,23 2448 mtctr 9 2449 b Loop_xts_enc6x 2450 2451.align 5 2452Loop_xts_enc6x: 2453 .long 0x10E7C508 2454 .long 0x118CC508 2455 .long 0x11ADC508 2456 .long 0x11CEC508 2457 .long 0x11EFC508 2458 .long 0x1210C508 2459 lvx 24,26,7 2460 addi 7,7,0x20 2461 2462 .long 0x10E7CD08 2463 .long 0x118CCD08 2464 .long 0x11ADCD08 2465 .long 0x11CECD08 2466 .long 0x11EFCD08 2467 .long 0x1210CD08 2468 lvx 25,3,7 2469 bc 16,0,Loop_xts_enc6x 2470 2471 subic 5,5,96 2472 vxor 0,17,31 2473 .long 0x10E7C508 2474 .long 0x118CC508 2475 vsrab 11,8,9 2476 vxor 17,8,23 2477 vaddubm 8,8,8 2478 .long 0x11ADC508 2479 .long 0x11CEC508 2480 vsldoi 11,11,11,15 2481 .long 0x11EFC508 2482 .long 0x1210C508 2483 2484 subfe. 0,0,0 2485 vand 11,11,10 2486 .long 0x10E7CD08 2487 .long 0x118CCD08 2488 vxor 8,8,11 2489 .long 0x11ADCD08 2490 .long 0x11CECD08 2491 vxor 1,18,31 2492 vsrab 11,8,9 2493 vxor 18,8,23 2494 .long 0x11EFCD08 2495 .long 0x1210CD08 2496 2497 and 0,0,5 2498 vaddubm 8,8,8 2499 vsldoi 11,11,11,15 2500 .long 0x10E7D508 2501 .long 0x118CD508 2502 vand 11,11,10 2503 .long 0x11ADD508 2504 .long 0x11CED508 2505 vxor 8,8,11 2506 .long 0x11EFD508 2507 .long 0x1210D508 2508 2509 add 10,10,0 2510 2511 2512 2513 vxor 2,19,31 2514 vsrab 11,8,9 2515 vxor 19,8,23 2516 vaddubm 8,8,8 2517 .long 0x10E7DD08 2518 .long 0x118CDD08 2519 vsldoi 11,11,11,15 2520 .long 0x11ADDD08 2521 .long 0x11CEDD08 2522 vand 11,11,10 2523 .long 0x11EFDD08 2524 .long 0x1210DD08 2525 2526 addi 7,1,64+15 2527 vxor 8,8,11 2528 .long 0x10E7E508 2529 .long 0x118CE508 2530 vxor 3,20,31 2531 vsrab 11,8,9 2532 vxor 20,8,23 2533 .long 0x11ADE508 2534 .long 0x11CEE508 2535 vaddubm 8,8,8 2536 vsldoi 11,11,11,15 2537 .long 0x11EFE508 2538 .long 0x1210E508 2539 lvx 24,0,7 2540 vand 11,11,10 2541 2542 .long 0x10E7ED08 2543 .long 0x118CED08 2544 vxor 8,8,11 2545 .long 0x11ADED08 2546 .long 0x11CEED08 2547 vxor 4,21,31 2548 vsrab 11,8,9 2549 vxor 21,8,23 2550 .long 0x11EFED08 2551 .long 0x1210ED08 2552 lvx 25,3,7 2553 vaddubm 8,8,8 2554 vsldoi 11,11,11,15 2555 2556 .long 0x10E7F508 2557 .long 0x118CF508 2558 vand 11,11,10 2559 .long 0x11ADF508 2560 .long 0x11CEF508 2561 vxor 8,8,11 2562 .long 0x11EFF508 2563 .long 0x1210F508 2564 vxor 5,22,31 2565 vsrab 11,8,9 2566 vxor 22,8,23 2567 2568 .long 0x10E70509 2569 .long 0x7C005699 2570 vaddubm 8,8,8 2571 vsldoi 11,11,11,15 2572 .long 0x118C0D09 2573 .long 0x7C235699 2574 .long 0x11AD1509 2575 vperm 0,0,0,6 2576 .long 0x7C5A5699 2577 vand 11,11,10 2578 .long 0x11CE1D09 2579 vperm 1,1,1,6 2580 .long 0x7C7B5699 2581 .long 0x11EF2509 2582 vperm 2,2,2,6 2583 .long 0x7C9C5699 2584 vxor 8,8,11 2585 .long 0x11702D09 2586 2587 vperm 3,3,3,6 2588 .long 0x7CBD5699 2589 addi 10,10,0x60 2590 vperm 4,4,4,6 2591 vperm 5,5,5,6 2592 2593 vperm 7,7,7,6 2594 vperm 12,12,12,6 2595 .long 0x7CE02799 2596 vxor 7,0,17 2597 vperm 13,13,13,6 2598 .long 0x7D832799 2599 vxor 12,1,18 2600 vperm 14,14,14,6 2601 .long 0x7DBA2799 2602 vxor 13,2,19 2603 vperm 15,15,15,6 2604 .long 0x7DDB2799 2605 vxor 14,3,20 2606 vperm 16,11,11,6 2607 .long 0x7DFC2799 2608 vxor 15,4,21 2609 .long 0x7E1D2799 2610 2611 vxor 16,5,22 2612 addi 4,4,0x60 2613 2614 mtctr 9 2615 beq Loop_xts_enc6x 2616 2617 addic. 5,5,0x60 2618 beq Lxts_enc6x_zero 2619 cmpwi 5,0x20 2620 blt Lxts_enc6x_one 2621 nop 2622 beq Lxts_enc6x_two 2623 cmpwi 5,0x40 2624 blt Lxts_enc6x_three 2625 nop 2626 beq Lxts_enc6x_four 2627 2628Lxts_enc6x_five: 2629 vxor 7,1,17 2630 vxor 12,2,18 2631 vxor 13,3,19 2632 vxor 14,4,20 2633 vxor 15,5,21 2634 2635 bl _aesp8_xts_enc5x 2636 2637 vperm 7,7,7,6 2638 vor 17,22,22 2639 vperm 12,12,12,6 2640 .long 0x7CE02799 2641 vperm 13,13,13,6 2642 .long 0x7D832799 2643 vperm 14,14,14,6 2644 .long 0x7DBA2799 2645 vxor 11,15,22 2646 vperm 15,15,15,6 2647 .long 0x7DDB2799 2648 .long 0x7DFC2799 2649 addi 4,4,0x50 2650 bne Lxts_enc6x_steal 2651 b Lxts_enc6x_done 2652 2653.align 4 2654Lxts_enc6x_four: 2655 vxor 7,2,17 2656 vxor 12,3,18 2657 vxor 13,4,19 2658 vxor 14,5,20 2659 vxor 15,15,15 2660 2661 bl _aesp8_xts_enc5x 2662 2663 vperm 7,7,7,6 2664 vor 17,21,21 2665 vperm 12,12,12,6 2666 .long 0x7CE02799 2667 vperm 13,13,13,6 2668 .long 0x7D832799 2669 vxor 11,14,21 2670 vperm 14,14,14,6 2671 .long 0x7DBA2799 2672 .long 0x7DDB2799 2673 addi 4,4,0x40 2674 bne Lxts_enc6x_steal 2675 b Lxts_enc6x_done 2676 2677.align 4 2678Lxts_enc6x_three: 2679 vxor 7,3,17 2680 vxor 12,4,18 2681 vxor 13,5,19 2682 vxor 14,14,14 2683 vxor 15,15,15 2684 2685 bl _aesp8_xts_enc5x 2686 2687 vperm 7,7,7,6 2688 vor 17,20,20 2689 vperm 12,12,12,6 2690 .long 0x7CE02799 2691 vxor 11,13,20 2692 vperm 13,13,13,6 2693 .long 0x7D832799 2694 .long 0x7DBA2799 2695 addi 4,4,0x30 2696 bne Lxts_enc6x_steal 2697 b Lxts_enc6x_done 2698 2699.align 4 2700Lxts_enc6x_two: 2701 vxor 7,4,17 2702 vxor 12,5,18 2703 vxor 13,13,13 2704 vxor 14,14,14 2705 vxor 15,15,15 2706 2707 bl _aesp8_xts_enc5x 2708 2709 vperm 7,7,7,6 2710 vor 17,19,19 2711 vxor 11,12,19 2712 vperm 12,12,12,6 2713 .long 0x7CE02799 2714 .long 0x7D832799 2715 addi 4,4,0x20 2716 bne Lxts_enc6x_steal 2717 b Lxts_enc6x_done 2718 2719.align 4 2720Lxts_enc6x_one: 2721 vxor 7,5,17 2722 nop 2723Loop_xts_enc1x: 2724 .long 0x10E7C508 2725 lvx 24,26,7 2726 addi 7,7,0x20 2727 2728 .long 0x10E7CD08 2729 lvx 25,3,7 2730 bc 16,0,Loop_xts_enc1x 2731 2732 add 10,10,31 2733 cmpwi 31,0 2734 .long 0x10E7C508 2735 2736 subi 10,10,16 2737 .long 0x10E7CD08 2738 2739 lvsr 5,0,31 2740 .long 0x10E7D508 2741 2742 .long 0x7C005699 2743 .long 0x10E7DD08 2744 2745 addi 7,1,64+15 2746 .long 0x10E7E508 2747 lvx 24,0,7 2748 2749 .long 0x10E7ED08 2750 lvx 25,3,7 2751 vxor 17,17,31 2752 2753 vperm 0,0,0,6 2754 .long 0x10E7F508 2755 2756 vperm 0,0,0,5 2757 .long 0x10E78D09 2758 2759 vor 17,18,18 2760 vxor 11,7,18 2761 vperm 7,7,7,6 2762 .long 0x7CE02799 2763 addi 4,4,0x10 2764 bne Lxts_enc6x_steal 2765 b Lxts_enc6x_done 2766 2767.align 4 2768Lxts_enc6x_zero: 2769 cmpwi 31,0 2770 beq Lxts_enc6x_done 2771 2772 add 10,10,31 2773 subi 10,10,16 2774 .long 0x7C005699 2775 lvsr 5,0,31 2776 vperm 0,0,0,6 2777 vperm 0,0,0,5 2778 vxor 11,11,17 2779Lxts_enc6x_steal: 2780 vxor 0,0,17 2781 vxor 7,7,7 2782 vspltisb 12,-1 2783 vperm 7,7,12,5 2784 vsel 7,0,11,7 2785 2786 subi 30,4,17 2787 subi 4,4,16 2788 mtctr 31 2789Loop_xts_enc6x_steal: 2790 lbzu 0,1(30) 2791 stb 0,16(30) 2792 bc 16,0,Loop_xts_enc6x_steal 2793 2794 li 31,0 2795 mtctr 9 2796 b Loop_xts_enc1x 2797 2798.align 4 2799Lxts_enc6x_done: 2800 cmpldi 8,0 2801 beq Lxts_enc6x_ret 2802 2803 vxor 8,17,23 2804 vperm 8,8,8,6 2805 .long 0x7D004799 2806 2807Lxts_enc6x_ret: 2808 mtlr 11 2809 li 10,79 2810 li 11,95 2811 stvx 9,10,1 2812 addi 10,10,32 2813 stvx 9,11,1 2814 addi 11,11,32 2815 stvx 9,10,1 2816 addi 10,10,32 2817 stvx 9,11,1 2818 addi 11,11,32 2819 stvx 9,10,1 2820 addi 10,10,32 2821 stvx 9,11,1 2822 addi 11,11,32 2823 stvx 9,10,1 2824 addi 10,10,32 2825 stvx 9,11,1 2826 addi 11,11,32 2827 2828 mtspr 256,12 2829 lvx 20,10,1 2830 addi 10,10,32 2831 lvx 21,11,1 2832 addi 11,11,32 2833 lvx 22,10,1 2834 addi 10,10,32 2835 lvx 23,11,1 2836 addi 11,11,32 2837 lvx 24,10,1 2838 addi 10,10,32 2839 lvx 25,11,1 2840 addi 11,11,32 2841 lvx 26,10,1 2842 addi 10,10,32 2843 lvx 27,11,1 2844 addi 11,11,32 2845 lvx 28,10,1 2846 addi 10,10,32 2847 lvx 29,11,1 2848 addi 11,11,32 2849 lvx 30,10,1 2850 lvx 31,11,1 2851 ld 26,400(1) 2852 ld 27,408(1) 2853 ld 28,416(1) 2854 ld 29,424(1) 2855 ld 30,432(1) 2856 ld 31,440(1) 2857 addi 1,1,448 2858 blr 2859.long 0 2860.byte 0,12,0x04,1,0x80,6,6,0 2861.long 0 2862 2863.align 5 2864_aesp8_xts_enc5x: 2865 .long 0x10E7C508 2866 .long 0x118CC508 2867 .long 0x11ADC508 2868 .long 0x11CEC508 2869 .long 0x11EFC508 2870 lvx 24,26,7 2871 addi 7,7,0x20 2872 2873 .long 0x10E7CD08 2874 .long 0x118CCD08 2875 .long 0x11ADCD08 2876 .long 0x11CECD08 2877 .long 0x11EFCD08 2878 lvx 25,3,7 2879 bc 16,0,_aesp8_xts_enc5x 2880 2881 add 10,10,31 2882 cmpwi 31,0 2883 .long 0x10E7C508 2884 .long 0x118CC508 2885 .long 0x11ADC508 2886 .long 0x11CEC508 2887 .long 0x11EFC508 2888 2889 subi 10,10,16 2890 .long 0x10E7CD08 2891 .long 0x118CCD08 2892 .long 0x11ADCD08 2893 .long 0x11CECD08 2894 .long 0x11EFCD08 2895 vxor 17,17,31 2896 2897 .long 0x10E7D508 2898 lvsr 5,0,31 2899 .long 0x118CD508 2900 .long 0x11ADD508 2901 .long 0x11CED508 2902 .long 0x11EFD508 2903 vxor 1,18,31 2904 2905 .long 0x10E7DD08 2906 .long 0x7C005699 2907 .long 0x118CDD08 2908 .long 0x11ADDD08 2909 .long 0x11CEDD08 2910 .long 0x11EFDD08 2911 vxor 2,19,31 2912 2913 addi 7,1,64+15 2914 .long 0x10E7E508 2915 .long 0x118CE508 2916 .long 0x11ADE508 2917 .long 0x11CEE508 2918 .long 0x11EFE508 2919 lvx 24,0,7 2920 vxor 3,20,31 2921 2922 .long 0x10E7ED08 2923 vperm 0,0,0,6 2924 .long 0x118CED08 2925 .long 0x11ADED08 2926 .long 0x11CEED08 2927 .long 0x11EFED08 2928 lvx 25,3,7 2929 vxor 4,21,31 2930 2931 .long 0x10E7F508 2932 vperm 0,0,0,5 2933 .long 0x118CF508 2934 .long 0x11ADF508 2935 .long 0x11CEF508 2936 .long 0x11EFF508 2937 2938 .long 0x10E78D09 2939 .long 0x118C0D09 2940 .long 0x11AD1509 2941 .long 0x11CE1D09 2942 .long 0x11EF2509 2943 blr 2944.long 0 2945.byte 0,12,0x14,0,0,0,0,0 2946 2947.align 5 2948_aesp8_xts_decrypt6x: 2949 stdu 1,-448(1) 2950 mflr 11 2951 li 7,207 2952 li 3,223 2953 std 11,464(1) 2954 stvx 20,7,1 2955 addi 7,7,32 2956 stvx 21,3,1 2957 addi 3,3,32 2958 stvx 22,7,1 2959 addi 7,7,32 2960 stvx 23,3,1 2961 addi 3,3,32 2962 stvx 24,7,1 2963 addi 7,7,32 2964 stvx 25,3,1 2965 addi 3,3,32 2966 stvx 26,7,1 2967 addi 7,7,32 2968 stvx 27,3,1 2969 addi 3,3,32 2970 stvx 28,7,1 2971 addi 7,7,32 2972 stvx 29,3,1 2973 addi 3,3,32 2974 stvx 30,7,1 2975 stvx 31,3,1 2976 li 0,-1 2977 stw 12,396(1) 2978 li 3,0x10 2979 std 26,400(1) 2980 li 26,0x20 2981 std 27,408(1) 2982 li 27,0x30 2983 std 28,416(1) 2984 li 28,0x40 2985 std 29,424(1) 2986 li 29,0x50 2987 std 30,432(1) 2988 li 30,0x60 2989 std 31,440(1) 2990 li 31,0x70 2991 mtspr 256,0 2992 2993 subi 9,9,3 2994 2995 lvx 23,0,6 2996 lvx 30,3,6 2997 addi 6,6,0x20 2998 lvx 31,0,6 2999 vperm 23,30,23,7 3000 addi 7,1,64+15 3001 mtctr 9 3002 3003Load_xts_dec_key: 3004 vperm 24,31,30,7 3005 lvx 30,3,6 3006 addi 6,6,0x20 3007 stvx 24,0,7 3008 vperm 25,30,31,7 3009 lvx 31,0,6 3010 stvx 25,3,7 3011 addi 7,7,0x20 3012 bc 16,0,Load_xts_dec_key 3013 3014 lvx 26,3,6 3015 vperm 24,31,30,7 3016 lvx 27,26,6 3017 stvx 24,0,7 3018 vperm 25,26,31,7 3019 lvx 28,27,6 3020 stvx 25,3,7 3021 addi 7,1,64+15 3022 vperm 26,27,26,7 3023 lvx 29,28,6 3024 vperm 27,28,27,7 3025 lvx 30,29,6 3026 vperm 28,29,28,7 3027 lvx 31,30,6 3028 vperm 29,30,29,7 3029 lvx 22,31,6 3030 vperm 30,31,30,7 3031 lvx 24,0,7 3032 vperm 31,22,31,7 3033 lvx 25,3,7 3034 3035 vperm 0,2,4,5 3036 subi 10,10,31 3037 vxor 17,8,23 3038 vsrab 11,8,9 3039 vaddubm 8,8,8 3040 vsldoi 11,11,11,15 3041 vand 11,11,10 3042 vxor 7,0,17 3043 vxor 8,8,11 3044 3045 .long 0x7C235699 3046 vxor 18,8,23 3047 vsrab 11,8,9 3048 vaddubm 8,8,8 3049 vsldoi 11,11,11,15 3050 vperm 1,1,1,6 3051 vand 11,11,10 3052 vxor 12,1,18 3053 vxor 8,8,11 3054 3055 .long 0x7C5A5699 3056 andi. 31,5,15 3057 vxor 19,8,23 3058 vsrab 11,8,9 3059 vaddubm 8,8,8 3060 vsldoi 11,11,11,15 3061 vperm 2,2,2,6 3062 vand 11,11,10 3063 vxor 13,2,19 3064 vxor 8,8,11 3065 3066 .long 0x7C7B5699 3067 sub 5,5,31 3068 vxor 20,8,23 3069 vsrab 11,8,9 3070 vaddubm 8,8,8 3071 vsldoi 11,11,11,15 3072 vperm 3,3,3,6 3073 vand 11,11,10 3074 vxor 14,3,20 3075 vxor 8,8,11 3076 3077 .long 0x7C9C5699 3078 subi 5,5,0x60 3079 vxor 21,8,23 3080 vsrab 11,8,9 3081 vaddubm 8,8,8 3082 vsldoi 11,11,11,15 3083 vperm 4,4,4,6 3084 vand 11,11,10 3085 vxor 15,4,21 3086 vxor 8,8,11 3087 3088 .long 0x7CBD5699 3089 addi 10,10,0x60 3090 vxor 22,8,23 3091 vsrab 11,8,9 3092 vaddubm 8,8,8 3093 vsldoi 11,11,11,15 3094 vperm 5,5,5,6 3095 vand 11,11,10 3096 vxor 16,5,22 3097 vxor 8,8,11 3098 3099 vxor 31,31,23 3100 mtctr 9 3101 b Loop_xts_dec6x 3102 3103.align 5 3104Loop_xts_dec6x: 3105 .long 0x10E7C548 3106 .long 0x118CC548 3107 .long 0x11ADC548 3108 .long 0x11CEC548 3109 .long 0x11EFC548 3110 .long 0x1210C548 3111 lvx 24,26,7 3112 addi 7,7,0x20 3113 3114 .long 0x10E7CD48 3115 .long 0x118CCD48 3116 .long 0x11ADCD48 3117 .long 0x11CECD48 3118 .long 0x11EFCD48 3119 .long 0x1210CD48 3120 lvx 25,3,7 3121 bc 16,0,Loop_xts_dec6x 3122 3123 subic 5,5,96 3124 vxor 0,17,31 3125 .long 0x10E7C548 3126 .long 0x118CC548 3127 vsrab 11,8,9 3128 vxor 17,8,23 3129 vaddubm 8,8,8 3130 .long 0x11ADC548 3131 .long 0x11CEC548 3132 vsldoi 11,11,11,15 3133 .long 0x11EFC548 3134 .long 0x1210C548 3135 3136 subfe. 0,0,0 3137 vand 11,11,10 3138 .long 0x10E7CD48 3139 .long 0x118CCD48 3140 vxor 8,8,11 3141 .long 0x11ADCD48 3142 .long 0x11CECD48 3143 vxor 1,18,31 3144 vsrab 11,8,9 3145 vxor 18,8,23 3146 .long 0x11EFCD48 3147 .long 0x1210CD48 3148 3149 and 0,0,5 3150 vaddubm 8,8,8 3151 vsldoi 11,11,11,15 3152 .long 0x10E7D548 3153 .long 0x118CD548 3154 vand 11,11,10 3155 .long 0x11ADD548 3156 .long 0x11CED548 3157 vxor 8,8,11 3158 .long 0x11EFD548 3159 .long 0x1210D548 3160 3161 add 10,10,0 3162 3163 3164 3165 vxor 2,19,31 3166 vsrab 11,8,9 3167 vxor 19,8,23 3168 vaddubm 8,8,8 3169 .long 0x10E7DD48 3170 .long 0x118CDD48 3171 vsldoi 11,11,11,15 3172 .long 0x11ADDD48 3173 .long 0x11CEDD48 3174 vand 11,11,10 3175 .long 0x11EFDD48 3176 .long 0x1210DD48 3177 3178 addi 7,1,64+15 3179 vxor 8,8,11 3180 .long 0x10E7E548 3181 .long 0x118CE548 3182 vxor 3,20,31 3183 vsrab 11,8,9 3184 vxor 20,8,23 3185 .long 0x11ADE548 3186 .long 0x11CEE548 3187 vaddubm 8,8,8 3188 vsldoi 11,11,11,15 3189 .long 0x11EFE548 3190 .long 0x1210E548 3191 lvx 24,0,7 3192 vand 11,11,10 3193 3194 .long 0x10E7ED48 3195 .long 0x118CED48 3196 vxor 8,8,11 3197 .long 0x11ADED48 3198 .long 0x11CEED48 3199 vxor 4,21,31 3200 vsrab 11,8,9 3201 vxor 21,8,23 3202 .long 0x11EFED48 3203 .long 0x1210ED48 3204 lvx 25,3,7 3205 vaddubm 8,8,8 3206 vsldoi 11,11,11,15 3207 3208 .long 0x10E7F548 3209 .long 0x118CF548 3210 vand 11,11,10 3211 .long 0x11ADF548 3212 .long 0x11CEF548 3213 vxor 8,8,11 3214 .long 0x11EFF548 3215 .long 0x1210F548 3216 vxor 5,22,31 3217 vsrab 11,8,9 3218 vxor 22,8,23 3219 3220 .long 0x10E70549 3221 .long 0x7C005699 3222 vaddubm 8,8,8 3223 vsldoi 11,11,11,15 3224 .long 0x118C0D49 3225 .long 0x7C235699 3226 .long 0x11AD1549 3227 vperm 0,0,0,6 3228 .long 0x7C5A5699 3229 vand 11,11,10 3230 .long 0x11CE1D49 3231 vperm 1,1,1,6 3232 .long 0x7C7B5699 3233 .long 0x11EF2549 3234 vperm 2,2,2,6 3235 .long 0x7C9C5699 3236 vxor 8,8,11 3237 .long 0x12102D49 3238 vperm 3,3,3,6 3239 .long 0x7CBD5699 3240 addi 10,10,0x60 3241 vperm 4,4,4,6 3242 vperm 5,5,5,6 3243 3244 vperm 7,7,7,6 3245 vperm 12,12,12,6 3246 .long 0x7CE02799 3247 vxor 7,0,17 3248 vperm 13,13,13,6 3249 .long 0x7D832799 3250 vxor 12,1,18 3251 vperm 14,14,14,6 3252 .long 0x7DBA2799 3253 vxor 13,2,19 3254 vperm 15,15,15,6 3255 .long 0x7DDB2799 3256 vxor 14,3,20 3257 vperm 16,16,16,6 3258 .long 0x7DFC2799 3259 vxor 15,4,21 3260 .long 0x7E1D2799 3261 vxor 16,5,22 3262 addi 4,4,0x60 3263 3264 mtctr 9 3265 beq Loop_xts_dec6x 3266 3267 addic. 5,5,0x60 3268 beq Lxts_dec6x_zero 3269 cmpwi 5,0x20 3270 blt Lxts_dec6x_one 3271 nop 3272 beq Lxts_dec6x_two 3273 cmpwi 5,0x40 3274 blt Lxts_dec6x_three 3275 nop 3276 beq Lxts_dec6x_four 3277 3278Lxts_dec6x_five: 3279 vxor 7,1,17 3280 vxor 12,2,18 3281 vxor 13,3,19 3282 vxor 14,4,20 3283 vxor 15,5,21 3284 3285 bl _aesp8_xts_dec5x 3286 3287 vperm 7,7,7,6 3288 vor 17,22,22 3289 vxor 18,8,23 3290 vperm 12,12,12,6 3291 .long 0x7CE02799 3292 vxor 7,0,18 3293 vperm 13,13,13,6 3294 .long 0x7D832799 3295 vperm 14,14,14,6 3296 .long 0x7DBA2799 3297 vperm 15,15,15,6 3298 .long 0x7DDB2799 3299 .long 0x7DFC2799 3300 addi 4,4,0x50 3301 bne Lxts_dec6x_steal 3302 b Lxts_dec6x_done 3303 3304.align 4 3305Lxts_dec6x_four: 3306 vxor 7,2,17 3307 vxor 12,3,18 3308 vxor 13,4,19 3309 vxor 14,5,20 3310 vxor 15,15,15 3311 3312 bl _aesp8_xts_dec5x 3313 3314 vperm 7,7,7,6 3315 vor 17,21,21 3316 vor 18,22,22 3317 vperm 12,12,12,6 3318 .long 0x7CE02799 3319 vxor 7,0,22 3320 vperm 13,13,13,6 3321 .long 0x7D832799 3322 vperm 14,14,14,6 3323 .long 0x7DBA2799 3324 .long 0x7DDB2799 3325 addi 4,4,0x40 3326 bne Lxts_dec6x_steal 3327 b Lxts_dec6x_done 3328 3329.align 4 3330Lxts_dec6x_three: 3331 vxor 7,3,17 3332 vxor 12,4,18 3333 vxor 13,5,19 3334 vxor 14,14,14 3335 vxor 15,15,15 3336 3337 bl _aesp8_xts_dec5x 3338 3339 vperm 7,7,7,6 3340 vor 17,20,20 3341 vor 18,21,21 3342 vperm 12,12,12,6 3343 .long 0x7CE02799 3344 vxor 7,0,21 3345 vperm 13,13,13,6 3346 .long 0x7D832799 3347 .long 0x7DBA2799 3348 addi 4,4,0x30 3349 bne Lxts_dec6x_steal 3350 b Lxts_dec6x_done 3351 3352.align 4 3353Lxts_dec6x_two: 3354 vxor 7,4,17 3355 vxor 12,5,18 3356 vxor 13,13,13 3357 vxor 14,14,14 3358 vxor 15,15,15 3359 3360 bl _aesp8_xts_dec5x 3361 3362 vperm 7,7,7,6 3363 vor 17,19,19 3364 vor 18,20,20 3365 vperm 12,12,12,6 3366 .long 0x7CE02799 3367 vxor 7,0,20 3368 .long 0x7D832799 3369 addi 4,4,0x20 3370 bne Lxts_dec6x_steal 3371 b Lxts_dec6x_done 3372 3373.align 4 3374Lxts_dec6x_one: 3375 vxor 7,5,17 3376 nop 3377Loop_xts_dec1x: 3378 .long 0x10E7C548 3379 lvx 24,26,7 3380 addi 7,7,0x20 3381 3382 .long 0x10E7CD48 3383 lvx 25,3,7 3384 bc 16,0,Loop_xts_dec1x 3385 3386 subi 0,31,1 3387 .long 0x10E7C548 3388 3389 andi. 0,0,16 3390 cmpwi 31,0 3391 .long 0x10E7CD48 3392 3393 sub 10,10,0 3394 .long 0x10E7D548 3395 3396 .long 0x7C005699 3397 .long 0x10E7DD48 3398 3399 addi 7,1,64+15 3400 .long 0x10E7E548 3401 lvx 24,0,7 3402 3403 .long 0x10E7ED48 3404 lvx 25,3,7 3405 vxor 17,17,31 3406 3407 vperm 0,0,0,6 3408 .long 0x10E7F548 3409 3410 mtctr 9 3411 .long 0x10E78D49 3412 3413 vor 17,18,18 3414 vor 18,19,19 3415 vperm 7,7,7,6 3416 .long 0x7CE02799 3417 addi 4,4,0x10 3418 vxor 7,0,19 3419 bne Lxts_dec6x_steal 3420 b Lxts_dec6x_done 3421 3422.align 4 3423Lxts_dec6x_zero: 3424 cmpwi 31,0 3425 beq Lxts_dec6x_done 3426 3427 .long 0x7C005699 3428 vperm 0,0,0,6 3429 vxor 7,0,18 3430Lxts_dec6x_steal: 3431 .long 0x10E7C548 3432 lvx 24,26,7 3433 addi 7,7,0x20 3434 3435 .long 0x10E7CD48 3436 lvx 25,3,7 3437 bc 16,0,Lxts_dec6x_steal 3438 3439 add 10,10,31 3440 .long 0x10E7C548 3441 3442 cmpwi 31,0 3443 .long 0x10E7CD48 3444 3445 .long 0x7C005699 3446 .long 0x10E7D548 3447 3448 lvsr 5,0,31 3449 .long 0x10E7DD48 3450 3451 addi 7,1,64+15 3452 .long 0x10E7E548 3453 lvx 24,0,7 3454 3455 .long 0x10E7ED48 3456 lvx 25,3,7 3457 vxor 18,18,31 3458 3459 vperm 0,0,0,6 3460 .long 0x10E7F548 3461 3462 vperm 0,0,0,5 3463 .long 0x11679549 3464 3465 vperm 7,11,11,6 3466 .long 0x7CE02799 3467 3468 3469 vxor 7,7,7 3470 vspltisb 12,-1 3471 vperm 7,7,12,5 3472 vsel 7,0,11,7 3473 vxor 7,7,17 3474 3475 subi 30,4,1 3476 mtctr 31 3477Loop_xts_dec6x_steal: 3478 lbzu 0,1(30) 3479 stb 0,16(30) 3480 bc 16,0,Loop_xts_dec6x_steal 3481 3482 li 31,0 3483 mtctr 9 3484 b Loop_xts_dec1x 3485 3486.align 4 3487Lxts_dec6x_done: 3488 cmpldi 8,0 3489 beq Lxts_dec6x_ret 3490 3491 vxor 8,17,23 3492 vperm 8,8,8,6 3493 .long 0x7D004799 3494 3495Lxts_dec6x_ret: 3496 mtlr 11 3497 li 10,79 3498 li 11,95 3499 stvx 9,10,1 3500 addi 10,10,32 3501 stvx 9,11,1 3502 addi 11,11,32 3503 stvx 9,10,1 3504 addi 10,10,32 3505 stvx 9,11,1 3506 addi 11,11,32 3507 stvx 9,10,1 3508 addi 10,10,32 3509 stvx 9,11,1 3510 addi 11,11,32 3511 stvx 9,10,1 3512 addi 10,10,32 3513 stvx 9,11,1 3514 addi 11,11,32 3515 3516 mtspr 256,12 3517 lvx 20,10,1 3518 addi 10,10,32 3519 lvx 21,11,1 3520 addi 11,11,32 3521 lvx 22,10,1 3522 addi 10,10,32 3523 lvx 23,11,1 3524 addi 11,11,32 3525 lvx 24,10,1 3526 addi 10,10,32 3527 lvx 25,11,1 3528 addi 11,11,32 3529 lvx 26,10,1 3530 addi 10,10,32 3531 lvx 27,11,1 3532 addi 11,11,32 3533 lvx 28,10,1 3534 addi 10,10,32 3535 lvx 29,11,1 3536 addi 11,11,32 3537 lvx 30,10,1 3538 lvx 31,11,1 3539 ld 26,400(1) 3540 ld 27,408(1) 3541 ld 28,416(1) 3542 ld 29,424(1) 3543 ld 30,432(1) 3544 ld 31,440(1) 3545 addi 1,1,448 3546 blr 3547.long 0 3548.byte 0,12,0x04,1,0x80,6,6,0 3549.long 0 3550 3551.align 5 3552_aesp8_xts_dec5x: 3553 .long 0x10E7C548 3554 .long 0x118CC548 3555 .long 0x11ADC548 3556 .long 0x11CEC548 3557 .long 0x11EFC548 3558 lvx 24,26,7 3559 addi 7,7,0x20 3560 3561 .long 0x10E7CD48 3562 .long 0x118CCD48 3563 .long 0x11ADCD48 3564 .long 0x11CECD48 3565 .long 0x11EFCD48 3566 lvx 25,3,7 3567 bc 16,0,_aesp8_xts_dec5x 3568 3569 subi 0,31,1 3570 .long 0x10E7C548 3571 .long 0x118CC548 3572 .long 0x11ADC548 3573 .long 0x11CEC548 3574 .long 0x11EFC548 3575 3576 andi. 0,0,16 3577 cmpwi 31,0 3578 .long 0x10E7CD48 3579 .long 0x118CCD48 3580 .long 0x11ADCD48 3581 .long 0x11CECD48 3582 .long 0x11EFCD48 3583 vxor 17,17,31 3584 3585 sub 10,10,0 3586 .long 0x10E7D548 3587 .long 0x118CD548 3588 .long 0x11ADD548 3589 .long 0x11CED548 3590 .long 0x11EFD548 3591 vxor 1,18,31 3592 3593 .long 0x10E7DD48 3594 .long 0x7C005699 3595 .long 0x118CDD48 3596 .long 0x11ADDD48 3597 .long 0x11CEDD48 3598 .long 0x11EFDD48 3599 vxor 2,19,31 3600 3601 addi 7,1,64+15 3602 .long 0x10E7E548 3603 .long 0x118CE548 3604 .long 0x11ADE548 3605 .long 0x11CEE548 3606 .long 0x11EFE548 3607 lvx 24,0,7 3608 vxor 3,20,31 3609 3610 .long 0x10E7ED48 3611 vperm 0,0,0,6 3612 .long 0x118CED48 3613 .long 0x11ADED48 3614 .long 0x11CEED48 3615 .long 0x11EFED48 3616 lvx 25,3,7 3617 vxor 4,21,31 3618 3619 .long 0x10E7F548 3620 .long 0x118CF548 3621 .long 0x11ADF548 3622 .long 0x11CEF548 3623 .long 0x11EFF548 3624 3625 .long 0x10E78D49 3626 .long 0x118C0D49 3627 .long 0x11AD1549 3628 .long 0x11CE1D49 3629 .long 0x11EF2549 3630 mtctr 9 3631 blr 3632.long 0 3633.byte 0,12,0x14,0,0,0,0,0 3634