1 #if defined(__i386__) 2 .file "src/crypto/aes/asm/aesni-x86.S" 3 .text 4 .globl _aesni_encrypt 5 .private_extern _aesni_encrypt 6 .align 4 7 _aesni_encrypt: 8 L_aesni_encrypt_begin: 9 movl 4(%esp),%eax 10 movl 12(%esp),%edx 11 movups (%eax),%xmm2 12 movl 240(%edx),%ecx 13 movl 8(%esp),%eax 14 movups (%edx),%xmm0 15 movups 16(%edx),%xmm1 16 leal 32(%edx),%edx 17 xorps %xmm0,%xmm2 18 L000enc1_loop_1: 19 .byte 102,15,56,220,209 20 decl %ecx 21 movups (%edx),%xmm1 22 leal 16(%edx),%edx 23 jnz L000enc1_loop_1 24 .byte 102,15,56,221,209 25 movups %xmm2,(%eax) 26 ret 27 .globl _aesni_decrypt 28 .private_extern _aesni_decrypt 29 .align 4 30 _aesni_decrypt: 31 L_aesni_decrypt_begin: 32 movl 4(%esp),%eax 33 movl 12(%esp),%edx 34 movups (%eax),%xmm2 35 movl 240(%edx),%ecx 36 movl 8(%esp),%eax 37 movups (%edx),%xmm0 38 movups 16(%edx),%xmm1 39 leal 32(%edx),%edx 40 xorps %xmm0,%xmm2 41 L001dec1_loop_2: 42 .byte 102,15,56,222,209 43 decl %ecx 44 movups (%edx),%xmm1 45 leal 16(%edx),%edx 46 jnz L001dec1_loop_2 47 .byte 102,15,56,223,209 48 movups %xmm2,(%eax) 49 ret 50 .private_extern __aesni_encrypt2 51 .align 4 52 __aesni_encrypt2: 53 movups (%edx),%xmm0 54 shll $4,%ecx 55 movups 16(%edx),%xmm1 56 xorps %xmm0,%xmm2 57 pxor %xmm0,%xmm3 58 movups 32(%edx),%xmm0 59 leal 32(%edx,%ecx,1),%edx 60 negl %ecx 61 addl $16,%ecx 62 L002enc2_loop: 63 .byte 102,15,56,220,209 64 .byte 102,15,56,220,217 65 movups (%edx,%ecx,1),%xmm1 66 addl $32,%ecx 67 .byte 102,15,56,220,208 68 .byte 102,15,56,220,216 69 movups -16(%edx,%ecx,1),%xmm0 70 jnz L002enc2_loop 71 .byte 102,15,56,220,209 72 .byte 102,15,56,220,217 73 .byte 102,15,56,221,208 74 .byte 102,15,56,221,216 75 ret 76 .private_extern __aesni_decrypt2 77 .align 4 78 __aesni_decrypt2: 79 movups (%edx),%xmm0 80 shll $4,%ecx 81 movups 16(%edx),%xmm1 82 xorps %xmm0,%xmm2 83 pxor %xmm0,%xmm3 84 movups 32(%edx),%xmm0 85 leal 32(%edx,%ecx,1),%edx 86 negl %ecx 87 addl $16,%ecx 88 L003dec2_loop: 89 .byte 102,15,56,222,209 90 .byte 102,15,56,222,217 91 movups (%edx,%ecx,1),%xmm1 92 addl $32,%ecx 93 .byte 102,15,56,222,208 94 .byte 102,15,56,222,216 95 movups -16(%edx,%ecx,1),%xmm0 96 jnz L003dec2_loop 97 .byte 102,15,56,222,209 98 .byte 102,15,56,222,217 99 .byte 102,15,56,223,208 100 .byte 102,15,56,223,216 101 ret 102 .private_extern __aesni_encrypt3 103 .align 4 104 __aesni_encrypt3: 105 movups (%edx),%xmm0 106 shll $4,%ecx 107 movups 16(%edx),%xmm1 108 xorps %xmm0,%xmm2 109 pxor %xmm0,%xmm3 110 pxor %xmm0,%xmm4 111 movups 32(%edx),%xmm0 112 leal 32(%edx,%ecx,1),%edx 113 negl %ecx 114 addl $16,%ecx 115 L004enc3_loop: 116 .byte 102,15,56,220,209 117 .byte 102,15,56,220,217 118 .byte 102,15,56,220,225 119 movups (%edx,%ecx,1),%xmm1 120 addl $32,%ecx 121 .byte 102,15,56,220,208 122 .byte 102,15,56,220,216 123 .byte 102,15,56,220,224 124 movups -16(%edx,%ecx,1),%xmm0 125 jnz L004enc3_loop 126 .byte 102,15,56,220,209 127 .byte 102,15,56,220,217 128 .byte 102,15,56,220,225 129 .byte 102,15,56,221,208 130 .byte 102,15,56,221,216 131 .byte 102,15,56,221,224 132 ret 133 .private_extern __aesni_decrypt3 134 .align 4 135 __aesni_decrypt3: 136 movups (%edx),%xmm0 137 shll $4,%ecx 138 movups 16(%edx),%xmm1 139 xorps %xmm0,%xmm2 140 pxor %xmm0,%xmm3 141 pxor %xmm0,%xmm4 142 movups 32(%edx),%xmm0 143 leal 32(%edx,%ecx,1),%edx 144 negl %ecx 145 addl $16,%ecx 146 L005dec3_loop: 147 .byte 102,15,56,222,209 148 .byte 102,15,56,222,217 149 .byte 102,15,56,222,225 150 movups (%edx,%ecx,1),%xmm1 151 addl $32,%ecx 152 .byte 102,15,56,222,208 153 .byte 102,15,56,222,216 154 .byte 102,15,56,222,224 155 movups -16(%edx,%ecx,1),%xmm0 156 jnz L005dec3_loop 157 .byte 102,15,56,222,209 158 .byte 102,15,56,222,217 159 .byte 102,15,56,222,225 160 .byte 102,15,56,223,208 161 .byte 102,15,56,223,216 162 .byte 102,15,56,223,224 163 ret 164 .private_extern __aesni_encrypt4 165 .align 4 166 __aesni_encrypt4: 167 movups (%edx),%xmm0 168 movups 16(%edx),%xmm1 169 shll $4,%ecx 170 xorps %xmm0,%xmm2 171 pxor %xmm0,%xmm3 172 pxor %xmm0,%xmm4 173 pxor %xmm0,%xmm5 174 movups 32(%edx),%xmm0 175 leal 32(%edx,%ecx,1),%edx 176 negl %ecx 177 .byte 15,31,64,0 178 addl $16,%ecx 179 L006enc4_loop: 180 .byte 102,15,56,220,209 181 .byte 102,15,56,220,217 182 .byte 102,15,56,220,225 183 .byte 102,15,56,220,233 184 movups (%edx,%ecx,1),%xmm1 185 addl $32,%ecx 186 .byte 102,15,56,220,208 187 .byte 102,15,56,220,216 188 .byte 102,15,56,220,224 189 .byte 102,15,56,220,232 190 movups -16(%edx,%ecx,1),%xmm0 191 jnz L006enc4_loop 192 .byte 102,15,56,220,209 193 .byte 102,15,56,220,217 194 .byte 102,15,56,220,225 195 .byte 102,15,56,220,233 196 .byte 102,15,56,221,208 197 .byte 102,15,56,221,216 198 .byte 102,15,56,221,224 199 .byte 102,15,56,221,232 200 ret 201 .private_extern __aesni_decrypt4 202 .align 4 203 __aesni_decrypt4: 204 movups (%edx),%xmm0 205 movups 16(%edx),%xmm1 206 shll $4,%ecx 207 xorps %xmm0,%xmm2 208 pxor %xmm0,%xmm3 209 pxor %xmm0,%xmm4 210 pxor %xmm0,%xmm5 211 movups 32(%edx),%xmm0 212 leal 32(%edx,%ecx,1),%edx 213 negl %ecx 214 .byte 15,31,64,0 215 addl $16,%ecx 216 L007dec4_loop: 217 .byte 102,15,56,222,209 218 .byte 102,15,56,222,217 219 .byte 102,15,56,222,225 220 .byte 102,15,56,222,233 221 movups (%edx,%ecx,1),%xmm1 222 addl $32,%ecx 223 .byte 102,15,56,222,208 224 .byte 102,15,56,222,216 225 .byte 102,15,56,222,224 226 .byte 102,15,56,222,232 227 movups -16(%edx,%ecx,1),%xmm0 228 jnz L007dec4_loop 229 .byte 102,15,56,222,209 230 .byte 102,15,56,222,217 231 .byte 102,15,56,222,225 232 .byte 102,15,56,222,233 233 .byte 102,15,56,223,208 234 .byte 102,15,56,223,216 235 .byte 102,15,56,223,224 236 .byte 102,15,56,223,232 237 ret 238 .private_extern __aesni_encrypt6 239 .align 4 240 __aesni_encrypt6: 241 movups (%edx),%xmm0 242 shll $4,%ecx 243 movups 16(%edx),%xmm1 244 xorps %xmm0,%xmm2 245 pxor %xmm0,%xmm3 246 pxor %xmm0,%xmm4 247 .byte 102,15,56,220,209 248 pxor %xmm0,%xmm5 249 pxor %xmm0,%xmm6 250 .byte 102,15,56,220,217 251 leal 32(%edx,%ecx,1),%edx 252 negl %ecx 253 .byte 102,15,56,220,225 254 pxor %xmm0,%xmm7 255 addl $16,%ecx 256 .byte 102,15,56,220,233 257 .byte 102,15,56,220,241 258 .byte 102,15,56,220,249 259 movups -16(%edx,%ecx,1),%xmm0 260 jmp L_aesni_encrypt6_enter 261 .align 4,0x90 262 L008enc6_loop: 263 .byte 102,15,56,220,209 264 .byte 102,15,56,220,217 265 .byte 102,15,56,220,225 266 .byte 102,15,56,220,233 267 .byte 102,15,56,220,241 268 .byte 102,15,56,220,249 269 L_aesni_encrypt6_enter: 270 movups (%edx,%ecx,1),%xmm1 271 addl $32,%ecx 272 .byte 102,15,56,220,208 273 .byte 102,15,56,220,216 274 .byte 102,15,56,220,224 275 .byte 102,15,56,220,232 276 .byte 102,15,56,220,240 277 .byte 102,15,56,220,248 278 movups -16(%edx,%ecx,1),%xmm0 279 jnz L008enc6_loop 280 .byte 102,15,56,220,209 281 .byte 102,15,56,220,217 282 .byte 102,15,56,220,225 283 .byte 102,15,56,220,233 284 .byte 102,15,56,220,241 285 .byte 102,15,56,220,249 286 .byte 102,15,56,221,208 287 .byte 102,15,56,221,216 288 .byte 102,15,56,221,224 289 .byte 102,15,56,221,232 290 .byte 102,15,56,221,240 291 .byte 102,15,56,221,248 292 ret 293 .private_extern __aesni_decrypt6 294 .align 4 295 __aesni_decrypt6: 296 movups (%edx),%xmm0 297 shll $4,%ecx 298 movups 16(%edx),%xmm1 299 xorps %xmm0,%xmm2 300 pxor %xmm0,%xmm3 301 pxor %xmm0,%xmm4 302 .byte 102,15,56,222,209 303 pxor %xmm0,%xmm5 304 pxor %xmm0,%xmm6 305 .byte 102,15,56,222,217 306 leal 32(%edx,%ecx,1),%edx 307 negl %ecx 308 .byte 102,15,56,222,225 309 pxor %xmm0,%xmm7 310 addl $16,%ecx 311 .byte 102,15,56,222,233 312 .byte 102,15,56,222,241 313 .byte 102,15,56,222,249 314 movups -16(%edx,%ecx,1),%xmm0 315 jmp L_aesni_decrypt6_enter 316 .align 4,0x90 317 L009dec6_loop: 318 .byte 102,15,56,222,209 319 .byte 102,15,56,222,217 320 .byte 102,15,56,222,225 321 .byte 102,15,56,222,233 322 .byte 102,15,56,222,241 323 .byte 102,15,56,222,249 324 L_aesni_decrypt6_enter: 325 movups (%edx,%ecx,1),%xmm1 326 addl $32,%ecx 327 .byte 102,15,56,222,208 328 .byte 102,15,56,222,216 329 .byte 102,15,56,222,224 330 .byte 102,15,56,222,232 331 .byte 102,15,56,222,240 332 .byte 102,15,56,222,248 333 movups -16(%edx,%ecx,1),%xmm0 334 jnz L009dec6_loop 335 .byte 102,15,56,222,209 336 .byte 102,15,56,222,217 337 .byte 102,15,56,222,225 338 .byte 102,15,56,222,233 339 .byte 102,15,56,222,241 340 .byte 102,15,56,222,249 341 .byte 102,15,56,223,208 342 .byte 102,15,56,223,216 343 .byte 102,15,56,223,224 344 .byte 102,15,56,223,232 345 .byte 102,15,56,223,240 346 .byte 102,15,56,223,248 347 ret 348 .globl _aesni_ecb_encrypt 349 .private_extern _aesni_ecb_encrypt 350 .align 4 351 _aesni_ecb_encrypt: 352 L_aesni_ecb_encrypt_begin: 353 pushl %ebp 354 pushl %ebx 355 pushl %esi 356 pushl %edi 357 movl 20(%esp),%esi 358 movl 24(%esp),%edi 359 movl 28(%esp),%eax 360 movl 32(%esp),%edx 361 movl 36(%esp),%ebx 362 andl $-16,%eax 363 jz L010ecb_ret 364 movl 240(%edx),%ecx 365 testl %ebx,%ebx 366 jz L011ecb_decrypt 367 movl %edx,%ebp 368 movl %ecx,%ebx 369 cmpl $96,%eax 370 jb L012ecb_enc_tail 371 movdqu (%esi),%xmm2 372 movdqu 16(%esi),%xmm3 373 movdqu 32(%esi),%xmm4 374 movdqu 48(%esi),%xmm5 375 movdqu 64(%esi),%xmm6 376 movdqu 80(%esi),%xmm7 377 leal 96(%esi),%esi 378 subl $96,%eax 379 jmp L013ecb_enc_loop6_enter 380 .align 4,0x90 381 L014ecb_enc_loop6: 382 movups %xmm2,(%edi) 383 movdqu (%esi),%xmm2 384 movups %xmm3,16(%edi) 385 movdqu 16(%esi),%xmm3 386 movups %xmm4,32(%edi) 387 movdqu 32(%esi),%xmm4 388 movups %xmm5,48(%edi) 389 movdqu 48(%esi),%xmm5 390 movups %xmm6,64(%edi) 391 movdqu 64(%esi),%xmm6 392 movups %xmm7,80(%edi) 393 leal 96(%edi),%edi 394 movdqu 80(%esi),%xmm7 395 leal 96(%esi),%esi 396 L013ecb_enc_loop6_enter: 397 call __aesni_encrypt6 398 movl %ebp,%edx 399 movl %ebx,%ecx 400 subl $96,%eax 401 jnc L014ecb_enc_loop6 402 movups %xmm2,(%edi) 403 movups %xmm3,16(%edi) 404 movups %xmm4,32(%edi) 405 movups %xmm5,48(%edi) 406 movups %xmm6,64(%edi) 407 movups %xmm7,80(%edi) 408 leal 96(%edi),%edi 409 addl $96,%eax 410 jz L010ecb_ret 411 L012ecb_enc_tail: 412 movups (%esi),%xmm2 413 cmpl $32,%eax 414 jb L015ecb_enc_one 415 movups 16(%esi),%xmm3 416 je L016ecb_enc_two 417 movups 32(%esi),%xmm4 418 cmpl $64,%eax 419 jb L017ecb_enc_three 420 movups 48(%esi),%xmm5 421 je L018ecb_enc_four 422 movups 64(%esi),%xmm6 423 xorps %xmm7,%xmm7 424 call __aesni_encrypt6 425 movups %xmm2,(%edi) 426 movups %xmm3,16(%edi) 427 movups %xmm4,32(%edi) 428 movups %xmm5,48(%edi) 429 movups %xmm6,64(%edi) 430 jmp L010ecb_ret 431 .align 4,0x90 432 L015ecb_enc_one: 433 movups (%edx),%xmm0 434 movups 16(%edx),%xmm1 435 leal 32(%edx),%edx 436 xorps %xmm0,%xmm2 437 L019enc1_loop_3: 438 .byte 102,15,56,220,209 439 decl %ecx 440 movups (%edx),%xmm1 441 leal 16(%edx),%edx 442 jnz L019enc1_loop_3 443 .byte 102,15,56,221,209 444 movups %xmm2,(%edi) 445 jmp L010ecb_ret 446 .align 4,0x90 447 L016ecb_enc_two: 448 call __aesni_encrypt2 449 movups %xmm2,(%edi) 450 movups %xmm3,16(%edi) 451 jmp L010ecb_ret 452 .align 4,0x90 453 L017ecb_enc_three: 454 call __aesni_encrypt3 455 movups %xmm2,(%edi) 456 movups %xmm3,16(%edi) 457 movups %xmm4,32(%edi) 458 jmp L010ecb_ret 459 .align 4,0x90 460 L018ecb_enc_four: 461 call __aesni_encrypt4 462 movups %xmm2,(%edi) 463 movups %xmm3,16(%edi) 464 movups %xmm4,32(%edi) 465 movups %xmm5,48(%edi) 466 jmp L010ecb_ret 467 .align 4,0x90 468 L011ecb_decrypt: 469 movl %edx,%ebp 470 movl %ecx,%ebx 471 cmpl $96,%eax 472 jb L020ecb_dec_tail 473 movdqu (%esi),%xmm2 474 movdqu 16(%esi),%xmm3 475 movdqu 32(%esi),%xmm4 476 movdqu 48(%esi),%xmm5 477 movdqu 64(%esi),%xmm6 478 movdqu 80(%esi),%xmm7 479 leal 96(%esi),%esi 480 subl $96,%eax 481 jmp L021ecb_dec_loop6_enter 482 .align 4,0x90 483 L022ecb_dec_loop6: 484 movups %xmm2,(%edi) 485 movdqu (%esi),%xmm2 486 movups %xmm3,16(%edi) 487 movdqu 16(%esi),%xmm3 488 movups %xmm4,32(%edi) 489 movdqu 32(%esi),%xmm4 490 movups %xmm5,48(%edi) 491 movdqu 48(%esi),%xmm5 492 movups %xmm6,64(%edi) 493 movdqu 64(%esi),%xmm6 494 movups %xmm7,80(%edi) 495 leal 96(%edi),%edi 496 movdqu 80(%esi),%xmm7 497 leal 96(%esi),%esi 498 L021ecb_dec_loop6_enter: 499 call __aesni_decrypt6 500 movl %ebp,%edx 501 movl %ebx,%ecx 502 subl $96,%eax 503 jnc L022ecb_dec_loop6 504 movups %xmm2,(%edi) 505 movups %xmm3,16(%edi) 506 movups %xmm4,32(%edi) 507 movups %xmm5,48(%edi) 508 movups %xmm6,64(%edi) 509 movups %xmm7,80(%edi) 510 leal 96(%edi),%edi 511 addl $96,%eax 512 jz L010ecb_ret 513 L020ecb_dec_tail: 514 movups (%esi),%xmm2 515 cmpl $32,%eax 516 jb L023ecb_dec_one 517 movups 16(%esi),%xmm3 518 je L024ecb_dec_two 519 movups 32(%esi),%xmm4 520 cmpl $64,%eax 521 jb L025ecb_dec_three 522 movups 48(%esi),%xmm5 523 je L026ecb_dec_four 524 movups 64(%esi),%xmm6 525 xorps %xmm7,%xmm7 526 call __aesni_decrypt6 527 movups %xmm2,(%edi) 528 movups %xmm3,16(%edi) 529 movups %xmm4,32(%edi) 530 movups %xmm5,48(%edi) 531 movups %xmm6,64(%edi) 532 jmp L010ecb_ret 533 .align 4,0x90 534 L023ecb_dec_one: 535 movups (%edx),%xmm0 536 movups 16(%edx),%xmm1 537 leal 32(%edx),%edx 538 xorps %xmm0,%xmm2 539 L027dec1_loop_4: 540 .byte 102,15,56,222,209 541 decl %ecx 542 movups (%edx),%xmm1 543 leal 16(%edx),%edx 544 jnz L027dec1_loop_4 545 .byte 102,15,56,223,209 546 movups %xmm2,(%edi) 547 jmp L010ecb_ret 548 .align 4,0x90 549 L024ecb_dec_two: 550 call __aesni_decrypt2 551 movups %xmm2,(%edi) 552 movups %xmm3,16(%edi) 553 jmp L010ecb_ret 554 .align 4,0x90 555 L025ecb_dec_three: 556 call __aesni_decrypt3 557 movups %xmm2,(%edi) 558 movups %xmm3,16(%edi) 559 movups %xmm4,32(%edi) 560 jmp L010ecb_ret 561 .align 4,0x90 562 L026ecb_dec_four: 563 call __aesni_decrypt4 564 movups %xmm2,(%edi) 565 movups %xmm3,16(%edi) 566 movups %xmm4,32(%edi) 567 movups %xmm5,48(%edi) 568 L010ecb_ret: 569 popl %edi 570 popl %esi 571 popl %ebx 572 popl %ebp 573 ret 574 .globl _aesni_ccm64_encrypt_blocks 575 .private_extern _aesni_ccm64_encrypt_blocks 576 .align 4 577 _aesni_ccm64_encrypt_blocks: 578 L_aesni_ccm64_encrypt_blocks_begin: 579 pushl %ebp 580 pushl %ebx 581 pushl %esi 582 pushl %edi 583 movl 20(%esp),%esi 584 movl 24(%esp),%edi 585 movl 28(%esp),%eax 586 movl 32(%esp),%edx 587 movl 36(%esp),%ebx 588 movl 40(%esp),%ecx 589 movl %esp,%ebp 590 subl $60,%esp 591 andl $-16,%esp 592 movl %ebp,48(%esp) 593 movdqu (%ebx),%xmm7 594 movdqu (%ecx),%xmm3 595 movl 240(%edx),%ecx 596 movl $202182159,(%esp) 597 movl $134810123,4(%esp) 598 movl $67438087,8(%esp) 599 movl $66051,12(%esp) 600 movl $1,%ebx 601 xorl %ebp,%ebp 602 movl %ebx,16(%esp) 603 movl %ebp,20(%esp) 604 movl %ebp,24(%esp) 605 movl %ebp,28(%esp) 606 shll $4,%ecx 607 movl $16,%ebx 608 leal (%edx),%ebp 609 movdqa (%esp),%xmm5 610 movdqa %xmm7,%xmm2 611 leal 32(%edx,%ecx,1),%edx 612 subl %ecx,%ebx 613 .byte 102,15,56,0,253 614 L028ccm64_enc_outer: 615 movups (%ebp),%xmm0 616 movl %ebx,%ecx 617 movups (%esi),%xmm6 618 xorps %xmm0,%xmm2 619 movups 16(%ebp),%xmm1 620 xorps %xmm6,%xmm0 621 xorps %xmm0,%xmm3 622 movups 32(%ebp),%xmm0 623 L029ccm64_enc2_loop: 624 .byte 102,15,56,220,209 625 .byte 102,15,56,220,217 626 movups (%edx,%ecx,1),%xmm1 627 addl $32,%ecx 628 .byte 102,15,56,220,208 629 .byte 102,15,56,220,216 630 movups -16(%edx,%ecx,1),%xmm0 631 jnz L029ccm64_enc2_loop 632 .byte 102,15,56,220,209 633 .byte 102,15,56,220,217 634 paddq 16(%esp),%xmm7 635 decl %eax 636 .byte 102,15,56,221,208 637 .byte 102,15,56,221,216 638 leal 16(%esi),%esi 639 xorps %xmm2,%xmm6 640 movdqa %xmm7,%xmm2 641 movups %xmm6,(%edi) 642 .byte 102,15,56,0,213 643 leal 16(%edi),%edi 644 jnz L028ccm64_enc_outer 645 movl 48(%esp),%esp 646 movl 40(%esp),%edi 647 movups %xmm3,(%edi) 648 popl %edi 649 popl %esi 650 popl %ebx 651 popl %ebp 652 ret 653 .globl _aesni_ccm64_decrypt_blocks 654 .private_extern _aesni_ccm64_decrypt_blocks 655 .align 4 656 _aesni_ccm64_decrypt_blocks: 657 L_aesni_ccm64_decrypt_blocks_begin: 658 pushl %ebp 659 pushl %ebx 660 pushl %esi 661 pushl %edi 662 movl 20(%esp),%esi 663 movl 24(%esp),%edi 664 movl 28(%esp),%eax 665 movl 32(%esp),%edx 666 movl 36(%esp),%ebx 667 movl 40(%esp),%ecx 668 movl %esp,%ebp 669 subl $60,%esp 670 andl $-16,%esp 671 movl %ebp,48(%esp) 672 movdqu (%ebx),%xmm7 673 movdqu (%ecx),%xmm3 674 movl 240(%edx),%ecx 675 movl $202182159,(%esp) 676 movl $134810123,4(%esp) 677 movl $67438087,8(%esp) 678 movl $66051,12(%esp) 679 movl $1,%ebx 680 xorl %ebp,%ebp 681 movl %ebx,16(%esp) 682 movl %ebp,20(%esp) 683 movl %ebp,24(%esp) 684 movl %ebp,28(%esp) 685 movdqa (%esp),%xmm5 686 movdqa %xmm7,%xmm2 687 movl %edx,%ebp 688 movl %ecx,%ebx 689 .byte 102,15,56,0,253 690 movups (%edx),%xmm0 691 movups 16(%edx),%xmm1 692 leal 32(%edx),%edx 693 xorps %xmm0,%xmm2 694 L030enc1_loop_5: 695 .byte 102,15,56,220,209 696 decl %ecx 697 movups (%edx),%xmm1 698 leal 16(%edx),%edx 699 jnz L030enc1_loop_5 700 .byte 102,15,56,221,209 701 shll $4,%ebx 702 movl $16,%ecx 703 movups (%esi),%xmm6 704 paddq 16(%esp),%xmm7 705 leal 16(%esi),%esi 706 subl %ebx,%ecx 707 leal 32(%ebp,%ebx,1),%edx 708 movl %ecx,%ebx 709 jmp L031ccm64_dec_outer 710 .align 4,0x90 711 L031ccm64_dec_outer: 712 xorps %xmm2,%xmm6 713 movdqa %xmm7,%xmm2 714 movups %xmm6,(%edi) 715 leal 16(%edi),%edi 716 .byte 102,15,56,0,213 717 subl $1,%eax 718 jz L032ccm64_dec_break 719 movups (%ebp),%xmm0 720 movl %ebx,%ecx 721 movups 16(%ebp),%xmm1 722 xorps %xmm0,%xmm6 723 xorps %xmm0,%xmm2 724 xorps %xmm6,%xmm3 725 movups 32(%ebp),%xmm0 726 L033ccm64_dec2_loop: 727 .byte 102,15,56,220,209 728 .byte 102,15,56,220,217 729 movups (%edx,%ecx,1),%xmm1 730 addl $32,%ecx 731 .byte 102,15,56,220,208 732 .byte 102,15,56,220,216 733 movups -16(%edx,%ecx,1),%xmm0 734 jnz L033ccm64_dec2_loop 735 movups (%esi),%xmm6 736 paddq 16(%esp),%xmm7 737 .byte 102,15,56,220,209 738 .byte 102,15,56,220,217 739 .byte 102,15,56,221,208 740 .byte 102,15,56,221,216 741 leal 16(%esi),%esi 742 jmp L031ccm64_dec_outer 743 .align 4,0x90 744 L032ccm64_dec_break: 745 movl 240(%ebp),%ecx 746 movl %ebp,%edx 747 movups (%edx),%xmm0 748 movups 16(%edx),%xmm1 749 xorps %xmm0,%xmm6 750 leal 32(%edx),%edx 751 xorps %xmm6,%xmm3 752 L034enc1_loop_6: 753 .byte 102,15,56,220,217 754 decl %ecx 755 movups (%edx),%xmm1 756 leal 16(%edx),%edx 757 jnz L034enc1_loop_6 758 .byte 102,15,56,221,217 759 movl 48(%esp),%esp 760 movl 40(%esp),%edi 761 movups %xmm3,(%edi) 762 popl %edi 763 popl %esi 764 popl %ebx 765 popl %ebp 766 ret 767 .globl _aesni_ctr32_encrypt_blocks 768 .private_extern _aesni_ctr32_encrypt_blocks 769 .align 4 770 _aesni_ctr32_encrypt_blocks: 771 L_aesni_ctr32_encrypt_blocks_begin: 772 pushl %ebp 773 pushl %ebx 774 pushl %esi 775 pushl %edi 776 movl 20(%esp),%esi 777 movl 24(%esp),%edi 778 movl 28(%esp),%eax 779 movl 32(%esp),%edx 780 movl 36(%esp),%ebx 781 movl %esp,%ebp 782 subl $88,%esp 783 andl $-16,%esp 784 movl %ebp,80(%esp) 785 cmpl $1,%eax 786 je L035ctr32_one_shortcut 787 movdqu (%ebx),%xmm7 788 movl $202182159,(%esp) 789 movl $134810123,4(%esp) 790 movl $67438087,8(%esp) 791 movl $66051,12(%esp) 792 movl $6,%ecx 793 xorl %ebp,%ebp 794 movl %ecx,16(%esp) 795 movl %ecx,20(%esp) 796 movl %ecx,24(%esp) 797 movl %ebp,28(%esp) 798 .byte 102,15,58,22,251,3 799 .byte 102,15,58,34,253,3 800 movl 240(%edx),%ecx 801 bswap %ebx 802 pxor %xmm0,%xmm0 803 pxor %xmm1,%xmm1 804 movdqa (%esp),%xmm2 805 .byte 102,15,58,34,195,0 806 leal 3(%ebx),%ebp 807 .byte 102,15,58,34,205,0 808 incl %ebx 809 .byte 102,15,58,34,195,1 810 incl %ebp 811 .byte 102,15,58,34,205,1 812 incl %ebx 813 .byte 102,15,58,34,195,2 814 incl %ebp 815 .byte 102,15,58,34,205,2 816 movdqa %xmm0,48(%esp) 817 .byte 102,15,56,0,194 818 movdqu (%edx),%xmm6 819 movdqa %xmm1,64(%esp) 820 .byte 102,15,56,0,202 821 pshufd $192,%xmm0,%xmm2 822 pshufd $128,%xmm0,%xmm3 823 cmpl $6,%eax 824 jb L036ctr32_tail 825 pxor %xmm6,%xmm7 826 shll $4,%ecx 827 movl $16,%ebx 828 movdqa %xmm7,32(%esp) 829 movl %edx,%ebp 830 subl %ecx,%ebx 831 leal 32(%edx,%ecx,1),%edx 832 subl $6,%eax 833 jmp L037ctr32_loop6 834 .align 4,0x90 835 L037ctr32_loop6: 836 pshufd $64,%xmm0,%xmm4 837 movdqa 32(%esp),%xmm0 838 pshufd $192,%xmm1,%xmm5 839 pxor %xmm0,%xmm2 840 pshufd $128,%xmm1,%xmm6 841 pxor %xmm0,%xmm3 842 pshufd $64,%xmm1,%xmm7 843 movups 16(%ebp),%xmm1 844 pxor %xmm0,%xmm4 845 pxor %xmm0,%xmm5 846 .byte 102,15,56,220,209 847 pxor %xmm0,%xmm6 848 pxor %xmm0,%xmm7 849 .byte 102,15,56,220,217 850 movups 32(%ebp),%xmm0 851 movl %ebx,%ecx 852 .byte 102,15,56,220,225 853 .byte 102,15,56,220,233 854 .byte 102,15,56,220,241 855 .byte 102,15,56,220,249 856 call L_aesni_encrypt6_enter 857 movups (%esi),%xmm1 858 movups 16(%esi),%xmm0 859 xorps %xmm1,%xmm2 860 movups 32(%esi),%xmm1 861 xorps %xmm0,%xmm3 862 movups %xmm2,(%edi) 863 movdqa 16(%esp),%xmm0 864 xorps %xmm1,%xmm4 865 movdqa 64(%esp),%xmm1 866 movups %xmm3,16(%edi) 867 movups %xmm4,32(%edi) 868 paddd %xmm0,%xmm1 869 paddd 48(%esp),%xmm0 870 movdqa (%esp),%xmm2 871 movups 48(%esi),%xmm3 872 movups 64(%esi),%xmm4 873 xorps %xmm3,%xmm5 874 movups 80(%esi),%xmm3 875 leal 96(%esi),%esi 876 movdqa %xmm0,48(%esp) 877 .byte 102,15,56,0,194 878 xorps %xmm4,%xmm6 879 movups %xmm5,48(%edi) 880 xorps %xmm3,%xmm7 881 movdqa %xmm1,64(%esp) 882 .byte 102,15,56,0,202 883 movups %xmm6,64(%edi) 884 pshufd $192,%xmm0,%xmm2 885 movups %xmm7,80(%edi) 886 leal 96(%edi),%edi 887 pshufd $128,%xmm0,%xmm3 888 subl $6,%eax 889 jnc L037ctr32_loop6 890 addl $6,%eax 891 jz L038ctr32_ret 892 movdqu (%ebp),%xmm7 893 movl %ebp,%edx 894 pxor 32(%esp),%xmm7 895 movl 240(%ebp),%ecx 896 L036ctr32_tail: 897 por %xmm7,%xmm2 898 cmpl $2,%eax 899 jb L039ctr32_one 900 pshufd $64,%xmm0,%xmm4 901 por %xmm7,%xmm3 902 je L040ctr32_two 903 pshufd $192,%xmm1,%xmm5 904 por %xmm7,%xmm4 905 cmpl $4,%eax 906 jb L041ctr32_three 907 pshufd $128,%xmm1,%xmm6 908 por %xmm7,%xmm5 909 je L042ctr32_four 910 por %xmm7,%xmm6 911 call __aesni_encrypt6 912 movups (%esi),%xmm1 913 movups 16(%esi),%xmm0 914 xorps %xmm1,%xmm2 915 movups 32(%esi),%xmm1 916 xorps %xmm0,%xmm3 917 movups 48(%esi),%xmm0 918 xorps %xmm1,%xmm4 919 movups 64(%esi),%xmm1 920 xorps %xmm0,%xmm5 921 movups %xmm2,(%edi) 922 xorps %xmm1,%xmm6 923 movups %xmm3,16(%edi) 924 movups %xmm4,32(%edi) 925 movups %xmm5,48(%edi) 926 movups %xmm6,64(%edi) 927 jmp L038ctr32_ret 928 .align 4,0x90 929 L035ctr32_one_shortcut: 930 movups (%ebx),%xmm2 931 movl 240(%edx),%ecx 932 L039ctr32_one: 933 movups (%edx),%xmm0 934 movups 16(%edx),%xmm1 935 leal 32(%edx),%edx 936 xorps %xmm0,%xmm2 937 L043enc1_loop_7: 938 .byte 102,15,56,220,209 939 decl %ecx 940 movups (%edx),%xmm1 941 leal 16(%edx),%edx 942 jnz L043enc1_loop_7 943 .byte 102,15,56,221,209 944 movups (%esi),%xmm6 945 xorps %xmm2,%xmm6 946 movups %xmm6,(%edi) 947 jmp L038ctr32_ret 948 .align 4,0x90 949 L040ctr32_two: 950 call __aesni_encrypt2 951 movups (%esi),%xmm5 952 movups 16(%esi),%xmm6 953 xorps %xmm5,%xmm2 954 xorps %xmm6,%xmm3 955 movups %xmm2,(%edi) 956 movups %xmm3,16(%edi) 957 jmp L038ctr32_ret 958 .align 4,0x90 959 L041ctr32_three: 960 call __aesni_encrypt3 961 movups (%esi),%xmm5 962 movups 16(%esi),%xmm6 963 xorps %xmm5,%xmm2 964 movups 32(%esi),%xmm7 965 xorps %xmm6,%xmm3 966 movups %xmm2,(%edi) 967 xorps %xmm7,%xmm4 968 movups %xmm3,16(%edi) 969 movups %xmm4,32(%edi) 970 jmp L038ctr32_ret 971 .align 4,0x90 972 L042ctr32_four: 973 call __aesni_encrypt4 974 movups (%esi),%xmm6 975 movups 16(%esi),%xmm7 976 movups 32(%esi),%xmm1 977 xorps %xmm6,%xmm2 978 movups 48(%esi),%xmm0 979 xorps %xmm7,%xmm3 980 movups %xmm2,(%edi) 981 xorps %xmm1,%xmm4 982 movups %xmm3,16(%edi) 983 xorps %xmm0,%xmm5 984 movups %xmm4,32(%edi) 985 movups %xmm5,48(%edi) 986 L038ctr32_ret: 987 movl 80(%esp),%esp 988 popl %edi 989 popl %esi 990 popl %ebx 991 popl %ebp 992 ret 993 .globl _aesni_xts_encrypt 994 .private_extern _aesni_xts_encrypt 995 .align 4 996 _aesni_xts_encrypt: 997 L_aesni_xts_encrypt_begin: 998 pushl %ebp 999 pushl %ebx 1000 pushl %esi 1001 pushl %edi 1002 movl 36(%esp),%edx 1003 movl 40(%esp),%esi 1004 movl 240(%edx),%ecx 1005 movups (%esi),%xmm2 1006 movups (%edx),%xmm0 1007 movups 16(%edx),%xmm1 1008 leal 32(%edx),%edx 1009 xorps %xmm0,%xmm2 1010 L044enc1_loop_8: 1011 .byte 102,15,56,220,209 1012 decl %ecx 1013 movups (%edx),%xmm1 1014 leal 16(%edx),%edx 1015 jnz L044enc1_loop_8 1016 .byte 102,15,56,221,209 1017 movl 20(%esp),%esi 1018 movl 24(%esp),%edi 1019 movl 28(%esp),%eax 1020 movl 32(%esp),%edx 1021 movl %esp,%ebp 1022 subl $120,%esp 1023 movl 240(%edx),%ecx 1024 andl $-16,%esp 1025 movl $135,96(%esp) 1026 movl $0,100(%esp) 1027 movl $1,104(%esp) 1028 movl $0,108(%esp) 1029 movl %eax,112(%esp) 1030 movl %ebp,116(%esp) 1031 movdqa %xmm2,%xmm1 1032 pxor %xmm0,%xmm0 1033 movdqa 96(%esp),%xmm3 1034 pcmpgtd %xmm1,%xmm0 1035 andl $-16,%eax 1036 movl %edx,%ebp 1037 movl %ecx,%ebx 1038 subl $96,%eax 1039 jc L045xts_enc_short 1040 shll $4,%ecx 1041 movl $16,%ebx 1042 subl %ecx,%ebx 1043 leal 32(%edx,%ecx,1),%edx 1044 jmp L046xts_enc_loop6 1045 .align 4,0x90 1046 L046xts_enc_loop6: 1047 pshufd $19,%xmm0,%xmm2 1048 pxor %xmm0,%xmm0 1049 movdqa %xmm1,(%esp) 1050 paddq %xmm1,%xmm1 1051 pand %xmm3,%xmm2 1052 pcmpgtd %xmm1,%xmm0 1053 pxor %xmm2,%xmm1 1054 pshufd $19,%xmm0,%xmm2 1055 pxor %xmm0,%xmm0 1056 movdqa %xmm1,16(%esp) 1057 paddq %xmm1,%xmm1 1058 pand %xmm3,%xmm2 1059 pcmpgtd %xmm1,%xmm0 1060 pxor %xmm2,%xmm1 1061 pshufd $19,%xmm0,%xmm2 1062 pxor %xmm0,%xmm0 1063 movdqa %xmm1,32(%esp) 1064 paddq %xmm1,%xmm1 1065 pand %xmm3,%xmm2 1066 pcmpgtd %xmm1,%xmm0 1067 pxor %xmm2,%xmm1 1068 pshufd $19,%xmm0,%xmm2 1069 pxor %xmm0,%xmm0 1070 movdqa %xmm1,48(%esp) 1071 paddq %xmm1,%xmm1 1072 pand %xmm3,%xmm2 1073 pcmpgtd %xmm1,%xmm0 1074 pxor %xmm2,%xmm1 1075 pshufd $19,%xmm0,%xmm7 1076 movdqa %xmm1,64(%esp) 1077 paddq %xmm1,%xmm1 1078 movups (%ebp),%xmm0 1079 pand %xmm3,%xmm7 1080 movups (%esi),%xmm2 1081 pxor %xmm1,%xmm7 1082 movl %ebx,%ecx 1083 movdqu 16(%esi),%xmm3 1084 xorps %xmm0,%xmm2 1085 movdqu 32(%esi),%xmm4 1086 pxor %xmm0,%xmm3 1087 movdqu 48(%esi),%xmm5 1088 pxor %xmm0,%xmm4 1089 movdqu 64(%esi),%xmm6 1090 pxor %xmm0,%xmm5 1091 movdqu 80(%esi),%xmm1 1092 pxor %xmm0,%xmm6 1093 leal 96(%esi),%esi 1094 pxor (%esp),%xmm2 1095 movdqa %xmm7,80(%esp) 1096 pxor %xmm1,%xmm7 1097 movups 16(%ebp),%xmm1 1098 pxor 16(%esp),%xmm3 1099 pxor 32(%esp),%xmm4 1100 .byte 102,15,56,220,209 1101 pxor 48(%esp),%xmm5 1102 pxor 64(%esp),%xmm6 1103 .byte 102,15,56,220,217 1104 pxor %xmm0,%xmm7 1105 movups 32(%ebp),%xmm0 1106 .byte 102,15,56,220,225 1107 .byte 102,15,56,220,233 1108 .byte 102,15,56,220,241 1109 .byte 102,15,56,220,249 1110 call L_aesni_encrypt6_enter 1111 movdqa 80(%esp),%xmm1 1112 pxor %xmm0,%xmm0 1113 xorps (%esp),%xmm2 1114 pcmpgtd %xmm1,%xmm0 1115 xorps 16(%esp),%xmm3 1116 movups %xmm2,(%edi) 1117 xorps 32(%esp),%xmm4 1118 movups %xmm3,16(%edi) 1119 xorps 48(%esp),%xmm5 1120 movups %xmm4,32(%edi) 1121 xorps 64(%esp),%xmm6 1122 movups %xmm5,48(%edi) 1123 xorps %xmm1,%xmm7 1124 movups %xmm6,64(%edi) 1125 pshufd $19,%xmm0,%xmm2 1126 movups %xmm7,80(%edi) 1127 leal 96(%edi),%edi 1128 movdqa 96(%esp),%xmm3 1129 pxor %xmm0,%xmm0 1130 paddq %xmm1,%xmm1 1131 pand %xmm3,%xmm2 1132 pcmpgtd %xmm1,%xmm0 1133 pxor %xmm2,%xmm1 1134 subl $96,%eax 1135 jnc L046xts_enc_loop6 1136 movl 240(%ebp),%ecx 1137 movl %ebp,%edx 1138 movl %ecx,%ebx 1139 L045xts_enc_short: 1140 addl $96,%eax 1141 jz L047xts_enc_done6x 1142 movdqa %xmm1,%xmm5 1143 cmpl $32,%eax 1144 jb L048xts_enc_one 1145 pshufd $19,%xmm0,%xmm2 1146 pxor %xmm0,%xmm0 1147 paddq %xmm1,%xmm1 1148 pand %xmm3,%xmm2 1149 pcmpgtd %xmm1,%xmm0 1150 pxor %xmm2,%xmm1 1151 je L049xts_enc_two 1152 pshufd $19,%xmm0,%xmm2 1153 pxor %xmm0,%xmm0 1154 movdqa %xmm1,%xmm6 1155 paddq %xmm1,%xmm1 1156 pand %xmm3,%xmm2 1157 pcmpgtd %xmm1,%xmm0 1158 pxor %xmm2,%xmm1 1159 cmpl $64,%eax 1160 jb L050xts_enc_three 1161 pshufd $19,%xmm0,%xmm2 1162 pxor %xmm0,%xmm0 1163 movdqa %xmm1,%xmm7 1164 paddq %xmm1,%xmm1 1165 pand %xmm3,%xmm2 1166 pcmpgtd %xmm1,%xmm0 1167 pxor %xmm2,%xmm1 1168 movdqa %xmm5,(%esp) 1169 movdqa %xmm6,16(%esp) 1170 je L051xts_enc_four 1171 movdqa %xmm7,32(%esp) 1172 pshufd $19,%xmm0,%xmm7 1173 movdqa %xmm1,48(%esp) 1174 paddq %xmm1,%xmm1 1175 pand %xmm3,%xmm7 1176 pxor %xmm1,%xmm7 1177 movdqu (%esi),%xmm2 1178 movdqu 16(%esi),%xmm3 1179 movdqu 32(%esi),%xmm4 1180 pxor (%esp),%xmm2 1181 movdqu 48(%esi),%xmm5 1182 pxor 16(%esp),%xmm3 1183 movdqu 64(%esi),%xmm6 1184 pxor 32(%esp),%xmm4 1185 leal 80(%esi),%esi 1186 pxor 48(%esp),%xmm5 1187 movdqa %xmm7,64(%esp) 1188 pxor %xmm7,%xmm6 1189 call __aesni_encrypt6 1190 movaps 64(%esp),%xmm1 1191 xorps (%esp),%xmm2 1192 xorps 16(%esp),%xmm3 1193 xorps 32(%esp),%xmm4 1194 movups %xmm2,(%edi) 1195 xorps 48(%esp),%xmm5 1196 movups %xmm3,16(%edi) 1197 xorps %xmm1,%xmm6 1198 movups %xmm4,32(%edi) 1199 movups %xmm5,48(%edi) 1200 movups %xmm6,64(%edi) 1201 leal 80(%edi),%edi 1202 jmp L052xts_enc_done 1203 .align 4,0x90 1204 L048xts_enc_one: 1205 movups (%esi),%xmm2 1206 leal 16(%esi),%esi 1207 xorps %xmm5,%xmm2 1208 movups (%edx),%xmm0 1209 movups 16(%edx),%xmm1 1210 leal 32(%edx),%edx 1211 xorps %xmm0,%xmm2 1212 L053enc1_loop_9: 1213 .byte 102,15,56,220,209 1214 decl %ecx 1215 movups (%edx),%xmm1 1216 leal 16(%edx),%edx 1217 jnz L053enc1_loop_9 1218 .byte 102,15,56,221,209 1219 xorps %xmm5,%xmm2 1220 movups %xmm2,(%edi) 1221 leal 16(%edi),%edi 1222 movdqa %xmm5,%xmm1 1223 jmp L052xts_enc_done 1224 .align 4,0x90 1225 L049xts_enc_two: 1226 movaps %xmm1,%xmm6 1227 movups (%esi),%xmm2 1228 movups 16(%esi),%xmm3 1229 leal 32(%esi),%esi 1230 xorps %xmm5,%xmm2 1231 xorps %xmm6,%xmm3 1232 call __aesni_encrypt2 1233 xorps %xmm5,%xmm2 1234 xorps %xmm6,%xmm3 1235 movups %xmm2,(%edi) 1236 movups %xmm3,16(%edi) 1237 leal 32(%edi),%edi 1238 movdqa %xmm6,%xmm1 1239 jmp L052xts_enc_done 1240 .align 4,0x90 1241 L050xts_enc_three: 1242 movaps %xmm1,%xmm7 1243 movups (%esi),%xmm2 1244 movups 16(%esi),%xmm3 1245 movups 32(%esi),%xmm4 1246 leal 48(%esi),%esi 1247 xorps %xmm5,%xmm2 1248 xorps %xmm6,%xmm3 1249 xorps %xmm7,%xmm4 1250 call __aesni_encrypt3 1251 xorps %xmm5,%xmm2 1252 xorps %xmm6,%xmm3 1253 xorps %xmm7,%xmm4 1254 movups %xmm2,(%edi) 1255 movups %xmm3,16(%edi) 1256 movups %xmm4,32(%edi) 1257 leal 48(%edi),%edi 1258 movdqa %xmm7,%xmm1 1259 jmp L052xts_enc_done 1260 .align 4,0x90 1261 L051xts_enc_four: 1262 movaps %xmm1,%xmm6 1263 movups (%esi),%xmm2 1264 movups 16(%esi),%xmm3 1265 movups 32(%esi),%xmm4 1266 xorps (%esp),%xmm2 1267 movups 48(%esi),%xmm5 1268 leal 64(%esi),%esi 1269 xorps 16(%esp),%xmm3 1270 xorps %xmm7,%xmm4 1271 xorps %xmm6,%xmm5 1272 call __aesni_encrypt4 1273 xorps (%esp),%xmm2 1274 xorps 16(%esp),%xmm3 1275 xorps %xmm7,%xmm4 1276 movups %xmm2,(%edi) 1277 xorps %xmm6,%xmm5 1278 movups %xmm3,16(%edi) 1279 movups %xmm4,32(%edi) 1280 movups %xmm5,48(%edi) 1281 leal 64(%edi),%edi 1282 movdqa %xmm6,%xmm1 1283 jmp L052xts_enc_done 1284 .align 4,0x90 1285 L047xts_enc_done6x: 1286 movl 112(%esp),%eax 1287 andl $15,%eax 1288 jz L054xts_enc_ret 1289 movdqa %xmm1,%xmm5 1290 movl %eax,112(%esp) 1291 jmp L055xts_enc_steal 1292 .align 4,0x90 1293 L052xts_enc_done: 1294 movl 112(%esp),%eax 1295 pxor %xmm0,%xmm0 1296 andl $15,%eax 1297 jz L054xts_enc_ret 1298 pcmpgtd %xmm1,%xmm0 1299 movl %eax,112(%esp) 1300 pshufd $19,%xmm0,%xmm5 1301 paddq %xmm1,%xmm1 1302 pand 96(%esp),%xmm5 1303 pxor %xmm1,%xmm5 1304 L055xts_enc_steal: 1305 movzbl (%esi),%ecx 1306 movzbl -16(%edi),%edx 1307 leal 1(%esi),%esi 1308 movb %cl,-16(%edi) 1309 movb %dl,(%edi) 1310 leal 1(%edi),%edi 1311 subl $1,%eax 1312 jnz L055xts_enc_steal 1313 subl 112(%esp),%edi 1314 movl %ebp,%edx 1315 movl %ebx,%ecx 1316 movups -16(%edi),%xmm2 1317 xorps %xmm5,%xmm2 1318 movups (%edx),%xmm0 1319 movups 16(%edx),%xmm1 1320 leal 32(%edx),%edx 1321 xorps %xmm0,%xmm2 1322 L056enc1_loop_10: 1323 .byte 102,15,56,220,209 1324 decl %ecx 1325 movups (%edx),%xmm1 1326 leal 16(%edx),%edx 1327 jnz L056enc1_loop_10 1328 .byte 102,15,56,221,209 1329 xorps %xmm5,%xmm2 1330 movups %xmm2,-16(%edi) 1331 L054xts_enc_ret: 1332 movl 116(%esp),%esp 1333 popl %edi 1334 popl %esi 1335 popl %ebx 1336 popl %ebp 1337 ret 1338 .globl _aesni_xts_decrypt 1339 .private_extern _aesni_xts_decrypt 1340 .align 4 1341 _aesni_xts_decrypt: 1342 L_aesni_xts_decrypt_begin: 1343 pushl %ebp 1344 pushl %ebx 1345 pushl %esi 1346 pushl %edi 1347 movl 36(%esp),%edx 1348 movl 40(%esp),%esi 1349 movl 240(%edx),%ecx 1350 movups (%esi),%xmm2 1351 movups (%edx),%xmm0 1352 movups 16(%edx),%xmm1 1353 leal 32(%edx),%edx 1354 xorps %xmm0,%xmm2 1355 L057enc1_loop_11: 1356 .byte 102,15,56,220,209 1357 decl %ecx 1358 movups (%edx),%xmm1 1359 leal 16(%edx),%edx 1360 jnz L057enc1_loop_11 1361 .byte 102,15,56,221,209 1362 movl 20(%esp),%esi 1363 movl 24(%esp),%edi 1364 movl 28(%esp),%eax 1365 movl 32(%esp),%edx 1366 movl %esp,%ebp 1367 subl $120,%esp 1368 andl $-16,%esp 1369 xorl %ebx,%ebx 1370 testl $15,%eax 1371 setnz %bl 1372 shll $4,%ebx 1373 subl %ebx,%eax 1374 movl $135,96(%esp) 1375 movl $0,100(%esp) 1376 movl $1,104(%esp) 1377 movl $0,108(%esp) 1378 movl %eax,112(%esp) 1379 movl %ebp,116(%esp) 1380 movl 240(%edx),%ecx 1381 movl %edx,%ebp 1382 movl %ecx,%ebx 1383 movdqa %xmm2,%xmm1 1384 pxor %xmm0,%xmm0 1385 movdqa 96(%esp),%xmm3 1386 pcmpgtd %xmm1,%xmm0 1387 andl $-16,%eax 1388 subl $96,%eax 1389 jc L058xts_dec_short 1390 shll $4,%ecx 1391 movl $16,%ebx 1392 subl %ecx,%ebx 1393 leal 32(%edx,%ecx,1),%edx 1394 jmp L059xts_dec_loop6 1395 .align 4,0x90 1396 L059xts_dec_loop6: 1397 pshufd $19,%xmm0,%xmm2 1398 pxor %xmm0,%xmm0 1399 movdqa %xmm1,(%esp) 1400 paddq %xmm1,%xmm1 1401 pand %xmm3,%xmm2 1402 pcmpgtd %xmm1,%xmm0 1403 pxor %xmm2,%xmm1 1404 pshufd $19,%xmm0,%xmm2 1405 pxor %xmm0,%xmm0 1406 movdqa %xmm1,16(%esp) 1407 paddq %xmm1,%xmm1 1408 pand %xmm3,%xmm2 1409 pcmpgtd %xmm1,%xmm0 1410 pxor %xmm2,%xmm1 1411 pshufd $19,%xmm0,%xmm2 1412 pxor %xmm0,%xmm0 1413 movdqa %xmm1,32(%esp) 1414 paddq %xmm1,%xmm1 1415 pand %xmm3,%xmm2 1416 pcmpgtd %xmm1,%xmm0 1417 pxor %xmm2,%xmm1 1418 pshufd $19,%xmm0,%xmm2 1419 pxor %xmm0,%xmm0 1420 movdqa %xmm1,48(%esp) 1421 paddq %xmm1,%xmm1 1422 pand %xmm3,%xmm2 1423 pcmpgtd %xmm1,%xmm0 1424 pxor %xmm2,%xmm1 1425 pshufd $19,%xmm0,%xmm7 1426 movdqa %xmm1,64(%esp) 1427 paddq %xmm1,%xmm1 1428 movups (%ebp),%xmm0 1429 pand %xmm3,%xmm7 1430 movups (%esi),%xmm2 1431 pxor %xmm1,%xmm7 1432 movl %ebx,%ecx 1433 movdqu 16(%esi),%xmm3 1434 xorps %xmm0,%xmm2 1435 movdqu 32(%esi),%xmm4 1436 pxor %xmm0,%xmm3 1437 movdqu 48(%esi),%xmm5 1438 pxor %xmm0,%xmm4 1439 movdqu 64(%esi),%xmm6 1440 pxor %xmm0,%xmm5 1441 movdqu 80(%esi),%xmm1 1442 pxor %xmm0,%xmm6 1443 leal 96(%esi),%esi 1444 pxor (%esp),%xmm2 1445 movdqa %xmm7,80(%esp) 1446 pxor %xmm1,%xmm7 1447 movups 16(%ebp),%xmm1 1448 pxor 16(%esp),%xmm3 1449 pxor 32(%esp),%xmm4 1450 .byte 102,15,56,222,209 1451 pxor 48(%esp),%xmm5 1452 pxor 64(%esp),%xmm6 1453 .byte 102,15,56,222,217 1454 pxor %xmm0,%xmm7 1455 movups 32(%ebp),%xmm0 1456 .byte 102,15,56,222,225 1457 .byte 102,15,56,222,233 1458 .byte 102,15,56,222,241 1459 .byte 102,15,56,222,249 1460 call L_aesni_decrypt6_enter 1461 movdqa 80(%esp),%xmm1 1462 pxor %xmm0,%xmm0 1463 xorps (%esp),%xmm2 1464 pcmpgtd %xmm1,%xmm0 1465 xorps 16(%esp),%xmm3 1466 movups %xmm2,(%edi) 1467 xorps 32(%esp),%xmm4 1468 movups %xmm3,16(%edi) 1469 xorps 48(%esp),%xmm5 1470 movups %xmm4,32(%edi) 1471 xorps 64(%esp),%xmm6 1472 movups %xmm5,48(%edi) 1473 xorps %xmm1,%xmm7 1474 movups %xmm6,64(%edi) 1475 pshufd $19,%xmm0,%xmm2 1476 movups %xmm7,80(%edi) 1477 leal 96(%edi),%edi 1478 movdqa 96(%esp),%xmm3 1479 pxor %xmm0,%xmm0 1480 paddq %xmm1,%xmm1 1481 pand %xmm3,%xmm2 1482 pcmpgtd %xmm1,%xmm0 1483 pxor %xmm2,%xmm1 1484 subl $96,%eax 1485 jnc L059xts_dec_loop6 1486 movl 240(%ebp),%ecx 1487 movl %ebp,%edx 1488 movl %ecx,%ebx 1489 L058xts_dec_short: 1490 addl $96,%eax 1491 jz L060xts_dec_done6x 1492 movdqa %xmm1,%xmm5 1493 cmpl $32,%eax 1494 jb L061xts_dec_one 1495 pshufd $19,%xmm0,%xmm2 1496 pxor %xmm0,%xmm0 1497 paddq %xmm1,%xmm1 1498 pand %xmm3,%xmm2 1499 pcmpgtd %xmm1,%xmm0 1500 pxor %xmm2,%xmm1 1501 je L062xts_dec_two 1502 pshufd $19,%xmm0,%xmm2 1503 pxor %xmm0,%xmm0 1504 movdqa %xmm1,%xmm6 1505 paddq %xmm1,%xmm1 1506 pand %xmm3,%xmm2 1507 pcmpgtd %xmm1,%xmm0 1508 pxor %xmm2,%xmm1 1509 cmpl $64,%eax 1510 jb L063xts_dec_three 1511 pshufd $19,%xmm0,%xmm2 1512 pxor %xmm0,%xmm0 1513 movdqa %xmm1,%xmm7 1514 paddq %xmm1,%xmm1 1515 pand %xmm3,%xmm2 1516 pcmpgtd %xmm1,%xmm0 1517 pxor %xmm2,%xmm1 1518 movdqa %xmm5,(%esp) 1519 movdqa %xmm6,16(%esp) 1520 je L064xts_dec_four 1521 movdqa %xmm7,32(%esp) 1522 pshufd $19,%xmm0,%xmm7 1523 movdqa %xmm1,48(%esp) 1524 paddq %xmm1,%xmm1 1525 pand %xmm3,%xmm7 1526 pxor %xmm1,%xmm7 1527 movdqu (%esi),%xmm2 1528 movdqu 16(%esi),%xmm3 1529 movdqu 32(%esi),%xmm4 1530 pxor (%esp),%xmm2 1531 movdqu 48(%esi),%xmm5 1532 pxor 16(%esp),%xmm3 1533 movdqu 64(%esi),%xmm6 1534 pxor 32(%esp),%xmm4 1535 leal 80(%esi),%esi 1536 pxor 48(%esp),%xmm5 1537 movdqa %xmm7,64(%esp) 1538 pxor %xmm7,%xmm6 1539 call __aesni_decrypt6 1540 movaps 64(%esp),%xmm1 1541 xorps (%esp),%xmm2 1542 xorps 16(%esp),%xmm3 1543 xorps 32(%esp),%xmm4 1544 movups %xmm2,(%edi) 1545 xorps 48(%esp),%xmm5 1546 movups %xmm3,16(%edi) 1547 xorps %xmm1,%xmm6 1548 movups %xmm4,32(%edi) 1549 movups %xmm5,48(%edi) 1550 movups %xmm6,64(%edi) 1551 leal 80(%edi),%edi 1552 jmp L065xts_dec_done 1553 .align 4,0x90 1554 L061xts_dec_one: 1555 movups (%esi),%xmm2 1556 leal 16(%esi),%esi 1557 xorps %xmm5,%xmm2 1558 movups (%edx),%xmm0 1559 movups 16(%edx),%xmm1 1560 leal 32(%edx),%edx 1561 xorps %xmm0,%xmm2 1562 L066dec1_loop_12: 1563 .byte 102,15,56,222,209 1564 decl %ecx 1565 movups (%edx),%xmm1 1566 leal 16(%edx),%edx 1567 jnz L066dec1_loop_12 1568 .byte 102,15,56,223,209 1569 xorps %xmm5,%xmm2 1570 movups %xmm2,(%edi) 1571 leal 16(%edi),%edi 1572 movdqa %xmm5,%xmm1 1573 jmp L065xts_dec_done 1574 .align 4,0x90 1575 L062xts_dec_two: 1576 movaps %xmm1,%xmm6 1577 movups (%esi),%xmm2 1578 movups 16(%esi),%xmm3 1579 leal 32(%esi),%esi 1580 xorps %xmm5,%xmm2 1581 xorps %xmm6,%xmm3 1582 call __aesni_decrypt2 1583 xorps %xmm5,%xmm2 1584 xorps %xmm6,%xmm3 1585 movups %xmm2,(%edi) 1586 movups %xmm3,16(%edi) 1587 leal 32(%edi),%edi 1588 movdqa %xmm6,%xmm1 1589 jmp L065xts_dec_done 1590 .align 4,0x90 1591 L063xts_dec_three: 1592 movaps %xmm1,%xmm7 1593 movups (%esi),%xmm2 1594 movups 16(%esi),%xmm3 1595 movups 32(%esi),%xmm4 1596 leal 48(%esi),%esi 1597 xorps %xmm5,%xmm2 1598 xorps %xmm6,%xmm3 1599 xorps %xmm7,%xmm4 1600 call __aesni_decrypt3 1601 xorps %xmm5,%xmm2 1602 xorps %xmm6,%xmm3 1603 xorps %xmm7,%xmm4 1604 movups %xmm2,(%edi) 1605 movups %xmm3,16(%edi) 1606 movups %xmm4,32(%edi) 1607 leal 48(%edi),%edi 1608 movdqa %xmm7,%xmm1 1609 jmp L065xts_dec_done 1610 .align 4,0x90 1611 L064xts_dec_four: 1612 movaps %xmm1,%xmm6 1613 movups (%esi),%xmm2 1614 movups 16(%esi),%xmm3 1615 movups 32(%esi),%xmm4 1616 xorps (%esp),%xmm2 1617 movups 48(%esi),%xmm5 1618 leal 64(%esi),%esi 1619 xorps 16(%esp),%xmm3 1620 xorps %xmm7,%xmm4 1621 xorps %xmm6,%xmm5 1622 call __aesni_decrypt4 1623 xorps (%esp),%xmm2 1624 xorps 16(%esp),%xmm3 1625 xorps %xmm7,%xmm4 1626 movups %xmm2,(%edi) 1627 xorps %xmm6,%xmm5 1628 movups %xmm3,16(%edi) 1629 movups %xmm4,32(%edi) 1630 movups %xmm5,48(%edi) 1631 leal 64(%edi),%edi 1632 movdqa %xmm6,%xmm1 1633 jmp L065xts_dec_done 1634 .align 4,0x90 1635 L060xts_dec_done6x: 1636 movl 112(%esp),%eax 1637 andl $15,%eax 1638 jz L067xts_dec_ret 1639 movl %eax,112(%esp) 1640 jmp L068xts_dec_only_one_more 1641 .align 4,0x90 1642 L065xts_dec_done: 1643 movl 112(%esp),%eax 1644 pxor %xmm0,%xmm0 1645 andl $15,%eax 1646 jz L067xts_dec_ret 1647 pcmpgtd %xmm1,%xmm0 1648 movl %eax,112(%esp) 1649 pshufd $19,%xmm0,%xmm2 1650 pxor %xmm0,%xmm0 1651 movdqa 96(%esp),%xmm3 1652 paddq %xmm1,%xmm1 1653 pand %xmm3,%xmm2 1654 pcmpgtd %xmm1,%xmm0 1655 pxor %xmm2,%xmm1 1656 L068xts_dec_only_one_more: 1657 pshufd $19,%xmm0,%xmm5 1658 movdqa %xmm1,%xmm6 1659 paddq %xmm1,%xmm1 1660 pand %xmm3,%xmm5 1661 pxor %xmm1,%xmm5 1662 movl %ebp,%edx 1663 movl %ebx,%ecx 1664 movups (%esi),%xmm2 1665 xorps %xmm5,%xmm2 1666 movups (%edx),%xmm0 1667 movups 16(%edx),%xmm1 1668 leal 32(%edx),%edx 1669 xorps %xmm0,%xmm2 1670 L069dec1_loop_13: 1671 .byte 102,15,56,222,209 1672 decl %ecx 1673 movups (%edx),%xmm1 1674 leal 16(%edx),%edx 1675 jnz L069dec1_loop_13 1676 .byte 102,15,56,223,209 1677 xorps %xmm5,%xmm2 1678 movups %xmm2,(%edi) 1679 L070xts_dec_steal: 1680 movzbl 16(%esi),%ecx 1681 movzbl (%edi),%edx 1682 leal 1(%esi),%esi 1683 movb %cl,(%edi) 1684 movb %dl,16(%edi) 1685 leal 1(%edi),%edi 1686 subl $1,%eax 1687 jnz L070xts_dec_steal 1688 subl 112(%esp),%edi 1689 movl %ebp,%edx 1690 movl %ebx,%ecx 1691 movups (%edi),%xmm2 1692 xorps %xmm6,%xmm2 1693 movups (%edx),%xmm0 1694 movups 16(%edx),%xmm1 1695 leal 32(%edx),%edx 1696 xorps %xmm0,%xmm2 1697 L071dec1_loop_14: 1698 .byte 102,15,56,222,209 1699 decl %ecx 1700 movups (%edx),%xmm1 1701 leal 16(%edx),%edx 1702 jnz L071dec1_loop_14 1703 .byte 102,15,56,223,209 1704 xorps %xmm6,%xmm2 1705 movups %xmm2,(%edi) 1706 L067xts_dec_ret: 1707 movl 116(%esp),%esp 1708 popl %edi 1709 popl %esi 1710 popl %ebx 1711 popl %ebp 1712 ret 1713 .globl _aesni_cbc_encrypt 1714 .private_extern _aesni_cbc_encrypt 1715 .align 4 1716 _aesni_cbc_encrypt: 1717 L_aesni_cbc_encrypt_begin: 1718 pushl %ebp 1719 pushl %ebx 1720 pushl %esi 1721 pushl %edi 1722 movl 20(%esp),%esi 1723 movl %esp,%ebx 1724 movl 24(%esp),%edi 1725 subl $24,%ebx 1726 movl 28(%esp),%eax 1727 andl $-16,%ebx 1728 movl 32(%esp),%edx 1729 movl 36(%esp),%ebp 1730 testl %eax,%eax 1731 jz L072cbc_abort 1732 cmpl $0,40(%esp) 1733 xchgl %esp,%ebx 1734 movups (%ebp),%xmm7 1735 movl 240(%edx),%ecx 1736 movl %edx,%ebp 1737 movl %ebx,16(%esp) 1738 movl %ecx,%ebx 1739 je L073cbc_decrypt 1740 movaps %xmm7,%xmm2 1741 cmpl $16,%eax 1742 jb L074cbc_enc_tail 1743 subl $16,%eax 1744 jmp L075cbc_enc_loop 1745 .align 4,0x90 1746 L075cbc_enc_loop: 1747 movups (%esi),%xmm7 1748 leal 16(%esi),%esi 1749 movups (%edx),%xmm0 1750 movups 16(%edx),%xmm1 1751 xorps %xmm0,%xmm7 1752 leal 32(%edx),%edx 1753 xorps %xmm7,%xmm2 1754 L076enc1_loop_15: 1755 .byte 102,15,56,220,209 1756 decl %ecx 1757 movups (%edx),%xmm1 1758 leal 16(%edx),%edx 1759 jnz L076enc1_loop_15 1760 .byte 102,15,56,221,209 1761 movl %ebx,%ecx 1762 movl %ebp,%edx 1763 movups %xmm2,(%edi) 1764 leal 16(%edi),%edi 1765 subl $16,%eax 1766 jnc L075cbc_enc_loop 1767 addl $16,%eax 1768 jnz L074cbc_enc_tail 1769 movaps %xmm2,%xmm7 1770 jmp L077cbc_ret 1771 L074cbc_enc_tail: 1772 movl %eax,%ecx 1773 .long 2767451785 1774 movl $16,%ecx 1775 subl %eax,%ecx 1776 xorl %eax,%eax 1777 .long 2868115081 1778 leal -16(%edi),%edi 1779 movl %ebx,%ecx 1780 movl %edi,%esi 1781 movl %ebp,%edx 1782 jmp L075cbc_enc_loop 1783 .align 4,0x90 1784 L073cbc_decrypt: 1785 cmpl $80,%eax 1786 jbe L078cbc_dec_tail 1787 movaps %xmm7,(%esp) 1788 subl $80,%eax 1789 jmp L079cbc_dec_loop6_enter 1790 .align 4,0x90 1791 L080cbc_dec_loop6: 1792 movaps %xmm0,(%esp) 1793 movups %xmm7,(%edi) 1794 leal 16(%edi),%edi 1795 L079cbc_dec_loop6_enter: 1796 movdqu (%esi),%xmm2 1797 movdqu 16(%esi),%xmm3 1798 movdqu 32(%esi),%xmm4 1799 movdqu 48(%esi),%xmm5 1800 movdqu 64(%esi),%xmm6 1801 movdqu 80(%esi),%xmm7 1802 call __aesni_decrypt6 1803 movups (%esi),%xmm1 1804 movups 16(%esi),%xmm0 1805 xorps (%esp),%xmm2 1806 xorps %xmm1,%xmm3 1807 movups 32(%esi),%xmm1 1808 xorps %xmm0,%xmm4 1809 movups 48(%esi),%xmm0 1810 xorps %xmm1,%xmm5 1811 movups 64(%esi),%xmm1 1812 xorps %xmm0,%xmm6 1813 movups 80(%esi),%xmm0 1814 xorps %xmm1,%xmm7 1815 movups %xmm2,(%edi) 1816 movups %xmm3,16(%edi) 1817 leal 96(%esi),%esi 1818 movups %xmm4,32(%edi) 1819 movl %ebx,%ecx 1820 movups %xmm5,48(%edi) 1821 movl %ebp,%edx 1822 movups %xmm6,64(%edi) 1823 leal 80(%edi),%edi 1824 subl $96,%eax 1825 ja L080cbc_dec_loop6 1826 movaps %xmm7,%xmm2 1827 movaps %xmm0,%xmm7 1828 addl $80,%eax 1829 jle L081cbc_dec_tail_collected 1830 movups %xmm2,(%edi) 1831 leal 16(%edi),%edi 1832 L078cbc_dec_tail: 1833 movups (%esi),%xmm2 1834 movaps %xmm2,%xmm6 1835 cmpl $16,%eax 1836 jbe L082cbc_dec_one 1837 movups 16(%esi),%xmm3 1838 movaps %xmm3,%xmm5 1839 cmpl $32,%eax 1840 jbe L083cbc_dec_two 1841 movups 32(%esi),%xmm4 1842 cmpl $48,%eax 1843 jbe L084cbc_dec_three 1844 movups 48(%esi),%xmm5 1845 cmpl $64,%eax 1846 jbe L085cbc_dec_four 1847 movups 64(%esi),%xmm6 1848 movaps %xmm7,(%esp) 1849 movups (%esi),%xmm2 1850 xorps %xmm7,%xmm7 1851 call __aesni_decrypt6 1852 movups (%esi),%xmm1 1853 movups 16(%esi),%xmm0 1854 xorps (%esp),%xmm2 1855 xorps %xmm1,%xmm3 1856 movups 32(%esi),%xmm1 1857 xorps %xmm0,%xmm4 1858 movups 48(%esi),%xmm0 1859 xorps %xmm1,%xmm5 1860 movups 64(%esi),%xmm7 1861 xorps %xmm0,%xmm6 1862 movups %xmm2,(%edi) 1863 movups %xmm3,16(%edi) 1864 movups %xmm4,32(%edi) 1865 movups %xmm5,48(%edi) 1866 leal 64(%edi),%edi 1867 movaps %xmm6,%xmm2 1868 subl $80,%eax 1869 jmp L081cbc_dec_tail_collected 1870 .align 4,0x90 1871 L082cbc_dec_one: 1872 movups (%edx),%xmm0 1873 movups 16(%edx),%xmm1 1874 leal 32(%edx),%edx 1875 xorps %xmm0,%xmm2 1876 L086dec1_loop_16: 1877 .byte 102,15,56,222,209 1878 decl %ecx 1879 movups (%edx),%xmm1 1880 leal 16(%edx),%edx 1881 jnz L086dec1_loop_16 1882 .byte 102,15,56,223,209 1883 xorps %xmm7,%xmm2 1884 movaps %xmm6,%xmm7 1885 subl $16,%eax 1886 jmp L081cbc_dec_tail_collected 1887 .align 4,0x90 1888 L083cbc_dec_two: 1889 call __aesni_decrypt2 1890 xorps %xmm7,%xmm2 1891 xorps %xmm6,%xmm3 1892 movups %xmm2,(%edi) 1893 movaps %xmm3,%xmm2 1894 leal 16(%edi),%edi 1895 movaps %xmm5,%xmm7 1896 subl $32,%eax 1897 jmp L081cbc_dec_tail_collected 1898 .align 4,0x90 1899 L084cbc_dec_three: 1900 call __aesni_decrypt3 1901 xorps %xmm7,%xmm2 1902 xorps %xmm6,%xmm3 1903 xorps %xmm5,%xmm4 1904 movups %xmm2,(%edi) 1905 movaps %xmm4,%xmm2 1906 movups %xmm3,16(%edi) 1907 leal 32(%edi),%edi 1908 movups 32(%esi),%xmm7 1909 subl $48,%eax 1910 jmp L081cbc_dec_tail_collected 1911 .align 4,0x90 1912 L085cbc_dec_four: 1913 call __aesni_decrypt4 1914 movups 16(%esi),%xmm1 1915 movups 32(%esi),%xmm0 1916 xorps %xmm7,%xmm2 1917 movups 48(%esi),%xmm7 1918 xorps %xmm6,%xmm3 1919 movups %xmm2,(%edi) 1920 xorps %xmm1,%xmm4 1921 movups %xmm3,16(%edi) 1922 xorps %xmm0,%xmm5 1923 movups %xmm4,32(%edi) 1924 leal 48(%edi),%edi 1925 movaps %xmm5,%xmm2 1926 subl $64,%eax 1927 L081cbc_dec_tail_collected: 1928 andl $15,%eax 1929 jnz L087cbc_dec_tail_partial 1930 movups %xmm2,(%edi) 1931 jmp L077cbc_ret 1932 .align 4,0x90 1933 L087cbc_dec_tail_partial: 1934 movaps %xmm2,(%esp) 1935 movl $16,%ecx 1936 movl %esp,%esi 1937 subl %eax,%ecx 1938 .long 2767451785 1939 L077cbc_ret: 1940 movl 16(%esp),%esp 1941 movl 36(%esp),%ebp 1942 movups %xmm7,(%ebp) 1943 L072cbc_abort: 1944 popl %edi 1945 popl %esi 1946 popl %ebx 1947 popl %ebp 1948 ret 1949 .private_extern __aesni_set_encrypt_key 1950 .align 4 1951 __aesni_set_encrypt_key: 1952 testl %eax,%eax 1953 jz L088bad_pointer 1954 testl %edx,%edx 1955 jz L088bad_pointer 1956 movups (%eax),%xmm0 1957 xorps %xmm4,%xmm4 1958 leal 16(%edx),%edx 1959 cmpl $256,%ecx 1960 je L08914rounds 1961 cmpl $192,%ecx 1962 je L09012rounds 1963 cmpl $128,%ecx 1964 jne L091bad_keybits 1965 .align 4,0x90 1966 L09210rounds: 1967 movl $9,%ecx 1968 movups %xmm0,-16(%edx) 1969 .byte 102,15,58,223,200,1 1970 call L093key_128_cold 1971 .byte 102,15,58,223,200,2 1972 call L094key_128 1973 .byte 102,15,58,223,200,4 1974 call L094key_128 1975 .byte 102,15,58,223,200,8 1976 call L094key_128 1977 .byte 102,15,58,223,200,16 1978 call L094key_128 1979 .byte 102,15,58,223,200,32 1980 call L094key_128 1981 .byte 102,15,58,223,200,64 1982 call L094key_128 1983 .byte 102,15,58,223,200,128 1984 call L094key_128 1985 .byte 102,15,58,223,200,27 1986 call L094key_128 1987 .byte 102,15,58,223,200,54 1988 call L094key_128 1989 movups %xmm0,(%edx) 1990 movl %ecx,80(%edx) 1991 xorl %eax,%eax 1992 ret 1993 .align 4,0x90 1994 L094key_128: 1995 movups %xmm0,(%edx) 1996 leal 16(%edx),%edx 1997 L093key_128_cold: 1998 shufps $16,%xmm0,%xmm4 1999 xorps %xmm4,%xmm0 2000 shufps $140,%xmm0,%xmm4 2001 xorps %xmm4,%xmm0 2002 shufps $255,%xmm1,%xmm1 2003 xorps %xmm1,%xmm0 2004 ret 2005 .align 4,0x90 2006 L09012rounds: 2007 movq 16(%eax),%xmm2 2008 movl $11,%ecx 2009 movups %xmm0,-16(%edx) 2010 .byte 102,15,58,223,202,1 2011 call L095key_192a_cold 2012 .byte 102,15,58,223,202,2 2013 call L096key_192b 2014 .byte 102,15,58,223,202,4 2015 call L097key_192a 2016 .byte 102,15,58,223,202,8 2017 call L096key_192b 2018 .byte 102,15,58,223,202,16 2019 call L097key_192a 2020 .byte 102,15,58,223,202,32 2021 call L096key_192b 2022 .byte 102,15,58,223,202,64 2023 call L097key_192a 2024 .byte 102,15,58,223,202,128 2025 call L096key_192b 2026 movups %xmm0,(%edx) 2027 movl %ecx,48(%edx) 2028 xorl %eax,%eax 2029 ret 2030 .align 4,0x90 2031 L097key_192a: 2032 movups %xmm0,(%edx) 2033 leal 16(%edx),%edx 2034 .align 4,0x90 2035 L095key_192a_cold: 2036 movaps %xmm2,%xmm5 2037 L098key_192b_warm: 2038 shufps $16,%xmm0,%xmm4 2039 movdqa %xmm2,%xmm3 2040 xorps %xmm4,%xmm0 2041 shufps $140,%xmm0,%xmm4 2042 pslldq $4,%xmm3 2043 xorps %xmm4,%xmm0 2044 pshufd $85,%xmm1,%xmm1 2045 pxor %xmm3,%xmm2 2046 pxor %xmm1,%xmm0 2047 pshufd $255,%xmm0,%xmm3 2048 pxor %xmm3,%xmm2 2049 ret 2050 .align 4,0x90 2051 L096key_192b: 2052 movaps %xmm0,%xmm3 2053 shufps $68,%xmm0,%xmm5 2054 movups %xmm5,(%edx) 2055 shufps $78,%xmm2,%xmm3 2056 movups %xmm3,16(%edx) 2057 leal 32(%edx),%edx 2058 jmp L098key_192b_warm 2059 .align 4,0x90 2060 L08914rounds: 2061 movups 16(%eax),%xmm2 2062 movl $13,%ecx 2063 leal 16(%edx),%edx 2064 movups %xmm0,-32(%edx) 2065 movups %xmm2,-16(%edx) 2066 .byte 102,15,58,223,202,1 2067 call L099key_256a_cold 2068 .byte 102,15,58,223,200,1 2069 call L100key_256b 2070 .byte 102,15,58,223,202,2 2071 call L101key_256a 2072 .byte 102,15,58,223,200,2 2073 call L100key_256b 2074 .byte 102,15,58,223,202,4 2075 call L101key_256a 2076 .byte 102,15,58,223,200,4 2077 call L100key_256b 2078 .byte 102,15,58,223,202,8 2079 call L101key_256a 2080 .byte 102,15,58,223,200,8 2081 call L100key_256b 2082 .byte 102,15,58,223,202,16 2083 call L101key_256a 2084 .byte 102,15,58,223,200,16 2085 call L100key_256b 2086 .byte 102,15,58,223,202,32 2087 call L101key_256a 2088 .byte 102,15,58,223,200,32 2089 call L100key_256b 2090 .byte 102,15,58,223,202,64 2091 call L101key_256a 2092 movups %xmm0,(%edx) 2093 movl %ecx,16(%edx) 2094 xorl %eax,%eax 2095 ret 2096 .align 4,0x90 2097 L101key_256a: 2098 movups %xmm2,(%edx) 2099 leal 16(%edx),%edx 2100 L099key_256a_cold: 2101 shufps $16,%xmm0,%xmm4 2102 xorps %xmm4,%xmm0 2103 shufps $140,%xmm0,%xmm4 2104 xorps %xmm4,%xmm0 2105 shufps $255,%xmm1,%xmm1 2106 xorps %xmm1,%xmm0 2107 ret 2108 .align 4,0x90 2109 L100key_256b: 2110 movups %xmm0,(%edx) 2111 leal 16(%edx),%edx 2112 shufps $16,%xmm2,%xmm4 2113 xorps %xmm4,%xmm2 2114 shufps $140,%xmm2,%xmm4 2115 xorps %xmm4,%xmm2 2116 shufps $170,%xmm1,%xmm1 2117 xorps %xmm1,%xmm2 2118 ret 2119 .align 2,0x90 2120 L088bad_pointer: 2121 movl $-1,%eax 2122 ret 2123 .align 2,0x90 2124 L091bad_keybits: 2125 movl $-2,%eax 2126 ret 2127 .globl _aesni_set_encrypt_key 2128 .private_extern _aesni_set_encrypt_key 2129 .align 4 2130 _aesni_set_encrypt_key: 2131 L_aesni_set_encrypt_key_begin: 2132 movl 4(%esp),%eax 2133 movl 8(%esp),%ecx 2134 movl 12(%esp),%edx 2135 call __aesni_set_encrypt_key 2136 ret 2137 .globl _aesni_set_decrypt_key 2138 .private_extern _aesni_set_decrypt_key 2139 .align 4 2140 _aesni_set_decrypt_key: 2141 L_aesni_set_decrypt_key_begin: 2142 movl 4(%esp),%eax 2143 movl 8(%esp),%ecx 2144 movl 12(%esp),%edx 2145 call __aesni_set_encrypt_key 2146 movl 12(%esp),%edx 2147 shll $4,%ecx 2148 testl %eax,%eax 2149 jnz L102dec_key_ret 2150 leal 16(%edx,%ecx,1),%eax 2151 movups (%edx),%xmm0 2152 movups (%eax),%xmm1 2153 movups %xmm0,(%eax) 2154 movups %xmm1,(%edx) 2155 leal 16(%edx),%edx 2156 leal -16(%eax),%eax 2157 L103dec_key_inverse: 2158 movups (%edx),%xmm0 2159 movups (%eax),%xmm1 2160 .byte 102,15,56,219,192 2161 .byte 102,15,56,219,201 2162 leal 16(%edx),%edx 2163 leal -16(%eax),%eax 2164 movups %xmm0,16(%eax) 2165 movups %xmm1,-16(%edx) 2166 cmpl %edx,%eax 2167 ja L103dec_key_inverse 2168 movups (%edx),%xmm0 2169 .byte 102,15,56,219,192 2170 movups %xmm0,(%edx) 2171 xorl %eax,%eax 2172 L102dec_key_ret: 2173 ret 2174 .byte 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69 2175 .byte 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83 2176 .byte 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115 2177 .byte 115,108,46,111,114,103,62,0 2178 #endif 2179