1 .machine "any" 2 3 .text 4 5 .globl gcm_init_p8 6 .align 5 7 gcm_init_p8: 8 li 0,-4096 9 li 8,0x10 10 mfspr 12,256 11 li 9,0x20 12 mtspr 256,0 13 li 10,0x30 14 .long 0x7D202699 15 16 vspltisb 8,-16 17 vspltisb 5,1 18 vaddubm 8,8,8 19 vxor 4,4,4 20 vor 8,8,5 21 vsldoi 8,8,4,15 22 vsldoi 6,4,5,1 23 vaddubm 8,8,8 24 vspltisb 7,7 25 vor 8,8,6 26 vspltb 6,9,0 27 vsl 9,9,5 28 vsrab 6,6,7 29 vand 6,6,8 30 vxor 3,9,6 31 32 vsldoi 9,3,3,8 33 vsldoi 8,4,8,8 34 vsldoi 11,4,9,8 35 vsldoi 10,9,4,8 36 37 .long 0x7D001F99 38 .long 0x7D681F99 39 li 8,0x40 40 .long 0x7D291F99 41 li 9,0x50 42 .long 0x7D4A1F99 43 li 10,0x60 44 45 .long 0x10035CC8 46 .long 0x10234CC8 47 .long 0x104354C8 48 49 .long 0x10E044C8 50 51 vsldoi 5,1,4,8 52 vsldoi 6,4,1,8 53 vxor 0,0,5 54 vxor 2,2,6 55 56 vsldoi 0,0,0,8 57 vxor 0,0,7 58 59 vsldoi 6,0,0,8 60 .long 0x100044C8 61 vxor 6,6,2 62 vxor 16,0,6 63 64 vsldoi 17,16,16,8 65 vsldoi 19,4,17,8 66 vsldoi 18,17,4,8 67 68 .long 0x7E681F99 69 li 8,0x70 70 .long 0x7E291F99 71 li 9,0x80 72 .long 0x7E4A1F99 73 li 10,0x90 74 .long 0x10039CC8 75 .long 0x11B09CC8 76 .long 0x10238CC8 77 .long 0x11D08CC8 78 .long 0x104394C8 79 .long 0x11F094C8 80 81 .long 0x10E044C8 82 .long 0x114D44C8 83 84 vsldoi 5,1,4,8 85 vsldoi 6,4,1,8 86 vsldoi 11,14,4,8 87 vsldoi 9,4,14,8 88 vxor 0,0,5 89 vxor 2,2,6 90 vxor 13,13,11 91 vxor 15,15,9 92 93 vsldoi 0,0,0,8 94 vsldoi 13,13,13,8 95 vxor 0,0,7 96 vxor 13,13,10 97 98 vsldoi 6,0,0,8 99 vsldoi 9,13,13,8 100 .long 0x100044C8 101 .long 0x11AD44C8 102 vxor 6,6,2 103 vxor 9,9,15 104 vxor 0,0,6 105 vxor 13,13,9 106 107 vsldoi 9,0,0,8 108 vsldoi 17,13,13,8 109 vsldoi 11,4,9,8 110 vsldoi 10,9,4,8 111 vsldoi 19,4,17,8 112 vsldoi 18,17,4,8 113 114 .long 0x7D681F99 115 li 8,0xa0 116 .long 0x7D291F99 117 li 9,0xb0 118 .long 0x7D4A1F99 119 li 10,0xc0 120 .long 0x7E681F99 121 .long 0x7E291F99 122 .long 0x7E4A1F99 123 124 mtspr 256,12 125 blr 126 .long 0 127 .byte 0,12,0x14,0,0,0,2,0 128 .long 0 129 130 .globl gcm_gmult_p8 131 .align 5 132 gcm_gmult_p8: 133 lis 0,0xfff8 134 li 8,0x10 135 mfspr 12,256 136 li 9,0x20 137 mtspr 256,0 138 li 10,0x30 139 .long 0x7C601E99 140 141 .long 0x7D682699 142 lvsl 12,0,0 143 .long 0x7D292699 144 vspltisb 5,0x07 145 .long 0x7D4A2699 146 vxor 12,12,5 147 .long 0x7D002699 148 vperm 3,3,3,12 149 vxor 4,4,4 150 151 .long 0x10035CC8 152 .long 0x10234CC8 153 .long 0x104354C8 154 155 .long 0x10E044C8 156 157 vsldoi 5,1,4,8 158 vsldoi 6,4,1,8 159 vxor 0,0,5 160 vxor 2,2,6 161 162 vsldoi 0,0,0,8 163 vxor 0,0,7 164 165 vsldoi 6,0,0,8 166 .long 0x100044C8 167 vxor 6,6,2 168 vxor 0,0,6 169 170 vperm 0,0,0,12 171 .long 0x7C001F99 172 173 mtspr 256,12 174 blr 175 .long 0 176 .byte 0,12,0x14,0,0,0,2,0 177 .long 0 178 179 180 .globl gcm_ghash_p8 181 .align 5 182 gcm_ghash_p8: 183 li 0,-4096 184 li 8,0x10 185 mfspr 12,256 186 li 9,0x20 187 mtspr 256,0 188 li 10,0x30 189 .long 0x7C001E99 190 191 .long 0x7D682699 192 li 8,0x40 193 lvsl 12,0,0 194 .long 0x7D292699 195 li 9,0x50 196 vspltisb 5,0x07 197 .long 0x7D4A2699 198 li 10,0x60 199 vxor 12,12,5 200 .long 0x7D002699 201 vperm 0,0,0,12 202 vxor 4,4,4 203 204 cmpldi 6,64 205 bge Lgcm_ghash_p8_4x 206 207 .long 0x7C602E99 208 addi 5,5,16 209 subic. 6,6,16 210 vperm 3,3,3,12 211 vxor 3,3,0 212 beq Lshort 213 214 .long 0x7E682699 215 li 8,16 216 .long 0x7E292699 217 add 9,5,6 218 .long 0x7E4A2699 219 220 221 .align 5 222 Loop_2x: 223 .long 0x7E002E99 224 vperm 16,16,16,12 225 226 subic 6,6,32 227 .long 0x10039CC8 228 .long 0x11B05CC8 229 subfe 0,0,0 230 .long 0x10238CC8 231 .long 0x11D04CC8 232 and 0,0,6 233 .long 0x104394C8 234 .long 0x11F054C8 235 add 5,5,0 236 237 vxor 0,0,13 238 vxor 1,1,14 239 240 .long 0x10E044C8 241 242 vsldoi 5,1,4,8 243 vsldoi 6,4,1,8 244 vxor 2,2,15 245 vxor 0,0,5 246 vxor 2,2,6 247 248 vsldoi 0,0,0,8 249 vxor 0,0,7 250 .long 0x7C682E99 251 addi 5,5,32 252 253 vsldoi 6,0,0,8 254 .long 0x100044C8 255 vperm 3,3,3,12 256 vxor 6,6,2 257 vxor 3,3,6 258 vxor 3,3,0 259 cmpld 9,5 260 bgt Loop_2x 261 262 cmplwi 6,0 263 bne Leven 264 265 Lshort: 266 .long 0x10035CC8 267 .long 0x10234CC8 268 .long 0x104354C8 269 270 .long 0x10E044C8 271 272 vsldoi 5,1,4,8 273 vsldoi 6,4,1,8 274 vxor 0,0,5 275 vxor 2,2,6 276 277 vsldoi 0,0,0,8 278 vxor 0,0,7 279 280 vsldoi 6,0,0,8 281 .long 0x100044C8 282 vxor 6,6,2 283 284 Leven: 285 vxor 0,0,6 286 vperm 0,0,0,12 287 .long 0x7C001F99 288 289 mtspr 256,12 290 blr 291 .long 0 292 .byte 0,12,0x14,0,0,0,4,0 293 .long 0 294 .align 5 295 .gcm_ghash_p8_4x: 296 Lgcm_ghash_p8_4x: 297 stdu 1,-256(1) 298 li 10,63 299 li 11,79 300 stvx 20,10,1 301 addi 10,10,32 302 stvx 21,11,1 303 addi 11,11,32 304 stvx 22,10,1 305 addi 10,10,32 306 stvx 23,11,1 307 addi 11,11,32 308 stvx 24,10,1 309 addi 10,10,32 310 stvx 25,11,1 311 addi 11,11,32 312 stvx 26,10,1 313 addi 10,10,32 314 stvx 27,11,1 315 addi 11,11,32 316 stvx 28,10,1 317 addi 10,10,32 318 stvx 29,11,1 319 addi 11,11,32 320 stvx 30,10,1 321 li 10,0x60 322 stvx 31,11,1 323 li 0,-1 324 stw 12,252(1) 325 mtspr 256,0 326 327 lvsl 5,0,8 328 329 li 8,0x70 330 .long 0x7E292699 331 li 9,0x80 332 vspltisb 6,8 333 334 li 10,0x90 335 .long 0x7EE82699 336 li 8,0xa0 337 .long 0x7F092699 338 li 9,0xb0 339 .long 0x7F2A2699 340 li 10,0xc0 341 .long 0x7FA82699 342 li 8,0x10 343 .long 0x7FC92699 344 li 9,0x20 345 .long 0x7FEA2699 346 li 10,0x30 347 348 vsldoi 7,4,6,8 349 vaddubm 18,5,7 350 vaddubm 19,6,18 351 352 srdi 6,6,4 353 354 .long 0x7C602E99 355 .long 0x7E082E99 356 subic. 6,6,8 357 .long 0x7EC92E99 358 .long 0x7F8A2E99 359 addi 5,5,0x40 360 vperm 3,3,3,12 361 vperm 16,16,16,12 362 vperm 22,22,22,12 363 vperm 28,28,28,12 364 365 vxor 2,3,0 366 367 .long 0x11B0BCC8 368 .long 0x11D0C4C8 369 .long 0x11F0CCC8 370 371 vperm 11,17,9,18 372 vperm 5,22,28,19 373 vperm 10,17,9,19 374 vperm 6,22,28,18 375 .long 0x12B68CC8 376 .long 0x12855CC8 377 .long 0x137C4CC8 378 .long 0x134654C8 379 380 vxor 21,21,14 381 vxor 20,20,13 382 vxor 27,27,21 383 vxor 26,26,15 384 385 blt Ltail_4x 386 387 Loop_4x: 388 .long 0x7C602E99 389 .long 0x7E082E99 390 subic. 6,6,4 391 .long 0x7EC92E99 392 .long 0x7F8A2E99 393 addi 5,5,0x40 394 vperm 16,16,16,12 395 vperm 22,22,22,12 396 vperm 28,28,28,12 397 vperm 3,3,3,12 398 399 .long 0x1002ECC8 400 .long 0x1022F4C8 401 .long 0x1042FCC8 402 .long 0x11B0BCC8 403 .long 0x11D0C4C8 404 .long 0x11F0CCC8 405 406 vxor 0,0,20 407 vxor 1,1,27 408 vxor 2,2,26 409 vperm 5,22,28,19 410 vperm 6,22,28,18 411 412 .long 0x10E044C8 413 .long 0x12855CC8 414 .long 0x134654C8 415 416 vsldoi 5,1,4,8 417 vsldoi 6,4,1,8 418 vxor 0,0,5 419 vxor 2,2,6 420 421 vsldoi 0,0,0,8 422 vxor 0,0,7 423 424 vsldoi 6,0,0,8 425 .long 0x12B68CC8 426 .long 0x137C4CC8 427 .long 0x100044C8 428 429 vxor 20,20,13 430 vxor 26,26,15 431 vxor 2,2,3 432 vxor 21,21,14 433 vxor 2,2,6 434 vxor 27,27,21 435 vxor 2,2,0 436 bge Loop_4x 437 438 Ltail_4x: 439 .long 0x1002ECC8 440 .long 0x1022F4C8 441 .long 0x1042FCC8 442 443 vxor 0,0,20 444 vxor 1,1,27 445 446 .long 0x10E044C8 447 448 vsldoi 5,1,4,8 449 vsldoi 6,4,1,8 450 vxor 2,2,26 451 vxor 0,0,5 452 vxor 2,2,6 453 454 vsldoi 0,0,0,8 455 vxor 0,0,7 456 457 vsldoi 6,0,0,8 458 .long 0x100044C8 459 vxor 6,6,2 460 vxor 0,0,6 461 462 addic. 6,6,4 463 beq Ldone_4x 464 465 .long 0x7C602E99 466 cmpldi 6,2 467 li 6,-4 468 blt Lone 469 .long 0x7E082E99 470 beq Ltwo 471 472 Lthree: 473 .long 0x7EC92E99 474 vperm 3,3,3,12 475 vperm 16,16,16,12 476 vperm 22,22,22,12 477 478 vxor 2,3,0 479 vor 29,23,23 480 vor 30, 24, 24 481 vor 31,25,25 482 483 vperm 5,16,22,19 484 vperm 6,16,22,18 485 .long 0x12B08CC8 486 .long 0x13764CC8 487 .long 0x12855CC8 488 .long 0x134654C8 489 490 vxor 27,27,21 491 b Ltail_4x 492 493 .align 4 494 Ltwo: 495 vperm 3,3,3,12 496 vperm 16,16,16,12 497 498 vxor 2,3,0 499 vperm 5,4,16,19 500 vperm 6,4,16,18 501 502 vsldoi 29,4,17,8 503 vor 30, 17, 17 504 vsldoi 31,17,4,8 505 506 .long 0x12855CC8 507 .long 0x13704CC8 508 .long 0x134654C8 509 510 b Ltail_4x 511 512 .align 4 513 Lone: 514 vperm 3,3,3,12 515 516 vsldoi 29,4,9,8 517 vor 30, 9, 9 518 vsldoi 31,9,4,8 519 520 vxor 2,3,0 521 vxor 20,20,20 522 vxor 27,27,27 523 vxor 26,26,26 524 525 b Ltail_4x 526 527 Ldone_4x: 528 vperm 0,0,0,12 529 .long 0x7C001F99 530 531 li 10,63 532 li 11,79 533 mtspr 256,12 534 lvx 20,10,1 535 addi 10,10,32 536 lvx 21,11,1 537 addi 11,11,32 538 lvx 22,10,1 539 addi 10,10,32 540 lvx 23,11,1 541 addi 11,11,32 542 lvx 24,10,1 543 addi 10,10,32 544 lvx 25,11,1 545 addi 11,11,32 546 lvx 26,10,1 547 addi 10,10,32 548 lvx 27,11,1 549 addi 11,11,32 550 lvx 28,10,1 551 addi 10,10,32 552 lvx 29,11,1 553 addi 11,11,32 554 lvx 30,10,1 555 lvx 31,11,1 556 addi 1,1,256 557 blr 558 .long 0 559 .byte 0,12,0x04,0,0x80,0,4,0 560 .long 0 561 562 563 .byte 71,72,65,83,72,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 564 .align 2 565 .align 2 566