| 1 |
; This file is generated from a similarly-named Perl script in the BoringSSL |
| 2 |
; source tree. Do not edit by hand. |
| 3 |
|
| 4 |
%ifidn __OUTPUT_FORMAT__, win64 |
| 5 |
default rel |
| 6 |
%define XMMWORD |
| 7 |
%define YMMWORD |
| 8 |
%define ZMMWORD |
| 9 |
|
| 10 |
%ifdef BORINGSSL_PREFIX |
| 11 |
%include "boringssl_prefix_symbols_nasm.inc" |
| 12 |
%endif |
| 13 |
section .text code align=64 |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
ALIGN 16 |
| 33 |
_vpaes_encrypt_core: |
| 34 |
|
| 35 |
mov r9,rdx |
| 36 |
mov r11,16 |
| 37 |
mov eax,DWORD[240+rdx] |
| 38 |
movdqa xmm1,xmm9 |
| 39 |
movdqa xmm2,XMMWORD[$L$k_ipt] |
| 40 |
pandn xmm1,xmm0 |
| 41 |
movdqu xmm5,XMMWORD[r9] |
| 42 |
psrld xmm1,4 |
| 43 |
pand xmm0,xmm9 |
| 44 |
DB 102,15,56,0,208 |
| 45 |
movdqa xmm0,XMMWORD[(($L$k_ipt+16))] |
| 46 |
DB 102,15,56,0,193 |
| 47 |
pxor xmm2,xmm5 |
| 48 |
add r9,16 |
| 49 |
pxor xmm0,xmm2 |
| 50 |
lea r10,[$L$k_mc_backward] |
| 51 |
jmp NEAR $L$enc_entry |
| 52 |
|
| 53 |
ALIGN 16 |
| 54 |
$L$enc_loop: |
| 55 |
|
| 56 |
movdqa xmm4,xmm13 |
| 57 |
movdqa xmm0,xmm12 |
| 58 |
DB 102,15,56,0,226 |
| 59 |
DB 102,15,56,0,195 |
| 60 |
pxor xmm4,xmm5 |
| 61 |
movdqa xmm5,xmm15 |
| 62 |
pxor xmm0,xmm4 |
| 63 |
movdqa xmm1,XMMWORD[((-64))+r10*1+r11] |
| 64 |
DB 102,15,56,0,234 |
| 65 |
movdqa xmm4,XMMWORD[r10*1+r11] |
| 66 |
movdqa xmm2,xmm14 |
| 67 |
DB 102,15,56,0,211 |
| 68 |
movdqa xmm3,xmm0 |
| 69 |
pxor xmm2,xmm5 |
| 70 |
DB 102,15,56,0,193 |
| 71 |
add r9,16 |
| 72 |
pxor xmm0,xmm2 |
| 73 |
DB 102,15,56,0,220 |
| 74 |
add r11,16 |
| 75 |
pxor xmm3,xmm0 |
| 76 |
DB 102,15,56,0,193 |
| 77 |
and r11,0x30 |
| 78 |
sub rax,1 |
| 79 |
pxor xmm0,xmm3 |
| 80 |
|
| 81 |
$L$enc_entry: |
| 82 |
|
| 83 |
movdqa xmm1,xmm9 |
| 84 |
movdqa xmm5,xmm11 |
| 85 |
pandn xmm1,xmm0 |
| 86 |
psrld xmm1,4 |
| 87 |
pand xmm0,xmm9 |
| 88 |
DB 102,15,56,0,232 |
| 89 |
movdqa xmm3,xmm10 |
| 90 |
pxor xmm0,xmm1 |
| 91 |
DB 102,15,56,0,217 |
| 92 |
movdqa xmm4,xmm10 |
| 93 |
pxor xmm3,xmm5 |
| 94 |
DB 102,15,56,0,224 |
| 95 |
movdqa xmm2,xmm10 |
| 96 |
pxor xmm4,xmm5 |
| 97 |
DB 102,15,56,0,211 |
| 98 |
movdqa xmm3,xmm10 |
| 99 |
pxor xmm2,xmm0 |
| 100 |
DB 102,15,56,0,220 |
| 101 |
movdqu xmm5,XMMWORD[r9] |
| 102 |
pxor xmm3,xmm1 |
| 103 |
jnz NEAR $L$enc_loop |
| 104 |
|
| 105 |
|
| 106 |
movdqa xmm4,XMMWORD[((-96))+r10] |
| 107 |
movdqa xmm0,XMMWORD[((-80))+r10] |
| 108 |
DB 102,15,56,0,226 |
| 109 |
pxor xmm4,xmm5 |
| 110 |
DB 102,15,56,0,195 |
| 111 |
movdqa xmm1,XMMWORD[64+r10*1+r11] |
| 112 |
pxor xmm0,xmm4 |
| 113 |
DB 102,15,56,0,193 |
| 114 |
DB 0F3h,0C3h ;repret |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
ALIGN 16 |
| 149 |
_vpaes_encrypt_core_2x: |
| 150 |
|
| 151 |
mov r9,rdx |
| 152 |
mov r11,16 |
| 153 |
mov eax,DWORD[240+rdx] |
| 154 |
movdqa xmm1,xmm9 |
| 155 |
movdqa xmm7,xmm9 |
| 156 |
movdqa xmm2,XMMWORD[$L$k_ipt] |
| 157 |
movdqa xmm8,xmm2 |
| 158 |
pandn xmm1,xmm0 |
| 159 |
pandn xmm7,xmm6 |
| 160 |
movdqu xmm5,XMMWORD[r9] |
| 161 |
|
| 162 |
psrld xmm1,4 |
| 163 |
psrld xmm7,4 |
| 164 |
pand xmm0,xmm9 |
| 165 |
pand xmm6,xmm9 |
| 166 |
DB 102,15,56,0,208 |
| 167 |
DB 102,68,15,56,0,198 |
| 168 |
movdqa xmm0,XMMWORD[(($L$k_ipt+16))] |
| 169 |
movdqa xmm6,xmm0 |
| 170 |
DB 102,15,56,0,193 |
| 171 |
DB 102,15,56,0,247 |
| 172 |
pxor xmm2,xmm5 |
| 173 |
pxor xmm8,xmm5 |
| 174 |
add r9,16 |
| 175 |
pxor xmm0,xmm2 |
| 176 |
pxor xmm6,xmm8 |
| 177 |
lea r10,[$L$k_mc_backward] |
| 178 |
jmp NEAR $L$enc2x_entry |
| 179 |
|
| 180 |
ALIGN 16 |
| 181 |
$L$enc2x_loop: |
| 182 |
|
| 183 |
movdqa xmm4,XMMWORD[$L$k_sb1] |
| 184 |
movdqa xmm0,XMMWORD[(($L$k_sb1+16))] |
| 185 |
movdqa xmm12,xmm4 |
| 186 |
movdqa xmm6,xmm0 |
| 187 |
DB 102,15,56,0,226 |
| 188 |
DB 102,69,15,56,0,224 |
| 189 |
DB 102,15,56,0,195 |
| 190 |
DB 102,65,15,56,0,243 |
| 191 |
pxor xmm4,xmm5 |
| 192 |
pxor xmm12,xmm5 |
| 193 |
movdqa xmm5,XMMWORD[$L$k_sb2] |
| 194 |
movdqa xmm13,xmm5 |
| 195 |
pxor xmm0,xmm4 |
| 196 |
pxor xmm6,xmm12 |
| 197 |
movdqa xmm1,XMMWORD[((-64))+r10*1+r11] |
| 198 |
|
| 199 |
DB 102,15,56,0,234 |
| 200 |
DB 102,69,15,56,0,232 |
| 201 |
movdqa xmm4,XMMWORD[r10*1+r11] |
| 202 |
|
| 203 |
movdqa xmm2,XMMWORD[(($L$k_sb2+16))] |
| 204 |
movdqa xmm8,xmm2 |
| 205 |
DB 102,15,56,0,211 |
| 206 |
DB 102,69,15,56,0,195 |
| 207 |
movdqa xmm3,xmm0 |
| 208 |
movdqa xmm11,xmm6 |
| 209 |
pxor xmm2,xmm5 |
| 210 |
pxor xmm8,xmm13 |
| 211 |
DB 102,15,56,0,193 |
| 212 |
DB 102,15,56,0,241 |
| 213 |
add r9,16 |
| 214 |
pxor xmm0,xmm2 |
| 215 |
pxor xmm6,xmm8 |
| 216 |
DB 102,15,56,0,220 |
| 217 |
DB 102,68,15,56,0,220 |
| 218 |
add r11,16 |
| 219 |
pxor xmm3,xmm0 |
| 220 |
pxor xmm11,xmm6 |
| 221 |
DB 102,15,56,0,193 |
| 222 |
DB 102,15,56,0,241 |
| 223 |
and r11,0x30 |
| 224 |
sub rax,1 |
| 225 |
pxor xmm0,xmm3 |
| 226 |
pxor xmm6,xmm11 |
| 227 |
|
| 228 |
$L$enc2x_entry: |
| 229 |
|
| 230 |
movdqa xmm1,xmm9 |
| 231 |
movdqa xmm7,xmm9 |
| 232 |
movdqa xmm5,XMMWORD[(($L$k_inv+16))] |
| 233 |
movdqa xmm13,xmm5 |
| 234 |
pandn xmm1,xmm0 |
| 235 |
pandn xmm7,xmm6 |
| 236 |
psrld xmm1,4 |
| 237 |
psrld xmm7,4 |
| 238 |
pand xmm0,xmm9 |
| 239 |
pand xmm6,xmm9 |
| 240 |
DB 102,15,56,0,232 |
| 241 |
DB 102,68,15,56,0,238 |
| 242 |
movdqa xmm3,xmm10 |
| 243 |
movdqa xmm11,xmm10 |
| 244 |
pxor xmm0,xmm1 |
| 245 |
pxor xmm6,xmm7 |
| 246 |
DB 102,15,56,0,217 |
| 247 |
DB 102,68,15,56,0,223 |
| 248 |
movdqa xmm4,xmm10 |
| 249 |
movdqa xmm12,xmm10 |
| 250 |
pxor xmm3,xmm5 |
| 251 |
pxor xmm11,xmm13 |
| 252 |
DB 102,15,56,0,224 |
| 253 |
DB 102,68,15,56,0,230 |
| 254 |
movdqa xmm2,xmm10 |
| 255 |
movdqa xmm8,xmm10 |
| 256 |
pxor xmm4,xmm5 |
| 257 |
pxor xmm12,xmm13 |
| 258 |
DB 102,15,56,0,211 |
| 259 |
DB 102,69,15,56,0,195 |
| 260 |
movdqa xmm3,xmm10 |
| 261 |
movdqa xmm11,xmm10 |
| 262 |
pxor xmm2,xmm0 |
| 263 |
pxor xmm8,xmm6 |
| 264 |
DB 102,15,56,0,220 |
| 265 |
DB 102,69,15,56,0,220 |
| 266 |
movdqu xmm5,XMMWORD[r9] |
| 267 |
|
| 268 |
pxor xmm3,xmm1 |
| 269 |
pxor xmm11,xmm7 |
| 270 |
jnz NEAR $L$enc2x_loop |
| 271 |
|
| 272 |
|
| 273 |
movdqa xmm4,XMMWORD[((-96))+r10] |
| 274 |
movdqa xmm0,XMMWORD[((-80))+r10] |
| 275 |
movdqa xmm12,xmm4 |
| 276 |
movdqa xmm6,xmm0 |
| 277 |
DB 102,15,56,0,226 |
| 278 |
DB 102,69,15,56,0,224 |
| 279 |
pxor xmm4,xmm5 |
| 280 |
pxor xmm12,xmm5 |
| 281 |
DB 102,15,56,0,195 |
| 282 |
DB 102,65,15,56,0,243 |
| 283 |
movdqa xmm1,XMMWORD[64+r10*1+r11] |
| 284 |
|
| 285 |
pxor xmm0,xmm4 |
| 286 |
pxor xmm6,xmm12 |
| 287 |
DB 102,15,56,0,193 |
| 288 |
DB 102,15,56,0,241 |
| 289 |
DB 0F3h,0C3h ;repret |
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
ALIGN 16 |
| 300 |
_vpaes_decrypt_core: |
| 301 |
|
| 302 |
mov r9,rdx |
| 303 |
mov eax,DWORD[240+rdx] |
| 304 |
movdqa xmm1,xmm9 |
| 305 |
movdqa xmm2,XMMWORD[$L$k_dipt] |
| 306 |
pandn xmm1,xmm0 |
| 307 |
mov r11,rax |
| 308 |
psrld xmm1,4 |
| 309 |
movdqu xmm5,XMMWORD[r9] |
| 310 |
shl r11,4 |
| 311 |
pand xmm0,xmm9 |
| 312 |
DB 102,15,56,0,208 |
| 313 |
movdqa xmm0,XMMWORD[(($L$k_dipt+16))] |
| 314 |
xor r11,0x30 |
| 315 |
lea r10,[$L$k_dsbd] |
| 316 |
DB 102,15,56,0,193 |
| 317 |
and r11,0x30 |
| 318 |
pxor xmm2,xmm5 |
| 319 |
movdqa xmm5,XMMWORD[(($L$k_mc_forward+48))] |
| 320 |
pxor xmm0,xmm2 |
| 321 |
add r9,16 |
| 322 |
add r11,r10 |
| 323 |
jmp NEAR $L$dec_entry |
| 324 |
|
| 325 |
ALIGN 16 |
| 326 |
$L$dec_loop: |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
movdqa xmm4,XMMWORD[((-32))+r10] |
| 331 |
movdqa xmm1,XMMWORD[((-16))+r10] |
| 332 |
DB 102,15,56,0,226 |
| 333 |
DB 102,15,56,0,203 |
| 334 |
pxor xmm0,xmm4 |
| 335 |
movdqa xmm4,XMMWORD[r10] |
| 336 |
pxor xmm0,xmm1 |
| 337 |
movdqa xmm1,XMMWORD[16+r10] |
| 338 |
|
| 339 |
DB 102,15,56,0,226 |
| 340 |
DB 102,15,56,0,197 |
| 341 |
DB 102,15,56,0,203 |
| 342 |
pxor xmm0,xmm4 |
| 343 |
movdqa xmm4,XMMWORD[32+r10] |
| 344 |
pxor xmm0,xmm1 |
| 345 |
movdqa xmm1,XMMWORD[48+r10] |
| 346 |
|
| 347 |
DB 102,15,56,0,226 |
| 348 |
DB 102,15,56,0,197 |
| 349 |
DB 102,15,56,0,203 |
| 350 |
pxor xmm0,xmm4 |
| 351 |
movdqa xmm4,XMMWORD[64+r10] |
| 352 |
pxor xmm0,xmm1 |
| 353 |
movdqa xmm1,XMMWORD[80+r10] |
| 354 |
|
| 355 |
DB 102,15,56,0,226 |
| 356 |
DB 102,15,56,0,197 |
| 357 |
DB 102,15,56,0,203 |
| 358 |
pxor xmm0,xmm4 |
| 359 |
add r9,16 |
| 360 |
DB 102,15,58,15,237,12 |
| 361 |
pxor xmm0,xmm1 |
| 362 |
sub rax,1 |
| 363 |
|
| 364 |
$L$dec_entry: |
| 365 |
|
| 366 |
movdqa xmm1,xmm9 |
| 367 |
pandn xmm1,xmm0 |
| 368 |
movdqa xmm2,xmm11 |
| 369 |
psrld xmm1,4 |
| 370 |
pand xmm0,xmm9 |
| 371 |
DB 102,15,56,0,208 |
| 372 |
movdqa xmm3,xmm10 |
| 373 |
pxor xmm0,xmm1 |
| 374 |
DB 102,15,56,0,217 |
| 375 |
movdqa xmm4,xmm10 |
| 376 |
pxor xmm3,xmm2 |
| 377 |
DB 102,15,56,0,224 |
| 378 |
pxor xmm4,xmm2 |
| 379 |
movdqa xmm2,xmm10 |
| 380 |
DB 102,15,56,0,211 |
| 381 |
movdqa xmm3,xmm10 |
| 382 |
pxor xmm2,xmm0 |
| 383 |
DB 102,15,56,0,220 |
| 384 |
movdqu xmm0,XMMWORD[r9] |
| 385 |
pxor xmm3,xmm1 |
| 386 |
jnz NEAR $L$dec_loop |
| 387 |
|
| 388 |
|
| 389 |
movdqa xmm4,XMMWORD[96+r10] |
| 390 |
DB 102,15,56,0,226 |
| 391 |
pxor xmm4,xmm0 |
| 392 |
movdqa xmm0,XMMWORD[112+r10] |
| 393 |
movdqa xmm2,XMMWORD[((-352))+r11] |
| 394 |
DB 102,15,56,0,195 |
| 395 |
pxor xmm0,xmm4 |
| 396 |
DB 102,15,56,0,194 |
| 397 |
DB 0F3h,0C3h ;repret |
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
ALIGN 16 |
| 408 |
_vpaes_schedule_core: |
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
call _vpaes_preheat |
| 416 |
movdqa xmm8,XMMWORD[$L$k_rcon] |
| 417 |
movdqu xmm0,XMMWORD[rdi] |
| 418 |
|
| 419 |
|
| 420 |
movdqa xmm3,xmm0 |
| 421 |
lea r11,[$L$k_ipt] |
| 422 |
call _vpaes_schedule_transform |
| 423 |
movdqa xmm7,xmm0 |
| 424 |
|
| 425 |
lea r10,[$L$k_sr] |
| 426 |
test rcx,rcx |
| 427 |
jnz NEAR $L$schedule_am_decrypting |
| 428 |
|
| 429 |
|
| 430 |
movdqu XMMWORD[rdx],xmm0 |
| 431 |
jmp NEAR $L$schedule_go |
| 432 |
|
| 433 |
$L$schedule_am_decrypting: |
| 434 |
|
| 435 |
movdqa xmm1,XMMWORD[r10*1+r8] |
| 436 |
DB 102,15,56,0,217 |
| 437 |
movdqu XMMWORD[rdx],xmm3 |
| 438 |
xor r8,0x30 |
| 439 |
|
| 440 |
$L$schedule_go: |
| 441 |
cmp esi,192 |
| 442 |
ja NEAR $L$schedule_256 |
| 443 |
je NEAR $L$schedule_192 |
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
$L$schedule_128: |
| 455 |
mov esi,10 |
| 456 |
|
| 457 |
$L$oop_schedule_128: |
| 458 |
call _vpaes_schedule_round |
| 459 |
dec rsi |
| 460 |
jz NEAR $L$schedule_mangle_last |
| 461 |
call _vpaes_schedule_mangle |
| 462 |
jmp NEAR $L$oop_schedule_128 |
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
ALIGN 16 |
| 480 |
$L$schedule_192: |
| 481 |
movdqu xmm0,XMMWORD[8+rdi] |
| 482 |
call _vpaes_schedule_transform |
| 483 |
movdqa xmm6,xmm0 |
| 484 |
pxor xmm4,xmm4 |
| 485 |
movhlps xmm6,xmm4 |
| 486 |
mov esi,4 |
| 487 |
|
| 488 |
$L$oop_schedule_192: |
| 489 |
call _vpaes_schedule_round |
| 490 |
DB 102,15,58,15,198,8 |
| 491 |
call _vpaes_schedule_mangle |
| 492 |
call _vpaes_schedule_192_smear |
| 493 |
call _vpaes_schedule_mangle |
| 494 |
call _vpaes_schedule_round |
| 495 |
dec rsi |
| 496 |
jz NEAR $L$schedule_mangle_last |
| 497 |
call _vpaes_schedule_mangle |
| 498 |
call _vpaes_schedule_192_smear |
| 499 |
jmp NEAR $L$oop_schedule_192 |
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
ALIGN 16 |
| 512 |
$L$schedule_256: |
| 513 |
movdqu xmm0,XMMWORD[16+rdi] |
| 514 |
call _vpaes_schedule_transform |
| 515 |
mov esi,7 |
| 516 |
|
| 517 |
$L$oop_schedule_256: |
| 518 |
call _vpaes_schedule_mangle |
| 519 |
movdqa xmm6,xmm0 |
| 520 |
|
| 521 |
|
| 522 |
call _vpaes_schedule_round |
| 523 |
dec rsi |
| 524 |
jz NEAR $L$schedule_mangle_last |
| 525 |
call _vpaes_schedule_mangle |
| 526 |
|
| 527 |
|
| 528 |
pshufd xmm0,xmm0,0xFF |
| 529 |
movdqa xmm5,xmm7 |
| 530 |
movdqa xmm7,xmm6 |
| 531 |
call _vpaes_schedule_low_round |
| 532 |
movdqa xmm7,xmm5 |
| 533 |
|
| 534 |
jmp NEAR $L$oop_schedule_256 |
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
ALIGN 16 |
| 548 |
$L$schedule_mangle_last: |
| 549 |
|
| 550 |
lea r11,[$L$k_deskew] |
| 551 |
test rcx,rcx |
| 552 |
jnz NEAR $L$schedule_mangle_last_dec |
| 553 |
|
| 554 |
|
| 555 |
movdqa xmm1,XMMWORD[r10*1+r8] |
| 556 |
DB 102,15,56,0,193 |
| 557 |
lea r11,[$L$k_opt] |
| 558 |
add rdx,32 |
| 559 |
|
| 560 |
$L$schedule_mangle_last_dec: |
| 561 |
add rdx,-16 |
| 562 |
pxor xmm0,XMMWORD[$L$k_s63] |
| 563 |
call _vpaes_schedule_transform |
| 564 |
movdqu XMMWORD[rdx],xmm0 |
| 565 |
|
| 566 |
|
| 567 |
pxor xmm0,xmm0 |
| 568 |
pxor xmm1,xmm1 |
| 569 |
pxor xmm2,xmm2 |
| 570 |
pxor xmm3,xmm3 |
| 571 |
pxor xmm4,xmm4 |
| 572 |
pxor xmm5,xmm5 |
| 573 |
pxor xmm6,xmm6 |
| 574 |
pxor xmm7,xmm7 |
| 575 |
DB 0F3h,0C3h ;repret |
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
ALIGN 16 |
| 595 |
_vpaes_schedule_192_smear: |
| 596 |
|
| 597 |
pshufd xmm1,xmm6,0x80 |
| 598 |
pshufd xmm0,xmm7,0xFE |
| 599 |
pxor xmm6,xmm1 |
| 600 |
pxor xmm1,xmm1 |
| 601 |
pxor xmm6,xmm0 |
| 602 |
movdqa xmm0,xmm6 |
| 603 |
movhlps xmm6,xmm1 |
| 604 |
DB 0F3h,0C3h ;repret |
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
ALIGN 16 |
| 628 |
_vpaes_schedule_round: |
| 629 |
|
| 630 |
|
| 631 |
pxor xmm1,xmm1 |
| 632 |
DB 102,65,15,58,15,200,15 |
| 633 |
DB 102,69,15,58,15,192,15 |
| 634 |
pxor xmm7,xmm1 |
| 635 |
|
| 636 |
|
| 637 |
pshufd xmm0,xmm0,0xFF |
| 638 |
DB 102,15,58,15,192,1 |
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
_vpaes_schedule_low_round: |
| 644 |
|
| 645 |
movdqa xmm1,xmm7 |
| 646 |
pslldq xmm7,4 |
| 647 |
pxor xmm7,xmm1 |
| 648 |
movdqa xmm1,xmm7 |
| 649 |
pslldq xmm7,8 |
| 650 |
pxor xmm7,xmm1 |
| 651 |
pxor xmm7,XMMWORD[$L$k_s63] |
| 652 |
|
| 653 |
|
| 654 |
movdqa xmm1,xmm9 |
| 655 |
pandn xmm1,xmm0 |
| 656 |
psrld xmm1,4 |
| 657 |
pand xmm0,xmm9 |
| 658 |
movdqa xmm2,xmm11 |
| 659 |
DB 102,15,56,0,208 |
| 660 |
pxor xmm0,xmm1 |
| 661 |
movdqa xmm3,xmm10 |
| 662 |
DB 102,15,56,0,217 |
| 663 |
pxor xmm3,xmm2 |
| 664 |
movdqa xmm4,xmm10 |
| 665 |
DB 102,15,56,0,224 |
| 666 |
pxor xmm4,xmm2 |
| 667 |
movdqa xmm2,xmm10 |
| 668 |
DB 102,15,56,0,211 |
| 669 |
pxor xmm2,xmm0 |
| 670 |
movdqa xmm3,xmm10 |
| 671 |
DB 102,15,56,0,220 |
| 672 |
pxor xmm3,xmm1 |
| 673 |
movdqa xmm4,xmm13 |
| 674 |
DB 102,15,56,0,226 |
| 675 |
movdqa xmm0,xmm12 |
| 676 |
DB 102,15,56,0,195 |
| 677 |
pxor xmm0,xmm4 |
| 678 |
|
| 679 |
|
| 680 |
pxor xmm0,xmm7 |
| 681 |
movdqa xmm7,xmm0 |
| 682 |
DB 0F3h,0C3h ;repret |
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
ALIGN 16 |
| 697 |
_vpaes_schedule_transform: |
| 698 |
|
| 699 |
movdqa xmm1,xmm9 |
| 700 |
pandn xmm1,xmm0 |
| 701 |
psrld xmm1,4 |
| 702 |
pand xmm0,xmm9 |
| 703 |
movdqa xmm2,XMMWORD[r11] |
| 704 |
DB 102,15,56,0,208 |
| 705 |
movdqa xmm0,XMMWORD[16+r11] |
| 706 |
DB 102,15,56,0,193 |
| 707 |
pxor xmm0,xmm2 |
| 708 |
DB 0F3h,0C3h ;repret |
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
ALIGN 16 |
| 737 |
_vpaes_schedule_mangle: |
| 738 |
|
| 739 |
movdqa xmm4,xmm0 |
| 740 |
movdqa xmm5,XMMWORD[$L$k_mc_forward] |
| 741 |
test rcx,rcx |
| 742 |
jnz NEAR $L$schedule_mangle_dec |
| 743 |
|
| 744 |
|
| 745 |
add rdx,16 |
| 746 |
pxor xmm4,XMMWORD[$L$k_s63] |
| 747 |
DB 102,15,56,0,229 |
| 748 |
movdqa xmm3,xmm4 |
| 749 |
DB 102,15,56,0,229 |
| 750 |
pxor xmm3,xmm4 |
| 751 |
DB 102,15,56,0,229 |
| 752 |
pxor xmm3,xmm4 |
| 753 |
|
| 754 |
jmp NEAR $L$schedule_mangle_both |
| 755 |
ALIGN 16 |
| 756 |
$L$schedule_mangle_dec: |
| 757 |
|
| 758 |
lea r11,[$L$k_dksd] |
| 759 |
movdqa xmm1,xmm9 |
| 760 |
pandn xmm1,xmm4 |
| 761 |
psrld xmm1,4 |
| 762 |
pand xmm4,xmm9 |
| 763 |
|
| 764 |
movdqa xmm2,XMMWORD[r11] |
| 765 |
DB 102,15,56,0,212 |
| 766 |
movdqa xmm3,XMMWORD[16+r11] |
| 767 |
DB 102,15,56,0,217 |
| 768 |
pxor xmm3,xmm2 |
| 769 |
DB 102,15,56,0,221 |
| 770 |
|
| 771 |
movdqa xmm2,XMMWORD[32+r11] |
| 772 |
DB 102,15,56,0,212 |
| 773 |
pxor xmm2,xmm3 |
| 774 |
movdqa xmm3,XMMWORD[48+r11] |
| 775 |
DB 102,15,56,0,217 |
| 776 |
pxor xmm3,xmm2 |
| 777 |
DB 102,15,56,0,221 |
| 778 |
|
| 779 |
movdqa xmm2,XMMWORD[64+r11] |
| 780 |
DB 102,15,56,0,212 |
| 781 |
pxor xmm2,xmm3 |
| 782 |
movdqa xmm3,XMMWORD[80+r11] |
| 783 |
DB 102,15,56,0,217 |
| 784 |
pxor xmm3,xmm2 |
| 785 |
DB 102,15,56,0,221 |
| 786 |
|
| 787 |
movdqa xmm2,XMMWORD[96+r11] |
| 788 |
DB 102,15,56,0,212 |
| 789 |
pxor xmm2,xmm3 |
| 790 |
movdqa xmm3,XMMWORD[112+r11] |
| 791 |
DB 102,15,56,0,217 |
| 792 |
pxor xmm3,xmm2 |
| 793 |
|
| 794 |
add rdx,-16 |
| 795 |
|
| 796 |
$L$schedule_mangle_both: |
| 797 |
movdqa xmm1,XMMWORD[r10*1+r8] |
| 798 |
DB 102,15,56,0,217 |
| 799 |
add r8,-16 |
| 800 |
and r8,0x30 |
| 801 |
movdqu XMMWORD[rdx],xmm3 |
| 802 |
DB 0F3h,0C3h ;repret |
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
global vpaes_set_encrypt_key |
| 810 |
|
| 811 |
ALIGN 16 |
| 812 |
vpaes_set_encrypt_key: |
| 813 |
mov QWORD[8+rsp],rdi ;WIN64 prologue |
| 814 |
mov QWORD[16+rsp],rsi |
| 815 |
mov rax,rsp |
| 816 |
$L$SEH_begin_vpaes_set_encrypt_key: |
| 817 |
mov rdi,rcx |
| 818 |
mov rsi,rdx |
| 819 |
mov rdx,r8 |
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
%ifdef BORINGSSL_DISPATCH_TEST |
| 824 |
EXTERN BORINGSSL_function_hit |
| 825 |
mov BYTE[((BORINGSSL_function_hit+5))],1 |
| 826 |
%endif |
| 827 |
|
| 828 |
lea rsp,[((-184))+rsp] |
| 829 |
movaps XMMWORD[16+rsp],xmm6 |
| 830 |
movaps XMMWORD[32+rsp],xmm7 |
| 831 |
movaps XMMWORD[48+rsp],xmm8 |
| 832 |
movaps XMMWORD[64+rsp],xmm9 |
| 833 |
movaps XMMWORD[80+rsp],xmm10 |
| 834 |
movaps XMMWORD[96+rsp],xmm11 |
| 835 |
movaps XMMWORD[112+rsp],xmm12 |
| 836 |
movaps XMMWORD[128+rsp],xmm13 |
| 837 |
movaps XMMWORD[144+rsp],xmm14 |
| 838 |
movaps XMMWORD[160+rsp],xmm15 |
| 839 |
$L$enc_key_body: |
| 840 |
mov eax,esi |
| 841 |
shr eax,5 |
| 842 |
add eax,5 |
| 843 |
mov DWORD[240+rdx],eax |
| 844 |
|
| 845 |
mov ecx,0 |
| 846 |
mov r8d,0x30 |
| 847 |
call _vpaes_schedule_core |
| 848 |
movaps xmm6,XMMWORD[16+rsp] |
| 849 |
movaps xmm7,XMMWORD[32+rsp] |
| 850 |
movaps xmm8,XMMWORD[48+rsp] |
| 851 |
movaps xmm9,XMMWORD[64+rsp] |
| 852 |
movaps xmm10,XMMWORD[80+rsp] |
| 853 |
movaps xmm11,XMMWORD[96+rsp] |
| 854 |
movaps xmm12,XMMWORD[112+rsp] |
| 855 |
movaps xmm13,XMMWORD[128+rsp] |
| 856 |
movaps xmm14,XMMWORD[144+rsp] |
| 857 |
movaps xmm15,XMMWORD[160+rsp] |
| 858 |
lea rsp,[184+rsp] |
| 859 |
$L$enc_key_epilogue: |
| 860 |
xor eax,eax |
| 861 |
mov rdi,QWORD[8+rsp] ;WIN64 epilogue |
| 862 |
mov rsi,QWORD[16+rsp] |
| 863 |
DB 0F3h,0C3h ;repret |
| 864 |
|
| 865 |
$L$SEH_end_vpaes_set_encrypt_key: |
| 866 |
|
| 867 |
global vpaes_set_decrypt_key |
| 868 |
|
| 869 |
ALIGN 16 |
| 870 |
vpaes_set_decrypt_key: |
| 871 |
mov QWORD[8+rsp],rdi ;WIN64 prologue |
| 872 |
mov QWORD[16+rsp],rsi |
| 873 |
mov rax,rsp |
| 874 |
$L$SEH_begin_vpaes_set_decrypt_key: |
| 875 |
mov rdi,rcx |
| 876 |
mov rsi,rdx |
| 877 |
mov rdx,r8 |
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
lea rsp,[((-184))+rsp] |
| 882 |
movaps XMMWORD[16+rsp],xmm6 |
| 883 |
movaps XMMWORD[32+rsp],xmm7 |
| 884 |
movaps XMMWORD[48+rsp],xmm8 |
| 885 |
movaps XMMWORD[64+rsp],xmm9 |
| 886 |
movaps XMMWORD[80+rsp],xmm10 |
| 887 |
movaps XMMWORD[96+rsp],xmm11 |
| 888 |
movaps XMMWORD[112+rsp],xmm12 |
| 889 |
movaps XMMWORD[128+rsp],xmm13 |
| 890 |
movaps XMMWORD[144+rsp],xmm14 |
| 891 |
movaps XMMWORD[160+rsp],xmm15 |
| 892 |
$L$dec_key_body: |
| 893 |
mov eax,esi |
| 894 |
shr eax,5 |
| 895 |
add eax,5 |
| 896 |
mov DWORD[240+rdx],eax |
| 897 |
shl eax,4 |
| 898 |
lea rdx,[16+rax*1+rdx] |
| 899 |
|
| 900 |
mov ecx,1 |
| 901 |
mov r8d,esi |
| 902 |
shr r8d,1 |
| 903 |
and r8d,32 |
| 904 |
xor r8d,32 |
| 905 |
call _vpaes_schedule_core |
| 906 |
movaps xmm6,XMMWORD[16+rsp] |
| 907 |
movaps xmm7,XMMWORD[32+rsp] |
| 908 |
movaps xmm8,XMMWORD[48+rsp] |
| 909 |
movaps xmm9,XMMWORD[64+rsp] |
| 910 |
movaps xmm10,XMMWORD[80+rsp] |
| 911 |
movaps xmm11,XMMWORD[96+rsp] |
| 912 |
movaps xmm12,XMMWORD[112+rsp] |
| 913 |
movaps xmm13,XMMWORD[128+rsp] |
| 914 |
movaps xmm14,XMMWORD[144+rsp] |
| 915 |
movaps xmm15,XMMWORD[160+rsp] |
| 916 |
lea rsp,[184+rsp] |
| 917 |
$L$dec_key_epilogue: |
| 918 |
xor eax,eax |
| 919 |
mov rdi,QWORD[8+rsp] ;WIN64 epilogue |
| 920 |
mov rsi,QWORD[16+rsp] |
| 921 |
DB 0F3h,0C3h ;repret |
| 922 |
|
| 923 |
$L$SEH_end_vpaes_set_decrypt_key: |
| 924 |
|
| 925 |
global vpaes_encrypt |
| 926 |
|
| 927 |
ALIGN 16 |
| 928 |
vpaes_encrypt: |
| 929 |
mov QWORD[8+rsp],rdi ;WIN64 prologue |
| 930 |
mov QWORD[16+rsp],rsi |
| 931 |
mov rax,rsp |
| 932 |
$L$SEH_begin_vpaes_encrypt: |
| 933 |
mov rdi,rcx |
| 934 |
mov rsi,rdx |
| 935 |
mov rdx,r8 |
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
%ifdef BORINGSSL_DISPATCH_TEST |
| 940 |
EXTERN BORINGSSL_function_hit |
| 941 |
mov BYTE[((BORINGSSL_function_hit+4))],1 |
| 942 |
%endif |
| 943 |
lea rsp,[((-184))+rsp] |
| 944 |
movaps XMMWORD[16+rsp],xmm6 |
| 945 |
movaps XMMWORD[32+rsp],xmm7 |
| 946 |
movaps XMMWORD[48+rsp],xmm8 |
| 947 |
movaps XMMWORD[64+rsp],xmm9 |
| 948 |
movaps XMMWORD[80+rsp],xmm10 |
| 949 |
movaps XMMWORD[96+rsp],xmm11 |
| 950 |
movaps XMMWORD[112+rsp],xmm12 |
| 951 |
movaps XMMWORD[128+rsp],xmm13 |
| 952 |
movaps XMMWORD[144+rsp],xmm14 |
| 953 |
movaps XMMWORD[160+rsp],xmm15 |
| 954 |
$L$enc_body: |
| 955 |
movdqu xmm0,XMMWORD[rdi] |
| 956 |
call _vpaes_preheat |
| 957 |
call _vpaes_encrypt_core |
| 958 |
movdqu XMMWORD[rsi],xmm0 |
| 959 |
movaps xmm6,XMMWORD[16+rsp] |
| 960 |
movaps xmm7,XMMWORD[32+rsp] |
| 961 |
movaps xmm8,XMMWORD[48+rsp] |
| 962 |
movaps xmm9,XMMWORD[64+rsp] |
| 963 |
movaps xmm10,XMMWORD[80+rsp] |
| 964 |
movaps xmm11,XMMWORD[96+rsp] |
| 965 |
movaps xmm12,XMMWORD[112+rsp] |
| 966 |
movaps xmm13,XMMWORD[128+rsp] |
| 967 |
movaps xmm14,XMMWORD[144+rsp] |
| 968 |
movaps xmm15,XMMWORD[160+rsp] |
| 969 |
lea rsp,[184+rsp] |
| 970 |
$L$enc_epilogue: |
| 971 |
mov rdi,QWORD[8+rsp] ;WIN64 epilogue |
| 972 |
mov rsi,QWORD[16+rsp] |
| 973 |
DB 0F3h,0C3h ;repret |
| 974 |
|
| 975 |
$L$SEH_end_vpaes_encrypt: |
| 976 |
|
| 977 |
global vpaes_decrypt |
| 978 |
|
| 979 |
ALIGN 16 |
| 980 |
vpaes_decrypt: |
| 981 |
mov QWORD[8+rsp],rdi ;WIN64 prologue |
| 982 |
mov QWORD[16+rsp],rsi |
| 983 |
mov rax,rsp |
| 984 |
$L$SEH_begin_vpaes_decrypt: |
| 985 |
mov rdi,rcx |
| 986 |
mov rsi,rdx |
| 987 |
mov rdx,r8 |
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
lea rsp,[((-184))+rsp] |
| 992 |
movaps XMMWORD[16+rsp],xmm6 |
| 993 |
movaps XMMWORD[32+rsp],xmm7 |
| 994 |
movaps XMMWORD[48+rsp],xmm8 |
| 995 |
movaps XMMWORD[64+rsp],xmm9 |
| 996 |
movaps XMMWORD[80+rsp],xmm10 |
| 997 |
movaps XMMWORD[96+rsp],xmm11 |
| 998 |
movaps XMMWORD[112+rsp],xmm12 |
| 999 |
movaps XMMWORD[128+rsp],xmm13 |
| 1000 |
movaps XMMWORD[144+rsp],xmm14 |
| 1001 |
movaps XMMWORD[160+rsp],xmm15 |
| 1002 |
$L$dec_body: |
| 1003 |
movdqu xmm0,XMMWORD[rdi] |
| 1004 |
call _vpaes_preheat |
| 1005 |
call _vpaes_decrypt_core |
| 1006 |
movdqu XMMWORD[rsi],xmm0 |
| 1007 |
movaps xmm6,XMMWORD[16+rsp] |
| 1008 |
movaps xmm7,XMMWORD[32+rsp] |
| 1009 |
movaps xmm8,XMMWORD[48+rsp] |
| 1010 |
movaps xmm9,XMMWORD[64+rsp] |
| 1011 |
movaps xmm10,XMMWORD[80+rsp] |
| 1012 |
movaps xmm11,XMMWORD[96+rsp] |
| 1013 |
movaps xmm12,XMMWORD[112+rsp] |
| 1014 |
movaps xmm13,XMMWORD[128+rsp] |
| 1015 |
movaps xmm14,XMMWORD[144+rsp] |
| 1016 |
movaps xmm15,XMMWORD[160+rsp] |
| 1017 |
lea rsp,[184+rsp] |
| 1018 |
$L$dec_epilogue: |
| 1019 |
mov rdi,QWORD[8+rsp] ;WIN64 epilogue |
| 1020 |
mov rsi,QWORD[16+rsp] |
| 1021 |
DB 0F3h,0C3h ;repret |
| 1022 |
|
| 1023 |
$L$SEH_end_vpaes_decrypt: |
| 1024 |
global vpaes_cbc_encrypt |
| 1025 |
|
| 1026 |
ALIGN 16 |
| 1027 |
vpaes_cbc_encrypt: |
| 1028 |
mov QWORD[8+rsp],rdi ;WIN64 prologue |
| 1029 |
mov QWORD[16+rsp],rsi |
| 1030 |
mov rax,rsp |
| 1031 |
$L$SEH_begin_vpaes_cbc_encrypt: |
| 1032 |
mov rdi,rcx |
| 1033 |
mov rsi,rdx |
| 1034 |
mov rdx,r8 |
| 1035 |
mov rcx,r9 |
| 1036 |
mov r8,QWORD[40+rsp] |
| 1037 |
mov r9,QWORD[48+rsp] |
| 1038 |
|
| 1039 |
|
| 1040 |
|
| 1041 |
xchg rdx,rcx |
| 1042 |
sub rcx,16 |
| 1043 |
jc NEAR $L$cbc_abort |
| 1044 |
lea rsp,[((-184))+rsp] |
| 1045 |
movaps XMMWORD[16+rsp],xmm6 |
| 1046 |
movaps XMMWORD[32+rsp],xmm7 |
| 1047 |
movaps XMMWORD[48+rsp],xmm8 |
| 1048 |
movaps XMMWORD[64+rsp],xmm9 |
| 1049 |
movaps XMMWORD[80+rsp],xmm10 |
| 1050 |
movaps XMMWORD[96+rsp],xmm11 |
| 1051 |
movaps XMMWORD[112+rsp],xmm12 |
| 1052 |
movaps XMMWORD[128+rsp],xmm13 |
| 1053 |
movaps XMMWORD[144+rsp],xmm14 |
| 1054 |
movaps XMMWORD[160+rsp],xmm15 |
| 1055 |
$L$cbc_body: |
| 1056 |
movdqu xmm6,XMMWORD[r8] |
| 1057 |
sub rsi,rdi |
| 1058 |
call _vpaes_preheat |
| 1059 |
cmp r9d,0 |
| 1060 |
je NEAR $L$cbc_dec_loop |
| 1061 |
jmp NEAR $L$cbc_enc_loop |
| 1062 |
ALIGN 16 |
| 1063 |
$L$cbc_enc_loop: |
| 1064 |
movdqu xmm0,XMMWORD[rdi] |
| 1065 |
pxor xmm0,xmm6 |
| 1066 |
call _vpaes_encrypt_core |
| 1067 |
movdqa xmm6,xmm0 |
| 1068 |
movdqu XMMWORD[rdi*1+rsi],xmm0 |
| 1069 |
lea rdi,[16+rdi] |
| 1070 |
sub rcx,16 |
| 1071 |
jnc NEAR $L$cbc_enc_loop |
| 1072 |
jmp NEAR $L$cbc_done |
| 1073 |
ALIGN 16 |
| 1074 |
$L$cbc_dec_loop: |
| 1075 |
movdqu xmm0,XMMWORD[rdi] |
| 1076 |
movdqa xmm7,xmm0 |
| 1077 |
call _vpaes_decrypt_core |
| 1078 |
pxor xmm0,xmm6 |
| 1079 |
movdqa xmm6,xmm7 |
| 1080 |
movdqu XMMWORD[rdi*1+rsi],xmm0 |
| 1081 |
lea rdi,[16+rdi] |
| 1082 |
sub rcx,16 |
| 1083 |
jnc NEAR $L$cbc_dec_loop |
| 1084 |
$L$cbc_done: |
| 1085 |
movdqu XMMWORD[r8],xmm6 |
| 1086 |
movaps xmm6,XMMWORD[16+rsp] |
| 1087 |
movaps xmm7,XMMWORD[32+rsp] |
| 1088 |
movaps xmm8,XMMWORD[48+rsp] |
| 1089 |
movaps xmm9,XMMWORD[64+rsp] |
| 1090 |
movaps xmm10,XMMWORD[80+rsp] |
| 1091 |
movaps xmm11,XMMWORD[96+rsp] |
| 1092 |
movaps xmm12,XMMWORD[112+rsp] |
| 1093 |
movaps xmm13,XMMWORD[128+rsp] |
| 1094 |
movaps xmm14,XMMWORD[144+rsp] |
| 1095 |
movaps xmm15,XMMWORD[160+rsp] |
| 1096 |
lea rsp,[184+rsp] |
| 1097 |
$L$cbc_epilogue: |
| 1098 |
$L$cbc_abort: |
| 1099 |
mov rdi,QWORD[8+rsp] ;WIN64 epilogue |
| 1100 |
mov rsi,QWORD[16+rsp] |
| 1101 |
DB 0F3h,0C3h ;repret |
| 1102 |
|
| 1103 |
$L$SEH_end_vpaes_cbc_encrypt: |
| 1104 |
global vpaes_ctr32_encrypt_blocks |
| 1105 |
|
| 1106 |
ALIGN 16 |
| 1107 |
vpaes_ctr32_encrypt_blocks: |
| 1108 |
mov QWORD[8+rsp],rdi ;WIN64 prologue |
| 1109 |
mov QWORD[16+rsp],rsi |
| 1110 |
mov rax,rsp |
| 1111 |
$L$SEH_begin_vpaes_ctr32_encrypt_blocks: |
| 1112 |
mov rdi,rcx |
| 1113 |
mov rsi,rdx |
| 1114 |
mov rdx,r8 |
| 1115 |
mov rcx,r9 |
| 1116 |
mov r8,QWORD[40+rsp] |
| 1117 |
|
| 1118 |
|
| 1119 |
|
| 1120 |
|
| 1121 |
xchg rdx,rcx |
| 1122 |
test rcx,rcx |
| 1123 |
jz NEAR $L$ctr32_abort |
| 1124 |
lea rsp,[((-184))+rsp] |
| 1125 |
movaps XMMWORD[16+rsp],xmm6 |
| 1126 |
movaps XMMWORD[32+rsp],xmm7 |
| 1127 |
movaps XMMWORD[48+rsp],xmm8 |
| 1128 |
movaps XMMWORD[64+rsp],xmm9 |
| 1129 |
movaps XMMWORD[80+rsp],xmm10 |
| 1130 |
movaps XMMWORD[96+rsp],xmm11 |
| 1131 |
movaps XMMWORD[112+rsp],xmm12 |
| 1132 |
movaps XMMWORD[128+rsp],xmm13 |
| 1133 |
movaps XMMWORD[144+rsp],xmm14 |
| 1134 |
movaps XMMWORD[160+rsp],xmm15 |
| 1135 |
$L$ctr32_body: |
| 1136 |
movdqu xmm0,XMMWORD[r8] |
| 1137 |
movdqa xmm8,XMMWORD[$L$ctr_add_one] |
| 1138 |
sub rsi,rdi |
| 1139 |
call _vpaes_preheat |
| 1140 |
movdqa xmm6,xmm0 |
| 1141 |
pshufb xmm6,XMMWORD[$L$rev_ctr] |
| 1142 |
|
| 1143 |
test rcx,1 |
| 1144 |
jz NEAR $L$ctr32_prep_loop |
| 1145 |
|
| 1146 |
|
| 1147 |
|
| 1148 |
movdqu xmm7,XMMWORD[rdi] |
| 1149 |
call _vpaes_encrypt_core |
| 1150 |
pxor xmm0,xmm7 |
| 1151 |
paddd xmm6,xmm8 |
| 1152 |
movdqu XMMWORD[rdi*1+rsi],xmm0 |
| 1153 |
sub rcx,1 |
| 1154 |
lea rdi,[16+rdi] |
| 1155 |
jz NEAR $L$ctr32_done |
| 1156 |
|
| 1157 |
$L$ctr32_prep_loop: |
| 1158 |
|
| 1159 |
|
| 1160 |
movdqa xmm14,xmm6 |
| 1161 |
movdqa xmm15,xmm6 |
| 1162 |
paddd xmm15,xmm8 |
| 1163 |
|
| 1164 |
$L$ctr32_loop: |
| 1165 |
movdqa xmm1,XMMWORD[$L$rev_ctr] |
| 1166 |
movdqa xmm0,xmm14 |
| 1167 |
movdqa xmm6,xmm15 |
| 1168 |
DB 102,15,56,0,193 |
| 1169 |
DB 102,15,56,0,241 |
| 1170 |
call _vpaes_encrypt_core_2x |
| 1171 |
movdqu xmm1,XMMWORD[rdi] |
| 1172 |
movdqu xmm2,XMMWORD[16+rdi] |
| 1173 |
movdqa xmm3,XMMWORD[$L$ctr_add_two] |
| 1174 |
pxor xmm0,xmm1 |
| 1175 |
pxor xmm6,xmm2 |
| 1176 |
paddd xmm14,xmm3 |
| 1177 |
paddd xmm15,xmm3 |
| 1178 |
movdqu XMMWORD[rdi*1+rsi],xmm0 |
| 1179 |
movdqu XMMWORD[16+rdi*1+rsi],xmm6 |
| 1180 |
sub rcx,2 |
| 1181 |
lea rdi,[32+rdi] |
| 1182 |
jnz NEAR $L$ctr32_loop |
| 1183 |
|
| 1184 |
$L$ctr32_done: |
| 1185 |
movaps xmm6,XMMWORD[16+rsp] |
| 1186 |
movaps xmm7,XMMWORD[32+rsp] |
| 1187 |
movaps xmm8,XMMWORD[48+rsp] |
| 1188 |
movaps xmm9,XMMWORD[64+rsp] |
| 1189 |
movaps xmm10,XMMWORD[80+rsp] |
| 1190 |
movaps xmm11,XMMWORD[96+rsp] |
| 1191 |
movaps xmm12,XMMWORD[112+rsp] |
| 1192 |
movaps xmm13,XMMWORD[128+rsp] |
| 1193 |
movaps xmm14,XMMWORD[144+rsp] |
| 1194 |
movaps xmm15,XMMWORD[160+rsp] |
| 1195 |
lea rsp,[184+rsp] |
| 1196 |
$L$ctr32_epilogue: |
| 1197 |
$L$ctr32_abort: |
| 1198 |
mov rdi,QWORD[8+rsp] ;WIN64 epilogue |
| 1199 |
mov rsi,QWORD[16+rsp] |
| 1200 |
DB 0F3h,0C3h ;repret |
| 1201 |
|
| 1202 |
$L$SEH_end_vpaes_ctr32_encrypt_blocks: |
| 1203 |
|
| 1204 |
|
| 1205 |
|
| 1206 |
|
| 1207 |
|
| 1208 |
|
| 1209 |
|
| 1210 |
ALIGN 16 |
| 1211 |
_vpaes_preheat: |
| 1212 |
|
| 1213 |
lea r10,[$L$k_s0F] |
| 1214 |
movdqa xmm10,XMMWORD[((-32))+r10] |
| 1215 |
movdqa xmm11,XMMWORD[((-16))+r10] |
| 1216 |
movdqa xmm9,XMMWORD[r10] |
| 1217 |
movdqa xmm13,XMMWORD[48+r10] |
| 1218 |
movdqa xmm12,XMMWORD[64+r10] |
| 1219 |
movdqa xmm15,XMMWORD[80+r10] |
| 1220 |
movdqa xmm14,XMMWORD[96+r10] |
| 1221 |
DB 0F3h,0C3h ;repret |
| 1222 |
|
| 1223 |
|
| 1224 |
|
| 1225 |
|
| 1226 |
|
| 1227 |
|
| 1228 |
|
| 1229 |
|
| 1230 |
section .rdata rdata align=8 |
| 1231 |
ALIGN 64 |
| 1232 |
_vpaes_consts: |
| 1233 |
$L$k_inv: |
| 1234 |
DQ 0x0E05060F0D080180,0x040703090A0B0C02 |
| 1235 |
DQ 0x01040A060F0B0780,0x030D0E0C02050809 |
| 1236 |
|
| 1237 |
$L$k_s0F: |
| 1238 |
DQ 0x0F0F0F0F0F0F0F0F,0x0F0F0F0F0F0F0F0F |
| 1239 |
|
| 1240 |
$L$k_ipt: |
| 1241 |
DQ 0xC2B2E8985A2A7000,0xCABAE09052227808 |
| 1242 |
DQ 0x4C01307D317C4D00,0xCD80B1FCB0FDCC81 |
| 1243 |
|
| 1244 |
$L$k_sb1: |
| 1245 |
DQ 0xB19BE18FCB503E00,0xA5DF7A6E142AF544 |
| 1246 |
DQ 0x3618D415FAE22300,0x3BF7CCC10D2ED9EF |
| 1247 |
$L$k_sb2: |
| 1248 |
DQ 0xE27A93C60B712400,0x5EB7E955BC982FCD |
| 1249 |
DQ 0x69EB88400AE12900,0xC2A163C8AB82234A |
| 1250 |
$L$k_sbo: |
| 1251 |
DQ 0xD0D26D176FBDC700,0x15AABF7AC502A878 |
| 1252 |
DQ 0xCFE474A55FBB6A00,0x8E1E90D1412B35FA |
| 1253 |
|
| 1254 |
$L$k_mc_forward: |
| 1255 |
DQ 0x0407060500030201,0x0C0F0E0D080B0A09 |
| 1256 |
DQ 0x080B0A0904070605,0x000302010C0F0E0D |
| 1257 |
DQ 0x0C0F0E0D080B0A09,0x0407060500030201 |
| 1258 |
DQ 0x000302010C0F0E0D,0x080B0A0904070605 |
| 1259 |
|
| 1260 |
$L$k_mc_backward: |
| 1261 |
DQ 0x0605040702010003,0x0E0D0C0F0A09080B |
| 1262 |
DQ 0x020100030E0D0C0F,0x0A09080B06050407 |
| 1263 |
DQ 0x0E0D0C0F0A09080B,0x0605040702010003 |
| 1264 |
DQ 0x0A09080B06050407,0x020100030E0D0C0F |
| 1265 |
|
| 1266 |
$L$k_sr: |
| 1267 |
DQ 0x0706050403020100,0x0F0E0D0C0B0A0908 |
| 1268 |
DQ 0x030E09040F0A0500,0x0B06010C07020D08 |
| 1269 |
DQ 0x0F060D040B020900,0x070E050C030A0108 |
| 1270 |
DQ 0x0B0E0104070A0D00,0x0306090C0F020508 |
| 1271 |
|
| 1272 |
$L$k_rcon: |
| 1273 |
DQ 0x1F8391B9AF9DEEB6,0x702A98084D7C7D81 |
| 1274 |
|
| 1275 |
$L$k_s63: |
| 1276 |
DQ 0x5B5B5B5B5B5B5B5B,0x5B5B5B5B5B5B5B5B |
| 1277 |
|
| 1278 |
$L$k_opt: |
| 1279 |
DQ 0xFF9F4929D6B66000,0xF7974121DEBE6808 |
| 1280 |
DQ 0x01EDBD5150BCEC00,0xE10D5DB1B05C0CE0 |
| 1281 |
|
| 1282 |
$L$k_deskew: |
| 1283 |
DQ 0x07E4A34047A4E300,0x1DFEB95A5DBEF91A |
| 1284 |
DQ 0x5F36B5DC83EA6900,0x2841C2ABF49D1E77 |
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
$L$k_dksd: |
| 1291 |
DQ 0xFEB91A5DA3E44700,0x0740E3A45A1DBEF9 |
| 1292 |
DQ 0x41C277F4B5368300,0x5FDC69EAAB289D1E |
| 1293 |
$L$k_dksb: |
| 1294 |
DQ 0x9A4FCA1F8550D500,0x03D653861CC94C99 |
| 1295 |
DQ 0x115BEDA7B6FC4A00,0xD993256F7E3482C8 |
| 1296 |
$L$k_dkse: |
| 1297 |
DQ 0xD5031CCA1FC9D600,0x53859A4C994F5086 |
| 1298 |
DQ 0xA23196054FDC7BE8,0xCD5EF96A20B31487 |
| 1299 |
$L$k_dks9: |
| 1300 |
DQ 0xB6116FC87ED9A700,0x4AED933482255BFC |
| 1301 |
DQ 0x4576516227143300,0x8BB89FACE9DAFDCE |
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
$L$k_dipt: |
| 1308 |
DQ 0x0F505B040B545F00,0x154A411E114E451A |
| 1309 |
DQ 0x86E383E660056500,0x12771772F491F194 |
| 1310 |
|
| 1311 |
$L$k_dsb9: |
| 1312 |
DQ 0x851C03539A86D600,0xCAD51F504F994CC9 |
| 1313 |
DQ 0xC03B1789ECD74900,0x725E2C9EB2FBA565 |
| 1314 |
$L$k_dsbd: |
| 1315 |
DQ 0x7D57CCDFE6B1A200,0xF56E9B13882A4439 |
| 1316 |
DQ 0x3CE2FAF724C6CB00,0x2931180D15DEEFD3 |
| 1317 |
$L$k_dsbb: |
| 1318 |
DQ 0xD022649296B44200,0x602646F6B0F2D404 |
| 1319 |
DQ 0xC19498A6CD596700,0xF3FF0C3E3255AA6B |
| 1320 |
$L$k_dsbe: |
| 1321 |
DQ 0x46F2929626D4D000,0x2242600464B4F6B0 |
| 1322 |
DQ 0x0C55A6CDFFAAC100,0x9467F36B98593E32 |
| 1323 |
$L$k_dsbo: |
| 1324 |
DQ 0x1387EA537EF94000,0xC7AA6DB9D4943E2D |
| 1325 |
DQ 0x12D7560F93441D00,0xCA4B8159D8C58E9C |
| 1326 |
|
| 1327 |
|
| 1328 |
$L$rev_ctr: |
| 1329 |
DQ 0x0706050403020100,0x0c0d0e0f0b0a0908 |
| 1330 |
|
| 1331 |
|
| 1332 |
$L$ctr_add_one: |
| 1333 |
DQ 0x0000000000000000,0x0000000100000000 |
| 1334 |
$L$ctr_add_two: |
| 1335 |
DQ 0x0000000000000000,0x0000000200000000 |
| 1336 |
|
| 1337 |
DB 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105 |
| 1338 |
DB 111,110,32,65,69,83,32,102,111,114,32,120,56,54,95,54 |
| 1339 |
DB 52,47,83,83,83,69,51,44,32,77,105,107,101,32,72,97 |
| 1340 |
DB 109,98,117,114,103,32,40,83,116,97,110,102,111,114,100,32 |
| 1341 |
DB 85,110,105,118,101,114,115,105,116,121,41,0 |
| 1342 |
ALIGN 64 |
| 1343 |
|
| 1344 |
section .text |
| 1345 |
|
| 1346 |
EXTERN __imp_RtlVirtualUnwind |
| 1347 |
|
| 1348 |
ALIGN 16 |
| 1349 |
se_handler: |
| 1350 |
push rsi |
| 1351 |
push rdi |
| 1352 |
push rbx |
| 1353 |
push rbp |
| 1354 |
push r12 |
| 1355 |
push r13 |
| 1356 |
push r14 |
| 1357 |
push r15 |
| 1358 |
pushfq |
| 1359 |
sub rsp,64 |
| 1360 |
|
| 1361 |
mov rax,QWORD[120+r8] |
| 1362 |
mov rbx,QWORD[248+r8] |
| 1363 |
|
| 1364 |
mov rsi,QWORD[8+r9] |
| 1365 |
mov r11,QWORD[56+r9] |
| 1366 |
|
| 1367 |
mov r10d,DWORD[r11] |
| 1368 |
lea r10,[r10*1+rsi] |
| 1369 |
cmp rbx,r10 |
| 1370 |
jb NEAR $L$in_prologue |
| 1371 |
|
| 1372 |
mov rax,QWORD[152+r8] |
| 1373 |
|
| 1374 |
mov r10d,DWORD[4+r11] |
| 1375 |
lea r10,[r10*1+rsi] |
| 1376 |
cmp rbx,r10 |
| 1377 |
jae NEAR $L$in_prologue |
| 1378 |
|
| 1379 |
lea rsi,[16+rax] |
| 1380 |
lea rdi,[512+r8] |
| 1381 |
mov ecx,20 |
| 1382 |
DD 0xa548f3fc |
| 1383 |
lea rax,[184+rax] |
| 1384 |
|
| 1385 |
$L$in_prologue: |
| 1386 |
mov rdi,QWORD[8+rax] |
| 1387 |
mov rsi,QWORD[16+rax] |
| 1388 |
mov QWORD[152+r8],rax |
| 1389 |
mov QWORD[168+r8],rsi |
| 1390 |
mov QWORD[176+r8],rdi |
| 1391 |
|
| 1392 |
mov rdi,QWORD[40+r9] |
| 1393 |
mov rsi,r8 |
| 1394 |
mov ecx,154 |
| 1395 |
DD 0xa548f3fc |
| 1396 |
|
| 1397 |
mov rsi,r9 |
| 1398 |
xor rcx,rcx |
| 1399 |
mov rdx,QWORD[8+rsi] |
| 1400 |
mov r8,QWORD[rsi] |
| 1401 |
mov r9,QWORD[16+rsi] |
| 1402 |
mov r10,QWORD[40+rsi] |
| 1403 |
lea r11,[56+rsi] |
| 1404 |
lea r12,[24+rsi] |
| 1405 |
mov QWORD[32+rsp],r10 |
| 1406 |
mov QWORD[40+rsp],r11 |
| 1407 |
mov QWORD[48+rsp],r12 |
| 1408 |
mov QWORD[56+rsp],rcx |
| 1409 |
call QWORD[__imp_RtlVirtualUnwind] |
| 1410 |
|
| 1411 |
mov eax,1 |
| 1412 |
add rsp,64 |
| 1413 |
popfq |
| 1414 |
pop r15 |
| 1415 |
pop r14 |
| 1416 |
pop r13 |
| 1417 |
pop r12 |
| 1418 |
pop rbp |
| 1419 |
pop rbx |
| 1420 |
pop rdi |
| 1421 |
pop rsi |
| 1422 |
DB 0F3h,0C3h ;repret |
| 1423 |
|
| 1424 |
|
| 1425 |
section .pdata rdata align=4 |
| 1426 |
ALIGN 4 |
| 1427 |
DD $L$SEH_begin_vpaes_set_encrypt_key wrt ..imagebase |
| 1428 |
DD $L$SEH_end_vpaes_set_encrypt_key wrt ..imagebase |
| 1429 |
DD $L$SEH_info_vpaes_set_encrypt_key wrt ..imagebase |
| 1430 |
|
| 1431 |
DD $L$SEH_begin_vpaes_set_decrypt_key wrt ..imagebase |
| 1432 |
DD $L$SEH_end_vpaes_set_decrypt_key wrt ..imagebase |
| 1433 |
DD $L$SEH_info_vpaes_set_decrypt_key wrt ..imagebase |
| 1434 |
|
| 1435 |
DD $L$SEH_begin_vpaes_encrypt wrt ..imagebase |
| 1436 |
DD $L$SEH_end_vpaes_encrypt wrt ..imagebase |
| 1437 |
DD $L$SEH_info_vpaes_encrypt wrt ..imagebase |
| 1438 |
|
| 1439 |
DD $L$SEH_begin_vpaes_decrypt wrt ..imagebase |
| 1440 |
DD $L$SEH_end_vpaes_decrypt wrt ..imagebase |
| 1441 |
DD $L$SEH_info_vpaes_decrypt wrt ..imagebase |
| 1442 |
|
| 1443 |
DD $L$SEH_begin_vpaes_cbc_encrypt wrt ..imagebase |
| 1444 |
DD $L$SEH_end_vpaes_cbc_encrypt wrt ..imagebase |
| 1445 |
DD $L$SEH_info_vpaes_cbc_encrypt wrt ..imagebase |
| 1446 |
|
| 1447 |
DD $L$SEH_begin_vpaes_ctr32_encrypt_blocks wrt ..imagebase |
| 1448 |
DD $L$SEH_end_vpaes_ctr32_encrypt_blocks wrt ..imagebase |
| 1449 |
DD $L$SEH_info_vpaes_ctr32_encrypt_blocks wrt ..imagebase |
| 1450 |
|
| 1451 |
section .xdata rdata align=8 |
| 1452 |
ALIGN 8 |
| 1453 |
$L$SEH_info_vpaes_set_encrypt_key: |
| 1454 |
DB 9,0,0,0 |
| 1455 |
DD se_handler wrt ..imagebase |
| 1456 |
DD $L$enc_key_body wrt ..imagebase,$L$enc_key_epilogue wrt ..imagebase |
| 1457 |
$L$SEH_info_vpaes_set_decrypt_key: |
| 1458 |
DB 9,0,0,0 |
| 1459 |
DD se_handler wrt ..imagebase |
| 1460 |
DD $L$dec_key_body wrt ..imagebase,$L$dec_key_epilogue wrt ..imagebase |
| 1461 |
$L$SEH_info_vpaes_encrypt: |
| 1462 |
DB 9,0,0,0 |
| 1463 |
DD se_handler wrt ..imagebase |
| 1464 |
DD $L$enc_body wrt ..imagebase,$L$enc_epilogue wrt ..imagebase |
| 1465 |
$L$SEH_info_vpaes_decrypt: |
| 1466 |
DB 9,0,0,0 |
| 1467 |
DD se_handler wrt ..imagebase |
| 1468 |
DD $L$dec_body wrt ..imagebase,$L$dec_epilogue wrt ..imagebase |
| 1469 |
$L$SEH_info_vpaes_cbc_encrypt: |
| 1470 |
DB 9,0,0,0 |
| 1471 |
DD se_handler wrt ..imagebase |
| 1472 |
DD $L$cbc_body wrt ..imagebase,$L$cbc_epilogue wrt ..imagebase |
| 1473 |
$L$SEH_info_vpaes_ctr32_encrypt_blocks: |
| 1474 |
DB 9,0,0,0 |
| 1475 |
DD se_handler wrt ..imagebase |
| 1476 |
DD $L$ctr32_body wrt ..imagebase,$L$ctr32_epilogue wrt ..imagebase |
| 1477 |
%else |
| 1478 |
; Work around https://bugzilla.nasm.us/show_bug.cgi?id=3392738 |
| 1479 |
ret |
| 1480 |
%endif |