1// This file is generated from a similarly-named Perl script in the BoringSSL 2// source tree. Do not edit by hand. 3 4#include <ring-core/asm_base.h> 5 6#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86_64) && defined(__ELF__) 7.text 8 9.type _aesni_ctr32_ghash_6x,@function 10.align 32 11_aesni_ctr32_ghash_6x: 12.cfi_startproc 13 vmovdqu 32(%r11),%xmm2 14 subq $6,%rdx 15 vpxor %xmm4,%xmm4,%xmm4 16 vmovdqu 0-128(%rcx),%xmm15 17 vpaddb %xmm2,%xmm1,%xmm10 18 vpaddb %xmm2,%xmm10,%xmm11 19 vpaddb %xmm2,%xmm11,%xmm12 20 vpaddb %xmm2,%xmm12,%xmm13 21 vpaddb %xmm2,%xmm13,%xmm14 22 vpxor %xmm15,%xmm1,%xmm9 23 vmovdqu %xmm4,16+8(%rsp) 24 jmp .Loop6x 25 26.align 32 27.Loop6x: 28 addl $100663296,%ebx 29 jc .Lhandle_ctr32 30 vmovdqu 0-32(%r9),%xmm3 31 vpaddb %xmm2,%xmm14,%xmm1 32 vpxor %xmm15,%xmm10,%xmm10 33 vpxor %xmm15,%xmm11,%xmm11 34 35.Lresume_ctr32: 36 vmovdqu %xmm1,(%r8) 37 vpclmulqdq $0x10,%xmm3,%xmm7,%xmm5 38 vpxor %xmm15,%xmm12,%xmm12 39 vmovups 16-128(%rcx),%xmm2 40 vpclmulqdq $0x01,%xmm3,%xmm7,%xmm6 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 xorq %r12,%r12 59 cmpq %r14,%r15 60 61 vaesenc %xmm2,%xmm9,%xmm9 62 vmovdqu 48+8(%rsp),%xmm0 63 vpxor %xmm15,%xmm13,%xmm13 64 vpclmulqdq $0x00,%xmm3,%xmm7,%xmm1 65 vaesenc %xmm2,%xmm10,%xmm10 66 vpxor %xmm15,%xmm14,%xmm14 67 setnc %r12b 68 vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 69 vaesenc %xmm2,%xmm11,%xmm11 70 vmovdqu 16-32(%r9),%xmm3 71 negq %r12 72 vaesenc %xmm2,%xmm12,%xmm12 73 vpxor %xmm5,%xmm6,%xmm6 74 vpclmulqdq $0x00,%xmm3,%xmm0,%xmm5 75 vpxor %xmm4,%xmm8,%xmm8 76 vaesenc %xmm2,%xmm13,%xmm13 77 vpxor %xmm5,%xmm1,%xmm4 78 andq $0x60,%r12 79 vmovups 32-128(%rcx),%xmm15 80 vpclmulqdq $0x10,%xmm3,%xmm0,%xmm1 81 vaesenc %xmm2,%xmm14,%xmm14 82 83 vpclmulqdq $0x01,%xmm3,%xmm0,%xmm2 84 leaq (%r14,%r12,1),%r14 85 vaesenc %xmm15,%xmm9,%xmm9 86 vpxor 16+8(%rsp),%xmm8,%xmm8 87 vpclmulqdq $0x11,%xmm3,%xmm0,%xmm3 88 vmovdqu 64+8(%rsp),%xmm0 89 vaesenc %xmm15,%xmm10,%xmm10 90 movbeq 88(%r14),%r13 91 vaesenc %xmm15,%xmm11,%xmm11 92 movbeq 80(%r14),%r12 93 vaesenc %xmm15,%xmm12,%xmm12 94 movq %r13,32+8(%rsp) 95 vaesenc %xmm15,%xmm13,%xmm13 96 movq %r12,40+8(%rsp) 97 vmovdqu 48-32(%r9),%xmm5 98 vaesenc %xmm15,%xmm14,%xmm14 99 100 vmovups 48-128(%rcx),%xmm15 101 vpxor %xmm1,%xmm6,%xmm6 102 vpclmulqdq $0x00,%xmm5,%xmm0,%xmm1 103 vaesenc %xmm15,%xmm9,%xmm9 104 vpxor %xmm2,%xmm6,%xmm6 105 vpclmulqdq $0x10,%xmm5,%xmm0,%xmm2 106 vaesenc %xmm15,%xmm10,%xmm10 107 vpxor %xmm3,%xmm7,%xmm7 108 vpclmulqdq $0x01,%xmm5,%xmm0,%xmm3 109 vaesenc %xmm15,%xmm11,%xmm11 110 vpclmulqdq $0x11,%xmm5,%xmm0,%xmm5 111 vmovdqu 80+8(%rsp),%xmm0 112 vaesenc %xmm15,%xmm12,%xmm12 113 vaesenc %xmm15,%xmm13,%xmm13 114 vpxor %xmm1,%xmm4,%xmm4 115 vmovdqu 64-32(%r9),%xmm1 116 vaesenc %xmm15,%xmm14,%xmm14 117 118 vmovups 64-128(%rcx),%xmm15 119 vpxor %xmm2,%xmm6,%xmm6 120 vpclmulqdq $0x00,%xmm1,%xmm0,%xmm2 121 vaesenc %xmm15,%xmm9,%xmm9 122 vpxor %xmm3,%xmm6,%xmm6 123 vpclmulqdq $0x10,%xmm1,%xmm0,%xmm3 124 vaesenc %xmm15,%xmm10,%xmm10 125 movbeq 72(%r14),%r13 126 vpxor %xmm5,%xmm7,%xmm7 127 vpclmulqdq $0x01,%xmm1,%xmm0,%xmm5 128 vaesenc %xmm15,%xmm11,%xmm11 129 movbeq 64(%r14),%r12 130 vpclmulqdq $0x11,%xmm1,%xmm0,%xmm1 131 vmovdqu 96+8(%rsp),%xmm0 132 vaesenc %xmm15,%xmm12,%xmm12 133 movq %r13,48+8(%rsp) 134 vaesenc %xmm15,%xmm13,%xmm13 135 movq %r12,56+8(%rsp) 136 vpxor %xmm2,%xmm4,%xmm4 137 vmovdqu 96-32(%r9),%xmm2 138 vaesenc %xmm15,%xmm14,%xmm14 139 140 vmovups 80-128(%rcx),%xmm15 141 vpxor %xmm3,%xmm6,%xmm6 142 vpclmulqdq $0x00,%xmm2,%xmm0,%xmm3 143 vaesenc %xmm15,%xmm9,%xmm9 144 vpxor %xmm5,%xmm6,%xmm6 145 vpclmulqdq $0x10,%xmm2,%xmm0,%xmm5 146 vaesenc %xmm15,%xmm10,%xmm10 147 movbeq 56(%r14),%r13 148 vpxor %xmm1,%xmm7,%xmm7 149 vpclmulqdq $0x01,%xmm2,%xmm0,%xmm1 150 vpxor 112+8(%rsp),%xmm8,%xmm8 151 vaesenc %xmm15,%xmm11,%xmm11 152 movbeq 48(%r14),%r12 153 vpclmulqdq $0x11,%xmm2,%xmm0,%xmm2 154 vaesenc %xmm15,%xmm12,%xmm12 155 movq %r13,64+8(%rsp) 156 vaesenc %xmm15,%xmm13,%xmm13 157 movq %r12,72+8(%rsp) 158 vpxor %xmm3,%xmm4,%xmm4 159 vmovdqu 112-32(%r9),%xmm3 160 vaesenc %xmm15,%xmm14,%xmm14 161 162 vmovups 96-128(%rcx),%xmm15 163 vpxor %xmm5,%xmm6,%xmm6 164 vpclmulqdq $0x10,%xmm3,%xmm8,%xmm5 165 vaesenc %xmm15,%xmm9,%xmm9 166 vpxor %xmm1,%xmm6,%xmm6 167 vpclmulqdq $0x01,%xmm3,%xmm8,%xmm1 168 vaesenc %xmm15,%xmm10,%xmm10 169 movbeq 40(%r14),%r13 170 vpxor %xmm2,%xmm7,%xmm7 171 vpclmulqdq $0x00,%xmm3,%xmm8,%xmm2 172 vaesenc %xmm15,%xmm11,%xmm11 173 movbeq 32(%r14),%r12 174 vpclmulqdq $0x11,%xmm3,%xmm8,%xmm8 175 vaesenc %xmm15,%xmm12,%xmm12 176 movq %r13,80+8(%rsp) 177 vaesenc %xmm15,%xmm13,%xmm13 178 movq %r12,88+8(%rsp) 179 vpxor %xmm5,%xmm6,%xmm6 180 vaesenc %xmm15,%xmm14,%xmm14 181 vpxor %xmm1,%xmm6,%xmm6 182 183 vmovups 112-128(%rcx),%xmm15 184 vpslldq $8,%xmm6,%xmm5 185 vpxor %xmm2,%xmm4,%xmm4 186 vmovdqu 16(%r11),%xmm3 187 188 vaesenc %xmm15,%xmm9,%xmm9 189 vpxor %xmm8,%xmm7,%xmm7 190 vaesenc %xmm15,%xmm10,%xmm10 191 vpxor %xmm5,%xmm4,%xmm4 192 movbeq 24(%r14),%r13 193 vaesenc %xmm15,%xmm11,%xmm11 194 movbeq 16(%r14),%r12 195 vpalignr $8,%xmm4,%xmm4,%xmm0 196 vpclmulqdq $0x10,%xmm3,%xmm4,%xmm4 197 movq %r13,96+8(%rsp) 198 vaesenc %xmm15,%xmm12,%xmm12 199 movq %r12,104+8(%rsp) 200 vaesenc %xmm15,%xmm13,%xmm13 201 vmovups 128-128(%rcx),%xmm1 202 vaesenc %xmm15,%xmm14,%xmm14 203 204 vaesenc %xmm1,%xmm9,%xmm9 205 vmovups 144-128(%rcx),%xmm15 206 vaesenc %xmm1,%xmm10,%xmm10 207 vpsrldq $8,%xmm6,%xmm6 208 vaesenc %xmm1,%xmm11,%xmm11 209 vpxor %xmm6,%xmm7,%xmm7 210 vaesenc %xmm1,%xmm12,%xmm12 211 vpxor %xmm0,%xmm4,%xmm4 212 movbeq 8(%r14),%r13 213 vaesenc %xmm1,%xmm13,%xmm13 214 movbeq 0(%r14),%r12 215 vaesenc %xmm1,%xmm14,%xmm14 216 vmovups 160-128(%rcx),%xmm1 217 cmpl $11,%r10d 218 jb .Lenc_tail 219 220 vaesenc %xmm15,%xmm9,%xmm9 221 vaesenc %xmm15,%xmm10,%xmm10 222 vaesenc %xmm15,%xmm11,%xmm11 223 vaesenc %xmm15,%xmm12,%xmm12 224 vaesenc %xmm15,%xmm13,%xmm13 225 vaesenc %xmm15,%xmm14,%xmm14 226 227 vaesenc %xmm1,%xmm9,%xmm9 228 vaesenc %xmm1,%xmm10,%xmm10 229 vaesenc %xmm1,%xmm11,%xmm11 230 vaesenc %xmm1,%xmm12,%xmm12 231 vaesenc %xmm1,%xmm13,%xmm13 232 vmovups 176-128(%rcx),%xmm15 233 vaesenc %xmm1,%xmm14,%xmm14 234 vmovups 192-128(%rcx),%xmm1 235 236 237 vaesenc %xmm15,%xmm9,%xmm9 238 vaesenc %xmm15,%xmm10,%xmm10 239 vaesenc %xmm15,%xmm11,%xmm11 240 vaesenc %xmm15,%xmm12,%xmm12 241 vaesenc %xmm15,%xmm13,%xmm13 242 vaesenc %xmm15,%xmm14,%xmm14 243 244 vaesenc %xmm1,%xmm9,%xmm9 245 vaesenc %xmm1,%xmm10,%xmm10 246 vaesenc %xmm1,%xmm11,%xmm11 247 vaesenc %xmm1,%xmm12,%xmm12 248 vaesenc %xmm1,%xmm13,%xmm13 249 vmovups 208-128(%rcx),%xmm15 250 vaesenc %xmm1,%xmm14,%xmm14 251 vmovups 224-128(%rcx),%xmm1 252 jmp .Lenc_tail 253 254.align 32 255.Lhandle_ctr32: 256 vmovdqu (%r11),%xmm0 257 vpshufb %xmm0,%xmm1,%xmm6 258 vmovdqu 48(%r11),%xmm5 259 vpaddd 64(%r11),%xmm6,%xmm10 260 vpaddd %xmm5,%xmm6,%xmm11 261 vmovdqu 0-32(%r9),%xmm3 262 vpaddd %xmm5,%xmm10,%xmm12 263 vpshufb %xmm0,%xmm10,%xmm10 264 vpaddd %xmm5,%xmm11,%xmm13 265 vpshufb %xmm0,%xmm11,%xmm11 266 vpxor %xmm15,%xmm10,%xmm10 267 vpaddd %xmm5,%xmm12,%xmm14 268 vpshufb %xmm0,%xmm12,%xmm12 269 vpxor %xmm15,%xmm11,%xmm11 270 vpaddd %xmm5,%xmm13,%xmm1 271 vpshufb %xmm0,%xmm13,%xmm13 272 vpshufb %xmm0,%xmm14,%xmm14 273 vpshufb %xmm0,%xmm1,%xmm1 274 jmp .Lresume_ctr32 275 276.align 32 277.Lenc_tail: 278 vaesenc %xmm15,%xmm9,%xmm9 279 vmovdqu %xmm7,16+8(%rsp) 280 vpalignr $8,%xmm4,%xmm4,%xmm8 281 vaesenc %xmm15,%xmm10,%xmm10 282 vpclmulqdq $0x10,%xmm3,%xmm4,%xmm4 283 vpxor 0(%rdi),%xmm1,%xmm2 284 vaesenc %xmm15,%xmm11,%xmm11 285 vpxor 16(%rdi),%xmm1,%xmm0 286 vaesenc %xmm15,%xmm12,%xmm12 287 vpxor 32(%rdi),%xmm1,%xmm5 288 vaesenc %xmm15,%xmm13,%xmm13 289 vpxor 48(%rdi),%xmm1,%xmm6 290 vaesenc %xmm15,%xmm14,%xmm14 291 vpxor 64(%rdi),%xmm1,%xmm7 292 vpxor 80(%rdi),%xmm1,%xmm3 293 vmovdqu (%r8),%xmm1 294 295 vaesenclast %xmm2,%xmm9,%xmm9 296 vmovdqu 32(%r11),%xmm2 297 vaesenclast %xmm0,%xmm10,%xmm10 298 vpaddb %xmm2,%xmm1,%xmm0 299 movq %r13,112+8(%rsp) 300 leaq 96(%rdi),%rdi 301 302 prefetcht0 512(%rdi) 303 prefetcht0 576(%rdi) 304 vaesenclast %xmm5,%xmm11,%xmm11 305 vpaddb %xmm2,%xmm0,%xmm5 306 movq %r12,120+8(%rsp) 307 leaq 96(%rsi),%rsi 308 vmovdqu 0-128(%rcx),%xmm15 309 vaesenclast %xmm6,%xmm12,%xmm12 310 vpaddb %xmm2,%xmm5,%xmm6 311 vaesenclast %xmm7,%xmm13,%xmm13 312 vpaddb %xmm2,%xmm6,%xmm7 313 vaesenclast %xmm3,%xmm14,%xmm14 314 vpaddb %xmm2,%xmm7,%xmm3 315 316 addq $0x60,%rax 317 subq $0x6,%rdx 318 jc .L6x_done 319 320 vmovups %xmm9,-96(%rsi) 321 vpxor %xmm15,%xmm1,%xmm9 322 vmovups %xmm10,-80(%rsi) 323 vmovdqa %xmm0,%xmm10 324 vmovups %xmm11,-64(%rsi) 325 vmovdqa %xmm5,%xmm11 326 vmovups %xmm12,-48(%rsi) 327 vmovdqa %xmm6,%xmm12 328 vmovups %xmm13,-32(%rsi) 329 vmovdqa %xmm7,%xmm13 330 vmovups %xmm14,-16(%rsi) 331 vmovdqa %xmm3,%xmm14 332 vmovdqu 32+8(%rsp),%xmm7 333 jmp .Loop6x 334 335.L6x_done: 336 vpxor 16+8(%rsp),%xmm8,%xmm8 337 vpxor %xmm4,%xmm8,%xmm8 338 339 ret 340.cfi_endproc 341.size _aesni_ctr32_ghash_6x,.-_aesni_ctr32_ghash_6x 342.globl aesni_gcm_decrypt 343.hidden aesni_gcm_decrypt 344.type aesni_gcm_decrypt,@function 345.align 32 346aesni_gcm_decrypt: 347.cfi_startproc 348 349_CET_ENDBR 350 xorq %rax,%rax 351 352 353 354 cmpq $0x60,%rdx 355 jb .Lgcm_dec_abort 356 357 pushq %rbp 358.cfi_adjust_cfa_offset 8 359.cfi_offset %rbp,-16 360 361 movq %rsp,%rbp 362.cfi_def_cfa_register %rbp 363 pushq %rbx 364.cfi_offset %rbx,-24 365 366 pushq %r12 367.cfi_offset %r12,-32 368 369 pushq %r13 370.cfi_offset %r13,-40 371 372 pushq %r14 373.cfi_offset %r14,-48 374 375 pushq %r15 376.cfi_offset %r15,-56 377 378 vzeroupper 379 380 movq 16(%rbp),%r12 381 vmovdqu (%r8),%xmm1 382 addq $-128,%rsp 383 movl 12(%r8),%ebx 384 leaq .Lbswap_mask(%rip),%r11 385 leaq -128(%rcx),%r14 386 movq $0xf80,%r15 387 vmovdqu (%r12),%xmm8 388 andq $-128,%rsp 389 vmovdqu (%r11),%xmm0 390 leaq 128(%rcx),%rcx 391 leaq 32(%r9),%r9 392 movl 240-128(%rcx),%r10d 393 vpshufb %xmm0,%xmm8,%xmm8 394 395 andq %r15,%r14 396 andq %rsp,%r15 397 subq %r14,%r15 398 jc .Ldec_no_key_aliasing 399 cmpq $768,%r15 400 jnc .Ldec_no_key_aliasing 401 subq %r15,%rsp 402.Ldec_no_key_aliasing: 403 404 vmovdqu 80(%rdi),%xmm7 405 movq %rdi,%r14 406 vmovdqu 64(%rdi),%xmm4 407 408 409 410 411 412 413 414 leaq -192(%rdi,%rdx,1),%r15 415 416 vmovdqu 48(%rdi),%xmm5 417 shrq $4,%rdx 418 xorq %rax,%rax 419 vmovdqu 32(%rdi),%xmm6 420 vpshufb %xmm0,%xmm7,%xmm7 421 vmovdqu 16(%rdi),%xmm2 422 vpshufb %xmm0,%xmm4,%xmm4 423 vmovdqu (%rdi),%xmm3 424 vpshufb %xmm0,%xmm5,%xmm5 425 vmovdqu %xmm4,48(%rsp) 426 vpshufb %xmm0,%xmm6,%xmm6 427 vmovdqu %xmm5,64(%rsp) 428 vpshufb %xmm0,%xmm2,%xmm2 429 vmovdqu %xmm6,80(%rsp) 430 vpshufb %xmm0,%xmm3,%xmm3 431 vmovdqu %xmm2,96(%rsp) 432 vmovdqu %xmm3,112(%rsp) 433 434 call _aesni_ctr32_ghash_6x 435 436 movq 16(%rbp),%r12 437 vmovups %xmm9,-96(%rsi) 438 vmovups %xmm10,-80(%rsi) 439 vmovups %xmm11,-64(%rsi) 440 vmovups %xmm12,-48(%rsi) 441 vmovups %xmm13,-32(%rsi) 442 vmovups %xmm14,-16(%rsi) 443 444 vpshufb (%r11),%xmm8,%xmm8 445 vmovdqu %xmm8,(%r12) 446 447 vzeroupper 448 leaq -40(%rbp),%rsp 449.cfi_def_cfa %rsp, 0x38 450 popq %r15 451.cfi_adjust_cfa_offset -8 452.cfi_restore %r15 453 popq %r14 454.cfi_adjust_cfa_offset -8 455.cfi_restore %r14 456 popq %r13 457.cfi_adjust_cfa_offset -8 458.cfi_restore %r13 459 popq %r12 460.cfi_adjust_cfa_offset -8 461.cfi_restore %r12 462 popq %rbx 463.cfi_adjust_cfa_offset -8 464.cfi_restore %rbx 465 popq %rbp 466.cfi_adjust_cfa_offset -8 467.cfi_restore %rbp 468.Lgcm_dec_abort: 469 ret 470 471.cfi_endproc 472.size aesni_gcm_decrypt,.-aesni_gcm_decrypt 473.type _aesni_ctr32_6x,@function 474.align 32 475_aesni_ctr32_6x: 476.cfi_startproc 477 vmovdqu 0-128(%rcx),%xmm4 478 vmovdqu 32(%r11),%xmm2 479 leaq -1(%r10),%r13 480 vmovups 16-128(%rcx),%xmm15 481 leaq 32-128(%rcx),%r12 482 vpxor %xmm4,%xmm1,%xmm9 483 addl $100663296,%ebx 484 jc .Lhandle_ctr32_2 485 vpaddb %xmm2,%xmm1,%xmm10 486 vpaddb %xmm2,%xmm10,%xmm11 487 vpxor %xmm4,%xmm10,%xmm10 488 vpaddb %xmm2,%xmm11,%xmm12 489 vpxor %xmm4,%xmm11,%xmm11 490 vpaddb %xmm2,%xmm12,%xmm13 491 vpxor %xmm4,%xmm12,%xmm12 492 vpaddb %xmm2,%xmm13,%xmm14 493 vpxor %xmm4,%xmm13,%xmm13 494 vpaddb %xmm2,%xmm14,%xmm1 495 vpxor %xmm4,%xmm14,%xmm14 496 jmp .Loop_ctr32 497 498.align 16 499.Loop_ctr32: 500 vaesenc %xmm15,%xmm9,%xmm9 501 vaesenc %xmm15,%xmm10,%xmm10 502 vaesenc %xmm15,%xmm11,%xmm11 503 vaesenc %xmm15,%xmm12,%xmm12 504 vaesenc %xmm15,%xmm13,%xmm13 505 vaesenc %xmm15,%xmm14,%xmm14 506 vmovups (%r12),%xmm15 507 leaq 16(%r12),%r12 508 decl %r13d 509 jnz .Loop_ctr32 510 511 vmovdqu (%r12),%xmm3 512 vaesenc %xmm15,%xmm9,%xmm9 513 vpxor 0(%rdi),%xmm3,%xmm4 514 vaesenc %xmm15,%xmm10,%xmm10 515 vpxor 16(%rdi),%xmm3,%xmm5 516 vaesenc %xmm15,%xmm11,%xmm11 517 vpxor 32(%rdi),%xmm3,%xmm6 518 vaesenc %xmm15,%xmm12,%xmm12 519 vpxor 48(%rdi),%xmm3,%xmm8 520 vaesenc %xmm15,%xmm13,%xmm13 521 vpxor 64(%rdi),%xmm3,%xmm2 522 vaesenc %xmm15,%xmm14,%xmm14 523 vpxor 80(%rdi),%xmm3,%xmm3 524 leaq 96(%rdi),%rdi 525 526 vaesenclast %xmm4,%xmm9,%xmm9 527 vaesenclast %xmm5,%xmm10,%xmm10 528 vaesenclast %xmm6,%xmm11,%xmm11 529 vaesenclast %xmm8,%xmm12,%xmm12 530 vaesenclast %xmm2,%xmm13,%xmm13 531 vaesenclast %xmm3,%xmm14,%xmm14 532 vmovups %xmm9,0(%rsi) 533 vmovups %xmm10,16(%rsi) 534 vmovups %xmm11,32(%rsi) 535 vmovups %xmm12,48(%rsi) 536 vmovups %xmm13,64(%rsi) 537 vmovups %xmm14,80(%rsi) 538 leaq 96(%rsi),%rsi 539 540 ret 541.align 32 542.Lhandle_ctr32_2: 543 vpshufb %xmm0,%xmm1,%xmm6 544 vmovdqu 48(%r11),%xmm5 545 vpaddd 64(%r11),%xmm6,%xmm10 546 vpaddd %xmm5,%xmm6,%xmm11 547 vpaddd %xmm5,%xmm10,%xmm12 548 vpshufb %xmm0,%xmm10,%xmm10 549 vpaddd %xmm5,%xmm11,%xmm13 550 vpshufb %xmm0,%xmm11,%xmm11 551 vpxor %xmm4,%xmm10,%xmm10 552 vpaddd %xmm5,%xmm12,%xmm14 553 vpshufb %xmm0,%xmm12,%xmm12 554 vpxor %xmm4,%xmm11,%xmm11 555 vpaddd %xmm5,%xmm13,%xmm1 556 vpshufb %xmm0,%xmm13,%xmm13 557 vpxor %xmm4,%xmm12,%xmm12 558 vpshufb %xmm0,%xmm14,%xmm14 559 vpxor %xmm4,%xmm13,%xmm13 560 vpshufb %xmm0,%xmm1,%xmm1 561 vpxor %xmm4,%xmm14,%xmm14 562 jmp .Loop_ctr32 563.cfi_endproc 564.size _aesni_ctr32_6x,.-_aesni_ctr32_6x 565 566.globl aesni_gcm_encrypt 567.hidden aesni_gcm_encrypt 568.type aesni_gcm_encrypt,@function 569.align 32 570aesni_gcm_encrypt: 571.cfi_startproc 572 573_CET_ENDBR 574#ifdef BORINGSSL_DISPATCH_TEST 575.extern BORINGSSL_function_hit 576.hidden BORINGSSL_function_hit 577 movb $1,BORINGSSL_function_hit+2(%rip) 578#endif 579 xorq %rax,%rax 580 581 582 583 584 cmpq $288,%rdx 585 jb .Lgcm_enc_abort 586 587 pushq %rbp 588.cfi_adjust_cfa_offset 8 589.cfi_offset %rbp,-16 590 591 movq %rsp,%rbp 592.cfi_def_cfa_register %rbp 593 pushq %rbx 594.cfi_offset %rbx,-24 595 596 pushq %r12 597.cfi_offset %r12,-32 598 599 pushq %r13 600.cfi_offset %r13,-40 601 602 pushq %r14 603.cfi_offset %r14,-48 604 605 pushq %r15 606.cfi_offset %r15,-56 607 608 vzeroupper 609 610 vmovdqu (%r8),%xmm1 611 addq $-128,%rsp 612 movl 12(%r8),%ebx 613 leaq .Lbswap_mask(%rip),%r11 614 leaq -128(%rcx),%r14 615 movq $0xf80,%r15 616 leaq 128(%rcx),%rcx 617 vmovdqu (%r11),%xmm0 618 andq $-128,%rsp 619 movl 240-128(%rcx),%r10d 620 621 andq %r15,%r14 622 andq %rsp,%r15 623 subq %r14,%r15 624 jc .Lenc_no_key_aliasing 625 cmpq $768,%r15 626 jnc .Lenc_no_key_aliasing 627 subq %r15,%rsp 628.Lenc_no_key_aliasing: 629 630 movq %rsi,%r14 631 632 633 634 635 636 637 638 639 leaq -192(%rsi,%rdx,1),%r15 640 641 shrq $4,%rdx 642 643 call _aesni_ctr32_6x 644 vpshufb %xmm0,%xmm9,%xmm8 645 vpshufb %xmm0,%xmm10,%xmm2 646 vmovdqu %xmm8,112(%rsp) 647 vpshufb %xmm0,%xmm11,%xmm4 648 vmovdqu %xmm2,96(%rsp) 649 vpshufb %xmm0,%xmm12,%xmm5 650 vmovdqu %xmm4,80(%rsp) 651 vpshufb %xmm0,%xmm13,%xmm6 652 vmovdqu %xmm5,64(%rsp) 653 vpshufb %xmm0,%xmm14,%xmm7 654 vmovdqu %xmm6,48(%rsp) 655 656 call _aesni_ctr32_6x 657 658 movq 16(%rbp),%r12 659 leaq 32(%r9),%r9 660 vmovdqu (%r12),%xmm8 661 subq $12,%rdx 662 movq $192,%rax 663 vpshufb %xmm0,%xmm8,%xmm8 664 665 call _aesni_ctr32_ghash_6x 666 vmovdqu 32(%rsp),%xmm7 667 vmovdqu (%r11),%xmm0 668 vmovdqu 0-32(%r9),%xmm3 669 vpunpckhqdq %xmm7,%xmm7,%xmm1 670 vmovdqu 32-32(%r9),%xmm15 671 vmovups %xmm9,-96(%rsi) 672 vpshufb %xmm0,%xmm9,%xmm9 673 vpxor %xmm7,%xmm1,%xmm1 674 vmovups %xmm10,-80(%rsi) 675 vpshufb %xmm0,%xmm10,%xmm10 676 vmovups %xmm11,-64(%rsi) 677 vpshufb %xmm0,%xmm11,%xmm11 678 vmovups %xmm12,-48(%rsi) 679 vpshufb %xmm0,%xmm12,%xmm12 680 vmovups %xmm13,-32(%rsi) 681 vpshufb %xmm0,%xmm13,%xmm13 682 vmovups %xmm14,-16(%rsi) 683 vpshufb %xmm0,%xmm14,%xmm14 684 vmovdqu %xmm9,16(%rsp) 685 vmovdqu 48(%rsp),%xmm6 686 vmovdqu 16-32(%r9),%xmm0 687 vpunpckhqdq %xmm6,%xmm6,%xmm2 688 vpclmulqdq $0x00,%xmm3,%xmm7,%xmm5 689 vpxor %xmm6,%xmm2,%xmm2 690 vpclmulqdq $0x11,%xmm3,%xmm7,%xmm7 691 vpclmulqdq $0x00,%xmm15,%xmm1,%xmm1 692 693 vmovdqu 64(%rsp),%xmm9 694 vpclmulqdq $0x00,%xmm0,%xmm6,%xmm4 695 vmovdqu 48-32(%r9),%xmm3 696 vpxor %xmm5,%xmm4,%xmm4 697 vpunpckhqdq %xmm9,%xmm9,%xmm5 698 vpclmulqdq $0x11,%xmm0,%xmm6,%xmm6 699 vpxor %xmm9,%xmm5,%xmm5 700 vpxor %xmm7,%xmm6,%xmm6 701 vpclmulqdq $0x10,%xmm15,%xmm2,%xmm2 702 vmovdqu 80-32(%r9),%xmm15 703 vpxor %xmm1,%xmm2,%xmm2 704 705 vmovdqu 80(%rsp),%xmm1 706 vpclmulqdq $0x00,%xmm3,%xmm9,%xmm7 707 vmovdqu 64-32(%r9),%xmm0 708 vpxor %xmm4,%xmm7,%xmm7 709 vpunpckhqdq %xmm1,%xmm1,%xmm4 710 vpclmulqdq $0x11,%xmm3,%xmm9,%xmm9 711 vpxor %xmm1,%xmm4,%xmm4 712 vpxor %xmm6,%xmm9,%xmm9 713 vpclmulqdq $0x00,%xmm15,%xmm5,%xmm5 714 vpxor %xmm2,%xmm5,%xmm5 715 716 vmovdqu 96(%rsp),%xmm2 717 vpclmulqdq $0x00,%xmm0,%xmm1,%xmm6 718 vmovdqu 96-32(%r9),%xmm3 719 vpxor %xmm7,%xmm6,%xmm6 720 vpunpckhqdq %xmm2,%xmm2,%xmm7 721 vpclmulqdq $0x11,%xmm0,%xmm1,%xmm1 722 vpxor %xmm2,%xmm7,%xmm7 723 vpxor %xmm9,%xmm1,%xmm1 724 vpclmulqdq $0x10,%xmm15,%xmm4,%xmm4 725 vmovdqu 128-32(%r9),%xmm15 726 vpxor %xmm5,%xmm4,%xmm4 727 728 vpxor 112(%rsp),%xmm8,%xmm8 729 vpclmulqdq $0x00,%xmm3,%xmm2,%xmm5 730 vmovdqu 112-32(%r9),%xmm0 731 vpunpckhqdq %xmm8,%xmm8,%xmm9 732 vpxor %xmm6,%xmm5,%xmm5 733 vpclmulqdq $0x11,%xmm3,%xmm2,%xmm2 734 vpxor %xmm8,%xmm9,%xmm9 735 vpxor %xmm1,%xmm2,%xmm2 736 vpclmulqdq $0x00,%xmm15,%xmm7,%xmm7 737 vpxor %xmm4,%xmm7,%xmm4 738 739 vpclmulqdq $0x00,%xmm0,%xmm8,%xmm6 740 vmovdqu 0-32(%r9),%xmm3 741 vpunpckhqdq %xmm14,%xmm14,%xmm1 742 vpclmulqdq $0x11,%xmm0,%xmm8,%xmm8 743 vpxor %xmm14,%xmm1,%xmm1 744 vpxor %xmm5,%xmm6,%xmm5 745 vpclmulqdq $0x10,%xmm15,%xmm9,%xmm9 746 vmovdqu 32-32(%r9),%xmm15 747 vpxor %xmm2,%xmm8,%xmm7 748 vpxor %xmm4,%xmm9,%xmm6 749 750 vmovdqu 16-32(%r9),%xmm0 751 vpxor %xmm5,%xmm7,%xmm9 752 vpclmulqdq $0x00,%xmm3,%xmm14,%xmm4 753 vpxor %xmm9,%xmm6,%xmm6 754 vpunpckhqdq %xmm13,%xmm13,%xmm2 755 vpclmulqdq $0x11,%xmm3,%xmm14,%xmm14 756 vpxor %xmm13,%xmm2,%xmm2 757 vpslldq $8,%xmm6,%xmm9 758 vpclmulqdq $0x00,%xmm15,%xmm1,%xmm1 759 vpxor %xmm9,%xmm5,%xmm8 760 vpsrldq $8,%xmm6,%xmm6 761 vpxor %xmm6,%xmm7,%xmm7 762 763 vpclmulqdq $0x00,%xmm0,%xmm13,%xmm5 764 vmovdqu 48-32(%r9),%xmm3 765 vpxor %xmm4,%xmm5,%xmm5 766 vpunpckhqdq %xmm12,%xmm12,%xmm9 767 vpclmulqdq $0x11,%xmm0,%xmm13,%xmm13 768 vpxor %xmm12,%xmm9,%xmm9 769 vpxor %xmm14,%xmm13,%xmm13 770 vpalignr $8,%xmm8,%xmm8,%xmm14 771 vpclmulqdq $0x10,%xmm15,%xmm2,%xmm2 772 vmovdqu 80-32(%r9),%xmm15 773 vpxor %xmm1,%xmm2,%xmm2 774 775 vpclmulqdq $0x00,%xmm3,%xmm12,%xmm4 776 vmovdqu 64-32(%r9),%xmm0 777 vpxor %xmm5,%xmm4,%xmm4 778 vpunpckhqdq %xmm11,%xmm11,%xmm1 779 vpclmulqdq $0x11,%xmm3,%xmm12,%xmm12 780 vpxor %xmm11,%xmm1,%xmm1 781 vpxor %xmm13,%xmm12,%xmm12 782 vxorps 16(%rsp),%xmm7,%xmm7 783 vpclmulqdq $0x00,%xmm15,%xmm9,%xmm9 784 vpxor %xmm2,%xmm9,%xmm9 785 786 vpclmulqdq $0x10,16(%r11),%xmm8,%xmm8 787 vxorps %xmm14,%xmm8,%xmm8 788 789 vpclmulqdq $0x00,%xmm0,%xmm11,%xmm5 790 vmovdqu 96-32(%r9),%xmm3 791 vpxor %xmm4,%xmm5,%xmm5 792 vpunpckhqdq %xmm10,%xmm10,%xmm2 793 vpclmulqdq $0x11,%xmm0,%xmm11,%xmm11 794 vpxor %xmm10,%xmm2,%xmm2 795 vpalignr $8,%xmm8,%xmm8,%xmm14 796 vpxor %xmm12,%xmm11,%xmm11 797 vpclmulqdq $0x10,%xmm15,%xmm1,%xmm1 798 vmovdqu 128-32(%r9),%xmm15 799 vpxor %xmm9,%xmm1,%xmm1 800 801 vxorps %xmm7,%xmm14,%xmm14 802 vpclmulqdq $0x10,16(%r11),%xmm8,%xmm8 803 vxorps %xmm14,%xmm8,%xmm8 804 805 vpclmulqdq $0x00,%xmm3,%xmm10,%xmm4 806 vmovdqu 112-32(%r9),%xmm0 807 vpxor %xmm5,%xmm4,%xmm4 808 vpunpckhqdq %xmm8,%xmm8,%xmm9 809 vpclmulqdq $0x11,%xmm3,%xmm10,%xmm10 810 vpxor %xmm8,%xmm9,%xmm9 811 vpxor %xmm11,%xmm10,%xmm10 812 vpclmulqdq $0x00,%xmm15,%xmm2,%xmm2 813 vpxor %xmm1,%xmm2,%xmm2 814 815 vpclmulqdq $0x00,%xmm0,%xmm8,%xmm5 816 vpclmulqdq $0x11,%xmm0,%xmm8,%xmm7 817 vpxor %xmm4,%xmm5,%xmm5 818 vpclmulqdq $0x10,%xmm15,%xmm9,%xmm6 819 vpxor %xmm10,%xmm7,%xmm7 820 vpxor %xmm2,%xmm6,%xmm6 821 822 vpxor %xmm5,%xmm7,%xmm4 823 vpxor %xmm4,%xmm6,%xmm6 824 vpslldq $8,%xmm6,%xmm1 825 vmovdqu 16(%r11),%xmm3 826 vpsrldq $8,%xmm6,%xmm6 827 vpxor %xmm1,%xmm5,%xmm8 828 vpxor %xmm6,%xmm7,%xmm7 829 830 vpalignr $8,%xmm8,%xmm8,%xmm2 831 vpclmulqdq $0x10,%xmm3,%xmm8,%xmm8 832 vpxor %xmm2,%xmm8,%xmm8 833 834 vpalignr $8,%xmm8,%xmm8,%xmm2 835 vpclmulqdq $0x10,%xmm3,%xmm8,%xmm8 836 vpxor %xmm7,%xmm2,%xmm2 837 vpxor %xmm2,%xmm8,%xmm8 838 movq 16(%rbp),%r12 839 vpshufb (%r11),%xmm8,%xmm8 840 vmovdqu %xmm8,(%r12) 841 842 vzeroupper 843 leaq -40(%rbp),%rsp 844.cfi_def_cfa %rsp, 0x38 845 popq %r15 846.cfi_adjust_cfa_offset -8 847.cfi_restore %r15 848 popq %r14 849.cfi_adjust_cfa_offset -8 850.cfi_restore %r14 851 popq %r13 852.cfi_adjust_cfa_offset -8 853.cfi_restore %r13 854 popq %r12 855.cfi_adjust_cfa_offset -8 856.cfi_restore %r12 857 popq %rbx 858.cfi_adjust_cfa_offset -8 859.cfi_restore %rbx 860 popq %rbp 861.cfi_adjust_cfa_offset -8 862.cfi_restore %rbp 863.Lgcm_enc_abort: 864 ret 865 866.cfi_endproc 867.size aesni_gcm_encrypt,.-aesni_gcm_encrypt 868.section .rodata 869.align 64 870.Lbswap_mask: 871.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 872.Lpoly: 873.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc2 874.Lone_msb: 875.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 876.Ltwo_lsb: 877.byte 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 878.Lone_lsb: 879.byte 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 880.byte 65,69,83,45,78,73,32,71,67,77,32,109,111,100,117,108,101,32,102,111,114,32,120,56,54,95,54,52,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 881.align 64 882.text 883#endif 884