Date   

[PATCH v15 45/46] UefiCpuPkg/MpInitLib: Prepare SEV-ES guest APs for OS use

Lendacky, Thomas
 

From: Tom Lendacky <thomas.lendacky@amd.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198

Before UEFI transfers control to the OS, it must park the AP. This is
done using the AsmRelocateApLoop function to transition into 32-bit
non-paging mode. For an SEV-ES guest, a few additional things must be
done:
- AsmRelocateApLoop must be updated to support SEV-ES. This means
performing a VMGEXIT AP Reset Hold instead of an MWAIT or HLT loop.
- Since the AP must transition to real mode, a small routine is copied
to the WakeupBuffer area. Since the WakeupBuffer will be used by
the AP during OS booting, it must be placed in reserved memory.
Additionally, the AP stack must be located where it can be accessed
in real mode.
- Once the AP is in real mode it will transfer control to the
destination specified by the OS in the SEV-ES AP Jump Table. The
SEV-ES AP Jump Table address is saved by the hypervisor for the OS
using the GHCB VMGEXIT AP Jump Table exit code.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
UefiCpuPkg/Library/MpInitLib/MpLib.h | 8 +-
UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 54 +++++++-
UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 5 +-
UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 130 ++++++++++++++++++--
4 files changed, 179 insertions(+), 18 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index b1a9d99cb3eb..02652eaae126 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -293,7 +293,8 @@ struct _CPU_MP_DATA {
UINT64 GhcbBase;
};

-#define AP_RESET_STACK_SIZE 64
+#define AP_SAFE_STACK_SIZE 128
+#define AP_RESET_STACK_SIZE AP_SAFE_STACK_SIZE

#pragma pack(1)

@@ -350,7 +351,10 @@ VOID
IN UINTN ApTargetCState,
IN UINTN PmCodeSegment,
IN UINTN TopOfApStack,
- IN UINTN NumberToFinish
+ IN UINTN NumberToFinish,
+ IN UINTN Pm16CodeSegment,
+ IN UINTN SevEsAPJumpTable,
+ IN UINTN WakeupBuffer
);

/**
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index 9115ff9e3e30..2c00d72ddefe 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -12,6 +12,7 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugAgentLib.h>
#include <Library/DxeServicesTableLib.h>
+#include <Library/VmgExitLib.h>
#include <Register/Amd/Fam17Msr.h>
#include <Register/Amd/Ghcb.h>

@@ -85,6 +86,13 @@ GetWakeupBuffer (
{
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS StartAddress;
+ EFI_MEMORY_TYPE MemoryType;
+
+ if (PcdGetBool (PcdSevEsIsEnabled)) {
+ MemoryType = EfiReservedMemoryType;
+ } else {
+ MemoryType = EfiBootServicesData;
+ }

//
// Try to allocate buffer below 1M for waking vector.
@@ -97,7 +105,7 @@ GetWakeupBuffer (
StartAddress = 0x88000;
Status = gBS->AllocatePages (
AllocateMaxAddress,
- EfiBootServicesData,
+ MemoryType,
EFI_SIZE_TO_PAGES (WakeupBufferSize),
&StartAddress
);
@@ -159,8 +167,10 @@ GetSevEsAPMemory (
VOID
)
{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS StartAddress;
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS StartAddress;
+ MSR_SEV_ES_GHCB_REGISTER Msr;
+ GHCB *Ghcb;

//
// Allocate 1 page for AP jump table page
@@ -176,6 +186,16 @@ GetSevEsAPMemory (

DEBUG ((DEBUG_INFO, "Dxe: SevEsAPMemory = %lx\n", (UINTN) StartAddress));

+ //
+ // Save the SevEsAPMemory as the AP jump table.
+ //
+ Msr.GhcbPhysicalAddress = AsmReadMsr64 (MSR_SEV_ES_GHCB);
+ Ghcb = Msr.Ghcb;
+
+ VmgInit (Ghcb);
+ VmgExit (Ghcb, SVM_EXIT_AP_JUMP_TABLE, 0, (UINT64) (UINTN) StartAddress);
+ VmgDone (Ghcb);
+
return (UINTN) StartAddress;
}

@@ -330,17 +350,26 @@ RelocateApLoop (
BOOLEAN MwaitSupport;
ASM_RELOCATE_AP_LOOP AsmRelocateApLoopFunc;
UINTN ProcessorNumber;
+ UINTN StackStart;

MpInitLibWhoAmI (&ProcessorNumber);
CpuMpData = GetCpuMpData ();
MwaitSupport = IsMwaitSupport ();
+ if (CpuMpData->SevEsIsEnabled) {
+ StackStart = CpuMpData->SevEsAPResetStackStart;
+ } else {
+ StackStart = mReservedTopOfApStack;
+ }
AsmRelocateApLoopFunc = (ASM_RELOCATE_AP_LOOP) (UINTN) mReservedApLoopFunc;
AsmRelocateApLoopFunc (
MwaitSupport,
CpuMpData->ApTargetCState,
CpuMpData->PmCodeSegment,
- mReservedTopOfApStack - ProcessorNumber * AP_SAFE_STACK_SIZE,
- (UINTN) &mNumberToFinish
+ StackStart - ProcessorNumber * AP_SAFE_STACK_SIZE,
+ (UINTN) &mNumberToFinish,
+ CpuMpData->Pm16CodeSegment,
+ CpuMpData->SevEsAPBuffer,
+ CpuMpData->WakeupBuffer
);
//
// It should never reach here
@@ -374,6 +403,21 @@ MpInitChangeApLoopCallback (
while (mNumberToFinish > 0) {
CpuPause ();
}
+
+ if (CpuMpData->SevEsIsEnabled && (CpuMpData->WakeupBuffer != (UINTN) -1)) {
+ //
+ // There are APs present. Re-use reserved memory area below 1MB from
+ // WakeupBuffer as the area to be used for transitioning to 16-bit mode
+ // in support of booting of the AP by an OS.
+ //
+ CopyMem (
+ (VOID *) CpuMpData->WakeupBuffer,
+ (VOID *) (CpuMpData->AddressMap.RendezvousFunnelAddress +
+ CpuMpData->AddressMap.SwitchToRealPM16ModeOffset),
+ CpuMpData->AddressMap.SwitchToRealPM16ModeSize
+ );
+ }
+
DEBUG ((DEBUG_INFO, "%a() done!\n", __FUNCTION__));
}

diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
index 309d53bf3b37..7e81d24aa60f 100644
--- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
@@ -226,7 +226,10 @@ SwitchToRealProcStart:
SwitchToRealProcEnd:

;-------------------------------------------------------------------------------------
-; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish);
+; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
+;
+; The last three parameters (Pm16CodeSegment, SevEsAPJumpTable and WakeupBuffer) are
+; specific to SEV-ES support and are not applicable on IA32.
;-------------------------------------------------------------------------------------
global ASM_PFX(AsmRelocateApLoop)
ASM_PFX(AsmRelocateApLoop):
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
index 6956b408d004..5d30f35b201c 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
@@ -465,6 +465,10 @@ BITS 16
; - IP for Real Mode (two bytes)
; - CS for Real Mode (two bytes)
;
+ ; This label is also used with AsmRelocateApLoop. During MP finalization,
+ ; the code from PM16Mode to SwitchToRealProcEnd is copied to the start of
+ ; the WakeupBuffer, allowing a parked AP to be booted by an OS.
+ ;
PM16Mode:
mov eax, cr0 ; Read CR0
btr eax, 0 ; Set PE=0
@@ -487,32 +491,96 @@ PM16Mode:
SwitchToRealProcEnd:

;-------------------------------------------------------------------------------------
-; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish);
+; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
;-------------------------------------------------------------------------------------
global ASM_PFX(AsmRelocateApLoop)
ASM_PFX(AsmRelocateApLoop):
AsmRelocateApLoopStart:
BITS 64
+ cmp qword [rsp + 56], 0 ; SevEsAPJumpTable
+ je NoSevEs
+
+ ;
+ ; Perform some SEV-ES related setup before leaving 64-bit mode
+ ;
+ push rcx
+ push rdx
+
+ ;
+ ; Get the RDX reset value using CPUID
+ ;
+ mov rax, 1
+ cpuid
+ mov rsi, rax ; Save off the reset value for RDX
+
+ ;
+ ; Prepare the GHCB for the AP_HLT_LOOP VMGEXIT call
+ ; - Must be done while in 64-bit long mode so that writes to
+ ; the GHCB memory will be unencrypted.
+ ; - No NAE events can be generated once this is set otherwise
+ ; the AP_RESET_HOLD SW_EXITCODE will be overwritten.
+ ;
+ mov rcx, 0xc0010130
+ rdmsr ; Retrieve current GHCB address
+ shl rdx, 32
+ or rdx, rax
+
+ mov rdi, rdx
+ xor rax, rax
+ mov rcx, 0x800
+ shr rcx, 3
+ rep stosq ; Clear the GHCB
+
+ mov rax, 0x80000004 ; VMGEXIT AP_RESET_HOLD
+ mov [rdx + 0x390], rax
+
+ pop rdx
+ pop rcx
+
+NoSevEs:
cli ; Disable interrupt before switching to 32-bit mode
mov rax, [rsp + 40] ; CountTofinish
lock dec dword [rax] ; (*CountTofinish)--
- mov rsp, r9
- push rcx
- push rdx

- lea rsi, [PmEntry] ; rsi <- The start address of transition code
+ mov r10, [rsp + 48] ; Pm16CodeSegment
+ mov rax, [rsp + 56] ; SevEsAPJumpTable
+ mov rbx, [rsp + 64] ; WakeupBuffer
+ mov rsp, r9 ; TopOfApStack
+
+ push rax ; Save SevEsAPJumpTable
+ push rbx ; Save WakeupBuffer
+ push r10 ; Save Pm16CodeSegment
+ push rcx ; Save MwaitSupport
+ push rdx ; Save ApTargetCState
+
+ lea rax, [PmEntry] ; rax <- The start address of transition code

push r8
- push rsi
- DB 0x48
- retf
+ push rax
+
+ ;
+ ; Clear R8 - R15, for reset, before going into 32-bit mode
+ ;
+ xor r8, r8
+ xor r9, r9
+ xor r10, r10
+ xor r11, r11
+ xor r12, r12
+ xor r13, r13
+ xor r14, r14
+ xor r15, r15
+
+ ;
+ ; Far return into 32-bit mode
+ ;
+o64 retf
+
BITS 32
PmEntry:
mov eax, cr0
btr eax, 31 ; Clear CR0.PG
mov cr0, eax ; Disable paging and caches

- mov ebx, edx ; Save EntryPoint to rbx, for rdmsr will overwrite rdx
mov ecx, 0xc0000080
rdmsr
and ah, ~ 1 ; Clear LME
@@ -525,6 +593,8 @@ PmEntry:
add esp, 4
pop ecx,
add esp, 4
+
+MwaitCheck:
cmp cl, 1 ; Check mwait-monitor support
jnz HltLoop
mov ebx, edx ; Save C-State to ebx
@@ -538,10 +608,50 @@ MwaitLoop:
shl eax, 4
mwait
jmp MwaitLoop
+
HltLoop:
+ pop edx ; PM16CodeSegment
+ add esp, 4
+ pop ebx ; WakeupBuffer
+ add esp, 4
+ pop eax ; SevEsAPJumpTable
+ add esp, 4
+ cmp eax, 0 ; Check for SEV-ES
+ je DoHlt
+
+ cli
+ ;
+ ; SEV-ES is enabled, use VMGEXIT (GHCB information already
+ ; set by caller)
+ ;
+BITS 64
+ rep vmmcall
+BITS 32
+
+ ;
+ ; Back from VMGEXIT AP_HLT_LOOP
+ ; Push the FLAGS/CS/IP values to use
+ ;
+ push word 0x0002 ; EFLAGS
+ xor ecx, ecx
+ mov cx, [eax + 2] ; CS
+ push cx
+ mov cx, [eax] ; IP
+ push cx
+ push word 0x0000 ; For alignment, will be discarded
+
+ push edx
+ push ebx
+
+ mov edx, esi ; Restore RDX reset value
+
+ retf
+
+DoHlt:
cli
hlt
- jmp HltLoop
+ jmp DoHlt
+
BITS 64
AsmRelocateApLoopEnd:

--
2.28.0


[PATCH v15 44/46] OvmfPkg: Move the GHCB allocations into reserved memory

Lendacky, Thomas
 

From: Tom Lendacky <thomas.lendacky@amd.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198

After having transitioned from UEFI to the OS, the OS will need to boot
the APs. For an SEV-ES guest, the APs will have been parked by UEFI using
GHCB pages allocated by UEFI. The hypervisor will write to the GHCB
SW_EXITINFO2 field of the GHCB when the AP is booted. As a result, the
GHCB pages must be marked reserved so that the OS does not attempt to use
them and experience memory corruption because of the hypervisor write.

Change the GHCB allocation from the default boot services memory to
reserved memory.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
OvmfPkg/PlatformPei/AmdSev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c
index a2b38c591236..4a515a484720 100644
--- a/OvmfPkg/PlatformPei/AmdSev.c
+++ b/OvmfPkg/PlatformPei/AmdSev.c
@@ -51,9 +51,11 @@ AmdSevEsInitialize (

//
// Allocate GHCB and per-CPU variable pages.
+ // Since the pages must survive across the UEFI to OS transition
+ // make them reserved.
//
GhcbPageCount = mMaxCpuCount * 2;
- GhcbBase = AllocatePages (GhcbPageCount);
+ GhcbBase = AllocateReservedPages (GhcbPageCount);
ASSERT (GhcbBase != NULL);

GhcbBasePa = (PHYSICAL_ADDRESS)(UINTN) GhcbBase;
--
2.28.0


[PATCH v15 43/46] OvmfPkg: Use the SEV-ES work area for the SEV-ES AP reset vector

Lendacky, Thomas
 

From: Tom Lendacky <thomas.lendacky@amd.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198

A hypervisor is not allowed to update an SEV-ES guest's register state,
so when booting an SEV-ES guest AP, the hypervisor is not allowed to
set the RIP to the guest requested value. Instead an SEV-ES AP must be
re-directed from within the guest to the actual requested staring location
as specified in the INIT-SIPI-SIPI sequence.

Use the SEV-ES work area for the reset vector code that contains support
to jump to the desired RIP location after having been started. This is
required for only the very first AP reset.

This new OVMF source file, ResetVectorVtf0.asm, is used in place of the
original file through the use of the include path order set in
OvmfPkg/ResetVector/ResetVector.inf under "[BuildOptions]".

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm | 100 ++++++++++++++++++++
OvmfPkg/ResetVector/ResetVector.nasmb | 1 +
2 files changed, 101 insertions(+)

diff --git a/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm b/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
new file mode 100644
index 000000000000..980e0138e7fe
--- /dev/null
+++ b/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
@@ -0,0 +1,100 @@
+;------------------------------------------------------------------------------
+; @file
+; First code executed by processor after resetting.
+; Derived from UefiCpuPkg/ResetVector/Vtf0/Ia16/ResetVectorVtf0.asm
+;
+; Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+;------------------------------------------------------------------------------
+
+BITS 16
+
+ALIGN 16
+
+;
+; Pad the image size to 4k when page tables are in VTF0
+;
+; If the VTF0 image has page tables built in, then we need to make
+; sure the end of VTF0 is 4k above where the page tables end.
+;
+; This is required so the page tables will be 4k aligned when VTF0 is
+; located just below 0x100000000 (4GB) in the firmware device.
+;
+%ifdef ALIGN_TOP_TO_4K_FOR_PAGING
+ TIMES (0x1000 - ($ - EndOfPageTables) - 0x20) DB 0
+%endif
+
+;
+; SEV-ES Processor Reset support
+;
+; sevEsResetBlock:
+; For the initial boot of an AP under SEV-ES, the "reset" RIP must be
+; programmed to the RAM area defined by SEV_ES_AP_RESET_IP. A known offset
+; and GUID will be used to locate this block in the firmware and extract
+; the build time RIP value. The GUID must always be 48 bytes from the
+; end of the firmware.
+;
+; 0xffffffca (-0x36) - IP value
+; 0xffffffcc (-0x34) - CS segment base [31:16]
+; 0xffffffce (-0x32) - Size of the SEV-ES reset block
+; 0xffffffd0 (-0x30) - SEV-ES reset block GUID
+; (00f771de-1a7e-4fcb-890e-68c77e2fb44e)
+;
+; A hypervisor reads the CS segement base and IP value. The CS segment base
+; value represents the high order 16-bits of the CS segment base, so the
+; hypervisor must left shift the value of the CS segement base by 16 bits to
+; form the full CS segment base for the CS segment register. It would then
+; program the EIP register with the IP value as read.
+;
+
+TIMES (32 - (sevEsResetBlockEnd - sevEsResetBlockStart)) DB 0
+
+sevEsResetBlockStart:
+ DD SEV_ES_AP_RESET_IP
+ DW sevEsResetBlockEnd - sevEsResetBlockStart
+ DB 0xDE, 0x71, 0xF7, 0x00, 0x7E, 0x1A, 0xCB, 0x4F
+ DB 0x89, 0x0E, 0x68, 0xC7, 0x7E, 0x2F, 0xB4, 0x4E
+sevEsResetBlockEnd:
+
+ALIGN 16
+
+applicationProcessorEntryPoint:
+;
+; Application Processors entry point
+;
+; GenFv generates code aligned on a 4k boundary which will jump to this
+; location. (0xffffffe0) This allows the Local APIC Startup IPI to be
+; used to wake up the application processors.
+;
+ jmp EarlyApInitReal16
+
+ALIGN 8
+
+ DD 0
+
+;
+; The VTF signature
+;
+; VTF-0 means that the VTF (Volume Top File) code does not require
+; any fixups.
+;
+vtfSignature:
+ DB 'V', 'T', 'F', 0
+
+ALIGN 16
+
+resetVector:
+;
+; Reset Vector
+;
+; This is where the processor will begin execution
+;
+ nop
+ nop
+ jmp EarlyBspInitReal16
+
+ALIGN 16
+
+fourGigabytes:
+
diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
index 762661115d50..4913b379a993 100644
--- a/OvmfPkg/ResetVector/ResetVector.nasmb
+++ b/OvmfPkg/ResetVector/ResetVector.nasmb
@@ -82,5 +82,6 @@

%include "Main.asm"

+ %define SEV_ES_AP_RESET_IP FixedPcdGet32 (PcdSevEsWorkAreaBase)
%include "Ia16/ResetVectorVtf0.asm"

--
2.28.0


[PATCH v15 42/46] UefiCpuPkg: Allow AP booting under SEV-ES

Lendacky, Thomas
 

From: Tom Lendacky <thomas.lendacky@amd.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198

Typically, an AP is booted using the INIT-SIPI-SIPI sequence. This
sequence is intercepted by the hypervisor, which sets the AP's registers
to the values requested by the sequence. At that point, the hypervisor can
start the AP, which will then begin execution at the appropriate location.

Under SEV-ES, AP booting presents some challenges since the hypervisor is
not allowed to alter the AP's register state. In this situation, we have
to distinguish between the AP's first boot and AP's subsequent boots.

First boot:
Once the AP's register state has been defined (which is before the guest
is first booted) it cannot be altered. Should the hypervisor attempt to
alter the register state, the change would be detected by the hardware
and the VMRUN instruction would fail. Given this, the first boot for the
AP is required to begin execution with this initial register state, which
is typically the reset vector. This prevents the BSP from directing the
AP startup location through the INIT-SIPI-SIPI sequence.

To work around this, the firmware will provide a build time reserved area
that can be used as the initial IP value. The hypervisor can extract this
location value by checking for the SEV-ES reset block GUID that must be
located 48-bytes from the end of the firmware. The format of the SEV-ES
reset block area is:

0x00 - 0x01 - SEV-ES Reset IP
0x02 - 0x03 - SEV-ES Reset CS Segment Base[31:16]
0x04 - 0x05 - Size of the SEV-ES reset block
0x06 - 0x15 - SEV-ES Reset Block GUID
(00f771de-1a7e-4fcb-890e-68c77e2fb44e)

The total size is 22 bytes. Any expansion to this block must be done
by adding new values before existing values.

The hypervisor will use the IP and CS values obtained from the SEV-ES
reset block to set as the AP's initial values. The CS Segment Base
represents the upper 16 bits of the CS segment base and must be left
shifted by 16 bits to form the complete CS segment base value.

Before booting the AP for the first time, the BSP must initialize the
SEV-ES reset area. This consists of programming a FAR JMP instruction
to the contents of a memory location that is also located in the SEV-ES
reset area. The BSP must program the IP and CS values for the FAR JMP
based on values drived from the INIT-SIPI-SIPI sequence.

Subsequent boots:
Again, the hypervisor cannot alter the AP register state, so a method is
required to take the AP out of halt state and redirect it to the desired
IP location. If it is determined that the AP is running in an SEV-ES
guest, then instead of calling CpuSleep(), a VMGEXIT is issued with the
AP Reset Hold exit code (0x80000004). The hypervisor will put the AP in
a halt state, waiting for an INIT-SIPI-SIPI sequence. Once the sequence
is recognized, the hypervisor will resume the AP. At this point the AP
must transition from the current 64-bit long mode down to 16-bit real
mode and begin executing at the derived location from the INIT-SIPI-SIPI
sequence.

Another change is around the area of obtaining the (x2)APIC ID during AP
startup. During AP startup, the AP can't take a #VC exception before the
AP has established a stack. However, the AP stack is set by using the
(x2)APIC ID, which is obtained through CPUID instructions. A CPUID
instruction will cause a #VC, so a different method must be used. The
GHCB protocol supports a method to obtain CPUID information from the
hypervisor through the GHCB MSR. This method does not require a stack,
so it is used to obtain the necessary CPUID information to determine the
(x2)APIC ID.

The new 16-bit protected mode GDT entry is used in order to transition
from 64-bit long mode down to 16-bit real mode.

A new assembler routine is created that takes the AP from 64-bit long mode
to 16-bit real mode. This is located under 1MB in memory and transitions
from 64-bit long mode to 32-bit compatibility mode to 16-bit protected
mode and finally 16-bit real mode.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 3 +
UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 3 +
UefiCpuPkg/Library/MpInitLib/MpLib.h | 60 ++++
UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 70 +++-
UefiCpuPkg/Library/MpInitLib/MpLib.c | 336 +++++++++++++++++++-
UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 19 ++
UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c | 2 +-
UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc | 2 +-
UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 15 +
UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc | 4 +-
UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 239 ++++++++++++++
11 files changed, 738 insertions(+), 15 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index 583276595619..1771575c69c1 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -52,6 +52,7 @@ [LibraryClasses]
DebugAgentLib
SynchronizationLib
PcdLib
+ VmgExitLib

[Protocols]
gEfiTimerArchProtocolGuid ## SOMETIMES_CONSUMES
@@ -72,4 +73,6 @@ [Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOMETIMES_CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStatusCheckIntervalInMicroSeconds ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## CONSUMES
+ gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ## CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
index 4b3d39fbf36c..34abf25d43cd 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
@@ -51,6 +51,7 @@ [LibraryClasses]
SynchronizationLib
PeiServicesLib
PcdLib
+ VmgExitLib

[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## CONSUMES
@@ -62,6 +63,8 @@ [Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOMETIMES_CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## CONSUMES
+ gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase ## SOMETIMES_CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ## CONSUMES

[Ppis]
gEdkiiPeiShadowMicrocodePpiGuid ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 5b46c295b6b2..b1a9d99cb3eb 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -173,6 +173,11 @@ typedef struct {
UINT8 *RelocateApLoopFuncAddress;
UINTN RelocateApLoopFuncSize;
UINTN ModeTransitionOffset;
+ UINTN SwitchToRealSize;
+ UINTN SwitchToRealOffset;
+ UINTN SwitchToRealNoNxOffset;
+ UINTN SwitchToRealPM16ModeOffset;
+ UINTN SwitchToRealPM16ModeSize;
} MP_ASSEMBLY_ADDRESS_MAP;

typedef struct _CPU_MP_DATA CPU_MP_DATA;
@@ -211,6 +216,8 @@ typedef struct {
// Enable5LevelPaging indicates whether 5-level paging is enabled in long mode.
//
BOOLEAN Enable5LevelPaging;
+ BOOLEAN SevEsIsEnabled;
+ UINTN GhcbBase;
} MP_CPU_EXCHANGE_INFO;

#pragma pack()
@@ -257,6 +264,7 @@ struct _CPU_MP_DATA {
UINT8 ApLoopMode;
UINT8 ApTargetCState;
UINT16 PmCodeSegment;
+ UINT16 Pm16CodeSegment;
CPU_AP_DATA *CpuData;
volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo;

@@ -278,8 +286,47 @@ struct _CPU_MP_DATA {
BOOLEAN WakeUpByInitSipiSipi;

BOOLEAN SevEsIsEnabled;
+ UINTN SevEsAPBuffer;
+ UINTN SevEsAPResetStackStart;
+ CPU_MP_DATA *NewCpuMpData;
+
+ UINT64 GhcbBase;
};

+#define AP_RESET_STACK_SIZE 64
+
+#pragma pack(1)
+
+typedef struct {
+ UINT8 InsnBuffer[8];
+ UINT16 Rip;
+ UINT16 Segment;
+} SEV_ES_AP_JMP_FAR;
+
+#pragma pack()
+
+/**
+ Assembly code to move an AP from long mode to real mode.
+
+ Move an AP from long mode to real mode in preparation to invoking
+ the reset vector. This is used for SEV-ES guests where a hypervisor
+ is not allowed to set the CS and RIP to point to the reset vector.
+
+ @param[in] BufferStart The reset vector target.
+ @param[in] Code16 16-bit protected mode code segment value.
+ @param[in] Code32 32-bit protected mode code segment value.
+ @param[in] StackStart The start of a stack to be used for transitioning
+ from long mode to real mode.
+**/
+typedef
+VOID
+(EFIAPI AP_RESET) (
+ IN UINTN BufferStart,
+ IN UINT16 Code16,
+ IN UINT16 Code32,
+ IN UINTN StackStart
+ );
+
extern EFI_GUID mCpuInitMpLibHobGuid;

/**
@@ -385,6 +432,19 @@ GetModeTransitionBuffer (
IN UINTN BufferSize
);

+/**
+ Return the address of the SEV-ES AP jump table.
+
+ This buffer is required in order for an SEV-ES guest to transition from
+ UEFI into an OS.
+
+ @return Return SEV-ES AP jump table buffer
+**/
+UINTN
+GetSevEsAPMemory (
+ VOID
+ );
+
/**
This function will be called by BSP to wakeup AP.

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index 8ccddf8e9f9c..9115ff9e3e30 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -12,6 +12,8 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugAgentLib.h>
#include <Library/DxeServicesTableLib.h>
+#include <Register/Amd/Fam17Msr.h>
+#include <Register/Amd/Ghcb.h>

#include <Protocol/Timer.h>

@@ -144,6 +146,39 @@ GetModeTransitionBuffer (
return (UINTN)StartAddress;
}

+/**
+ Return the address of the SEV-ES AP jump table.
+
+ This buffer is required in order for an SEV-ES guest to transition from
+ UEFI into an OS.
+
+ @return Return SEV-ES AP jump table buffer
+**/
+UINTN
+GetSevEsAPMemory (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS StartAddress;
+
+ //
+ // Allocate 1 page for AP jump table page
+ //
+ StartAddress = BASE_4GB - 1;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiReservedMemoryType,
+ 1,
+ &StartAddress
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((DEBUG_INFO, "Dxe: SevEsAPMemory = %lx\n", (UINTN) StartAddress));
+
+ return (UINTN) StartAddress;
+}
+
/**
Checks APs status and updates APs status if needed.

@@ -218,6 +253,38 @@ CheckApsStatus (
}
}

+/**
+ Get Protected mode code segment with 16-bit default addressing
+ from current GDT table.
+
+ @return Protected mode 16-bit code segment value.
+**/
+UINT16
+GetProtectedMode16CS (
+ VOID
+ )
+{
+ IA32_DESCRIPTOR GdtrDesc;
+ IA32_SEGMENT_DESCRIPTOR *GdtEntry;
+ UINTN GdtEntryCount;
+ UINT16 Index;
+
+ Index = (UINT16) -1;
+ AsmReadGdtr (&GdtrDesc);
+ GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR);
+ GdtEntry = (IA32_SEGMENT_DESCRIPTOR *) GdtrDesc.Base;
+ for (Index = 0; Index < GdtEntryCount; Index++) {
+ if (GdtEntry->Bits.L == 0) {
+ if (GdtEntry->Bits.Type > 8 && GdtEntry->Bits.DB == 0) {
+ break;
+ }
+ }
+ GdtEntry++;
+ }
+ ASSERT (Index != GdtEntryCount);
+ return Index * 8;
+}
+
/**
Get Protected mode code segment from current GDT table.

@@ -238,7 +305,7 @@ GetProtectedModeCS (
GdtEntry = (IA32_SEGMENT_DESCRIPTOR *) GdtrDesc.Base;
for (Index = 0; Index < GdtEntryCount; Index++) {
if (GdtEntry->Bits.L == 0) {
- if (GdtEntry->Bits.Type > 8 && GdtEntry->Bits.L == 0) {
+ if (GdtEntry->Bits.Type > 8 && GdtEntry->Bits.DB == 1) {
break;
}
}
@@ -300,6 +367,7 @@ MpInitChangeApLoopCallback (

CpuMpData = GetCpuMpData ();
CpuMpData->PmCodeSegment = GetProtectedModeCS ();
+ CpuMpData->Pm16CodeSegment = GetProtectedMode16CS ();
CpuMpData->ApLoopMode = PcdGet8 (PcdCpuApLoopMode);
mNumberToFinish = CpuMpData->CpuCount - 1;
WakeUpAP (CpuMpData, TRUE, 0, RelocateApLoop, NULL, TRUE);
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 2a3fbeef35f7..90416c81b616 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -9,6 +9,9 @@
**/

#include "MpLib.h"
+#include <Library/VmgExitLib.h>
+#include <Register/Amd/Fam17Msr.h>
+#include <Register/Amd/Ghcb.h>

EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;

@@ -291,6 +294,14 @@ GetApLoopMode (
//
ApLoopMode = ApInHltLoop;
}
+
+ if (PcdGetBool (PcdSevEsIsEnabled)) {
+ //
+ // For SEV-ES, force AP in Hlt-loop mode in order to use the GHCB
+ // protocol for starting APs
+ //
+ ApLoopMode = ApInHltLoop;
+ }
}

if (ApLoopMode != ApInMwaitLoop) {
@@ -587,6 +598,112 @@ InitializeApData (
SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle);
}

+/**
+ Get Protected mode code segment with 16-bit default addressing
+ from current GDT table.
+
+ @return Protected mode 16-bit code segment value.
+**/
+STATIC
+UINT16
+GetProtectedMode16CS (
+ VOID
+ )
+{
+ IA32_DESCRIPTOR GdtrDesc;
+ IA32_SEGMENT_DESCRIPTOR *GdtEntry;
+ UINTN GdtEntryCount;
+ UINT16 Index;
+
+ Index = (UINT16) -1;
+ AsmReadGdtr (&GdtrDesc);
+ GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR);
+ GdtEntry = (IA32_SEGMENT_DESCRIPTOR *) GdtrDesc.Base;
+ for (Index = 0; Index < GdtEntryCount; Index++) {
+ if (GdtEntry->Bits.L == 0 &&
+ GdtEntry->Bits.DB == 0 &&
+ GdtEntry->Bits.Type > 8) {
+ break;
+ }
+ GdtEntry++;
+ }
+ ASSERT (Index != GdtEntryCount);
+ return Index * 8;
+}
+
+/**
+ Get Protected mode code segment with 32-bit default addressing
+ from current GDT table.
+
+ @return Protected mode 32-bit code segment value.
+**/
+STATIC
+UINT16
+GetProtectedMode32CS (
+ VOID
+ )
+{
+ IA32_DESCRIPTOR GdtrDesc;
+ IA32_SEGMENT_DESCRIPTOR *GdtEntry;
+ UINTN GdtEntryCount;
+ UINT16 Index;
+
+ Index = (UINT16) -1;
+ AsmReadGdtr (&GdtrDesc);
+ GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR);
+ GdtEntry = (IA32_SEGMENT_DESCRIPTOR *) GdtrDesc.Base;
+ for (Index = 0; Index < GdtEntryCount; Index++) {
+ if (GdtEntry->Bits.L == 0 &&
+ GdtEntry->Bits.DB == 1 &&
+ GdtEntry->Bits.Type > 8) {
+ break;
+ }
+ GdtEntry++;
+ }
+ ASSERT (Index != GdtEntryCount);
+ return Index * 8;
+}
+
+/**
+ Reset an AP when in SEV-ES mode.
+
+ If successful, this function never returns.
+
+ @param[in] Ghcb Pointer to the GHCB
+ @param[in] CpuMpData Pointer to CPU MP Data
+
+**/
+STATIC
+VOID
+MpInitLibSevEsAPReset (
+ IN GHCB *Ghcb,
+ IN CPU_MP_DATA *CpuMpData
+ )
+{
+ UINT16 Code16, Code32;
+ AP_RESET *APResetFn;
+ UINTN BufferStart;
+ UINTN StackStart;
+
+ Code16 = GetProtectedMode16CS ();
+ Code32 = GetProtectedMode32CS ();
+
+ if (CpuMpData->WakeupBufferHigh != 0) {
+ APResetFn = (AP_RESET *) (CpuMpData->WakeupBufferHigh + CpuMpData->AddressMap.SwitchToRealNoNxOffset);
+ } else {
+ APResetFn = (AP_RESET *) (CpuMpData->MpCpuExchangeInfo->BufferStart + CpuMpData->AddressMap.SwitchToRealOffset);
+ }
+
+ BufferStart = CpuMpData->MpCpuExchangeInfo->BufferStart;
+ StackStart = CpuMpData->SevEsAPResetStackStart -
+ (AP_RESET_STACK_SIZE * GetApicId ());
+
+ //
+ // This call never returns.
+ //
+ APResetFn (BufferStart, Code16, Code32, StackStart);
+}
+
/**
This function will be called from AP reset code if BSP uses WakeUpAP.

@@ -648,7 +765,14 @@ ApWakeupFunction (
InitializeApData (CpuMpData, ProcessorNumber, BistData, ApTopOfStack);
ApStartupSignalBuffer = CpuMpData->CpuData[ProcessorNumber].StartupApSignal;

- InterlockedDecrement ((UINT32 *) &CpuMpData->MpCpuExchangeInfo->NumApsExecuting);
+ //
+ // Delay decrementing the APs executing count when SEV-ES is enabled
+ // to allow the APs to issue an AP_RESET_HOLD before the BSP possibly
+ // performs another INIT-SIPI-SIPI sequence.
+ //
+ if (!CpuMpData->SevEsIsEnabled) {
+ InterlockedDecrement ((UINT32 *) &CpuMpData->MpCpuExchangeInfo->NumApsExecuting);
+ }
} else {
//
// Execute AP function if AP is ready
@@ -755,7 +879,52 @@ ApWakeupFunction (
//
while (TRUE) {
DisableInterrupts ();
- CpuSleep ();
+ if (CpuMpData->SevEsIsEnabled) {
+ MSR_SEV_ES_GHCB_REGISTER Msr;
+ GHCB *Ghcb;
+ UINT64 Status;
+ BOOLEAN DoDecrement;
+
+ if (CpuMpData->InitFlag == ApInitConfig) {
+ DoDecrement = TRUE;
+ }
+
+ while (TRUE) {
+ Msr.GhcbPhysicalAddress = AsmReadMsr64 (MSR_SEV_ES_GHCB);
+ Ghcb = Msr.Ghcb;
+
+ VmgInit (Ghcb);
+
+ if (DoDecrement) {
+ DoDecrement = FALSE;
+
+ //
+ // Perform the delayed decrement just before issuing the first
+ // VMGEXIT with AP_RESET_HOLD.
+ //
+ InterlockedDecrement ((UINT32 *) &CpuMpData->MpCpuExchangeInfo->NumApsExecuting);
+ }
+
+ Status = VmgExit (Ghcb, SVM_EXIT_AP_RESET_HOLD, 0, 0);
+ if ((Status == 0) && (Ghcb->SaveArea.SwExitInfo2 != 0)) {
+ VmgDone (Ghcb);
+ break;
+ }
+
+ VmgDone (Ghcb);
+ }
+
+ //
+ // Awakened in a new phase? Use the new CpuMpData
+ //
+ if (CpuMpData->NewCpuMpData != NULL) {
+ CpuMpData = CpuMpData->NewCpuMpData;
+ }
+
+ MpInitLibSevEsAPReset (Ghcb, CpuMpData);
+ } else {
+ CpuSleep ();
+ }
CpuPause ();
}
}
@@ -868,6 +1037,9 @@ FillExchangeInfoData (
ExchangeInfo->Enable5LevelPaging = (BOOLEAN) (Cr4.Bits.LA57 == 1);
DEBUG ((DEBUG_INFO, "%a: 5-Level Paging = %d\n", gEfiCallerBaseName, ExchangeInfo->Enable5LevelPaging));

+ ExchangeInfo->SevEsIsEnabled = CpuMpData->SevEsIsEnabled;
+ ExchangeInfo->GhcbBase = (UINTN) CpuMpData->GhcbBase;
+
//
// Get the BSP's data of GDT and IDT
//
@@ -894,8 +1066,9 @@ FillExchangeInfoData (
// EfiBootServicesCode to avoid page fault if NX memory protection is enabled.
//
if (CpuMpData->WakeupBufferHigh != 0) {
- Size = CpuMpData->AddressMap.RendezvousFunnelSize -
- CpuMpData->AddressMap.ModeTransitionOffset;
+ Size = CpuMpData->AddressMap.RendezvousFunnelSize +
+ CpuMpData->AddressMap.SwitchToRealSize -
+ CpuMpData->AddressMap.ModeTransitionOffset;
CopyMem (
(VOID *)CpuMpData->WakeupBufferHigh,
CpuMpData->AddressMap.RendezvousFunnelAddress +
@@ -948,7 +1121,8 @@ BackupAndPrepareWakeupBuffer(
CopyMem (
(VOID *) CpuMpData->WakeupBuffer,
(VOID *) CpuMpData->AddressMap.RendezvousFunnelAddress,
- CpuMpData->AddressMap.RendezvousFunnelSize
+ CpuMpData->AddressMap.RendezvousFunnelSize +
+ CpuMpData->AddressMap.SwitchToRealSize
);
}

@@ -969,6 +1143,44 @@ RestoreWakeupBuffer(
);
}

+/**
+ Calculate the size of the reset stack.
+
+ @return Total amount of memory required for stacks
+**/
+STATIC
+UINTN
+GetApResetStackSize (
+ VOID
+ )
+{
+ return AP_RESET_STACK_SIZE * PcdGet32(PcdCpuMaxLogicalProcessorNumber);
+}
+
+/**
+ Calculate the size of the reset vector.
+
+ @param[in] AddressMap The pointer to Address Map structure.
+
+ @return Total amount of memory required for the AP reset area
+**/
+STATIC
+UINTN
+GetApResetVectorSize (
+ IN MP_ASSEMBLY_ADDRESS_MAP *AddressMap
+ )
+{
+ UINTN Size;
+
+ Size = ALIGN_VALUE (AddressMap->RendezvousFunnelSize +
+ AddressMap->SwitchToRealSize +
+ sizeof (MP_CPU_EXCHANGE_INFO),
+ CPU_STACK_ALIGNMENT);
+ Size += GetApResetStackSize ();
+
+ return Size;
+}
+
/**
Allocate reset vector buffer.

@@ -982,16 +1194,22 @@ AllocateResetVector (
UINTN ApResetVectorSize;

if (CpuMpData->WakeupBuffer == (UINTN) -1) {
- ApResetVectorSize = CpuMpData->AddressMap.RendezvousFunnelSize +
- sizeof (MP_CPU_EXCHANGE_INFO);
+ ApResetVectorSize = GetApResetVectorSize (&CpuMpData->AddressMap);

CpuMpData->WakeupBuffer = GetWakeupBuffer (ApResetVectorSize);
CpuMpData->MpCpuExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN)
- (CpuMpData->WakeupBuffer + CpuMpData->AddressMap.RendezvousFunnelSize);
+ (CpuMpData->WakeupBuffer +
+ CpuMpData->AddressMap.RendezvousFunnelSize +
+ CpuMpData->AddressMap.SwitchToRealSize);
CpuMpData->WakeupBufferHigh = GetModeTransitionBuffer (
- CpuMpData->AddressMap.RendezvousFunnelSize -
+ CpuMpData->AddressMap.RendezvousFunnelSize +
+ CpuMpData->AddressMap.SwitchToRealSize -
CpuMpData->AddressMap.ModeTransitionOffset
);
+ //
+ // The reset stack starts at the end of the buffer.
+ //
+ CpuMpData->SevEsAPResetStackStart = CpuMpData->WakeupBuffer + ApResetVectorSize;
}
BackupAndPrepareWakeupBuffer (CpuMpData);
}
@@ -1006,7 +1224,80 @@ FreeResetVector (
IN CPU_MP_DATA *CpuMpData
)
{
- RestoreWakeupBuffer (CpuMpData);
+ //
+ // If SEV-ES is enabled, the reset area is needed for AP parking and
+ // and AP startup in the OS, so the reset area is reserved. Do not
+ // perform the restore as this will overwrite memory which has data
+ // needed by SEV-ES.
+ //
+ if (!CpuMpData->SevEsIsEnabled) {
+ RestoreWakeupBuffer (CpuMpData);
+ }
+}
+
+/**
+ Allocate the SEV-ES AP jump table buffer.
+
+ @param[in, out] CpuMpData The pointer to CPU MP Data structure.
+**/
+VOID
+AllocateSevEsAPMemory (
+ IN OUT CPU_MP_DATA *CpuMpData
+ )
+{
+ if (CpuMpData->SevEsAPBuffer == (UINTN) -1) {
+ CpuMpData->SevEsAPBuffer =
+ CpuMpData->SevEsIsEnabled ? GetSevEsAPMemory () : 0;
+ }
+}
+
+/**
+ Program the SEV-ES AP jump table buffer.
+
+ @param[in] SipiVector The SIPI vector used for the AP Reset
+**/
+VOID
+SetSevEsJumpTable (
+ IN UINTN SipiVector
+ )
+{
+ SEV_ES_AP_JMP_FAR *JmpFar;
+ UINT32 Offset, InsnByte;
+ UINT8 LoNib, HiNib;
+
+ JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32 (PcdSevEsWorkAreaBase);
+ ASSERT (JmpFar != NULL);
+
+ //
+ // Obtain the address of the Segment/Rip location in the workarea.
+ // This will be set to a value derived from the SIPI vector and will
+ // be the memory address used for the far jump below.
+ //
+ Offset = FixedPcdGet32 (PcdSevEsWorkAreaBase);
+ Offset += sizeof (JmpFar->InsnBuffer);
+ LoNib = (UINT8) Offset;
+ HiNib = (UINT8) (Offset >> 8);
+
+ //
+ // Program the workarea (which is the initial AP boot address) with
+ // far jump to the SIPI vector (where XX and YY represent the
+ // address of where the SIPI vector is stored.
+ //
+ // JMP FAR [CS:XXYY] => 2E FF 2E YY XX
+ //
+ InsnByte = 0;
+ JmpFar->InsnBuffer[InsnByte++] = 0x2E; // CS override prefix
+ JmpFar->InsnBuffer[InsnByte++] = 0xFF; // JMP (FAR)
+ JmpFar->InsnBuffer[InsnByte++] = 0x2E; // ModRM (JMP memory location)
+ JmpFar->InsnBuffer[InsnByte++] = LoNib; // YY offset ...
+ JmpFar->InsnBuffer[InsnByte++] = HiNib; // XX offset ...
+
+ //
+ // Program the Segment/Rip based on the SIPI vector (always at least
+ // 16-byte aligned, so Rip is set to 0).
+ //
+ JmpFar->Rip = 0;
+ JmpFar->Segment = (UINT16) (SipiVector >> 4);
}

/**
@@ -1043,6 +1334,7 @@ WakeUpAP (
CpuMpData->InitFlag != ApInitDone) {
ResetVectorRequired = TRUE;
AllocateResetVector (CpuMpData);
+ AllocateSevEsAPMemory (CpuMpData);
FillExchangeInfoData (CpuMpData);
SaveLocalApicTimerSetting (CpuMpData);
}
@@ -1079,6 +1371,15 @@ WakeUpAP (
}
}
if (ResetVectorRequired) {
+ //
+ // For SEV-ES, the initial AP boot address will be defined by
+ // PcdSevEsWorkAreaBase. The Segment/Rip must be the jump address
+ // from the original INIT-SIPI-SIPI.
+ //
+ if (CpuMpData->SevEsIsEnabled) {
+ SetSevEsJumpTable (ExchangeInfo->BufferStart);
+ }
+
//
// Wakeup all APs
//
@@ -1170,6 +1471,16 @@ WakeUpAP (
*(UINT32 *) CpuData->StartupApSignal = WAKEUP_AP_SIGNAL;
if (ResetVectorRequired) {
CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
+
+ //
+ // For SEV-ES, the initial AP boot address will be defined by
+ // PcdSevEsWorkAreaBase. The Segment/Rip must be the jump address
+ // from the original INIT-SIPI-SIPI.
+ //
+ if (CpuMpData->SevEsIsEnabled) {
+ SetSevEsJumpTable (ExchangeInfo->BufferStart);
+ }
+
SendInitSipiSipi (
CpuInfoInHob[ProcessorNumber].ApicId,
(UINT32) ExchangeInfo->BufferStart
@@ -1646,7 +1957,7 @@ MpInitLibInitialize (
ASSERT (MaxLogicalProcessorNumber != 0);

AsmGetAddressMap (&AddressMap);
- ApResetVectorSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);
+ ApResetVectorSize = GetApResetVectorSize (&AddressMap);
ApStackSize = PcdGet32(PcdCpuApStackSize);
ApLoopMode = GetApLoopMode (&MonitorFilterSize);

@@ -1705,6 +2016,8 @@ MpInitLibInitialize (
CpuMpData->CpuInfoInHob = (UINT64) (UINTN) (CpuMpData->CpuData + MaxLogicalProcessorNumber);
InitializeSpinLock(&CpuMpData->MpLock);
CpuMpData->SevEsIsEnabled = PcdGetBool (PcdSevEsIsEnabled);
+ CpuMpData->SevEsAPBuffer = (UINTN) -1;
+ CpuMpData->GhcbBase = PcdGet64 (PcdGhcbBase);

//
// Make sure no memory usage outside of the allocated buffer.
@@ -1763,6 +2076,7 @@ MpInitLibInitialize (
// APs have been wakeup before, just get the CPU Information
// from HOB
//
+ OldCpuMpData->NewCpuMpData = CpuMpData;
CpuMpData->CpuCount = OldCpuMpData->CpuCount;
CpuMpData->BspNumber = OldCpuMpData->BspNumber;
CpuMpData->CpuInfoInHob = OldCpuMpData->CpuInfoInHob;
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
index a548fed23fa7..3989bd6a7a9f 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
@@ -280,6 +280,25 @@ GetModeTransitionBuffer (
return 0;
}

+/**
+ Return the address of the SEV-ES AP jump table.
+
+ This buffer is required in order for an SEV-ES guest to transition from
+ UEFI into an OS.
+
+ @return Return SEV-ES AP jump table buffer
+**/
+UINTN
+GetSevEsAPMemory (
+ VOID
+ )
+{
+ //
+ // PEI phase doesn't need to do such transition. So simply return 0.
+ //
+ return 0;
+}
+
/**
Checks APs status and updates APs status if needed.

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
index 6298571e29b2..28f8e8e133e5 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c
@@ -121,7 +121,7 @@ GetProtectedModeCS (
GdtEntry = (IA32_SEGMENT_DESCRIPTOR *) GdtrDesc.Base;
for (Index = 0; Index < GdtEntryCount; Index++) {
if (GdtEntry->Bits.L == 0) {
- if (GdtEntry->Bits.Type > 8 && GdtEntry->Bits.L == 0) {
+ if (GdtEntry->Bits.Type > 8 && GdtEntry->Bits.DB == 1) {
break;
}
}
diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc b/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
index efb1bc2bf7cb..4f5a7c859a56 100644
--- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
+++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
@@ -19,7 +19,7 @@ CPU_SWITCH_STATE_IDLE equ 0
CPU_SWITCH_STATE_STORED equ 1
CPU_SWITCH_STATE_LOADED equ 2

-LockLocation equ (RendezvousFunnelProcEnd - RendezvousFunnelProcStart)
+LockLocation equ (SwitchToRealProcEnd - RendezvousFunnelProcStart)
StackStartAddressLocation equ LockLocation + 04h
StackSizeLocation equ LockLocation + 08h
ApProcedureLocation equ LockLocation + 0Ch
diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
index b74046b76af3..309d53bf3b37 100644
--- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
@@ -215,6 +215,16 @@ CProcedureInvoke:
jmp $ ; Never reach here
RendezvousFunnelProcEnd:

+;-------------------------------------------------------------------------------------
+;SwitchToRealProc procedure follows.
+;NOT USED IN 32 BIT MODE.
+;-------------------------------------------------------------------------------------
+global ASM_PFX(SwitchToRealProc)
+ASM_PFX(SwitchToRealProc):
+SwitchToRealProcStart:
+ jmp $ ; Never reach here
+SwitchToRealProcEnd:
+
;-------------------------------------------------------------------------------------
; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish);
;-------------------------------------------------------------------------------------
@@ -263,6 +273,11 @@ ASM_PFX(AsmGetAddressMap):
mov dword [ebx + 0Ch], AsmRelocateApLoopStart
mov dword [ebx + 10h], AsmRelocateApLoopEnd - AsmRelocateApLoopStart
mov dword [ebx + 14h], Flat32Start - RendezvousFunnelProcStart
+ mov dword [ebx + 18h], SwitchToRealProcEnd - SwitchToRealProcStart ; SwitchToRealSize
+ mov dword [ebx + 1Ch], SwitchToRealProcStart - RendezvousFunnelProcStart ; SwitchToRealOffset
+ mov dword [ebx + 20h], SwitchToRealProcStart - Flat32Start ; SwitchToRealNoNxOffset
+ mov dword [ebx + 24h], 0 ; SwitchToRealPM16ModeOffset
+ mov dword [ebx + 28h], 0 ; SwitchToRealPM16ModeSize

popad
ret
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc b/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc
index 58ef369342a7..c92daaaffd6b 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc
+++ b/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc
@@ -19,7 +19,7 @@ CPU_SWITCH_STATE_IDLE equ 0
CPU_SWITCH_STATE_STORED equ 1
CPU_SWITCH_STATE_LOADED equ 2

-LockLocation equ (RendezvousFunnelProcEnd - RendezvousFunnelProcStart)
+LockLocation equ (SwitchToRealProcEnd - RendezvousFunnelProcStart)
StackStartAddressLocation equ LockLocation + 08h
StackSizeLocation equ LockLocation + 10h
ApProcedureLocation equ LockLocation + 18h
@@ -41,3 +41,5 @@ ModeTransitionSegmentLocation equ LockLocation + 98h
ModeHighMemoryLocation equ LockLocation + 9Ah
ModeHighSegmentLocation equ LockLocation + 9Eh
Enable5LevelPagingLocation equ LockLocation + 0A0h
+SevEsIsEnabledLocation equ LockLocation + 0A1h
+GhcbBaseLocation equ LockLocation + 0A2h
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
index 87f2523e856f..6956b408d004 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
@@ -184,9 +184,97 @@ Releaselock:
add edi, StackStartAddressLocation
add rax, qword [edi]
mov rsp, rax
+
+ lea edi, [esi + SevEsIsEnabledLocation]
+ cmp byte [edi], 1 ; SevEsIsEnabled
+ jne CProcedureInvoke
+
+ ;
+ ; program GHCB
+ ; Each page after the GHCB is a per-CPU page, so the calculation programs
+ ; a GHCB to be every 8KB.
+ ;
+ mov eax, SIZE_4KB
+ shl eax, 1 ; EAX = SIZE_4K * 2
+ mov ecx, ebx
+ mul ecx ; EAX = SIZE_4K * 2 * CpuNumber
+ mov edi, esi
+ add edi, GhcbBaseLocation
+ add rax, qword [edi]
+ mov rdx, rax
+ shr rdx, 32
+ mov rcx, 0xc0010130
+ wrmsr
jmp CProcedureInvoke

GetApicId:
+ lea edi, [esi + SevEsIsEnabledLocation]
+ cmp byte [edi], 1 ; SevEsIsEnabled
+ jne DoCpuid
+
+ ;
+ ; Since we don't have a stack yet, we can't take a #VC
+ ; exception. Use the GHCB protocol to perform the CPUID
+ ; calls.
+ ;
+ mov rcx, 0xc0010130
+ rdmsr
+ shl rdx, 32
+ or rax, rdx
+ mov rdi, rax ; RDI now holds the original GHCB GPA
+
+ mov rdx, 0 ; CPUID function 0
+ mov rax, 0 ; RAX register requested
+ or rax, 4
+ wrmsr
+ rep vmmcall
+ rdmsr
+ cmp edx, 0bh
+ jb NoX2ApicSevEs ; CPUID level below CPUID_EXTENDED_TOPOLOGY
+
+ mov rdx, 0bh ; CPUID function 0x0b
+ mov rax, 040000000h ; RBX register requested
+ or rax, 4
+ wrmsr
+ rep vmmcall
+ rdmsr
+ test edx, 0ffffh
+ jz NoX2ApicSevEs ; CPUID.0BH:EBX[15:0] is zero
+
+ mov rdx, 0bh ; CPUID function 0x0b
+ mov rax, 0c0000000h ; RDX register requested
+ or rax, 4
+ wrmsr
+ rep vmmcall
+ rdmsr
+
+ ; Processor is x2APIC capable; 32-bit x2APIC ID is now in EDX
+ jmp RestoreGhcb
+
+NoX2ApicSevEs:
+ ; Processor is not x2APIC capable, so get 8-bit APIC ID
+ mov rdx, 1 ; CPUID function 1
+ mov rax, 040000000h ; RBX register requested
+ or rax, 4
+ wrmsr
+ rep vmmcall
+ rdmsr
+ shr edx, 24
+
+RestoreGhcb:
+ mov rbx, rdx ; Save x2APIC/APIC ID
+
+ mov rdx, rdi ; RDI holds the saved GHCB GPA
+ shr rdx, 32
+ mov eax, edi
+ wrmsr
+
+ mov rdx, rbx
+
+ ; x2APIC ID or APIC ID is in EDX
+ jmp GetProcessorNumber
+
+DoCpuid:
mov eax, 0
cpuid
cmp eax, 0bh
@@ -253,12 +341,158 @@ CProcedureInvoke:

RendezvousFunnelProcEnd:

+;-------------------------------------------------------------------------------------
+;SwitchToRealProc procedure follows.
+;ALSO THIS PROCEDURE IS EXECUTED BY APs TRANSITIONING TO 16 BIT MODE. HENCE THIS PROC
+;IS IN MACHINE CODE.
+; SwitchToRealProc (UINTN BufferStart, UINT16 Code16, UINT16 Code32, UINTN StackStart)
+; rcx - Buffer Start
+; rdx - Code16 Selector Offset
+; r8 - Code32 Selector Offset
+; r9 - Stack Start
+;-------------------------------------------------------------------------------------
+global ASM_PFX(SwitchToRealProc)
+ASM_PFX(SwitchToRealProc):
+SwitchToRealProcStart:
+BITS 64
+ cli
+
+ ;
+ ; Get RDX reset value before changing stacks since the
+ ; new stack won't be able to accomodate a #VC exception.
+ ;
+ push rax
+ push rbx
+ push rcx
+ push rdx
+
+ mov rax, 1
+ cpuid
+ mov rsi, rax ; Save off the reset value for RDX
+
+ pop rdx
+ pop rcx
+ pop rbx
+ pop rax
+
+ ;
+ ; Establish stack below 1MB
+ ;
+ mov rsp, r9
+
+ ;
+ ; Push ultimate Reset Vector onto the stack
+ ;
+ mov rax, rcx
+ shr rax, 4
+ push word 0x0002 ; RFLAGS
+ push ax ; CS
+ push word 0x0000 ; RIP
+ push word 0x0000 ; For alignment, will be discarded
+
+ ;
+ ; Get address of "16-bit operand size" label
+ ;
+ lea rbx, [PM16Mode]
+
+ ;
+ ; Push addresses used to change to compatibility mode
+ ;
+ lea rax, [CompatMode]
+ push r8
+ push rax
+
+ ;
+ ; Clear R8 - R15, for reset, before going into 32-bit mode
+ ;
+ xor r8, r8
+ xor r9, r9
+ xor r10, r10
+ xor r11, r11
+ xor r12, r12
+ xor r13, r13
+ xor r14, r14
+ xor r15, r15
+
+ ;
+ ; Far return into 32-bit mode
+ ;
+o64 retf
+
+BITS 32
+CompatMode:
+ ;
+ ; Set up stack to prepare for exiting protected mode
+ ;
+ push edx ; Code16 CS
+ push ebx ; PM16Mode label address
+
+ ;
+ ; Disable paging
+ ;
+ mov eax, cr0 ; Read CR0
+ btr eax, 31 ; Set PG=0
+ mov cr0, eax ; Write CR0
+
+ ;
+ ; Disable long mode
+ ;
+ mov ecx, 0c0000080h ; EFER MSR number
+ rdmsr ; Read EFER
+ btr eax, 8 ; Set LME=0
+ wrmsr ; Write EFER
+
+ ;
+ ; Disable PAE
+ ;
+ mov eax, cr4 ; Read CR4
+ btr eax, 5 ; Set PAE=0
+ mov cr4, eax ; Write CR4
+
+ mov edx, esi ; Restore RDX reset value
+
+ ;
+ ; Switch to 16-bit operand size
+ ;
+ retf
+
+BITS 16
+ ;
+ ; At entry to this label
+ ; - RDX will have its reset value
+ ; - On the top of the stack
+ ; - Alignment data (two bytes) to be discarded
+ ; - IP for Real Mode (two bytes)
+ ; - CS for Real Mode (two bytes)
+ ;
+PM16Mode:
+ mov eax, cr0 ; Read CR0
+ btr eax, 0 ; Set PE=0
+ mov cr0, eax ; Write CR0
+
+ pop ax ; Discard alignment data
+
+ ;
+ ; Clear registers (except RDX and RSP) before going into 16-bit mode
+ ;
+ xor eax, eax
+ xor ebx, ebx
+ xor ecx, ecx
+ xor esi, esi
+ xor edi, edi
+ xor ebp, ebp
+
+ iret
+
+SwitchToRealProcEnd:
+
;-------------------------------------------------------------------------------------
; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish);
;-------------------------------------------------------------------------------------
global ASM_PFX(AsmRelocateApLoop)
ASM_PFX(AsmRelocateApLoop):
AsmRelocateApLoopStart:
+BITS 64
cli ; Disable interrupt before switching to 32-bit mode
mov rax, [rsp + 40] ; CountTofinish
lock dec dword [rax] ; (*CountTofinish)--
@@ -324,6 +558,11 @@ ASM_PFX(AsmGetAddressMap):
mov qword [rcx + 18h], rax
mov qword [rcx + 20h], AsmRelocateApLoopEnd - AsmRelocateApLoopStart
mov qword [rcx + 28h], Flat32Start - RendezvousFunnelProcStart
+ mov qword [rcx + 30h], SwitchToRealProcEnd - SwitchToRealProcStart ; SwitchToRealSize
+ mov qword [rcx + 38h], SwitchToRealProcStart - RendezvousFunnelProcStart ; SwitchToRealOffset
+ mov qword [rcx + 40h], SwitchToRealProcStart - Flat32Start ; SwitchToRealNoNxOffset
+ mov qword [rcx + 48h], PM16Mode - RendezvousFunnelProcStart ; SwitchToRealPM16ModeOffset
+ mov qword [rcx + 50h], SwitchToRealProcEnd - PM16Mode ; SwitchToRealPM16ModeSize
ret

;-------------------------------------------------------------------------------------
--
2.28.0


[PATCH v15 41/46] UefiCpuPkg/MpInitLib: Add CPU MP data flag to indicate if SEV-ES is enabled

Lendacky, Thomas
 

From: Tom Lendacky <thomas.lendacky@amd.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198

When starting APs in an SMP configuration, the AP needs to know if it is
running as an SEV-ES guest in order to assign a GHCB page.

Add a field to the CPU_MP_DATA structure that will indicate if SEV-ES is
enabled. This new field is set during MP library initialization with the
PCD value PcdSevEsIsEnabled. This flag can then be used to determine if
SEV-ES is enabled.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 +
UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 +
UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 ++
UefiCpuPkg/Library/MpInitLib/MpLib.c | 1 +
4 files changed, 5 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index 9907f4157b09..583276595619 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -71,4 +71,5 @@ [Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOMETIMES_CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStatusCheckIntervalInMicroSeconds ## CONSUMES
+ gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
index 89ee9a79d8c5..4b3d39fbf36c 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
@@ -61,6 +61,7 @@ [Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOMETIMES_CONSUMES
+ gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## CONSUMES

[Ppis]
gEdkiiPeiShadowMicrocodePpiGuid ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index a8ca03efb8e3..5b46c295b6b2 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -276,6 +276,8 @@ struct _CPU_MP_DATA {
// driver.
//
BOOLEAN WakeUpByInitSipiSipi;
+
+ BOOLEAN SevEsIsEnabled;
};

extern EFI_GUID mCpuInitMpLibHobGuid;
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 9b0660a5d4ea..2a3fbeef35f7 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1704,6 +1704,7 @@ MpInitLibInitialize (
CpuMpData->CpuData = (CPU_AP_DATA *) (CpuMpData + 1);
CpuMpData->CpuInfoInHob = (UINT64) (UINTN) (CpuMpData->CpuData + MaxLogicalProcessorNumber);
InitializeSpinLock(&CpuMpData->MpLock);
+ CpuMpData->SevEsIsEnabled = PcdGetBool (PcdSevEsIsEnabled);

//
// Make sure no memory usage outside of the allocated buffer.
--
2.28.0


[PATCH v15 40/46] UefiCpuPkg: Add a 16-bit protected mode code segment descriptor

Lendacky, Thomas
 

From: Tom Lendacky <thomas.lendacky@amd.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198

A hypervisor is not allowed to update an SEV-ES guests register state,
so when booting an SEV-ES guest AP, the hypervisor is not allowed to
set the RIP to the guest requested value. Instead, an SEV-ES AP must be
transition from 64-bit long mode to 16-bit real mode in response to an
INIT-SIPI-SIPI sequence. This requires a 16-bit code segment descriptor.
For PEI, create this descriptor in the reset vector GDT table. For DXE,
create this descriptor from the newly reserved entry at location 0x28.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
UefiCpuPkg/CpuDxe/CpuGdt.h | 4 ++--
UefiCpuPkg/CpuDxe/CpuGdt.c | 8 ++++----
UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm | 9 +++++++++
3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.h b/UefiCpuPkg/CpuDxe/CpuGdt.h
index 3a0210b2f172..1c94487cbee8 100644
--- a/UefiCpuPkg/CpuDxe/CpuGdt.h
+++ b/UefiCpuPkg/CpuDxe/CpuGdt.h
@@ -36,7 +36,7 @@ struct _GDT_ENTRIES {
GDT_ENTRY LinearCode;
GDT_ENTRY SysData;
GDT_ENTRY SysCode;
- GDT_ENTRY Spare4;
+ GDT_ENTRY SysCode16;
GDT_ENTRY LinearData64;
GDT_ENTRY LinearCode64;
GDT_ENTRY Spare5;
@@ -49,7 +49,7 @@ struct _GDT_ENTRIES {
#define LINEAR_CODE_SEL OFFSET_OF (GDT_ENTRIES, LinearCode)
#define SYS_DATA_SEL OFFSET_OF (GDT_ENTRIES, SysData)
#define SYS_CODE_SEL OFFSET_OF (GDT_ENTRIES, SysCode)
-#define SPARE4_SEL OFFSET_OF (GDT_ENTRIES, Spare4)
+#define SYS_CODE16_SEL OFFSET_OF (GDT_ENTRIES, SysCode16)
#define LINEAR_DATA64_SEL OFFSET_OF (GDT_ENTRIES, LinearData64)
#define LINEAR_CODE64_SEL OFFSET_OF (GDT_ENTRIES, LinearCode64)
#define SPARE5_SEL OFFSET_OF (GDT_ENTRIES, Spare5)
diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.c b/UefiCpuPkg/CpuDxe/CpuGdt.c
index 64efadeba601..a1ab543f2da5 100644
--- a/UefiCpuPkg/CpuDxe/CpuGdt.c
+++ b/UefiCpuPkg/CpuDxe/CpuGdt.c
@@ -70,14 +70,14 @@ STATIC GDT_ENTRIES GdtTemplate = {
0x0,
},
//
- // SPARE4_SEL
+ // SYS_CODE16_SEL
//
{
- 0x0, // limit 15:0
+ 0x0FFFF, // limit 15:0
0x0, // base 15:0
0x0, // base 23:16
- 0x0, // type
- 0x0, // limit 19:16, flags
+ 0x09A, // present, ring 0, code, execute/read
+ 0x08F, // page-granular, 16-bit
0x0, // base 31:24
},
//
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm b/UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm
index ce4ebfffb688..0e79a3984b16 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm
@@ -129,5 +129,14 @@ LINEAR_CODE64_SEL equ $-GDT_BASE
DB 0 ; base 31:24
%endif

+; linear code segment descriptor
+LINEAR_CODE16_SEL equ $-GDT_BASE
+ DW 0xffff ; limit 15:0
+ DW 0 ; base 15:0
+ DB 0 ; base 23:16
+ DB PRESENT_FLAG(1)|DPL(0)|SYSTEM_FLAG(1)|DESC_TYPE(CODE32_TYPE)
+ DB GRANULARITY_FLAG(1)|DEFAULT_SIZE32(0)|CODE64_FLAG(0)|UPPER_LIMIT(0xf)
+ DB 0 ; base 31:24
+
GDT_END:

--
2.28.0


Re: [Patch ] Static IP based HTTP Support

Sivaraman Nainar
 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2888

 

*** NetworkPkg\HttpBootDxe\HttpBootClient.c             2020-05-07 22:54:46.000000000 +05-30

--- NetworkPkg\HttpBootDxe\HttpBootClient.c 2020-08-09 21:03:01.000000000 +05-30

***************

*** 1,6 ****

--- 1,13 ----

+ //***********************************************************************

+ //*                                                                     *

+ //*   Copyright (c) 1985-2020, American Megatrends International LLC.   *

+ //*                                                                     *

+ //*      All rights reserved. Subject to AMI licensing agreement.       *

+ //*                                                                     *

+ //***********************************************************************

  /** @file

    Implementation of the boot file download function.

 

  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>

  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

***************

*** 45,57 ****

      Node->Ipv4.Header.Type    = MESSAGING_DEVICE_PATH;

      Node->Ipv4.Header.SubType = MSG_IPv4_DP;

      SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));

      CopyMem (&Node->Ipv4.LocalIpAddress, &Private->StationIp, sizeof (EFI_IPv4_ADDRESS));

      Node->Ipv4.RemotePort      = Private->Port;

      Node->Ipv4.Protocol        = EFI_IP_PROTO_TCP;

!     Node->Ipv4.StaticIpAddress = FALSE;

      CopyMem (&Node->Ipv4.GatewayIpAddress, &Private->GatewayIp, sizeof (EFI_IPv4_ADDRESS));

      CopyMem (&Node->Ipv4.SubnetMask, &Private->SubnetMask, sizeof (EFI_IPv4_ADDRESS));

    } else {

      Node = AllocateZeroPool (sizeof (IPv6_DEVICE_PATH));

      if (Node == NULL) {

        return EFI_OUT_OF_RESOURCES;

--- 52,67 ----

      Node->Ipv4.Header.Type    = MESSAGING_DEVICE_PATH;

      Node->Ipv4.Header.SubType = MSG_IPv4_DP;

      SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));

      CopyMem (&Node->Ipv4.LocalIpAddress, &Private->StationIp, sizeof (EFI_IPv4_ADDRESS));

      Node->Ipv4.RemotePort      = Private->Port;

      Node->Ipv4.Protocol        = EFI_IP_PROTO_TCP;

!     if (Private->UsingStatic)

!         Node->Ipv4.StaticIpAddress =TRUE;

!     else

!         Node->Ipv4.StaticIpAddress = FALSE;

      CopyMem (&Node->Ipv4.GatewayIpAddress, &Private->GatewayIp, sizeof (EFI_IPv4_ADDRESS));

      CopyMem (&Node->Ipv4.SubnetMask, &Private->SubnetMask, sizeof (EFI_IPv4_ADDRESS));

   } else {

      Node = AllocateZeroPool (sizeof (IPv6_DEVICE_PATH));

      if (Node == NULL) {

        return EFI_OUT_OF_RESOURCES;

***************

*** 325,374 ****

    EFI_DHCP6_PACKET_OPTION         *Option;

    EFI_IPv6_ADDRESS                IpAddr;

    CHAR8                           *HostName;

    UINTN                           HostNameSize;

    CHAR16                          *HostNameStr;

    EFI_STATUS                      Status;

!

    ASSERT (Private != NULL);

!   ASSERT (Private->SelectIndex != 0);

!   SelectIndex = Private->SelectIndex - 1;

!   ASSERT (SelectIndex < HTTP_BOOT_OFFER_MAX_NUM);

!

    DnsServerIndex = 0;

 

    Status   = EFI_SUCCESS;

    HostName = NULL;

    //

    // SelectOffer contains the IP address configuration and name server configuration.

    // HttpOffer contains the boot file URL.

    //

!   SelectOffer = &Private->OfferBuffer[SelectIndex].Dhcp6;

!   if (Private->FilePathUri == NULL) {

!     //

!     // In Corporate environment, we need a HttpOffer.

!     //

!     if ((SelectOffer->OfferType == HttpOfferTypeDhcpIpUri) ||

!         (SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns) ||

!         (SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns)) {

!       HttpOffer = SelectOffer;

!     } else {

!       ASSERT (Private->SelectProxyType != HttpOfferTypeMax);

!       ProxyIndex = Private->OfferIndex[Private->SelectProxyType][0];

!       HttpOffer = &Private->OfferBuffer[ProxyIndex].Dhcp6;

!     }

!     Private->BootFileUriParser = HttpOffer->UriParser;

!     Private->BootFileUri = (CHAR8*) HttpOffer->OptList[HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL]->Data;

!   } else {

!     //

!     // In Home environment the BootFileUri comes from the FilePath.

!     //

!     Private->BootFileUriParser = Private->FilePathUriParser;

!     Private->BootFileUri = Private->FilePathUri;

!   }

!

    //

    // Check the URI scheme.

    //

    Status = HttpBootCheckUriScheme (Private->BootFileUri);

    if (EFI_ERROR (Status)) {

      DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n", Status));

--- 335,397 ----

    EFI_DHCP6_PACKET_OPTION         *Option;

    EFI_IPv6_ADDRESS                IpAddr;

    CHAR8                           *HostName;

    UINTN                           HostNameSize;

    CHAR16                          *HostNameStr;

    EFI_STATUS                      Status;

!   EFI_IPv6_ADDRESS                *Dns;

!   UINTN                           DataSize;

    ASSERT (Private != NULL);

!   if (!Private->UsingStatic){

!       ASSERT (Private->SelectIndex != 0);

!       SelectIndex = Private->SelectIndex - 1;

!       ASSERT (SelectIndex < HTTP_BOOT_OFFER_MAX_NUM);

!   }

    DnsServerIndex = 0;

+   DataSize = 0;

 

    Status   = EFI_SUCCESS;

    HostName = NULL;

+   Dns = NULL;

+   if (Private->UsingStatic){

+                 //Static HttpBoot supports Home Environment Only.

+         // In Home environment the BootFileUri comes from the FilePath.

+         //

+         Private->BootFileUriParser = Private->FilePathUriParser;

+         Private->BootFileUri = Private->FilePathUri;

+   }else{

+         Dns = NULL;

    //

    // SelectOffer contains the IP address configuration and name server configuration.

    // HttpOffer contains the boot file URL.

    //

!       SelectOffer = &Private->OfferBuffer[SelectIndex].Dhcp6;

!       if (Private->FilePathUri == NULL ) {

!         //

!         // In Corporate environment, we need a HttpOffer.

!         //

!         if ((SelectOffer->OfferType == HttpOfferTypeDhcpIpUri) ||

!             (SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns) ||

!             (SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns)) {

!           HttpOffer = SelectOffer;

!         } else {

!           ASSERT (Private->SelectProxyType != HttpOfferTypeMax);

!           ProxyIndex = Private->OfferIndex[Private->SelectProxyType][0];

!           HttpOffer = &Private->OfferBuffer[ProxyIndex].Dhcp6;

!         }

!         Private->BootFileUriParser = HttpOffer->UriParser;

!         Private->BootFileUri = (CHAR8*) HttpOffer->OptList[HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL]->Data;

!       } else {

!         //

!         // In Home environment the BootFileUri comes from the FilePath.

!         //

!         Private->BootFileUriParser = Private->FilePathUriParser;

!         Private->BootFileUri = Private->FilePathUri;

!       }

!   }

    //

    // Check the URI scheme.

    //

    Status = HttpBootCheckUriScheme (Private->BootFileUri);

    if (EFI_ERROR (Status)) {

      DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n", Status));

***************

*** 391,403 ****

    //

    // Register the IPv6 gateway address to the network device.

    //

    Status = HttpBootSetIp6Gateway (Private);

    if (EFI_ERROR (Status)) {

      return Status;

!   }

 

    if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) ||

        (SelectOffer->OfferType == HttpOfferTypeDhcpDns) ||

        (SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns)) {

      Option = SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER];

      ASSERT (Option != NULL);

--- 414,450 ----

    //

    // Register the IPv6 gateway address to the network device.

    //

    Status = HttpBootSetIp6Gateway (Private);

    if (EFI_ERROR (Status)) {

      return Status;

!   }

!   if (Private->UsingStatic){

!          if( Private->DnsServerIp != NULL ){

!       //

!       // Configure the default DNS server if server assigned.

!       //

!

!           DataSize = Private->DnsServerCount * sizeof (EFI_IPv6_ADDRESS);

!           Dns = AllocateZeroPool(DataSize);

!           for (DnsServerIndex = 0;DnsServerIndex < Private->DnsServerCount;DnsServerIndex++)

!               CopyMem(&Dns[DnsServerIndex],&Private->DnsServerIp[DnsServerIndex].v6,sizeof(EFI_IPv6_ADDRESS));        

!           Status = HttpBootSetIp6Dns (

!                      Private,

!                      DataSize,

!                      Dns

!                      );

!           FreePool(Dns);

!           if (EFI_ERROR (Status)) {

!               goto Error;

!           }

!         }

!

!       goto StaticBoot;

!   }

!

  

    if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) ||

        (SelectOffer->OfferType == HttpOfferTypeDhcpDns) ||

        (SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns)) {

      Option = SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER];

      ASSERT (Option != NULL);

***************

*** 430,441 ****

--- 477,489 ----

    }

 

    //

    // Extract the HTTP server Ip from URL. This is used to Check route table

    // whether can send message to HTTP Server Ip through the GateWay.

    //

+   StaticBoot:

    Status = HttpUrlGetIp6 (

               Private->BootFileUri,

               Private->BootFileUriParser,

               &IpAddr

               );

 

***************

*** 523,546 ****

  EFI_STATUS

  HttpBootDiscoverBootInfo (

    IN OUT HTTP_BOOT_PRIVATE_DATA   *Private

    )

  {

    EFI_STATUS              Status;

 

    //

    // Start D.O.R.A/S.A.R.R exchange to acquire station ip address and

    // other Http boot information.

    //

    Status = HttpBootDhcp (Private);

    if (EFI_ERROR (Status)) {

      return Status;

    }

 

    if (!Private->UsingIpv6) {

!     Status = HttpBootDhcp4ExtractUriInfo (Private);

    } else {

      Status = HttpBootDhcp6ExtractUriInfo (Private);

    }

 

    return Status;

  }

--- 571,639 ----

  EFI_STATUS

  HttpBootDiscoverBootInfo (

    IN OUT HTTP_BOOT_PRIVATE_DATA   *Private

    )

  {

    EFI_STATUS              Status;

+   EFI_IPv4_ADDRESS        *Dns;

+   UINTN                   DataSize = 0;

+   UINT8                   DnsServerIndex = 0;

 

+   Dns = NULL;

    //

    // Start D.O.R.A/S.A.R.R exchange to acquire station ip address and

    // other Http boot information.

    //

    Status = HttpBootDhcp (Private);

    if (EFI_ERROR (Status)) {

      return Status;

    }

 

    if (!Private->UsingIpv6) {

!       if (!Private->UsingStatic){

!           Status = HttpBootDhcp4ExtractUriInfo (Private);

!       }

!       else{

!         Private->BootFileUriParser = Private->FilePathUriParser;

!         Private->BootFileUri = Private->FilePathUri;

!        

!         if (Private->DnsServerIp != NULL){

!             DataSize = Private->DnsServerCount * sizeof(EFI_IPv4_ADDRESS);

!             Dns = AllocateZeroPool(DataSize);

!             for (DnsServerIndex = 0;DnsServerIndex < Private->DnsServerCount;DnsServerIndex++)

!                 CopyMem(&Dns[DnsServerIndex],&(Private->DnsServerIp[DnsServerIndex].v4),sizeof(EFI_IPv4_ADDRESS));

!            

!             Status = HttpBootRegisterIp4Dns (

!                        Private,

!                        DataSize,

!                        Dns

!                        );

!            

!             FreePool (Dns);

!             if (EFI_ERROR (Status)) {

!               FreePool (Private->DnsServerIp);

!               Private->DnsServerIp = NULL;

!               return Status;

!             }

!         }

!         //

!         // Extract the port from URL, and use default HTTP port 80 if not provided.

!         //

!         Status = HttpUrlGetPort (

!                      Private->BootFileUri,

!                      Private->BootFileUriParser,

!                      &Private->Port

!                      );

!         if (EFI_ERROR (Status) || Private->Port == 0) {

!             Private ->Port = 80;

!         }

!         //

!         // Update the device path to include the IP and boot URI information.

!         //

!         Status = HttpBootUpdateDevicePath (Private);

!       }

    } else {

      Status = HttpBootDhcp6ExtractUriInfo (Private);

    }

 

    return Status;

  }

*** NetworkPkg\HttpBootDxe\HttpBootConfig.c            2020-05-07 22:54:46.000000000 +05-30

--- NetworkPkg\HttpBootDxe\HttpBootConfig.c               2020-08-04 15:28:06.000000000 +05-30

***************

*** 1,6 ****

--- 1,13 ----

+ //***********************************************************************

+ //*                                                                     *

+ //*   Copyright (c) 1985-2020, American Megatrends International LLC.   *

+ //*                                                                     *

+ //*      All rights reserved. Subject to AMI licensing agreement.       *

+ //*                                                                     *

+ //***********************************************************************

  /** @file

    Helper functions for configuring or getting the parameters relating to HTTP Boot.

 

  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

 

***************

*** 36,72 ****

    EFI_DEVICE_PATH_PROTOCOL          *NewDevicePath;

    UINTN                             Length;

    CHAR8                             AsciiUri[URI_STR_MAX_SIZE];

    EFI_STATUS                        Status;

    UINTN                             Index;

    EFI_BOOT_MANAGER_LOAD_OPTION      NewOption;

!

    NewDevicePath = NULL;

    Node          = NULL;

    TmpDevicePath = NULL;

 

    if (StrLen (Description) == 0) {

      return EFI_INVALID_PARAMETER;

    }

 

    //

    // Convert the scheme to all lower case.

    //

    for (Index = 0; Index < StrLen (Uri); Index++) {

!     if (Uri[Index] == L':') {

!       break;

!     }

      if (Uri[Index] >= L'A' && Uri[Index] <= L'Z') {

        Uri[Index] -= (CHAR16)(L'A' - L'a');

      }

    }

 

    //

!   // Only accept empty URI, or http and https URI.

    //

!   if ((StrLen (Uri) != 0) && (StrnCmp (Uri, L"http://", 7) != 0) && (StrnCmp (Uri, L"https://", 8) != 0)) {

      return EFI_INVALID_PARAMETER;

    }

 

    //

    // Create a new device path by appending the IP node and URI node to

    // the driver's parent device path

--- 43,93 ----

    EFI_DEVICE_PATH_PROTOCOL          *NewDevicePath;

    UINTN                             Length;

    CHAR8                             AsciiUri[URI_STR_MAX_SIZE];

    EFI_STATUS                        Status;

    UINTN                             Index;

    EFI_BOOT_MANAGER_LOAD_OPTION      NewOption;

!   EFI_IP_ADDRESS                    LocalIp;

!   EFI_IP_ADDRESS                    SubnetMask;

!   EFI_IP_ADDRESS                    GatewayIp;

!   CHAR16                            DebugString[URI_STR_MAX_SIZE];

!   CHAR8                             *AsciiUri2;

!  

!   AsciiUri2     = NULL;

    NewDevicePath = NULL;

    Node          = NULL;

    TmpDevicePath = NULL;

 

    if (StrLen (Description) == 0) {

      return EFI_INVALID_PARAMETER;

    }

 

    //

    // Convert the scheme to all lower case.

    //

    for (Index = 0; Index < StrLen (Uri); Index++) {

!       if (Uri[Index] == L'/' && Uri[Index + 1] == L'/') {

!         break;

!       }

!

      if (Uri[Index] >= L'A' && Uri[Index] <= L'Z') {

        Uri[Index] -= (CHAR16)(L'A' - L'a');

      }

    }

 

    //

!   // Only accept empty URI, or http , https URI and Static URI.

    //

!

!   if ((StrLen (Uri) != 0) && StrStr(Uri,L"static")){

!       Private->UsingStatic = TRUE;

!   }

!   else{

!       Private->UsingStatic = FALSE;

!   }

!   if ((StrLen (Uri) != 0) && (StrnCmp (Uri, L"http://", 7) != 0) && (StrnCmp (Uri, L"https://", 8) != 0)&& EFI_ERROR(HttpBootCheckStaticUri(Uri)) {

      return EFI_INVALID_PARAMETER;

    }

 

    //

    // Create a new device path by appending the IP node and URI node to

    // the driver's parent device path

***************

*** 77,107 ****

--- 98,159 ----

        Status = EFI_OUT_OF_RESOURCES;

        goto ON_EXIT;

      }

      Node->Ipv4.Header.Type    = MESSAGING_DEVICE_PATH;

      Node->Ipv4.Header.SubType = MSG_IPv4_DP;

      SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));

+     if (Private->UsingStatic){

+         Status = VerifyIpv4Address(Uri,&LocalIp,&SubnetMask,&GatewayIp,DebugString);

+         if (EFI_ERROR(Status))

+             return Status;

+         CopyMem (&Node->Ipv4.LocalIpAddress, &LocalIp.v4, sizeof (EFI_IPv4_ADDRESS));

+         Node->Ipv4.RemotePort      = Private->Port;

+         Node->Ipv4.Protocol        = EFI_IP_PROTO_TCP;

+         Node->Ipv4.StaticIpAddress = TRUE;

+         CopyMem (&Node->Ipv4.GatewayIpAddress, &GatewayIp.v4, sizeof (EFI_IPv4_ADDRESS));

+         CopyMem (&Node->Ipv4.SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));

+     }

    } else {

      Node = AllocateZeroPool (sizeof (IPv6_DEVICE_PATH));

      if (Node == NULL) {

        Status = EFI_OUT_OF_RESOURCES;

        goto ON_EXIT;

      }

      Node->Ipv6.Header.Type     = MESSAGING_DEVICE_PATH;

      Node->Ipv6.Header.SubType  = MSG_IPv6_DP;

      SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH));

+     if (Private->UsingStatic){

+         Status = VerifyIpv6Address (Uri,&LocalIp,&GatewayIp,DebugString);

+         if (EFI_ERROR(Status))

+             return Status;

+         Node->Ipv6.PrefixLength    = IP6_PREFIX_LENGTH;

+         Node->Ipv6.RemotePort      = Private->Port;

+         Node->Ipv6.Protocol        = EFI_IP_PROTO_TCP;

+         Node->Ipv6.IpAddressOrigin = 0x03;

+         CopyMem (&Node->Ipv6.LocalIpAddress, &LocalIp.v6 , sizeof (EFI_IPv6_ADDRESS));

+         CopyMem (&Node->Ipv6.GatewayIpAddress, &GatewayIp.v6, sizeof (EFI_IPv6_ADDRESS));

+     }

    }

    TmpDevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL*) Node);

    FreePool (Node);

    if (TmpDevicePath == NULL) {

      return EFI_OUT_OF_RESOURCES;

    }

    //

    // Update the URI node with the input boot file URI.

    //

    UnicodeStrToAsciiStrS (Uri, AsciiUri, sizeof (AsciiUri));

+   //Extract Bootfile uri from Static Uri.

+   if ((Private->UsingStatic  && (AsciiStrStr(AsciiUri,"dns") == NULL))||( AsciiStrStr(AsciiUri,"dhcp"))){

+     AsciiUri2 = AsciiStrStr (AsciiUri ,"http");

+     if (AsciiUri2 != NULL){

+         for (Index =0;AsciiUri2[Index] != ')' && AsciiUri2[Index] != '\0'  ;Index++);

+         AsciiUri2[Index] = '\0';

+         AsciiStrCpy(AsciiUri,AsciiUri2);

+    }

+   }

    Length = sizeof (EFI_DEVICE_PATH_PROTOCOL) + AsciiStrSize (AsciiUri);

    Node = AllocatePool (Length);

    if (Node == NULL) {

      Status = EFI_OUT_OF_RESOURCES;

      FreePool (TmpDevicePath);

      goto ON_EXIT;

***************

*** 483,494 ****

--- 535,551 ----

          return EFI_OUT_OF_RESOURCES;

        }

 

        UnicodeStrToAsciiStrS (Uri, AsciiUri, UriLen);

 

        Status = HttpBootCheckUriScheme (AsciiUri);

+       if (Status == EFI_INVALID_PARAMETER){

+           Status = HttpBootCheckStaticUri(Uri);

+           if (Status == EFI_UNSUPPORTED)

+               return EFI_INVALID_PARAMETER;

+       }

 

        if (Status == EFI_INVALID_PARAMETER) {

 

          DEBUG ((EFI_D_ERROR, "HttpBootFormCallback: %r.\n", Status));

 

          CreatePopUp (

*** NetworkPkg\HttpBootDxe\HttpBootDxe.h 2020-05-07 22:54:46.000000000 +05-30

--- NetworkPkg\HttpBootDxe\HttpBootDxe.h   2020-08-09 21:00:21.000000000 +05-30

***************

*** 1,6 ****

--- 1,13 ----

+ //***********************************************************************

+ //*                                                                     *

+ //*   Copyright (c) 1985-2020, American Megatrends International LLC.   *

+ //*                                                                     *

+ //*      All rights reserved. Subject to AMI licensing agreement.       *

+ //*                                                                     *

+ //***********************************************************************

  /** @file

    UEFI HTTP boot driver's private data structure and interfaces declaration.

 

  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>

  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

***************

*** 254,265 ****

--- 261,273 ----

    UINT32                                    SelectIndex;

    UINT32                                    SelectProxyType;

    HTTP_BOOT_DHCP_PACKET_CACHE               OfferBuffer[HTTP_BOOT_OFFER_MAX_NUM];

    UINT32                                    OfferNum;

    UINT32                                    OfferCount[HttpOfferTypeMax];

    UINT32                                    OfferIndex[HttpOfferTypeMax][HTTP_BOOT_OFFER_MAX_NUM];

+   BOOLEAN                                   UsingStatic;

  };

 

  #define HTTP_BOOT_PRIVATE_DATA_SIGNATURE          SIGNATURE_32 ('H', 'B', 'P', 'D')

  #define HTTP_BOOT_VIRTUAL_NIC_SIGNATURE           SIGNATURE_32 ('H', 'B', 'V', 'N')

  #define HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE(a)   CR (a, HTTP_BOOT_PRIVATE_DATA, LoadFile, HTTP_BOOT_PRIVATE_DATA_SIGNATURE)

  #define HTTP_BOOT_PRIVATE_DATA_FROM_ID(a)         CR (a, HTTP_BOOT_PRIVATE_DATA, Id, HTTP_BOOT_PRIVATE_DATA_SIGNATURE)

***************

*** 518,524 ****

--- 526,665 ----

  HttpBootIp6DxeDriverBindingStop (

    IN EFI_DRIVER_BINDING_PROTOCOL  *This,

    IN EFI_HANDLE                   ControllerHandle,

    IN UINTN                        NumberOfChildren,

    IN EFI_HANDLE                   *ChildHandleBuffer OPTIONAL

    );

+ /**

+   Configure Static Ip Address using Ipconfig2 Protocol

+

+   @param[in]  Private             Pointer to HTTP boot driver private data.

+ **/

+ EFI_STATUS

+ StaticHttpBoot(HTTP_BOOT_PRIVATE_DATA        *Private);

+ /**

+   Get the IPv4 Address and Ipv6 Address   from the Input Devicepath.

+

+

+   @param[in]   FilePath         Pointer to the device path which contains IPV4 and IPV6 path node.

+

+   @retval EFI_SUCCESS            The IPV4 Address and IPV6 Address successfully assigned to Private variable 

+           EFI_INVALID_PARAMETER   If FilePath is Null

+           EFI_NOT_FOUND          If IPV4Address can't be found

+ **/

+ EFI_STATUS

+ HttpBootParseIpAddress (

+   IN     EFI_DEVICE_PATH_PROTOCOL     *FilePath,

+   IN HTTP_BOOT_PRIVATE_DATA         *Private

+   );

+ /******

+   Get the IPv6Address,GatewayIp6Address using Http Uri given by user,

+   IPV6(LocalIp6Address,Tcp,static or dhcp,gatewayip6Address)/Dns(IP1,IP2,...,IPn)/Uri(_http://DomainName/xxx.efi)

+

+   @param[in]  Buffer                  URI string of the boot file.

+   @param[out] LocalIp                 Ipv6 LocalIp Address is updated statically based on Uri

+   @param[out] GatewayIp               Ipv6  GatewayIp is updated statically based on Uri

+   @Param[out] String                  The Error Message.

+  

+   @retval EFI_SUCCESS                 IP Address is translated from String.

+   @retval EFI_INVALID_PARAMETER                      Url is not supported http and https

+           EFI_UNSUPPORTED             If IP Address is Invalid and Static Uri is invalid

+ *******/

+ EFI_STATUS

+ VerifyIpv6Address (

+       IN   CHAR16                                               *Buffer,

+       OUT  EFI_IP_ADDRESS          *LocalIp,

+       OUT  EFI_IP_ADDRESS          *GatewayIp,

+       OUT  CHAR16                                            *String 

+               );

+ /*********

+   Get the IPv4Address,subnetMask,GatewayIp using Http Uri given by user,

+   IPV4(ClientAddress,protocol,static or Dhcp,gatewayip,subnetMask)/Dns(DnsIP1,DnsIP2...,IPn)/Uri(_http://DomainName/xxx.efi)

+

+   @param[in]  Uri                   The URI string of the boot file.

+   @param[out] LocalIP                    Ipv4 LocalP is updated statically based on Uri

+   @param[out] SubnetMask            Ipv4 SubnetMask is updated statically based on Uri

+   @param[out] GatewayIp             Ipv4  GatewayIp is updated statically based on Uri

+   @Param[out] String                The Error Message.

+  

+   @retval EFI_SUCCESS               IP Address is translated from String.

+   @retval EFI_INVALID_PARAMETER     Url is not supported http and https

+           EFI_UNSUPPORTED           If IP Addrress and static Uri is invalid

+ ********/

+ EFI_STATUS

+ VerifyIpv4Address (

+         IN   CHAR16                                             *Buffer,

+                             OUT  EFI_IP_ADDRESS     *LocalIp,

+         OUT  EFI_IP_ADDRESS       *SubnetMask,

+         OUT  EFI_IP_ADDRESS       *GatewayIp,

+         OUT  CHAR16                                                         *String

+                             );

+ /******

+ This function checks static Uri given by user.

+

+ @param[in]  Buffer               The URI string of the boot file.

+

+ @retval EFI_SUCCESS                Uri and static IP address are valid.

+         EFI_UNSUPPORTED            Static Uri is invalid Format.

+                             EFI_INVALID_PARAMETER      Url is not supported http and https.

+ *******/

+ EFI_STATUS

+ HttpBootCheckStaticUri(IN CHAR16 *Uri);

+ /**

+   Configure Static IPv6 Address using Ip6config Protocol

+

+   @param[in]  Private             Pointer to HTTP boot driver private data.

+ **/

+ EFI_STATUS StaticHttpIPv6Boot (HTTP_BOOT_PRIVATE_DATA        *Private);

+

+ /**

+   This function will register the IPv4 gateway address to the network device.

+

+   @param[in]  Private             The pointer to HTTP_BOOT_PRIVATE_DATA.

+

+   @retval     EFI_SUCCESS         The new IP configuration has been configured successfully.

+   @retval     Others              Failed to configure the address.

+

+ **/

+ EFI_STATUS

+ HttpBootRegisterIp4Gateway (

+   IN HTTP_BOOT_PRIVATE_DATA         *Private

+   );

+ /**

+   This function will switch the IP4 configuration policy to Static.

+

+   @param[in]  Private             Pointer to HTTP boot driver private data.

+

+   @retval     EFI_SUCCESS         The policy is already configured to static.

+   @retval     Others              Other error as indicated..

+

+ **/

+ EFI_STATUS

+ HttpBootSetIp4Policy (

+   IN HTTP_BOOT_PRIVATE_DATA         *Private

+   );

+ /**

+   Checks the HttpBoot Mode is static or Dhcp  from the Input Devicepath.

+   And Update Private variable private->usingstatic

+

+

+   @param[in]   FilePath         Pointer to the device path which contains a IPV4 and IPv6 device path node.

+

+   @retval EFI_SUCCESS            The IPV4 Address  and IPv6 Address are successfully assigned to Private variable 

+           EFI_INVALID_PARAMETER   If FilePath is Null

+ **/

+ EFI_STATUS

+ HttpBootCheckBootType (IN     EFI_DEVICE_PATH_PROTOCOL     *FilePath,IN HTTP_BOOT_PRIVATE_DATA         *Private);

+ /**

+   Get the IPv4 and IPv6 Dns Address from Input Uri

+

+

+   @param[in]   Uri               Input Uri from Filepath

+   @param[in]   UsingIPv6         Specifies the type of IP addresses.

+   @param[in]   Private           The pointer to the driver's private data.

+

+   @retval EFI_SUCCESS            The IPV4 Address  and IPv6 Address are successfully assigned to HTTP boot driver private data.

+           EFI_INVALID_PARAMETER   If Uri is not a valid Static Devicepath URI

+ **/

+ EFI_STATUS

+ HttpBootParseDnsIp(IN CHAR8  *Uri,BOOLEAN UsingIpv6,IN HTTP_BOOT_PRIVATE_DATA         *Private);

  #endif

*** NetworkPkg\HttpBootDxe\HttpBootDxe.inf              2020-05-07 22:54:46.000000000 +05-30

--- NetworkPkg\HttpBootDxe\HttpBootDxe.inf 2020-07-24 16:19:43.000000000 +05-30

***************

*** 1,6 ****

--- 1,15 ----

+

+ #***********************************************************************

+ #*                                                                     *

+ #*   Copyright (c) 1985-2020, American Megatrends International LLC.   *

+ #*                                                                     *

+ #*      All rights reserved. Subject to AMI licensing agreement.       *

+ #*                                                                     *

+ #***********************************************************************

+

  ## @file

  #  This modules produce the Load File Protocol for UEFI HTTP boot.

  #

  #  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>

  #  SPDX-License-Identifier: BSD-2-Clause-Patent

  #

***************

*** 38,49 ****

--- 47,59 ----

    HttpBootSupport.h

    HttpBootSupport.c

    HttpBootClient.h

    HttpBootClient.c

    HttpBootConfigVfr.vfr

    HttpBootConfigStrings.uni

+   HttpBootStatic.c

 

  [LibraryClasses]

    UefiDriverEntryPoint

    UefiBootServicesTableLib

    MemoryAllocationLib

    BaseLib

*** NetworkPkg\HttpBootDxe\HttpBootImpl.c                2020-05-07 22:54:46.000000000 +05-30

--- NetworkPkg\HttpBootDxe\HttpBootImpl.c   2020-08-09 20:08:53.000000000 +05-30

***************

*** 1,6 ****

--- 1,14 ----

+ //***********************************************************************

+ //*                                                                     *

+ //*   Copyright (c) 1985-2020, American Megatrends International LLC.   *

+ //*                                                                     *

+ //*      All rights reserved. Subject to AMI licensing agreement.       *

+ //*                                                                     *

+ //***********************************************************************

+

  /** @file

    The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.

 

  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>

  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

***************

*** 119,139 ****

 

    Uri = NULL;

 

    if (Private == NULL || FilePath == NULL) {

      return EFI_INVALID_PARAMETER;

    }

!

    //

    // Check the URI in the input FilePath, in order to see whether it is

    // required to boot from a new specified boot file.

    //

    Status = HttpBootParseFilePath (FilePath, &Uri);

    if (EFI_ERROR (Status)) {

      return EFI_INVALID_PARAMETER;

!   }

 

    //

    // Check whether we need to stop and restart the HTTP boot driver.

    //

    if (Private->Started) {

      //

--- 127,158 ----

 

    Uri = NULL;

 

    if (Private == NULL || FilePath == NULL) {

      return EFI_INVALID_PARAMETER;

    }

!   //

!   // Check  If HttpBoot get IP Address from user as statically or from dhcp in the input FilePath,

    //

+   Status = HttpBootCheckBootType(FilePath,Private);

+   if (EFI_ERROR (Status)) {

+             return EFI_INVALID_PARAMETER;

+   }

    // Check the URI in the input FilePath, in order to see whether it is

    // required to boot from a new specified boot file.

    //

    Status = HttpBootParseFilePath (FilePath, &Uri);

    if (EFI_ERROR (Status)) {

      return EFI_INVALID_PARAMETER;

!   }

!  

!   if (Private->UsingStatic){

!         Status = HttpBootParseDnsIp(Uri,UsingIpv6,Private);

!         if (EFI_ERROR(Status))

!             return Status;

!     }

 

    //

    // Check whether we need to stop and restart the HTTP boot driver.

   //

    if (Private->Started) {

      //

***************

*** 161,173 ****

        if (Uri != NULL) {

          FreePool (Uri);

        }

        return EFI_ALREADY_STARTED;

      }

    }

!

    //

    // Detect whether using ipv6 or not, and set it to the private data.

    //

    if (UsingIpv6 && Private->Ip6Nic != NULL) {

      Private->UsingIpv6 = TRUE;

    } else if (!UsingIpv6 && Private->Ip4Nic != NULL) {

--- 180,201 ----

        if (Uri != NULL) {

          FreePool (Uri);

        }

        return EFI_ALREADY_STARTED;

      }

    }

!  

!   //Check the IP Address in the input FilePath and

!   //update the Ip Address to Private Data

!   //

!   if (Private->UsingStatic){

!       Status = HttpBootParseIpAddress (FilePath,Private);

!       if (EFI_ERROR (Status)) {

!           return Status;

!       }

!   }

    //

    // Detect whether using ipv6 or not, and set it to the private data.

    //

    if (UsingIpv6 && Private->Ip6Nic != NULL) {

      Private->UsingIpv6 = TRUE;

    } else if (!UsingIpv6 && Private->Ip4Nic != NULL) {

***************

*** 196,215 ****

--- 224,245 ----

      }

    }

 

    //

    // Init the content of cached DHCP offer list.

    //

+ if(!Private->UsingStatic){

    ZeroMem (Private->OfferBuffer, sizeof (Private->OfferBuffer));

    if (!Private->UsingIpv6) {

      for (Index = 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) {

        Private->OfferBuffer[Index].Dhcp4.Packet.Offer.Size = HTTP_CACHED_DHCP4_PACKET_MAX_SIZE;

      }

    } else {

      for (Index = 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) {

        Private->OfferBuffer[Index].Dhcp6.Packet.Offer.Size = HTTP_CACHED_DHCP6_PACKET_MAX_SIZE;

+     }

      }

    }

 

    if (Private->UsingIpv6) {

      //

      // Set Ip6 policy to Automatic to start the Ip6 router discovery.

***************

*** 252,274 ****

      return EFI_NOT_STARTED;

    }

 

    Status = EFI_DEVICE_ERROR;

 

    if (!Private->UsingIpv6) {

!     //

      // Start D.O.R.A process to get a IPv4 address and other boot information.

      //

!     Status = HttpBootDhcp4Dora (Private);

    } else {

!      //

      // Start S.A.R.R process to get a IPv6 address and other boot information.

      //

!     Status = HttpBootDhcp6Sarr (Private);

!   }

!

    return Status;

  }

 

  /**

    Attempt to download the boot file through HTTP message exchange.

 

--- 282,332 ----

      return EFI_NOT_STARTED;

    }

 

    Status = EFI_DEVICE_ERROR;

 

    if (!Private->UsingIpv6) {

!   

!     if (!Private->UsingStatic) {

!               //

      // Start D.O.R.A process to get a IPv4 address and other boot information.

      //

!         Status = HttpBootDhcp4Dora (Private);

!    }else{

!       Status = HttpBootSetIp4Policy (Private);

!       if (EFI_ERROR (Status)) {

!         return Status;

!       }

!       Status = StaticHttpBoot(Private);

!       if (EFI_ERROR (Status)) {

!           return Status;

!        }

!       Status = HttpBootRegisterIp4Gateway (Private);

!       if (EFI_ERROR (Status)) {

!           return Status;

!        }

!

!       AsciiPrint ("\n  Station IP address is ");

!       HttpBootShowIp4Addr (&Private->StationIp.v4);

!       AsciiPrint ("\n");

!     }

!    

    } else {

!     

!     if (!Private->UsingStatic){

!              //

      // Start S.A.R.R process to get a IPv6 address and other boot information.

      //

!         Status = HttpBootDhcp6Sarr (Private);

!     }else{

!         Status = StaticHttpIPv6Boot (Private);

!         AsciiPrint ("\n  Station IPv6 address is ");

!         HttpBootShowIp6Addr (&Private->StationIp.v6);

!         AsciiPrint ("\n");

!     }

!   }

    return Status;

  }

 

  /**

    Attempt to download the boot file through HTTP message exchange.

 

***

--- NetworkPkg\HttpBootDxe\HttpBootStatic.c 2020-08-09 21:00:09.000000000 +05-30

***************

*** 0 ****

--- 1,650 ----

+ //***********************************************************************

+ //*                                                                     *

+ //*   Copyright (c) 1985-2020, American Megatrends International LLC.   *

+ //*                                                                     *

+ //*      All rights reserved. Subject to AMI licensing agreement.       *

+ //*                                                                     *

+ //***********************************************************************

+

+ /** @file HttpBootStatic.c  

+ Provides the Static Http Boot related functions .

+

+ Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>

+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

+ SPDX-License-Identifier: BSD-2-Clause-Patent

+

+ **/

+

+

+ #include "HttpBootDxe.h"

+ #include <Library/UefiBootManagerLib.h>

+

+

+ /**

+   Get the IPv4 and IPv6 Address  from the Input Devicepath.

+

+

+   @param[in]   FilePath         Pointer to the device path which contains a IPV4 and IPV6 device path node.

+

+   @retval EFI_SUCCESS            The IPV4 Address  and IPv6 Address are successfully assigned to Private variable 

+           EFI_INVALID_PARAMETER   If FilePath is Null

+ **/

+ EFI_STATUS

+ HttpBootParseIpAddress (

+   IN     EFI_DEVICE_PATH_PROTOCOL     *FilePath,

+   IN HTTP_BOOT_PRIVATE_DATA         *Private

+   )

+ {

+   EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;

+   EFI_DEV_PATH                      *Node;

+

+   if (FilePath == NULL) {

+     return EFI_INVALID_PARAMETER;

+   }

+   

+   ZeroMem (&Private->StationIp, sizeof (EFI_IP_ADDRESS));

+   ZeroMem (&Private->SubnetMask,  sizeof (EFI_IP_ADDRESS));

+   ZeroMem (&Private->GatewayIp, sizeof (EFI_IP_ADDRESS));

+   //

+   // Extract the IPV4 address from the FilePath

+   //

+  

+   TempDevicePath = FilePath;

+   while (!IsDevicePathEnd (TempDevicePath)) {

+      

+    if ((DevicePathType (TempDevicePath) == MESSAGING_DEVICE_PATH) &&

+            (DevicePathSubType (TempDevicePath) == MSG_IPv4_DP)) {

+       Node = ( EFI_DEV_PATH *)TempDevicePath;

+      

+       CopyMem (&Private->StationIp.v4, &Node->Ipv4.LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));

+       CopyMem (&Private->SubnetMask.v4, &Node->Ipv4.SubnetMask , sizeof (EFI_IPv4_ADDRESS));

+       CopyMem (&Private->GatewayIp.v4, &Node->Ipv4.GatewayIpAddress, sizeof (EFI_IPv4_ADDRESS));

+    }

+    else if ((DevicePathType (TempDevicePath) == MESSAGING_DEVICE_PATH) &&

+                 (DevicePathSubType (TempDevicePath) == MSG_IPv6_DP)) {

+          Node = (EFI_DEV_PATH *)TempDevicePath ;

+          CopyMem (&Private ->StationIp.v6,&Node ->Ipv6.LocalIpAddress,sizeof (EFI_IPv6_ADDRESS));

+          CopyMem (&Private ->GatewayIp.v6,&Node ->Ipv6.GatewayIpAddress,sizeof (EFI_IPv6_ADDRESS));

+      }

+   

+     TempDevicePath = NextDevicePathNode (TempDevicePath);

+   }

+

+   return EFI_SUCCESS;

+ }

+

+ /**

+   The notify function of create event when performing a manual config.

+

+   @param[in]    Event        The event this notify function registered to.

+   @param[in]    Context      Pointer to the context data registered to the event.

+

+ **/

+ VOID

+ EFIAPI

+ IfConfigManualAddressNotify (

+   IN EFI_EVENT    Event,

+   IN VOID         *Context

+   )

+ {

+     *((BOOLEAN *) Context) = TRUE;

+ }

+ /**

+   Configure Static Ip Address using Ip4config2 Protocol

+

+   @param[in]  Private             Pointer to HTTP boot driver private data.

+ **/

+ EFI_STATUS

+ StaticHttpBoot (HTTP_BOOT_PRIVATE_DATA        *Private)

+ {

+     EFI_EVENT                        MappedEvt;

+     BOOLEAN                          IsAddressOk;

+     EFI_IP4_CONFIG2_POLICY           Policy;

+     EFI_IP4_CONFIG2_MANUAL_ADDRESS   ManualAddress;

+     EFI_STATUS                       Status;

+     UINTN                            DataSize ;

+     EFI_IP4_CONFIG2_PROTOCOL         *IfCfg ;

+     EFI_EVENT                        TimeOutEvt ;

+     //

+     // Create events & timers for asynchronous settings.

+     //

+     CopyMem (&ManualAddress.Address , &Private->StationIp.v4, sizeof (EFI_IPv4_ADDRESS));

+     CopyMem (&ManualAddress.SubnetMask , &Private ->SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));

+

+    

+     Status = gBS->CreateEvent (

+                     EVT_TIMER,

+                     TPL_CALLBACK,

+                     NULL,

+                     NULL,

+                     &TimeOutEvt

+                     );

+     if (EFI_ERROR(Status))

+         return Status;

+    

+     Status = gBS->CreateEvent (

+                 EVT_NOTIFY_SIGNAL,

+                 TPL_NOTIFY,

+                 IfConfigManualAddressNotify,

+                 &IsAddressOk,

+                 &MappedEvt

+                 );

+     if (EFI_ERROR(Status))

+         return Status;

+

+     IfCfg  = Private->Ip4Config2; 

+     Status = IfCfg->RegisterDataNotify (

+                             IfCfg,

+                             Ip4Config2DataTypeManualAddress,

+                             MappedEvt

+                             );

+     if (EFI_ERROR(Status))

+         return Status;

+     Policy = Ip4Config2PolicyStatic;

+     Status = IfCfg->SetData (

+                             IfCfg,

+                             Ip4Config2DataTypePolicy,

+                             sizeof (EFI_IP4_CONFIG2_POLICY),

+                             &Policy

+                             );

+                                                                                                            

+ if (EFI_ERROR(Status))

+         return Status;

+     DataSize = sizeof (EFI_IP4_CONFIG2_MANUAL_ADDRESS);

+    

+     Status = IfCfg->SetData (

+                           IfCfg,

+                           Ip4Config2DataTypeManualAddress,

+                           DataSize,

+                           &ManualAddress

+                           );

+     if (Status == EFI_NOT_READY) {

+         gBS->SetTimer (TimeOutEvt, TimerRelative, 50000000);

+         while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) {

+             if (IsAddressOk) {

+                 Status = EFI_SUCCESS;

+                 break;

+       }

+     }

+     }

+

+     Status = IfCfg->UnregisterDataNotify (

+                  IfCfg,

+                  Ip4Config2DataTypeManualAddress,

+                  MappedEvt

+                  );

+    

+     return Status;

+ }                   

+

+ /**

+   The notify function of create event when performing a manual config.

+

+   @param[in]    Event        The event this notify function registered to.

+   @param[in]    Context      Pointer to the context data registered to the event.

+

+ **/

+ VOID

+ EFIAPI

+ IfConfig6ManualAddressNotify (

+   IN EFI_EVENT    Event,

+   IN VOID         *Context

+   )

+ {

+   *((BOOLEAN *) Context) = TRUE;

+ }

+ /**

+   Configure Static Ipv6 Address using Ip6config Protocol

+

+   @param[in]  Private             Pointer to HTTP boot driver private data.

+ **/

+

+ EFI_STATUS

+ StaticHttpIPv6Boot (HTTP_BOOT_PRIVATE_DATA        *Private)

+ {

+     EFI_STATUS                       Status;

+     EFI_IP6_CONFIG_PROTOCOL          *IfCfg;

+             EFI_IP6_CONFIG_MANUAL_ADDRESS    CfgManAddr;

+             UINT32                           CurDadXmits;

+             UINTN                            CurDadXmitsLen;

+             EFI_IP6_CONFIG_POLICY            Policy;

+             EFI_EVENT                        TimeOutEvt;

+             EFI_EVENT                        MappedEvt;

+             BOOLEAN                          IsAddressOk;

+    

+              // Set static host ip6 address list.

+              //   This is a asynchronous process.

+              //

+             CopyMem (&CfgManAddr.Address,&Private->StationIp.v6,sizeof(EFI_IPv6_ADDRESS));

+             CfgManAddr.PrefixLength = IP6_PREFIX_LENGTH;

+             CfgManAddr.IsAnycast = FALSE ;

+            

+             IsAddressOk = FALSE;

+             IfCfg  = Private->Ip6Config;

+             Status = gBS->CreateEvent (

+                              EVT_TIMER,

+                              TPL_CALLBACK,

+                              NULL,

+                              NULL,

+                              &TimeOutEvt

+                              );

+             if (EFI_ERROR(Status))

+                             return Status;

+     

+     Status = gBS->CreateEvent (

+                  EVT_NOTIFY_SIGNAL,

+                  TPL_NOTIFY,

+                  IfConfig6ManualAddressNotify,

+                  &IsAddressOk,

+                  &MappedEvt

+                  );

+     if (EFI_ERROR(Status))

+             return Status;

+

+             Status = IfCfg->RegisterDataNotify (

+                                  IfCfg,

+                                  Ip6ConfigDataTypeManualAddress,

+                                  MappedEvt

+                                  );

+             if (EFI_ERROR (Status)) {

+                             return Status;

+             }

+            

+             Policy = Ip6ConfigPolicyManual;

+             Status = IfCfg->SetData (

+                                  IfCfg,

+                                  Ip6ConfigDataTypePolicy,

+                                  sizeof (EFI_IP6_CONFIG_POLICY),

+                                  &Policy

+                                  );

+             if (EFI_ERROR (Status)) {

+              goto ON_EXIT;

+                   }

+         

+             Status = IfCfg->SetData (

+                                  IfCfg,

+                                  Ip6ConfigDataTypeManualAddress,

+                                  sizeof(EFI_IP6_CONFIG_MANUAL_ADDRESS),

+                                  &CfgManAddr

+                                  );

+         

+

+             if (Status == EFI_NOT_READY) {

+             //

+             // Get current dad transmits count.

+             //

+             CurDadXmitsLen = sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS);

+             Status = IfCfg->GetData (

+                           IfCfg,

+                           Ip6ConfigDataTypeDupAddrDetectTransmits,

+                           &CurDadXmitsLen,

+                           &CurDadXmits

+                           );

+             if (EFI_ERROR (Status)) {

+               goto ON_EXIT;

+             }

+

+             gBS->SetTimer (TimeOutEvt, TimerRelative, 50000000 + 10000000 * CurDadXmits);

+

+             while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) {

+                             if (IsAddressOk) {

+                             Status = EFI_SUCCESS;

+                             break;

+                             }

+             }

+             }

+

+             Status = IfCfg->SetData (

+                                     IfCfg,

+                                     Ip6ConfigDataTypeGateway,

+                                     sizeof(EFI_IPv6_ADDRESS),

+                                     &Private->GatewayIp.v6

+                                     );

+             if (EFI_ERROR (Status)) {

+                             goto ON_EXIT;

+             }

+

+ ON_EXIT:

+

+             Status = IfCfg->UnregisterDataNotify (

+                        IfCfg,

+                         Ip6ConfigDataTypeManualAddress,

+                         MappedEvt

+                         );

+

+             if (EFI_ERROR (Status)) {

+                             return Status;

+             }

+             return Status;

+             

+ }

+ /*********

+   Get the IPv4Address,subnetMask,GatewayIp using Http Uri given by user,

+   IPV4(ClientAddress,protocol,static or Dhcp ,gatewayip,subnetMask)/Dns(DnsIP1,DnsIP2...,IPn)/Uri(_http://DomainName/xxx.efi)

+

+   @param[in]  Uri                   The URI string of the boot file.

+   @param[out] LocalIP                    Ipv4 LocalP is updated statically based on Uri

+   @param[out] SubnetMask            Ipv4 SubnetMask is updated statically based on Uri

+   @param[out] GatewayIp             Ipv4  GatewayIp is updated statically based on Uri

+   @Param[out] String                The Error Message.

+  

+   @retval EFI_SUCCESS               IP Address is translated from String.

+   @retval EFI_INVALID_PARAMETER     Url is not supported http and https

+           EFI_UNSUPPORTED           If IP Addrress and static Uri is invalid

+ ********/

+ EFI_STATUS

+ VerifyIpv4Address (

+         IN   CHAR16             *Buffer,

+         OUT  EFI_IP_ADDRESS     *LocalIp,

+         OUT  EFI_IP_ADDRESS     *SubnetMask,

+         OUT  EFI_IP_ADDRESS     *GatewayIp,

+         OUT  CHAR16             *String

+         )

+ {

+     CHAR16                        *EndPointer;

+     RETURN_STATUS                  Status;

+     EFI_IPv4_ADDRESS               Dns;

+     CHAR8                         AsciiUri[URI_STR_MAX_SIZE];

+    

+     if (StrnCmp (Buffer ,L"ipv4(",5)){

+         StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!");

+         return EFI_UNSUPPORTED;

+     }

+     Buffer +=StrLen(L"ipv4(");

+     Status = StrToIpv4Address (Buffer, &EndPointer,&LocalIp->v4,NULL);

+     if (RETURN_ERROR (Status)){

+         StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid LocalIP address!");

+         return EFI_UNSUPPORTED;

+     }

+     Buffer = EndPointer;

+     if (StrnCmp(Buffer,L",tcp,static,",12 ) && StrnCmp(Buffer,L",tcp,dhcp,",10 )){

+         StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!");

+         return EFI_UNSUPPORTED;

+     }

+     if (StrnCmp(Buffer,L",tcp,dhcp,",10))

+         Buffer +=StrLen(L",tcp,static,");

+     else

+         Buffer +=StrLen(L",tcp,dhcp,");

+    

+     Status = StrToIpv4Address (Buffer,&EndPointer, &GatewayIp->v4,NULL);

+     if (RETURN_ERROR(Status)) {

+         StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid GatewayIP Address!");

+         return EFI_UNSUPPORTED;

+     }

+     Buffer = EndPointer + 1;

+     Status = StrToIpv4Address (Buffer,&EndPointer, &SubnetMask->v4,NULL);

+     if (RETURN_ERROR(Status)) {

+         StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid SubnetMask Address!");

+         return EFI_UNSUPPORTED;

+     }

+     Buffer = EndPointer;

+     if (StrnCmp(Buffer,L")/uri(",6) && StrnCmp(Buffer,L")/dns(",6)){

+         StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!");

+         return EFI_UNSUPPORTED;

+     }

+     if (!StrnCmp(Buffer,L")/dns(",6))

+     {

+         Buffer += StrLen(L")/dns(");

+         do{

+             Status  = StrToIpv4Address (Buffer,&EndPointer, &Dns,NULL);

+             if (RETURN_ERROR(Status)) {

+                StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid DnsServerIP Address!");

+                return EFI_UNSUPPORTED;

+              }

+             Buffer = EndPointer +1;

+         }while(*EndPointer == L',');  

+     }

+     if (!StrnCmp (Buffer,L"}/uri(",6)){

+         Buffer +=StrLen(L")/uri(");

+         UnicodeStrToAsciiStrS (Buffer, AsciiUri, URI_STR_MAX_SIZE);

+         Status = HttpBootCheckUriScheme (AsciiUri);

+         return Status;

+     }

+        

+     return EFI_SUCCESS;

+ }

+

+ /******

+   Get the IPv6Address,GatewayIp6Address using Http Uri given by user,

+   IPV6(LocalIp6Address,Tcp,static or dhcp,gatewayip6Address)/Dns(IP1,IP2,...,IPn)/Uri(_http://DomainName/xxx.efi)

+

+   @param[in]  Buffer                  URI string of the boot file.

+   @param[out] LocalIp                 Ipv6 LocalIp Address is updated statically based on Uri

+   @param[out] GatewayIp               Ipv6  GatewayIp is updated statically based on Uri

+   @Param[out] String                  The Error Message.

+  

+   @retval EFI_SUCCESS                 IP Address is translated from String.

+   @retval EFI_INVALID_PARAMETER                      Url is not supported http and https

+           EFI_UNSUPPORTED             If IP Address is Invalid and Static Uri is invalid

+ *******/

+ EFI_STATUS

+ VerifyIpv6Address (

+       IN   CHAR16                                               *Buffer,

+       OUT  EFI_IP_ADDRESS         *LocalIp,

+       OUT  EFI_IP_ADDRESS         *GatewayIp,

+       OUT  CHAR16                                           *String 

+               )

+ {

+    

+     CHAR16                        *EndPointer;

+     RETURN_STATUS                  Status;

+     EFI_IPv6_ADDRESS                 Dns;

+     CHAR8                         AsciiUri[URI_STR_MAX_SIZE];

+    

+     if (StrnCmp (Buffer ,L"ipv6(",5)){

+         StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!");

+         return EFI_UNSUPPORTED;

+     }

+     Buffer += StrLen (L"ipv6(");

+     Status = StrToIpv6Address (Buffer, &EndPointer,&LocalIp->v6,NULL);

+     if (RETURN_ERROR (Status)){

+       StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid LocalIP address!");

+       return EFI_UNSUPPORTED;

+     }

+     Buffer = EndPointer;

+     if (StrnCmp(Buffer,L",tcp,static,",12) && StrnCmp(Buffer,L",tcp,dhcp,",10)){

+       StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!");

+       return EFI_UNSUPPORTED;

+     }

+     if (StrnCmp(Buffer,L",tcp,dhcp,",10))

+         Buffer +=StrLen(L",tcp,static,");

+     else

+         Buffer +=StrLen(L",tcp,dhcp,");

+    

+     Status = StrToIpv6Address (Buffer,&EndPointer, &GatewayIp->v6,NULL);

+     if (RETURN_ERROR (Status) ) {

+       StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid GatewayIP Address!");

+       return EFI_UNSUPPORTED;

+     }

+     Buffer = EndPointer;

+     if (StrnCmp(Buffer,L")/uri(",6) && StrnCmp(Buffer,L")/dns(",6)){

+         StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!");

+         return EFI_UNSUPPORTED;

+     }

+     if (!StrnCmp(Buffer,L")/dns(",6))

+     {

+         Buffer += StrLen(L")/dns(");

+         do{

+             Status  = StrToIpv6Address (Buffer,&EndPointer, &Dns,NULL);

+             if (RETURN_ERROR(Status)) {

+                StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid DnsServerIP Address!");

+                return EFI_UNSUPPORTED;

+              }

+             Buffer = EndPointer +1;

+         }while(*EndPointer == L',');  

+     }

+     if (!StrnCmp (Buffer,L"}/uri(",6)){

+         Buffer +=StrLen(L")/uri(");

+         UnicodeStrToAsciiStrS (Buffer, AsciiUri, URI_STR_MAX_SIZE);

+         Status = HttpBootCheckUriScheme (AsciiUri);

+         return Status;

+     }

+     return EFI_SUCCESS;

+ }

+ /******

+ This function checks static Uri given by user and returns BOOLEAN(TRUE:valid Uri,FALSE:Invalid Uri)

+

+ @param[in]  Buffer               The URI string of the boot file.

+

+ @retval SUCCESS   Uri and static IP address are valid.

+         EFI_UNSUPPORTED Static Uri is invalid Format.

+                             EFI_INVALID_PARAMETER  Url is not supported http and https

+ *******/

+ EFI_STATUS

+ HttpBootCheckStaticUri(IN CHAR16 *Uri)

+ {

+     EFI_STATUS                      Status;

+     EFI_INPUT_KEY                   Key;

+     EFI_IP_ADDRESS                  LocalIp;

+     EFI_IP_ADDRESS                  SubnetMask;

+     EFI_IP_ADDRESS                  GatewayIp;

+     CHAR16                          ErrorMessage[URI_STR_MAX_SIZE];

+     UINTN                           Index = 0;

+    

+     if (StrLen (Uri) == 0)

+         return EFI_INVALID_PARAMETER;

+      

+     for (Index = 0; Index < StrLen (Uri); Index++) {

+         if (Uri[Index] == L'/' && Uri[Index + 1] == L'/') {

+           break;

+         }

+       if (Uri[Index] >= L'A' && Uri[Index] <= L'Z') {

+         Uri[Index] -= (CHAR16)(L'A' - L'a');

+       }

+     }

+     if (StrnCmp (Uri,L"ipv4(",5) == 0){

+         Status = VerifyIpv4Address (Uri,&LocalIp,&SubnetMask,&GatewayIp,ErrorMessage);

+         if (EFI_ERROR(Status)){

+            CreatePopUp (

+                EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

+                &Key,

+                ErrorMessage,

+                NULL

+                );

+            return Status;

+        }

+     }else if (StrnCmp (Uri,L"ipv6(",5) == 0){

+         Status = VerifyIpv6Address (Uri,&LocalIp,&GatewayIp,ErrorMessage);

+         if (EFI_ERROR(Status)){

+             CreatePopUp (

+                EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

+                &Key,

+                ErrorMessage,

+                NULL

+                );

+             return Status;

+         }

+     }else  if ((StrnCmp(Uri, L"http://", 7) != 0) && (StrnCmp(Uri, L"https://", 8) != 0)){

+         CreatePopUp (

+                EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

+                &Key,

+                L"Invalid Uri",

+                NULL

+                );

+         return EFI_UNSUPPORTED;

+     }

+     return EFI_SUCCESS ;

+ }

+ /**

+   Checks the HttpBoot Mode is static or Dhcp  from the Input Devicepath.

+   And Update Private Variable Private->UsingStatic

+

+

+   @param[in]   FilePath         Pointer to the device path which contains a IPV4 and IPv6 device path node.

+

+   @retval EFI_SUCCESS            The IPV4 Address  and IPv6 Address are successfully assigned to Private variable 

+           EFI_INVALID_PARAMETER   If FilePath is Null

+ **/

+ EFI_STATUS

+ HttpBootCheckBootType (IN     EFI_DEVICE_PATH_PROTOCOL     *FilePath,IN HTTP_BOOT_PRIVATE_DATA         *Private)

+ {

+     EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;

+     EFI_DEV_PATH                      *Node;

+

+       if (FilePath == NULL) {

+         return EFI_INVALID_PARAMETER;

+       }

+      

+       TempDevicePath = FilePath;

+       while (!IsDevicePathEnd (TempDevicePath)) {

+         if ((DevicePathType (TempDevicePath) == MESSAGING_DEVICE_PATH)){

+             if (DevicePathSubType (TempDevicePath) == MSG_IPv4_DP){

+                 Node = (EFI_DEV_PATH *)TempDevicePath ;

+                 Private->UsingStatic = Node->Ipv4.StaticIpAddress ;

+             }else if (DevicePathSubType (TempDevicePath) == MSG_IPv6_DP){

+                 Node = (EFI_DEV_PATH *)TempDevicePath ;

+                 Private->UsingStatic =(Node->Ipv6.IpAddressOrigin == 0x03) ? TRUE : FALSE;

+             }

+         }

+         TempDevicePath = NextDevicePathNode (TempDevicePath);

+       }

+

+       return EFI_SUCCESS;

+ }

+ /**

+   Get the IPv4 and IPv6 Dns Address from Input Uri

+

+

+   @param[in]   Uri               Input Uri from Filepath

+   @param[in]   UsingIPv6         Specifies the type of IP addresses.

+   @param[in]   Private           The pointer to the driver's private data.

+

+   @retval EFI_SUCCESS            The IPV4 Address  and IPv6 Address are successfully assigned to HTTP boot driver private data.

+           EFI_INVALID_PARAMETER   If Uri is not a valid Static Devicepath URI

+ **/

+ EFI_STATUS

+ HttpBootParseDnsIp(IN CHAR8  *Uri,BOOLEAN  UsingIpv6,IN HTTP_BOOT_PRIVATE_DATA         *Private)

+ {

+     EFI_STATUS           Status;

+     CHAR16               Uri2[URI_STR_MAX_SIZE];

+     UINT32               Index = 0;

+     UINTN                UriStrLength = 0;

+     CHAR16              *EndPointer;

+     CHAR16              *Buffer;

+     UINTN                DataSize = 0;

+    

+     if (Uri == NULL)

+         return EFI_SUCCESS;

+     AsciiStrToUnicodeStrS(Uri,Uri2,URI_STR_MAX_SIZE);

+     UriStrLength = AsciiStrLen(Uri) + 1;

+     Status = HttpBootCheckStaticUri(Uri2);

+     if (EFI_ERROR(Status))

+         return Status;

+     if (Buffer = StrStr(Uri2,L"dns("))

+     {

+         Buffer += 4;

+         DataSize = sizeof(EFI_IP_ADDRESS) ;

+         Private->DnsServerIp = AllocateZeroPool(DataSize);

+         if (UsingIpv6)

+             Status = StrToIpv6Address (Buffer,&EndPointer,&Private->DnsServerIp[Index++].v6,NULL);

+         else

+             Status = StrToIpv4Address (Buffer,&EndPointer,&Private->DnsServerIp[Index++].v4,NULL);

+         if (EFI_ERROR(Status)){

+             FreePool(Private->DnsServerIp);

+             Private->DnsServerIp = NULL;

+             return Status;

+         }

+         while(*EndPointer == L','){

+             Private->DnsServerIp = ReallocatePool(DataSize,DataSize + sizeof(EFI_IP_ADDRESS),Private->DnsServerIp);

+             if (UsingIpv6)

+                 Status = StrToIpv6Address (Buffer,&EndPointer,&Private->DnsServerIp[Index++].v6,NULL);

+             else

+                 Status = StrToIpv4Address (Buffer,&EndPointer,&Private->DnsServerIp[Index++].v4,NULL);

+             if (EFI_ERROR(Status)){

+                 FreePool(Private->DnsServerIp);

+                 Private->DnsServerIp = NULL;

+                 return Status;

+             }

+             Buffer = EndPointer + 1;

+         }while(*EndPointer == L',');

+     Private->DnsServerCount = Index;

+     if (Buffer = StrStr(Uri2,L"http")){

+         for (Index =0;Buffer[Index] != L')' && Buffer[Index] != L'\0'  ;Index++);

+         Buffer[Index] = L'\0';

+     }

+     UnicodeStrToAsciiStrS(Buffer,Uri,UriStrLength);

+     }

+     return EFI_SUCCESS;

+ }

+


Re: [PATCH v2 2/2] CryptoPkg/OpensslLib: Commit the auto-generated assembly files for X64

Yao, Jiewen
 

Thank you Mike to help on this.

I also believe that the best option is to integrate the auto-gen process in base tool.

-----Original Message-----
From: Kinney, Michael D <michael.d.kinney@intel.com>
Sent: Thursday, August 13, 2020 11:38 PM
To: Yao, Jiewen <jiewen.yao@intel.com>; Zurcher, Christopher J
<christopher.j.zurcher@intel.com>; devel@edk2.groups.io; Kinney, Michael D
<michael.d.kinney@intel.com>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Lu, XiaoyuX <xiaoyux.lu@intel.com>;
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: RE: [PATCH v2 2/2] CryptoPkg/OpensslLib: Commit the auto-generated
assembly files for X64

Hi Jiewen,

For this use case, generating the files as part of the build process would add
a dependency in pearl.

Based on other recent CryptoPkg changes and some being discussed in BZ, I am
seeing more changes to the OpenSLL .pl configuration files, and I am concerned
that based on platform requirements, we may need to build OpenSSL with
different .pl config file settings which would also add a pearl dependency
to the build.

So exploring what it would take to add the pearl dependency to the build system
is worth exploring and if successful would eliminate the need to checkin these
types of autogenerated files. This would also reduce maintenance of the
auto-genererated files when EDK II moves to a new version of OpenSSL.

@Cristopher - Can you please share a branch that uses pearl to generate the
files
instead of checking them in? I would like the BaseTools maintainers to review
that and evaluate adding the pearl dependency. Hopefully, we can make the
pearl dependency detectable so it is only required if the build requires it.

Thanks,

Mike

-----Original Message-----
From: Yao, Jiewen <jiewen.yao@intel.com>
Sent: Thursday, August 13, 2020 8:25 AM
To: Zurcher, Christopher J <christopher.j.zurcher@intel.com>;
devel@edk2.groups.io
Cc: Wang, Jian J <jian.j.wang@intel.com>; Lu, XiaoyuX
<xiaoyux.lu@intel.com>; Kinney, Michael D
<michael.d.kinney@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: RE: [PATCH v2 2/2] CryptoPkg/OpensslLib: Commit the auto-
generated assembly files for X64

+ Mike Kinney

I am not sure if it is a right way to check in auto-generated file.
That means, whenever we upgrade the openssl, we need manually generate
them again.
Any step by step, or readme to tell us how to do that?

Mike, would you please double confirm what is the right way for auto-
generated file in EDKII?


-----Original Message-----
From: Zurcher, Christopher J <christopher.j.zurcher@intel.com>
Sent: Tuesday, August 4, 2020 8:24 AM
To: devel@edk2.groups.io
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J
<jian.j.wang@intel.com>;
Lu, XiaoyuX <xiaoyux.lu@intel.com>; Ard Biesheuvel
<ard.biesheuvel@linaro.org>
Subject: [PATCH v2 2/2] CryptoPkg/OpensslLib: Commit the auto-generated
assembly files for X64

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2507

Adding the auto-generated assembly files for the X64 architecture.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
---
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-x86_64.nasm |
732
+++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-x86_64.nasm |
1916 ++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-x86_64.nasm |
78 +
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm |
5103
++++++++++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-x86_64.nasm |
1173
+++++
CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm |
1569 ++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-x86_64.nasm |
3137
++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-x86_64.nasm |
2884
+++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-mb-x86_64.nasm |
3461 +++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-x86_64.nasm |
3313
+++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha512-x86_64.nasm |
1938
++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/x86_64cpuid.nasm | 491
++
12 files changed, 25795 insertions(+)

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-
x86_64.nasm b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-
x86_64.nasm
new file mode 100644
index 0000000000..1a3ed1dd35
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-x86_64.nasm
@@ -0,0 +1,732 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/aesni-mb-x86_64.pl

+;

+; Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+

+EXTERN OPENSSL_ia32cap_P

+

+global aesni_multi_cbc_encrypt

+

+ALIGN 32

+aesni_multi_cbc_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_multi_cbc_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ mov rax,rsp

+

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ push r15

+

+ lea rsp,[((-168))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+ movaps XMMWORD[64+rsp],xmm10

+ movaps XMMWORD[80+rsp],xmm11

+ movaps XMMWORD[96+rsp],xmm12

+ movaps XMMWORD[(-104)+rax],xmm13

+ movaps XMMWORD[(-88)+rax],xmm14

+ movaps XMMWORD[(-72)+rax],xmm15

+

+

+

+

+

+

+ sub rsp,48

+ and rsp,-64

+ mov QWORD[16+rsp],rax

+

+

+$L$enc4x_body:

+ movdqu xmm12,XMMWORD[rsi]

+ lea rsi,[120+rsi]

+ lea rdi,[80+rdi]

+

+$L$enc4x_loop_grande:

+ mov DWORD[24+rsp],edx

+ xor edx,edx

+ mov ecx,DWORD[((-64))+rdi]

+ mov r8,QWORD[((-80))+rdi]

+ cmp ecx,edx

+ mov r12,QWORD[((-72))+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm2,XMMWORD[((-56))+rdi]

+ mov DWORD[32+rsp],ecx

+ cmovle r8,rsp

+ mov ecx,DWORD[((-24))+rdi]

+ mov r9,QWORD[((-40))+rdi]

+ cmp ecx,edx

+ mov r13,QWORD[((-32))+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm3,XMMWORD[((-16))+rdi]

+ mov DWORD[36+rsp],ecx

+ cmovle r9,rsp

+ mov ecx,DWORD[16+rdi]

+ mov r10,QWORD[rdi]

+ cmp ecx,edx

+ mov r14,QWORD[8+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm4,XMMWORD[24+rdi]

+ mov DWORD[40+rsp],ecx

+ cmovle r10,rsp

+ mov ecx,DWORD[56+rdi]

+ mov r11,QWORD[40+rdi]

+ cmp ecx,edx

+ mov r15,QWORD[48+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm5,XMMWORD[64+rdi]

+ mov DWORD[44+rsp],ecx

+ cmovle r11,rsp

+ test edx,edx

+ jz NEAR $L$enc4x_done

+

+ movups xmm1,XMMWORD[((16-120))+rsi]

+ pxor xmm2,xmm12

+ movups xmm0,XMMWORD[((32-120))+rsi]

+ pxor xmm3,xmm12

+ mov eax,DWORD[((240-120))+rsi]

+ pxor xmm4,xmm12

+ movdqu xmm6,XMMWORD[r8]

+ pxor xmm5,xmm12

+ movdqu xmm7,XMMWORD[r9]

+ pxor xmm2,xmm6

+ movdqu xmm8,XMMWORD[r10]

+ pxor xmm3,xmm7

+ movdqu xmm9,XMMWORD[r11]

+ pxor xmm4,xmm8

+ pxor xmm5,xmm9

+ movdqa xmm10,XMMWORD[32+rsp]

+ xor rbx,rbx

+ jmp NEAR $L$oop_enc4x

+

+ALIGN 32

+$L$oop_enc4x:

+ add rbx,16

+ lea rbp,[16+rsp]

+ mov ecx,1

+ sub rbp,rbx

+

+DB 102,15,56,220,209

+ prefetcht0 [31+rbx*1+r8]

+ prefetcht0 [31+rbx*1+r9]

+DB 102,15,56,220,217

+ prefetcht0 [31+rbx*1+r10]

+ prefetcht0 [31+rbx*1+r10]

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((48-120))+rsi]

+ cmp ecx,DWORD[32+rsp]

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+ cmovge r8,rbp

+ cmovg r12,rbp

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((-56))+rsi]

+ cmp ecx,DWORD[36+rsp]

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+ cmovge r9,rbp

+ cmovg r13,rbp

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((-40))+rsi]

+ cmp ecx,DWORD[40+rsp]

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+ cmovge r10,rbp

+ cmovg r14,rbp

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((-24))+rsi]

+ cmp ecx,DWORD[44+rsp]

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+ cmovge r11,rbp

+ cmovg r15,rbp

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((-8))+rsi]

+ movdqa xmm11,xmm10

+DB 102,15,56,220,208

+ prefetcht0 [15+rbx*1+r12]

+ prefetcht0 [15+rbx*1+r13]

+DB 102,15,56,220,216

+ prefetcht0 [15+rbx*1+r14]

+ prefetcht0 [15+rbx*1+r15]

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((128-120))+rsi]

+ pxor xmm12,xmm12

+

+DB 102,15,56,220,209

+ pcmpgtd xmm11,xmm12

+ movdqu xmm12,XMMWORD[((-120))+rsi]

+DB 102,15,56,220,217

+ paddd xmm10,xmm11

+ movdqa XMMWORD[32+rsp],xmm10

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((144-120))+rsi]

+

+ cmp eax,11

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((160-120))+rsi]

+

+ jb NEAR $L$enc4x_tail

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((176-120))+rsi]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((192-120))+rsi]

+

+ je NEAR $L$enc4x_tail

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((208-120))+rsi]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((224-120))+rsi]

+ jmp NEAR $L$enc4x_tail

+

+ALIGN 32

+$L$enc4x_tail:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movdqu xmm6,XMMWORD[rbx*1+r8]

+ movdqu xmm1,XMMWORD[((16-120))+rsi]

+

+DB 102,15,56,221,208

+ movdqu xmm7,XMMWORD[rbx*1+r9]

+ pxor xmm6,xmm12

+DB 102,15,56,221,216

+ movdqu xmm8,XMMWORD[rbx*1+r10]

+ pxor xmm7,xmm12

+DB 102,15,56,221,224

+ movdqu xmm9,XMMWORD[rbx*1+r11]

+ pxor xmm8,xmm12

+DB 102,15,56,221,232

+ movdqu xmm0,XMMWORD[((32-120))+rsi]

+ pxor xmm9,xmm12

+

+ movups XMMWORD[(-16)+rbx*1+r12],xmm2

+ pxor xmm2,xmm6

+ movups XMMWORD[(-16)+rbx*1+r13],xmm3

+ pxor xmm3,xmm7

+ movups XMMWORD[(-16)+rbx*1+r14],xmm4

+ pxor xmm4,xmm8

+ movups XMMWORD[(-16)+rbx*1+r15],xmm5

+ pxor xmm5,xmm9

+

+ dec edx

+ jnz NEAR $L$oop_enc4x

+

+ mov rax,QWORD[16+rsp]

+

+ mov edx,DWORD[24+rsp]

+

+

+

+

+

+

+

+

+

+

+ lea rdi,[160+rdi]

+ dec edx

+ jnz NEAR $L$enc4x_loop_grande

+

+$L$enc4x_done:

+ movaps xmm6,XMMWORD[((-216))+rax]

+ movaps xmm7,XMMWORD[((-200))+rax]

+ movaps xmm8,XMMWORD[((-184))+rax]

+ movaps xmm9,XMMWORD[((-168))+rax]

+ movaps xmm10,XMMWORD[((-152))+rax]

+ movaps xmm11,XMMWORD[((-136))+rax]

+ movaps xmm12,XMMWORD[((-120))+rax]

+

+

+

+ mov r15,QWORD[((-48))+rax]

+

+ mov r14,QWORD[((-40))+rax]

+

+ mov r13,QWORD[((-32))+rax]

+

+ mov r12,QWORD[((-24))+rax]

+

+ mov rbp,QWORD[((-16))+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+

+ lea rsp,[rax]

+

+$L$enc4x_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_multi_cbc_encrypt:

+

+global aesni_multi_cbc_decrypt

+

+ALIGN 32

+aesni_multi_cbc_decrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_multi_cbc_decrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ mov rax,rsp

+

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ push r15

+

+ lea rsp,[((-168))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+ movaps XMMWORD[64+rsp],xmm10

+ movaps XMMWORD[80+rsp],xmm11

+ movaps XMMWORD[96+rsp],xmm12

+ movaps XMMWORD[(-104)+rax],xmm13

+ movaps XMMWORD[(-88)+rax],xmm14

+ movaps XMMWORD[(-72)+rax],xmm15

+

+

+

+

+

+

+ sub rsp,48

+ and rsp,-64

+ mov QWORD[16+rsp],rax

+

+

+$L$dec4x_body:

+ movdqu xmm12,XMMWORD[rsi]

+ lea rsi,[120+rsi]

+ lea rdi,[80+rdi]

+

+$L$dec4x_loop_grande:

+ mov DWORD[24+rsp],edx

+ xor edx,edx

+ mov ecx,DWORD[((-64))+rdi]

+ mov r8,QWORD[((-80))+rdi]

+ cmp ecx,edx

+ mov r12,QWORD[((-72))+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm6,XMMWORD[((-56))+rdi]

+ mov DWORD[32+rsp],ecx

+ cmovle r8,rsp

+ mov ecx,DWORD[((-24))+rdi]

+ mov r9,QWORD[((-40))+rdi]

+ cmp ecx,edx

+ mov r13,QWORD[((-32))+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm7,XMMWORD[((-16))+rdi]

+ mov DWORD[36+rsp],ecx

+ cmovle r9,rsp

+ mov ecx,DWORD[16+rdi]

+ mov r10,QWORD[rdi]

+ cmp ecx,edx

+ mov r14,QWORD[8+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm8,XMMWORD[24+rdi]

+ mov DWORD[40+rsp],ecx

+ cmovle r10,rsp

+ mov ecx,DWORD[56+rdi]

+ mov r11,QWORD[40+rdi]

+ cmp ecx,edx

+ mov r15,QWORD[48+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm9,XMMWORD[64+rdi]

+ mov DWORD[44+rsp],ecx

+ cmovle r11,rsp

+ test edx,edx

+ jz NEAR $L$dec4x_done

+

+ movups xmm1,XMMWORD[((16-120))+rsi]

+ movups xmm0,XMMWORD[((32-120))+rsi]

+ mov eax,DWORD[((240-120))+rsi]

+ movdqu xmm2,XMMWORD[r8]

+ movdqu xmm3,XMMWORD[r9]

+ pxor xmm2,xmm12

+ movdqu xmm4,XMMWORD[r10]

+ pxor xmm3,xmm12

+ movdqu xmm5,XMMWORD[r11]

+ pxor xmm4,xmm12

+ pxor xmm5,xmm12

+ movdqa xmm10,XMMWORD[32+rsp]

+ xor rbx,rbx

+ jmp NEAR $L$oop_dec4x

+

+ALIGN 32

+$L$oop_dec4x:

+ add rbx,16

+ lea rbp,[16+rsp]

+ mov ecx,1

+ sub rbp,rbx

+

+DB 102,15,56,222,209

+ prefetcht0 [31+rbx*1+r8]

+ prefetcht0 [31+rbx*1+r9]

+DB 102,15,56,222,217

+ prefetcht0 [31+rbx*1+r10]

+ prefetcht0 [31+rbx*1+r11]

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((48-120))+rsi]

+ cmp ecx,DWORD[32+rsp]

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+ cmovge r8,rbp

+ cmovg r12,rbp

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((-56))+rsi]

+ cmp ecx,DWORD[36+rsp]

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+ cmovge r9,rbp

+ cmovg r13,rbp

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((-40))+rsi]

+ cmp ecx,DWORD[40+rsp]

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+ cmovge r10,rbp

+ cmovg r14,rbp

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((-24))+rsi]

+ cmp ecx,DWORD[44+rsp]

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+ cmovge r11,rbp

+ cmovg r15,rbp

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((-8))+rsi]

+ movdqa xmm11,xmm10

+DB 102,15,56,222,208

+ prefetcht0 [15+rbx*1+r12]

+ prefetcht0 [15+rbx*1+r13]

+DB 102,15,56,222,216

+ prefetcht0 [15+rbx*1+r14]

+ prefetcht0 [15+rbx*1+r15]

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((128-120))+rsi]

+ pxor xmm12,xmm12

+

+DB 102,15,56,222,209

+ pcmpgtd xmm11,xmm12

+ movdqu xmm12,XMMWORD[((-120))+rsi]

+DB 102,15,56,222,217

+ paddd xmm10,xmm11

+ movdqa XMMWORD[32+rsp],xmm10

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((144-120))+rsi]

+

+ cmp eax,11

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((160-120))+rsi]

+

+ jb NEAR $L$dec4x_tail

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((176-120))+rsi]

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((192-120))+rsi]

+

+ je NEAR $L$dec4x_tail

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((208-120))+rsi]

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((224-120))+rsi]

+ jmp NEAR $L$dec4x_tail

+

+ALIGN 32

+$L$dec4x_tail:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+ pxor xmm6,xmm0

+ pxor xmm7,xmm0

+DB 102,15,56,222,233

+ movdqu xmm1,XMMWORD[((16-120))+rsi]

+ pxor xmm8,xmm0

+ pxor xmm9,xmm0

+ movdqu xmm0,XMMWORD[((32-120))+rsi]

+

+DB 102,15,56,223,214

+DB 102,15,56,223,223

+ movdqu xmm6,XMMWORD[((-16))+rbx*1+r8]

+ movdqu xmm7,XMMWORD[((-16))+rbx*1+r9]

+DB 102,65,15,56,223,224

+DB 102,65,15,56,223,233

+ movdqu xmm8,XMMWORD[((-16))+rbx*1+r10]

+ movdqu xmm9,XMMWORD[((-16))+rbx*1+r11]

+

+ movups XMMWORD[(-16)+rbx*1+r12],xmm2

+ movdqu xmm2,XMMWORD[rbx*1+r8]

+ movups XMMWORD[(-16)+rbx*1+r13],xmm3

+ movdqu xmm3,XMMWORD[rbx*1+r9]

+ pxor xmm2,xmm12

+ movups XMMWORD[(-16)+rbx*1+r14],xmm4

+ movdqu xmm4,XMMWORD[rbx*1+r10]

+ pxor xmm3,xmm12

+ movups XMMWORD[(-16)+rbx*1+r15],xmm5

+ movdqu xmm5,XMMWORD[rbx*1+r11]

+ pxor xmm4,xmm12

+ pxor xmm5,xmm12

+

+ dec edx

+ jnz NEAR $L$oop_dec4x

+

+ mov rax,QWORD[16+rsp]

+

+ mov edx,DWORD[24+rsp]

+

+ lea rdi,[160+rdi]

+ dec edx

+ jnz NEAR $L$dec4x_loop_grande

+

+$L$dec4x_done:

+ movaps xmm6,XMMWORD[((-216))+rax]

+ movaps xmm7,XMMWORD[((-200))+rax]

+ movaps xmm8,XMMWORD[((-184))+rax]

+ movaps xmm9,XMMWORD[((-168))+rax]

+ movaps xmm10,XMMWORD[((-152))+rax]

+ movaps xmm11,XMMWORD[((-136))+rax]

+ movaps xmm12,XMMWORD[((-120))+rax]

+

+

+

+ mov r15,QWORD[((-48))+rax]

+

+ mov r14,QWORD[((-40))+rax]

+

+ mov r13,QWORD[((-32))+rax]

+

+ mov r12,QWORD[((-24))+rax]

+

+ mov rbp,QWORD[((-16))+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+

+ lea rsp,[rax]

+

+$L$dec4x_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_multi_cbc_decrypt:

+EXTERN __imp_RtlVirtualUnwind

+

+ALIGN 16

+se_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$in_prologue

+

+ mov rax,QWORD[152+r8]

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$in_prologue

+

+ mov rax,QWORD[16+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+ mov rbp,QWORD[((-16))+rax]

+ mov r12,QWORD[((-24))+rax]

+ mov r13,QWORD[((-32))+rax]

+ mov r14,QWORD[((-40))+rax]

+ mov r15,QWORD[((-48))+rax]

+ mov QWORD[144+r8],rbx

+ mov QWORD[160+r8],rbp

+ mov QWORD[216+r8],r12

+ mov QWORD[224+r8],r13

+ mov QWORD[232+r8],r14

+ mov QWORD[240+r8],r15

+

+ lea rsi,[((-56-160))+rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+

+$L$in_prologue:

+ mov rdi,QWORD[8+rax]

+ mov rsi,QWORD[16+rax]

+ mov QWORD[152+r8],rax

+ mov QWORD[168+r8],rsi

+ mov QWORD[176+r8],rdi

+

+ mov rdi,QWORD[40+r9]

+ mov rsi,r8

+ mov ecx,154

+ DD 0xa548f3fc

+

+ mov rsi,r9

+ xor rcx,rcx

+ mov rdx,QWORD[8+rsi]

+ mov r8,QWORD[rsi]

+ mov r9,QWORD[16+rsi]

+ mov r10,QWORD[40+rsi]

+ lea r11,[56+rsi]

+ lea r12,[24+rsi]

+ mov QWORD[32+rsp],r10

+ mov QWORD[40+rsp],r11

+ mov QWORD[48+rsp],r12

+ mov QWORD[56+rsp],rcx

+ call QWORD[__imp_RtlVirtualUnwind]

+

+ mov eax,1

+ add rsp,64

+ popfq

+ pop r15

+ pop r14

+ pop r13

+ pop r12

+ pop rbp

+ pop rbx

+ pop rdi

+ pop rsi

+ DB 0F3h,0C3h ;repret

+

+

+section .pdata rdata align=4

+ALIGN 4

+ DD $L$SEH_begin_aesni_multi_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_multi_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_info_aesni_multi_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_begin_aesni_multi_cbc_decrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_multi_cbc_decrypt wrt ..imagebase

+ DD $L$SEH_info_aesni_multi_cbc_decrypt wrt ..imagebase

+section .xdata rdata align=8

+ALIGN 8

+$L$SEH_info_aesni_multi_cbc_encrypt:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$enc4x_body wrt ..imagebase,$L$enc4x_epilogue
wrt ..imagebase

+$L$SEH_info_aesni_multi_cbc_decrypt:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$dec4x_body wrt ..imagebase,$L$dec4x_epilogue
wrt ..imagebase

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-
x86_64.nasm b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-
x86_64.nasm
new file mode 100644
index 0000000000..f4fd9ca50d
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-
x86_64.nasm
@@ -0,0 +1,1916 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/aesni-sha1-x86_64.pl

+;

+; Copyright 2011-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+EXTERN OPENSSL_ia32cap_P

+

+global aesni_cbc_sha1_enc

+

+ALIGN 32

+aesni_cbc_sha1_enc:

+

+

+ mov r10d,DWORD[((OPENSSL_ia32cap_P+0))]

+ mov r11,QWORD[((OPENSSL_ia32cap_P+4))]

+ bt r11,61

+ jc NEAR aesni_cbc_sha1_enc_shaext

+ jmp NEAR aesni_cbc_sha1_enc_ssse3

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 32

+aesni_cbc_sha1_enc_ssse3:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_cbc_sha1_enc_ssse3:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ mov r10,QWORD[56+rsp]

+

+

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ push r15

+

+ lea rsp,[((-264))+rsp]

+

+

+

+ movaps XMMWORD[(96+0)+rsp],xmm6

+ movaps XMMWORD[(96+16)+rsp],xmm7

+ movaps XMMWORD[(96+32)+rsp],xmm8

+ movaps XMMWORD[(96+48)+rsp],xmm9

+ movaps XMMWORD[(96+64)+rsp],xmm10

+ movaps XMMWORD[(96+80)+rsp],xmm11

+ movaps XMMWORD[(96+96)+rsp],xmm12

+ movaps XMMWORD[(96+112)+rsp],xmm13

+ movaps XMMWORD[(96+128)+rsp],xmm14

+ movaps XMMWORD[(96+144)+rsp],xmm15

+$L$prologue_ssse3:

+ mov r12,rdi

+ mov r13,rsi

+ mov r14,rdx

+ lea r15,[112+rcx]

+ movdqu xmm2,XMMWORD[r8]

+ mov QWORD[88+rsp],r8

+ shl r14,6

+ sub r13,r12

+ mov r8d,DWORD[((240-112))+r15]

+ add r14,r10

+

+ lea r11,[K_XX_XX]

+ mov eax,DWORD[r9]

+ mov ebx,DWORD[4+r9]

+ mov ecx,DWORD[8+r9]

+ mov edx,DWORD[12+r9]

+ mov esi,ebx

+ mov ebp,DWORD[16+r9]

+ mov edi,ecx

+ xor edi,edx

+ and esi,edi

+

+ movdqa xmm3,XMMWORD[64+r11]

+ movdqa xmm13,XMMWORD[r11]

+ movdqu xmm4,XMMWORD[r10]

+ movdqu xmm5,XMMWORD[16+r10]

+ movdqu xmm6,XMMWORD[32+r10]

+ movdqu xmm7,XMMWORD[48+r10]

+DB 102,15,56,0,227

+DB 102,15,56,0,235

+DB 102,15,56,0,243

+ add r10,64

+ paddd xmm4,xmm13

+DB 102,15,56,0,251

+ paddd xmm5,xmm13

+ paddd xmm6,xmm13

+ movdqa XMMWORD[rsp],xmm4

+ psubd xmm4,xmm13

+ movdqa XMMWORD[16+rsp],xmm5

+ psubd xmm5,xmm13

+ movdqa XMMWORD[32+rsp],xmm6

+ psubd xmm6,xmm13

+ movups xmm15,XMMWORD[((-112))+r15]

+ movups xmm0,XMMWORD[((16-112))+r15]

+ jmp NEAR $L$oop_ssse3

+ALIGN 32

+$L$oop_ssse3:

+ ror ebx,2

+ movups xmm14,XMMWORD[r12]

+ xorps xmm14,xmm15

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+r15]

+DB 102,15,56,220,208

+ pshufd xmm8,xmm4,238

+ xor esi,edx

+ movdqa xmm12,xmm7

+ paddd xmm13,xmm7

+ mov edi,eax

+ add ebp,DWORD[rsp]

+ punpcklqdq xmm8,xmm5

+ xor ebx,ecx

+ rol eax,5

+ add ebp,esi

+ psrldq xmm12,4

+ and edi,ebx

+ xor ebx,ecx

+ pxor xmm8,xmm4

+ add ebp,eax

+ ror eax,7

+ pxor xmm12,xmm6

+ xor edi,ecx

+ mov esi,ebp

+ add edx,DWORD[4+rsp]

+ pxor xmm8,xmm12

+ xor eax,ebx

+ rol ebp,5

+ movdqa XMMWORD[48+rsp],xmm13

+ add edx,edi

+ movups xmm0,XMMWORD[((-64))+r15]

+DB 102,15,56,220,209

+ and esi,eax

+ movdqa xmm3,xmm8

+ xor eax,ebx

+ add edx,ebp

+ ror ebp,7

+ movdqa xmm12,xmm8

+ xor esi,ebx

+ pslldq xmm3,12

+ paddd xmm8,xmm8

+ mov edi,edx

+ add ecx,DWORD[8+rsp]

+ psrld xmm12,31

+ xor ebp,eax

+ rol edx,5

+ add ecx,esi

+ movdqa xmm13,xmm3

+ and edi,ebp

+ xor ebp,eax

+ psrld xmm3,30

+ add ecx,edx

+ ror edx,7

+ por xmm8,xmm12

+ xor edi,eax

+ mov esi,ecx

+ add ebx,DWORD[12+rsp]

+ movups xmm1,XMMWORD[((-48))+r15]

+DB 102,15,56,220,208

+ pslld xmm13,2

+ pxor xmm8,xmm3

+ xor edx,ebp

+ movdqa xmm3,XMMWORD[r11]

+ rol ecx,5

+ add ebx,edi

+ and esi,edx

+ pxor xmm8,xmm13

+ xor edx,ebp

+ add ebx,ecx

+ ror ecx,7

+ pshufd xmm9,xmm5,238

+ xor esi,ebp

+ movdqa xmm13,xmm8

+ paddd xmm3,xmm8

+ mov edi,ebx

+ add eax,DWORD[16+rsp]

+ punpcklqdq xmm9,xmm6

+ xor ecx,edx

+ rol ebx,5

+ add eax,esi

+ psrldq xmm13,4

+ and edi,ecx

+ xor ecx,edx

+ pxor xmm9,xmm5

+ add eax,ebx

+ ror ebx,7

+ movups xmm0,XMMWORD[((-32))+r15]

+DB 102,15,56,220,209

+ pxor xmm13,xmm7

+ xor edi,edx

+ mov esi,eax

+ add ebp,DWORD[20+rsp]

+ pxor xmm9,xmm13

+ xor ebx,ecx

+ rol eax,5

+ movdqa XMMWORD[rsp],xmm3

+ add ebp,edi

+ and esi,ebx

+ movdqa xmm12,xmm9

+ xor ebx,ecx

+ add ebp,eax

+ ror eax,7

+ movdqa xmm13,xmm9

+ xor esi,ecx

+ pslldq xmm12,12

+ paddd xmm9,xmm9

+ mov edi,ebp

+ add edx,DWORD[24+rsp]

+ psrld xmm13,31

+ xor eax,ebx

+ rol ebp,5

+ add edx,esi

+ movups xmm1,XMMWORD[((-16))+r15]

+DB 102,15,56,220,208

+ movdqa xmm3,xmm12

+ and edi,eax

+ xor eax,ebx

+ psrld xmm12,30

+ add edx,ebp

+ ror ebp,7

+ por xmm9,xmm13

+ xor edi,ebx

+ mov esi,edx

+ add ecx,DWORD[28+rsp]

+ pslld xmm3,2

+ pxor xmm9,xmm12

+ xor ebp,eax

+ movdqa xmm12,XMMWORD[16+r11]

+ rol edx,5

+ add ecx,edi

+ and esi,ebp

+ pxor xmm9,xmm3

+ xor ebp,eax

+ add ecx,edx

+ ror edx,7

+ pshufd xmm10,xmm6,238

+ xor esi,eax

+ movdqa xmm3,xmm9

+ paddd xmm12,xmm9

+ mov edi,ecx

+ add ebx,DWORD[32+rsp]

+ movups xmm0,XMMWORD[r15]

+DB 102,15,56,220,209

+ punpcklqdq xmm10,xmm7

+ xor edx,ebp

+ rol ecx,5

+ add ebx,esi

+ psrldq xmm3,4

+ and edi,edx

+ xor edx,ebp

+ pxor xmm10,xmm6

+ add ebx,ecx

+ ror ecx,7

+ pxor xmm3,xmm8

+ xor edi,ebp

+ mov esi,ebx

+ add eax,DWORD[36+rsp]

+ pxor xmm10,xmm3

+ xor ecx,edx

+ rol ebx,5

+ movdqa XMMWORD[16+rsp],xmm12

+ add eax,edi

+ and esi,ecx

+ movdqa xmm13,xmm10

+ xor ecx,edx

+ add eax,ebx

+ ror ebx,7

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ movdqa xmm3,xmm10

+ xor esi,edx

+ pslldq xmm13,12

+ paddd xmm10,xmm10

+ mov edi,eax

+ add ebp,DWORD[40+rsp]

+ psrld xmm3,31

+ xor ebx,ecx

+ rol eax,5

+ add ebp,esi

+ movdqa xmm12,xmm13

+ and edi,ebx

+ xor ebx,ecx

+ psrld xmm13,30

+ add ebp,eax

+ ror eax,7

+ por xmm10,xmm3

+ xor edi,ecx

+ mov esi,ebp

+ add edx,DWORD[44+rsp]

+ pslld xmm12,2

+ pxor xmm10,xmm13

+ xor eax,ebx

+ movdqa xmm13,XMMWORD[16+r11]

+ rol ebp,5

+ add edx,edi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ and esi,eax

+ pxor xmm10,xmm12

+ xor eax,ebx

+ add edx,ebp

+ ror ebp,7

+ pshufd xmm11,xmm7,238

+ xor esi,ebx

+ movdqa xmm12,xmm10

+ paddd xmm13,xmm10

+ mov edi,edx

+ add ecx,DWORD[48+rsp]

+ punpcklqdq xmm11,xmm8

+ xor ebp,eax

+ rol edx,5

+ add ecx,esi

+ psrldq xmm12,4

+ and edi,ebp

+ xor ebp,eax

+ pxor xmm11,xmm7

+ add ecx,edx

+ ror edx,7

+ pxor xmm12,xmm9

+ xor edi,eax

+ mov esi,ecx

+ add ebx,DWORD[52+rsp]

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ pxor xmm11,xmm12

+ xor edx,ebp

+ rol ecx,5

+ movdqa XMMWORD[32+rsp],xmm13

+ add ebx,edi

+ and esi,edx

+ movdqa xmm3,xmm11

+ xor edx,ebp

+ add ebx,ecx

+ ror ecx,7

+ movdqa xmm12,xmm11

+ xor esi,ebp

+ pslldq xmm3,12

+ paddd xmm11,xmm11

+ mov edi,ebx

+ add eax,DWORD[56+rsp]

+ psrld xmm12,31

+ xor ecx,edx

+ rol ebx,5

+ add eax,esi

+ movdqa xmm13,xmm3

+ and edi,ecx

+ xor ecx,edx

+ psrld xmm3,30

+ add eax,ebx

+ ror ebx,7

+ cmp r8d,11

+ jb NEAR $L$aesenclast1

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast1

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast1:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ por xmm11,xmm12

+ xor edi,edx

+ mov esi,eax

+ add ebp,DWORD[60+rsp]

+ pslld xmm13,2

+ pxor xmm11,xmm3

+ xor ebx,ecx

+ movdqa xmm3,XMMWORD[16+r11]

+ rol eax,5

+ add ebp,edi

+ and esi,ebx

+ pxor xmm11,xmm13

+ pshufd xmm13,xmm10,238

+ xor ebx,ecx

+ add ebp,eax

+ ror eax,7

+ pxor xmm4,xmm8

+ xor esi,ecx

+ mov edi,ebp

+ add edx,DWORD[rsp]

+ punpcklqdq xmm13,xmm11

+ xor eax,ebx

+ rol ebp,5

+ pxor xmm4,xmm5

+ add edx,esi

+ movups xmm14,XMMWORD[16+r12]

+ xorps xmm14,xmm15

+ movups XMMWORD[r13*1+r12],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+r15]

+DB 102,15,56,220,208

+ and edi,eax

+ movdqa xmm12,xmm3

+ xor eax,ebx

+ paddd xmm3,xmm11

+ add edx,ebp

+ pxor xmm4,xmm13

+ ror ebp,7

+ xor edi,ebx

+ mov esi,edx

+ add ecx,DWORD[4+rsp]

+ movdqa xmm13,xmm4

+ xor ebp,eax

+ rol edx,5

+ movdqa XMMWORD[48+rsp],xmm3

+ add ecx,edi

+ and esi,ebp

+ xor ebp,eax

+ pslld xmm4,2

+ add ecx,edx

+ ror edx,7

+ psrld xmm13,30

+ xor esi,eax

+ mov edi,ecx

+ add ebx,DWORD[8+rsp]

+ movups xmm0,XMMWORD[((-64))+r15]

+DB 102,15,56,220,209

+ por xmm4,xmm13

+ xor edx,ebp

+ rol ecx,5

+ pshufd xmm3,xmm11,238

+ add ebx,esi

+ and edi,edx

+ xor edx,ebp

+ add ebx,ecx

+ add eax,DWORD[12+rsp]

+ xor edi,ebp

+ mov esi,ebx

+ rol ebx,5

+ add eax,edi

+ xor esi,edx

+ ror ecx,7

+ add eax,ebx

+ pxor xmm5,xmm9

+ add ebp,DWORD[16+rsp]

+ movups xmm1,XMMWORD[((-48))+r15]

+DB 102,15,56,220,208

+ xor esi,ecx

+ punpcklqdq xmm3,xmm4

+ mov edi,eax

+ rol eax,5

+ pxor xmm5,xmm6

+ add ebp,esi

+ xor edi,ecx

+ movdqa xmm13,xmm12

+ ror ebx,7

+ paddd xmm12,xmm4

+ add ebp,eax

+ pxor xmm5,xmm3

+ add edx,DWORD[20+rsp]

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ movdqa xmm3,xmm5

+ add edx,edi

+ xor esi,ebx

+ movdqa XMMWORD[rsp],xmm12

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[24+rsp]

+ pslld xmm5,2

+ xor esi,eax

+ mov edi,edx

+ psrld xmm3,30

+ rol edx,5

+ add ecx,esi

+ movups xmm0,XMMWORD[((-32))+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ ror ebp,7

+ por xmm5,xmm3

+ add ecx,edx

+ add ebx,DWORD[28+rsp]

+ pshufd xmm12,xmm4,238

+ xor edi,ebp

+ mov esi,ecx

+ rol ecx,5

+ add ebx,edi

+ xor esi,ebp

+ ror edx,7

+ add ebx,ecx

+ pxor xmm6,xmm10

+ add eax,DWORD[32+rsp]

+ xor esi,edx

+ punpcklqdq xmm12,xmm5

+ mov edi,ebx

+ rol ebx,5

+ pxor xmm6,xmm7

+ add eax,esi

+ xor edi,edx

+ movdqa xmm3,XMMWORD[32+r11]

+ ror ecx,7

+ paddd xmm13,xmm5

+ add eax,ebx

+ pxor xmm6,xmm12

+ add ebp,DWORD[36+rsp]

+ movups xmm1,XMMWORD[((-16))+r15]

+DB 102,15,56,220,208

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ movdqa xmm12,xmm6

+ add ebp,edi

+ xor esi,ecx

+ movdqa XMMWORD[16+rsp],xmm13

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[40+rsp]

+ pslld xmm6,2

+ xor esi,ebx

+ mov edi,ebp

+ psrld xmm12,30

+ rol ebp,5

+ add edx,esi

+ xor edi,ebx

+ ror eax,7

+ por xmm6,xmm12

+ add edx,ebp

+ add ecx,DWORD[44+rsp]

+ pshufd xmm13,xmm5,238

+ xor edi,eax

+ mov esi,edx

+ rol edx,5

+ add ecx,edi

+ movups xmm0,XMMWORD[r15]

+DB 102,15,56,220,209

+ xor esi,eax

+ ror ebp,7

+ add ecx,edx

+ pxor xmm7,xmm11

+ add ebx,DWORD[48+rsp]

+ xor esi,ebp

+ punpcklqdq xmm13,xmm6

+ mov edi,ecx

+ rol ecx,5

+ pxor xmm7,xmm8

+ add ebx,esi

+ xor edi,ebp

+ movdqa xmm12,xmm3

+ ror edx,7

+ paddd xmm3,xmm6

+ add ebx,ecx

+ pxor xmm7,xmm13

+ add eax,DWORD[52+rsp]

+ xor edi,edx

+ mov esi,ebx

+ rol ebx,5

+ movdqa xmm13,xmm7

+ add eax,edi

+ xor esi,edx

+ movdqa XMMWORD[32+rsp],xmm3

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[56+rsp]

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ pslld xmm7,2

+ xor esi,ecx

+ mov edi,eax

+ psrld xmm13,30

+ rol eax,5

+ add ebp,esi

+ xor edi,ecx

+ ror ebx,7

+ por xmm7,xmm13

+ add ebp,eax

+ add edx,DWORD[60+rsp]

+ pshufd xmm3,xmm6,238

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ add edx,edi

+ xor esi,ebx

+ ror eax,7

+ add edx,ebp

+ pxor xmm8,xmm4

+ add ecx,DWORD[rsp]

+ xor esi,eax

+ punpcklqdq xmm3,xmm7

+ mov edi,edx

+ rol edx,5

+ pxor xmm8,xmm9

+ add ecx,esi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ movdqa xmm13,xmm12

+ ror ebp,7

+ paddd xmm12,xmm7

+ add ecx,edx

+ pxor xmm8,xmm3

+ add ebx,DWORD[4+rsp]

+ xor edi,ebp

+ mov esi,ecx

+ rol ecx,5

+ movdqa xmm3,xmm8

+ add ebx,edi

+ xor esi,ebp

+ movdqa XMMWORD[48+rsp],xmm12

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[8+rsp]

+ pslld xmm8,2

+ xor esi,edx

+ mov edi,ebx

+ psrld xmm3,30

+ rol ebx,5

+ add eax,esi

+ xor edi,edx

+ ror ecx,7

+ por xmm8,xmm3

+ add eax,ebx

+ add ebp,DWORD[12+rsp]

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ pshufd xmm12,xmm7,238

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ add ebp,edi

+ xor esi,ecx

+ ror ebx,7

+ add ebp,eax

+ pxor xmm9,xmm5

+ add edx,DWORD[16+rsp]

+ xor esi,ebx

+ punpcklqdq xmm12,xmm8

+ mov edi,ebp

+ rol ebp,5

+ pxor xmm9,xmm10

+ add edx,esi

+ xor edi,ebx

+ movdqa xmm3,xmm13

+ ror eax,7

+ paddd xmm13,xmm8

+ add edx,ebp

+ pxor xmm9,xmm12

+ add ecx,DWORD[20+rsp]

+ xor edi,eax

+ mov esi,edx

+ rol edx,5

+ movdqa xmm12,xmm9

+ add ecx,edi

+ cmp r8d,11

+ jb NEAR $L$aesenclast2

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast2

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast2:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ xor esi,eax

+ movdqa XMMWORD[rsp],xmm13

+ ror ebp,7

+ add ecx,edx

+ add ebx,DWORD[24+rsp]

+ pslld xmm9,2

+ xor esi,ebp

+ mov edi,ecx

+ psrld xmm12,30

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ por xmm9,xmm12

+ add ebx,ecx

+ add eax,DWORD[28+rsp]

+ pshufd xmm13,xmm8,238

+ ror ecx,7

+ mov esi,ebx

+ xor edi,edx

+ rol ebx,5

+ add eax,edi

+ xor esi,ecx

+ xor ecx,edx

+ add eax,ebx

+ pxor xmm10,xmm6

+ add ebp,DWORD[32+rsp]

+ movups xmm14,XMMWORD[32+r12]

+ xorps xmm14,xmm15

+ movups XMMWORD[16+r12*1+r13],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+r15]

+DB 102,15,56,220,208

+ and esi,ecx

+ xor ecx,edx

+ ror ebx,7

+ punpcklqdq xmm13,xmm9

+ mov edi,eax

+ xor esi,ecx

+ pxor xmm10,xmm11

+ rol eax,5

+ add ebp,esi

+ movdqa xmm12,xmm3

+ xor edi,ebx

+ paddd xmm3,xmm9

+ xor ebx,ecx

+ pxor xmm10,xmm13

+ add ebp,eax

+ add edx,DWORD[36+rsp]

+ and edi,ebx

+ xor ebx,ecx

+ ror eax,7

+ movdqa xmm13,xmm10

+ mov esi,ebp

+ xor edi,ebx

+ movdqa XMMWORD[16+rsp],xmm3

+ rol ebp,5

+ add edx,edi

+ movups xmm0,XMMWORD[((-64))+r15]

+DB 102,15,56,220,209

+ xor esi,eax

+ pslld xmm10,2

+ xor eax,ebx

+ add edx,ebp

+ psrld xmm13,30

+ add ecx,DWORD[40+rsp]

+ and esi,eax

+ xor eax,ebx

+ por xmm10,xmm13

+ ror ebp,7

+ mov edi,edx

+ xor esi,eax

+ rol edx,5

+ pshufd xmm3,xmm9,238

+ add ecx,esi

+ xor edi,ebp

+ xor ebp,eax

+ add ecx,edx

+ add ebx,DWORD[44+rsp]

+ and edi,ebp

+ xor ebp,eax

+ ror edx,7

+ movups xmm1,XMMWORD[((-48))+r15]

+DB 102,15,56,220,208

+ mov esi,ecx

+ xor edi,ebp

+ rol ecx,5

+ add ebx,edi

+ xor esi,edx

+ xor edx,ebp

+ add ebx,ecx

+ pxor xmm11,xmm7

+ add eax,DWORD[48+rsp]

+ and esi,edx

+ xor edx,ebp

+ ror ecx,7

+ punpcklqdq xmm3,xmm10

+ mov edi,ebx

+ xor esi,edx

+ pxor xmm11,xmm4

+ rol ebx,5

+ add eax,esi

+ movdqa xmm13,XMMWORD[48+r11]

+ xor edi,ecx

+ paddd xmm12,xmm10

+ xor ecx,edx

+ pxor xmm11,xmm3

+ add eax,ebx

+ add ebp,DWORD[52+rsp]

+ movups xmm0,XMMWORD[((-32))+r15]

+DB 102,15,56,220,209

+ and edi,ecx

+ xor ecx,edx

+ ror ebx,7

+ movdqa xmm3,xmm11

+ mov esi,eax

+ xor edi,ecx

+ movdqa XMMWORD[32+rsp],xmm12

+ rol eax,5

+ add ebp,edi

+ xor esi,ebx

+ pslld xmm11,2

+ xor ebx,ecx

+ add ebp,eax

+ psrld xmm3,30

+ add edx,DWORD[56+rsp]

+ and esi,ebx

+ xor ebx,ecx

+ por xmm11,xmm3

+ ror eax,7

+ mov edi,ebp

+ xor esi,ebx

+ rol ebp,5

+ pshufd xmm12,xmm10,238

+ add edx,esi

+ movups xmm1,XMMWORD[((-16))+r15]

+DB 102,15,56,220,208

+ xor edi,eax

+ xor eax,ebx

+ add edx,ebp

+ add ecx,DWORD[60+rsp]

+ and edi,eax

+ xor eax,ebx

+ ror ebp,7

+ mov esi,edx

+ xor edi,eax

+ rol edx,5

+ add ecx,edi

+ xor esi,ebp

+ xor ebp,eax

+ add ecx,edx

+ pxor xmm4,xmm8

+ add ebx,DWORD[rsp]

+ and esi,ebp

+ xor ebp,eax

+ ror edx,7

+ movups xmm0,XMMWORD[r15]

+DB 102,15,56,220,209

+ punpcklqdq xmm12,xmm11

+ mov edi,ecx

+ xor esi,ebp

+ pxor xmm4,xmm5

+ rol ecx,5

+ add ebx,esi

+ movdqa xmm3,xmm13

+ xor edi,edx

+ paddd xmm13,xmm11

+ xor edx,ebp

+ pxor xmm4,xmm12

+ add ebx,ecx

+ add eax,DWORD[4+rsp]

+ and edi,edx

+ xor edx,ebp

+ ror ecx,7

+ movdqa xmm12,xmm4

+ mov esi,ebx

+ xor edi,edx

+ movdqa XMMWORD[48+rsp],xmm13

+ rol ebx,5

+ add eax,edi

+ xor esi,ecx

+ pslld xmm4,2

+ xor ecx,edx

+ add eax,ebx

+ psrld xmm12,30

+ add ebp,DWORD[8+rsp]

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ and esi,ecx

+ xor ecx,edx

+ por xmm4,xmm12

+ ror ebx,7

+ mov edi,eax

+ xor esi,ecx

+ rol eax,5

+ pshufd xmm13,xmm11,238

+ add ebp,esi

+ xor edi,ebx

+ xor ebx,ecx

+ add ebp,eax

+ add edx,DWORD[12+rsp]

+ and edi,ebx

+ xor ebx,ecx

+ ror eax,7

+ mov esi,ebp

+ xor edi,ebx

+ rol ebp,5

+ add edx,edi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ xor esi,eax

+ xor eax,ebx

+ add edx,ebp

+ pxor xmm5,xmm9

+ add ecx,DWORD[16+rsp]

+ and esi,eax

+ xor eax,ebx

+ ror ebp,7

+ punpcklqdq xmm13,xmm4

+ mov edi,edx

+ xor esi,eax

+ pxor xmm5,xmm6

+ rol edx,5

+ add ecx,esi

+ movdqa xmm12,xmm3

+ xor edi,ebp

+ paddd xmm3,xmm4

+ xor ebp,eax

+ pxor xmm5,xmm13

+ add ecx,edx

+ add ebx,DWORD[20+rsp]

+ and edi,ebp

+ xor ebp,eax

+ ror edx,7

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ movdqa xmm13,xmm5

+ mov esi,ecx

+ xor edi,ebp

+ movdqa XMMWORD[rsp],xmm3

+ rol ecx,5

+ add ebx,edi

+ xor esi,edx

+ pslld xmm5,2

+ xor edx,ebp

+ add ebx,ecx

+ psrld xmm13,30

+ add eax,DWORD[24+rsp]

+ and esi,edx

+ xor edx,ebp

+ por xmm5,xmm13

+ ror ecx,7

+ mov edi,ebx

+ xor esi,edx

+ rol ebx,5

+ pshufd xmm3,xmm4,238

+ add eax,esi

+ xor edi,ecx

+ xor ecx,edx

+ add eax,ebx

+ add ebp,DWORD[28+rsp]

+ cmp r8d,11

+ jb NEAR $L$aesenclast3

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast3

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast3:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ and edi,ecx

+ xor ecx,edx

+ ror ebx,7

+ mov esi,eax

+ xor edi,ecx

+ rol eax,5

+ add ebp,edi

+ xor esi,ebx

+ xor ebx,ecx

+ add ebp,eax

+ pxor xmm6,xmm10

+ add edx,DWORD[32+rsp]

+ and esi,ebx

+ xor ebx,ecx

+ ror eax,7

+ punpcklqdq xmm3,xmm5

+ mov edi,ebp

+ xor esi,ebx

+ pxor xmm6,xmm7

+ rol ebp,5

+ add edx,esi

+ movups xmm14,XMMWORD[48+r12]

+ xorps xmm14,xmm15

+ movups XMMWORD[32+r12*1+r13],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+r15]

+DB 102,15,56,220,208

+ movdqa xmm13,xmm12

+ xor edi,eax

+ paddd xmm12,xmm5

+ xor eax,ebx

+ pxor xmm6,xmm3

+ add edx,ebp

+ add ecx,DWORD[36+rsp]

+ and edi,eax

+ xor eax,ebx

+ ror ebp,7

+ movdqa xmm3,xmm6

+ mov esi,edx

+ xor edi,eax

+ movdqa XMMWORD[16+rsp],xmm12

+ rol edx,5

+ add ecx,edi

+ xor esi,ebp

+ pslld xmm6,2

+ xor ebp,eax

+ add ecx,edx

+ psrld xmm3,30

+ add ebx,DWORD[40+rsp]

+ and esi,ebp

+ xor ebp,eax

+ por xmm6,xmm3

+ ror edx,7

+ movups xmm0,XMMWORD[((-64))+r15]

+DB 102,15,56,220,209

+ mov edi,ecx

+ xor esi,ebp

+ rol ecx,5

+ pshufd xmm12,xmm5,238

+ add ebx,esi

+ xor edi,edx

+ xor edx,ebp

+ add ebx,ecx

+ add eax,DWORD[44+rsp]

+ and edi,edx

+ xor edx,ebp

+ ror ecx,7

+ mov esi,ebx

+ xor edi,edx

+ rol ebx,5

+ add eax,edi

+ xor esi,edx

+ add eax,ebx

+ pxor xmm7,xmm11

+ add ebp,DWORD[48+rsp]

+ movups xmm1,XMMWORD[((-48))+r15]

+DB 102,15,56,220,208

+ xor esi,ecx

+ punpcklqdq xmm12,xmm6

+ mov edi,eax

+ rol eax,5

+ pxor xmm7,xmm8

+ add ebp,esi

+ xor edi,ecx

+ movdqa xmm3,xmm13

+ ror ebx,7

+ paddd xmm13,xmm6

+ add ebp,eax

+ pxor xmm7,xmm12

+ add edx,DWORD[52+rsp]

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ movdqa xmm12,xmm7

+ add edx,edi

+ xor esi,ebx

+ movdqa XMMWORD[32+rsp],xmm13

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[56+rsp]

+ pslld xmm7,2

+ xor esi,eax

+ mov edi,edx

+ psrld xmm12,30

+ rol edx,5

+ add ecx,esi

+ movups xmm0,XMMWORD[((-32))+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ ror ebp,7

+ por xmm7,xmm12

+ add ecx,edx

+ add ebx,DWORD[60+rsp]

+ xor edi,ebp

+ mov esi,ecx

+ rol ecx,5

+ add ebx,edi

+ xor esi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[rsp]

+ xor esi,edx

+ mov edi,ebx

+ rol ebx,5

+ paddd xmm3,xmm7

+ add eax,esi

+ xor edi,edx

+ movdqa XMMWORD[48+rsp],xmm3

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[4+rsp]

+ movups xmm1,XMMWORD[((-16))+r15]

+DB 102,15,56,220,208

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ add ebp,edi

+ xor esi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[8+rsp]

+ xor esi,ebx

+ mov edi,ebp

+ rol ebp,5

+ add edx,esi

+ xor edi,ebx

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[12+rsp]

+ xor edi,eax

+ mov esi,edx

+ rol edx,5

+ add ecx,edi

+ movups xmm0,XMMWORD[r15]

+DB 102,15,56,220,209

+ xor esi,eax

+ ror ebp,7

+ add ecx,edx

+ cmp r10,r14

+ je NEAR $L$done_ssse3

+ movdqa xmm3,XMMWORD[64+r11]

+ movdqa xmm13,XMMWORD[r11]

+ movdqu xmm4,XMMWORD[r10]

+ movdqu xmm5,XMMWORD[16+r10]

+ movdqu xmm6,XMMWORD[32+r10]

+ movdqu xmm7,XMMWORD[48+r10]

+DB 102,15,56,0,227

+ add r10,64

+ add ebx,DWORD[16+rsp]

+ xor esi,ebp

+ mov edi,ecx

+DB 102,15,56,0,235

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ paddd xmm4,xmm13

+ add ebx,ecx

+ add eax,DWORD[20+rsp]

+ xor edi,edx

+ mov esi,ebx

+ movdqa XMMWORD[rsp],xmm4

+ rol ebx,5

+ add eax,edi

+ xor esi,edx

+ ror ecx,7

+ psubd xmm4,xmm13

+ add eax,ebx

+ add ebp,DWORD[24+rsp]

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ xor esi,ecx

+ mov edi,eax

+ rol eax,5

+ add ebp,esi

+ xor edi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[28+rsp]

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ add edx,edi

+ xor esi,ebx

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[32+rsp]

+ xor esi,eax

+ mov edi,edx

+DB 102,15,56,0,243

+ rol edx,5

+ add ecx,esi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ ror ebp,7

+ paddd xmm5,xmm13

+ add ecx,edx

+ add ebx,DWORD[36+rsp]

+ xor edi,ebp

+ mov esi,ecx

+ movdqa XMMWORD[16+rsp],xmm5

+ rol ecx,5

+ add ebx,edi

+ xor esi,ebp

+ ror edx,7

+ psubd xmm5,xmm13

+ add ebx,ecx

+ add eax,DWORD[40+rsp]

+ xor esi,edx

+ mov edi,ebx

+ rol ebx,5

+ add eax,esi

+ xor edi,edx

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[44+rsp]

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ add ebp,edi

+ xor esi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[48+rsp]

+ xor esi,ebx

+ mov edi,ebp

+DB 102,15,56,0,251

+ rol ebp,5

+ add edx,esi

+ xor edi,ebx

+ ror eax,7

+ paddd xmm6,xmm13

+ add edx,ebp

+ add ecx,DWORD[52+rsp]

+ xor edi,eax

+ mov esi,edx

+ movdqa XMMWORD[32+rsp],xmm6

+ rol edx,5

+ add ecx,edi

+ cmp r8d,11

+ jb NEAR $L$aesenclast4

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast4

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast4:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ xor esi,eax

+ ror ebp,7

+ psubd xmm6,xmm13

+ add ecx,edx

+ add ebx,DWORD[56+rsp]

+ xor esi,ebp

+ mov edi,ecx

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[60+rsp]

+ xor edi,edx

+ mov esi,ebx

+ rol ebx,5

+ add eax,edi

+ ror ecx,7

+ add eax,ebx

+ movups XMMWORD[48+r12*1+r13],xmm2

+ lea r12,[64+r12]

+

+ add eax,DWORD[r9]

+ add esi,DWORD[4+r9]

+ add ecx,DWORD[8+r9]

+ add edx,DWORD[12+r9]

+ mov DWORD[r9],eax

+ add ebp,DWORD[16+r9]

+ mov DWORD[4+r9],esi

+ mov ebx,esi

+ mov DWORD[8+r9],ecx

+ mov edi,ecx

+ mov DWORD[12+r9],edx

+ xor edi,edx

+ mov DWORD[16+r9],ebp

+ and esi,edi

+ jmp NEAR $L$oop_ssse3

+

+$L$done_ssse3:

+ add ebx,DWORD[16+rsp]

+ xor esi,ebp

+ mov edi,ecx

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[20+rsp]

+ xor edi,edx

+ mov esi,ebx

+ rol ebx,5

+ add eax,edi

+ xor esi,edx

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[24+rsp]

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ xor esi,ecx

+ mov edi,eax

+ rol eax,5

+ add ebp,esi

+ xor edi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[28+rsp]

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ add edx,edi

+ xor esi,ebx

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[32+rsp]

+ xor esi,eax

+ mov edi,edx

+ rol edx,5

+ add ecx,esi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ ror ebp,7

+ add ecx,edx

+ add ebx,DWORD[36+rsp]

+ xor edi,ebp

+ mov esi,ecx

+ rol ecx,5

+ add ebx,edi

+ xor esi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[40+rsp]

+ xor esi,edx

+ mov edi,ebx

+ rol ebx,5

+ add eax,esi

+ xor edi,edx

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[44+rsp]

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ add ebp,edi

+ xor esi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[48+rsp]

+ xor esi,ebx

+ mov edi,ebp

+ rol ebp,5

+ add edx,esi

+ xor edi,ebx

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[52+rsp]

+ xor edi,eax

+ mov esi,edx

+ rol edx,5

+ add ecx,edi

+ cmp r8d,11

+ jb NEAR $L$aesenclast5

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast5

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast5:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ xor esi,eax

+ ror ebp,7

+ add ecx,edx

+ add ebx,DWORD[56+rsp]

+ xor esi,ebp

+ mov edi,ecx

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[60+rsp]

+ xor edi,edx

+ mov esi,ebx

+ rol ebx,5

+ add eax,edi

+ ror ecx,7

+ add eax,ebx

+ movups XMMWORD[48+r12*1+r13],xmm2

+ mov r8,QWORD[88+rsp]

+

+ add eax,DWORD[r9]

+ add esi,DWORD[4+r9]

+ add ecx,DWORD[8+r9]

+ mov DWORD[r9],eax

+ add edx,DWORD[12+r9]

+ mov DWORD[4+r9],esi

+ add ebp,DWORD[16+r9]

+ mov DWORD[8+r9],ecx

+ mov DWORD[12+r9],edx

+ mov DWORD[16+r9],ebp

+ movups XMMWORD[r8],xmm2

+ movaps xmm6,XMMWORD[((96+0))+rsp]

+ movaps xmm7,XMMWORD[((96+16))+rsp]

+ movaps xmm8,XMMWORD[((96+32))+rsp]

+ movaps xmm9,XMMWORD[((96+48))+rsp]

+ movaps xmm10,XMMWORD[((96+64))+rsp]

+ movaps xmm11,XMMWORD[((96+80))+rsp]

+ movaps xmm12,XMMWORD[((96+96))+rsp]

+ movaps xmm13,XMMWORD[((96+112))+rsp]

+ movaps xmm14,XMMWORD[((96+128))+rsp]

+ movaps xmm15,XMMWORD[((96+144))+rsp]

+ lea rsi,[264+rsp]

+

+ mov r15,QWORD[rsi]

+

+ mov r14,QWORD[8+rsi]

+

+ mov r13,QWORD[16+rsi]

+

+ mov r12,QWORD[24+rsi]

+

+ mov rbp,QWORD[32+rsi]

+

+ mov rbx,QWORD[40+rsi]

+

+ lea rsp,[48+rsi]

+

+$L$epilogue_ssse3:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_cbc_sha1_enc_ssse3:

+ALIGN 64

+K_XX_XX:

+ DD 0x5a827999,0x5a827999,0x5a827999,0x5a827999

+ DD 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1

+ DD 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc

+ DD 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6

+ DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f

+DB 0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0

+

+DB 65,69,83,78,73,45,67,66,67,43,83,72,65,49,32,115

+DB 116,105,116,99,104,32,102,111,114,32,120,56,54,95,54,52

+DB 44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32

+DB 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111

+DB 114,103,62,0

+ALIGN 64

+

+ALIGN 32

+aesni_cbc_sha1_enc_shaext:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_cbc_sha1_enc_shaext:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ mov r10,QWORD[56+rsp]

+ lea rsp,[((-168))+rsp]

+ movaps XMMWORD[(-8-160)+rax],xmm6

+ movaps XMMWORD[(-8-144)+rax],xmm7

+ movaps XMMWORD[(-8-128)+rax],xmm8

+ movaps XMMWORD[(-8-112)+rax],xmm9

+ movaps XMMWORD[(-8-96)+rax],xmm10

+ movaps XMMWORD[(-8-80)+rax],xmm11

+ movaps XMMWORD[(-8-64)+rax],xmm12

+ movaps XMMWORD[(-8-48)+rax],xmm13

+ movaps XMMWORD[(-8-32)+rax],xmm14

+ movaps XMMWORD[(-8-16)+rax],xmm15

+$L$prologue_shaext:

+ movdqu xmm8,XMMWORD[r9]

+ movd xmm9,DWORD[16+r9]

+ movdqa xmm7,XMMWORD[((K_XX_XX+80))]

+

+ mov r11d,DWORD[240+rcx]

+ sub rsi,rdi

+ movups xmm15,XMMWORD[rcx]

+ movups xmm2,XMMWORD[r8]

+ movups xmm0,XMMWORD[16+rcx]

+ lea rcx,[112+rcx]

+

+ pshufd xmm8,xmm8,27

+ pshufd xmm9,xmm9,27

+ jmp NEAR $L$oop_shaext

+

+ALIGN 16

+$L$oop_shaext:

+ movups xmm14,XMMWORD[rdi]

+ xorps xmm14,xmm15

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+rcx]

+DB 102,15,56,220,208

+ movdqu xmm3,XMMWORD[r10]

+ movdqa xmm12,xmm9

+DB 102,15,56,0,223

+ movdqu xmm4,XMMWORD[16+r10]

+ movdqa xmm11,xmm8

+ movups xmm0,XMMWORD[((-64))+rcx]

+DB 102,15,56,220,209

+DB 102,15,56,0,231

+

+ paddd xmm9,xmm3

+ movdqu xmm5,XMMWORD[32+r10]

+ lea r10,[64+r10]

+ pxor xmm3,xmm12

+ movups xmm1,XMMWORD[((-48))+rcx]

+DB 102,15,56,220,208

+ pxor xmm3,xmm12

+ movdqa xmm10,xmm8

+DB 102,15,56,0,239

+DB 69,15,58,204,193,0

+DB 68,15,56,200,212

+ movups xmm0,XMMWORD[((-32))+rcx]

+DB 102,15,56,220,209

+DB 15,56,201,220

+ movdqu xmm6,XMMWORD[((-16))+r10]

+ movdqa xmm9,xmm8

+DB 102,15,56,0,247

+ movups xmm1,XMMWORD[((-16))+rcx]

+DB 102,15,56,220,208

+DB 69,15,58,204,194,0

+DB 68,15,56,200,205

+ pxor xmm3,xmm5

+DB 15,56,201,229

+ movups xmm0,XMMWORD[rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,0

+DB 68,15,56,200,214

+ movups xmm1,XMMWORD[16+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,222

+ pxor xmm4,xmm6

+DB 15,56,201,238

+ movups xmm0,XMMWORD[32+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,0

+DB 68,15,56,200,203

+ movups xmm1,XMMWORD[48+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,227

+ pxor xmm5,xmm3

+DB 15,56,201,243

+ cmp r11d,11

+ jb NEAR $L$aesenclast6

+ movups xmm0,XMMWORD[64+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+rcx]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast6

+ movups xmm0,XMMWORD[96+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+rcx]

+DB 102,15,56,220,208

+$L$aesenclast6:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+rcx]

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,0

+DB 68,15,56,200,212

+ movups xmm14,XMMWORD[16+rdi]

+ xorps xmm14,xmm15

+ movups XMMWORD[rdi*1+rsi],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,236

+ pxor xmm6,xmm4

+DB 15,56,201,220

+ movups xmm0,XMMWORD[((-64))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,1

+DB 68,15,56,200,205

+ movups xmm1,XMMWORD[((-48))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,245

+ pxor xmm3,xmm5

+DB 15,56,201,229

+ movups xmm0,XMMWORD[((-32))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,1

+DB 68,15,56,200,214

+ movups xmm1,XMMWORD[((-16))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,222

+ pxor xmm4,xmm6

+DB 15,56,201,238

+ movups xmm0,XMMWORD[rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,1

+DB 68,15,56,200,203

+ movups xmm1,XMMWORD[16+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,227

+ pxor xmm5,xmm3

+DB 15,56,201,243

+ movups xmm0,XMMWORD[32+rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,1

+DB 68,15,56,200,212

+ movups xmm1,XMMWORD[48+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,236

+ pxor xmm6,xmm4

+DB 15,56,201,220

+ cmp r11d,11

+ jb NEAR $L$aesenclast7

+ movups xmm0,XMMWORD[64+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+rcx]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast7

+ movups xmm0,XMMWORD[96+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+rcx]

+DB 102,15,56,220,208

+$L$aesenclast7:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+rcx]

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,1

+DB 68,15,56,200,205

+ movups xmm14,XMMWORD[32+rdi]

+ xorps xmm14,xmm15

+ movups XMMWORD[16+rdi*1+rsi],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,245

+ pxor xmm3,xmm5

+DB 15,56,201,229

+ movups xmm0,XMMWORD[((-64))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,2

+DB 68,15,56,200,214

+ movups xmm1,XMMWORD[((-48))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,222

+ pxor xmm4,xmm6

+DB 15,56,201,238

+ movups xmm0,XMMWORD[((-32))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,2

+DB 68,15,56,200,203

+ movups xmm1,XMMWORD[((-16))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,227

+ pxor xmm5,xmm3

+DB 15,56,201,243

+ movups xmm0,XMMWORD[rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,2

+DB 68,15,56,200,212

+ movups xmm1,XMMWORD[16+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,236

+ pxor xmm6,xmm4

+DB 15,56,201,220

+ movups xmm0,XMMWORD[32+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,2

+DB 68,15,56,200,205

+ movups xmm1,XMMWORD[48+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,245

+ pxor xmm3,xmm5

+DB 15,56,201,229

+ cmp r11d,11

+ jb NEAR $L$aesenclast8

+ movups xmm0,XMMWORD[64+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+rcx]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast8

+ movups xmm0,XMMWORD[96+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+rcx]

+DB 102,15,56,220,208

+$L$aesenclast8:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+rcx]

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,2

+DB 68,15,56,200,214

+ movups xmm14,XMMWORD[48+rdi]

+ xorps xmm14,xmm15

+ movups XMMWORD[32+rdi*1+rsi],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,222

+ pxor xmm4,xmm6

+DB 15,56,201,238

+ movups xmm0,XMMWORD[((-64))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,3

+DB 68,15,56,200,203

+ movups xmm1,XMMWORD[((-48))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,227

+ pxor xmm5,xmm3

+DB 15,56,201,243

+ movups xmm0,XMMWORD[((-32))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,3

+DB 68,15,56,200,212

+DB 15,56,202,236

+ pxor xmm6,xmm4

+ movups xmm1,XMMWORD[((-16))+rcx]

+DB 102,15,56,220,208

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,3

+DB 68,15,56,200,205

+DB 15,56,202,245

+ movups xmm0,XMMWORD[rcx]

+DB 102,15,56,220,209

+ movdqa xmm5,xmm12

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,3

+DB 68,15,56,200,214

+ movups xmm1,XMMWORD[16+rcx]

+DB 102,15,56,220,208

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,3

+DB 68,15,56,200,205

+ movups xmm0,XMMWORD[32+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[48+rcx]

+DB 102,15,56,220,208

+ cmp r11d,11

+ jb NEAR $L$aesenclast9

+ movups xmm0,XMMWORD[64+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+rcx]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast9

+ movups xmm0,XMMWORD[96+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+rcx]

+DB 102,15,56,220,208

+$L$aesenclast9:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+rcx]

+ dec rdx

+

+ paddd xmm8,xmm11

+ movups XMMWORD[48+rdi*1+rsi],xmm2

+ lea rdi,[64+rdi]

+ jnz NEAR $L$oop_shaext

+

+ pshufd xmm8,xmm8,27

+ pshufd xmm9,xmm9,27

+ movups XMMWORD[r8],xmm2

+ movdqu XMMWORD[r9],xmm8

+ movd DWORD[16+r9],xmm9

+ movaps xmm6,XMMWORD[((-8-160))+rax]

+ movaps xmm7,XMMWORD[((-8-144))+rax]

+ movaps xmm8,XMMWORD[((-8-128))+rax]

+ movaps xmm9,XMMWORD[((-8-112))+rax]

+ movaps xmm10,XMMWORD[((-8-96))+rax]

+ movaps xmm11,XMMWORD[((-8-80))+rax]

+ movaps xmm12,XMMWORD[((-8-64))+rax]

+ movaps xmm13,XMMWORD[((-8-48))+rax]

+ movaps xmm14,XMMWORD[((-8-32))+rax]

+ movaps xmm15,XMMWORD[((-8-16))+rax]

+ mov rsp,rax

+$L$epilogue_shaext:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_cbc_sha1_enc_shaext:

+EXTERN __imp_RtlVirtualUnwind

+

+ALIGN 16

+ssse3_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$common_seh_tail

+

+ mov rax,QWORD[152+r8]

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$common_seh_tail

+ lea r10,[aesni_cbc_sha1_enc_shaext]

+ cmp rbx,r10

+ jb NEAR $L$seh_no_shaext

+

+ lea rsi,[rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+ lea rax,[168+rax]

+ jmp NEAR $L$common_seh_tail

+$L$seh_no_shaext:

+ lea rsi,[96+rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+ lea rax,[264+rax]

+

+ mov r15,QWORD[rax]

+ mov r14,QWORD[8+rax]

+ mov r13,QWORD[16+rax]

+ mov r12,QWORD[24+rax]

+ mov rbp,QWORD[32+rax]

+ mov rbx,QWORD[40+rax]

+ lea rax,[48+rax]

+ mov QWORD[144+r8],rbx

+ mov QWORD[160+r8],rbp

+ mov QWORD[216+r8],r12

+ mov QWORD[224+r8],r13

+ mov QWORD[232+r8],r14

+ mov QWORD[240+r8],r15

+

+$L$common_seh_tail:

+ mov rdi,QWORD[8+rax]

+ mov rsi,QWORD[16+rax]

+ mov QWORD[152+r8],rax

+ mov QWORD[168+r8],rsi

+ mov QWORD[176+r8],rdi

+

+ mov rdi,QWORD[40+r9]

+ mov rsi,r8

+ mov ecx,154

+ DD 0xa548f3fc

+

+ mov rsi,r9

+ xor rcx,rcx

+ mov rdx,QWORD[8+rsi]

+ mov r8,QWORD[rsi]

+ mov r9,QWORD[16+rsi]

+ mov r10,QWORD[40+rsi]

+ lea r11,[56+rsi]

+ lea r12,[24+rsi]

+ mov QWORD[32+rsp],r10

+ mov QWORD[40+rsp],r11

+ mov QWORD[48+rsp],r12

+ mov QWORD[56+rsp],rcx

+ call QWORD[__imp_RtlVirtualUnwind]

+

+ mov eax,1

+ add rsp,64

+ popfq

+ pop r15

+ pop r14

+ pop r13

+ pop r12

+ pop rbp

+ pop rbx

+ pop rdi

+ pop rsi

+ DB 0F3h,0C3h ;repret

+

+

+section .pdata rdata align=4

+ALIGN 4

+ DD $L$SEH_begin_aesni_cbc_sha1_enc_ssse3 wrt ..imagebase

+ DD $L$SEH_end_aesni_cbc_sha1_enc_ssse3 wrt ..imagebase

+ DD $L$SEH_info_aesni_cbc_sha1_enc_ssse3 wrt ..imagebase

+ DD $L$SEH_begin_aesni_cbc_sha1_enc_shaext wrt ..imagebase

+ DD $L$SEH_end_aesni_cbc_sha1_enc_shaext wrt ..imagebase

+ DD $L$SEH_info_aesni_cbc_sha1_enc_shaext wrt ..imagebase

+section .xdata rdata align=8

+ALIGN 8

+$L$SEH_info_aesni_cbc_sha1_enc_ssse3:

+DB 9,0,0,0

+ DD ssse3_handler wrt ..imagebase

+ DD $L$prologue_ssse3 wrt ..imagebase,$L$epilogue_ssse3
wrt ..imagebase

+$L$SEH_info_aesni_cbc_sha1_enc_shaext:

+DB 9,0,0,0

+ DD ssse3_handler wrt ..imagebase

+ DD $L$prologue_shaext wrt ..imagebase,$L$epilogue_shaext
wrt ..imagebase

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-
x86_64.nasm b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-
sha256-
x86_64.nasm
new file mode 100644
index 0000000000..f5c250b904
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-
x86_64.nasm
@@ -0,0 +1,78 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/aesni-sha256-x86_64.pl

+;

+; Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+

+EXTERN OPENSSL_ia32cap_P

+global aesni_cbc_sha256_enc

+

+ALIGN 16

+aesni_cbc_sha256_enc:

+

+ xor eax,eax

+ cmp rcx,0

+ je NEAR $L$probe

+ ud2

+$L$probe:

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 64

+

+K256:

+ DD 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5

+ DD 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5

+ DD 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5

+ DD 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5

+ DD 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3

+ DD 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3

+ DD 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174

+ DD 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174

+ DD 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc

+ DD 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc

+ DD 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da

+ DD 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da

+ DD 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7

+ DD 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7

+ DD 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967

+ DD 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967

+ DD 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13

+ DD 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13

+ DD 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85

+ DD 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85

+ DD 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3

+ DD 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3

+ DD 0xd192e819,0xd6990624,0xf40e3585,0x106aa070

+ DD 0xd192e819,0xd6990624,0xf40e3585,0x106aa070

+ DD 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5

+ DD 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5

+ DD 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3

+ DD 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3

+ DD 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208

+ DD 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208

+ DD 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2

+ DD 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2

+

+ DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f

+ DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f

+ DD 0,0,0,0,0,0,0,0,-1,-1,-1,-1

+ DD 0,0,0,0,0,0,0,0

+DB 65,69,83,78,73,45,67,66,67,43,83,72,65,50,53,54

+DB 32,115,116,105,116,99,104,32,102,111,114,32,120,56,54,95

+DB 54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98

+DB 121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108

+DB 46,111,114,103,62,0

+ALIGN 64

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-
x86_64.nasm
b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm
new file mode 100644
index 0000000000..57ee23ea8c
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm
@@ -0,0 +1,5103 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/aesni-x86_64.pl

+;

+; Copyright 2009-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+EXTERN OPENSSL_ia32cap_P

+global aesni_encrypt

+

+ALIGN 16

+aesni_encrypt:

+

+ movups xmm2,XMMWORD[rcx]

+ mov eax,DWORD[240+r8]

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[16+r8]

+ lea r8,[32+r8]

+ xorps xmm2,xmm0

+$L$oop_enc1_1:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[r8]

+ lea r8,[16+r8]

+ jnz NEAR $L$oop_enc1_1

+DB 102,15,56,221,209

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ movups XMMWORD[rdx],xmm2

+ pxor xmm2,xmm2

+ DB 0F3h,0C3h ;repret

+

+

+

+global aesni_decrypt

+

+ALIGN 16

+aesni_decrypt:

+

+ movups xmm2,XMMWORD[rcx]

+ mov eax,DWORD[240+r8]

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[16+r8]

+ lea r8,[32+r8]

+ xorps xmm2,xmm0

+$L$oop_dec1_2:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[r8]

+ lea r8,[16+r8]

+ jnz NEAR $L$oop_dec1_2

+DB 102,15,56,223,209

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ movups XMMWORD[rdx],xmm2

+ pxor xmm2,xmm2

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt2:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+ add rax,16

+

+$L$enc_loop2:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop2

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt2:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+ add rax,16

+

+$L$dec_loop2:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop2

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt3:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ xorps xmm4,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+ add rax,16

+

+$L$enc_loop3:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop3

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+DB 102,15,56,221,224

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt3:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ xorps xmm4,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+ add rax,16

+

+$L$dec_loop3:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop3

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+DB 102,15,56,223,224

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt4:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ xorps xmm4,xmm0

+ xorps xmm5,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 0x0f,0x1f,0x00

+ add rax,16

+

+$L$enc_loop4:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop4

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+DB 102,15,56,221,224

+DB 102,15,56,221,232

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt4:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ xorps xmm4,xmm0

+ xorps xmm5,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 0x0f,0x1f,0x00

+ add rax,16

+

+$L$dec_loop4:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop4

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+DB 102,15,56,223,224

+DB 102,15,56,223,232

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt6:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ pxor xmm3,xmm0

+ pxor xmm4,xmm0

+DB 102,15,56,220,209

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 102,15,56,220,217

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+DB 102,15,56,220,225

+ pxor xmm7,xmm0

+ movups xmm0,XMMWORD[rax*1+rcx]

+ add rax,16

+ jmp NEAR $L$enc_loop6_enter

+ALIGN 16

+$L$enc_loop6:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+$L$enc_loop6_enter:

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop6

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+DB 102,15,56,221,224

+DB 102,15,56,221,232

+DB 102,15,56,221,240

+DB 102,15,56,221,248

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt6:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ pxor xmm3,xmm0

+ pxor xmm4,xmm0

+DB 102,15,56,222,209

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 102,15,56,222,217

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+DB 102,15,56,222,225

+ pxor xmm7,xmm0

+ movups xmm0,XMMWORD[rax*1+rcx]

+ add rax,16

+ jmp NEAR $L$dec_loop6_enter

+ALIGN 16

+$L$dec_loop6:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+$L$dec_loop6_enter:

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop6

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+DB 102,15,56,223,224

+DB 102,15,56,223,232

+DB 102,15,56,223,240

+DB 102,15,56,223,248

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt8:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ pxor xmm4,xmm0

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 102,15,56,220,209

+ pxor xmm7,xmm0

+ pxor xmm8,xmm0

+DB 102,15,56,220,217

+ pxor xmm9,xmm0

+ movups xmm0,XMMWORD[rax*1+rcx]

+ add rax,16

+ jmp NEAR $L$enc_loop8_inner

+ALIGN 16

+$L$enc_loop8:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+$L$enc_loop8_inner:

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+$L$enc_loop8_enter:

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop8

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+DB 102,15,56,221,224

+DB 102,15,56,221,232

+DB 102,15,56,221,240

+DB 102,15,56,221,248

+DB 102,68,15,56,221,192

+DB 102,68,15,56,221,200

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt8:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ pxor xmm4,xmm0

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 102,15,56,222,209

+ pxor xmm7,xmm0

+ pxor xmm8,xmm0

+DB 102,15,56,222,217

+ pxor xmm9,xmm0

+ movups xmm0,XMMWORD[rax*1+rcx]

+ add rax,16

+ jmp NEAR $L$dec_loop8_inner

+ALIGN 16

+$L$dec_loop8:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+$L$dec_loop8_inner:

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+$L$dec_loop8_enter:

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+DB 102,68,15,56,222,192

+DB 102,68,15,56,222,200

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop8

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+DB 102,15,56,223,224

+DB 102,15,56,223,232

+DB 102,15,56,223,240

+DB 102,15,56,223,248

+DB 102,68,15,56,223,192

+DB 102,68,15,56,223,200

+ DB 0F3h,0C3h ;repret

+

+

+global aesni_ecb_encrypt

+

+ALIGN 16

+aesni_ecb_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ecb_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+

+

+

+ lea rsp,[((-88))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+$L$ecb_enc_body:

+ and rdx,-16

+ jz NEAR $L$ecb_ret

+

+ mov eax,DWORD[240+rcx]

+ movups xmm0,XMMWORD[rcx]

+ mov r11,rcx

+ mov r10d,eax

+ test r8d,r8d

+ jz NEAR $L$ecb_decrypt

+

+ cmp rdx,0x80

+ jb NEAR $L$ecb_enc_tail

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqu xmm7,XMMWORD[80+rdi]

+ movdqu xmm8,XMMWORD[96+rdi]

+ movdqu xmm9,XMMWORD[112+rdi]

+ lea rdi,[128+rdi]

+ sub rdx,0x80

+ jmp NEAR $L$ecb_enc_loop8_enter

+ALIGN 16

+$L$ecb_enc_loop8:

+ movups XMMWORD[rsi],xmm2

+ mov rcx,r11

+ movdqu xmm2,XMMWORD[rdi]

+ mov eax,r10d

+ movups XMMWORD[16+rsi],xmm3

+ movdqu xmm3,XMMWORD[16+rdi]

+ movups XMMWORD[32+rsi],xmm4

+ movdqu xmm4,XMMWORD[32+rdi]

+ movups XMMWORD[48+rsi],xmm5

+ movdqu xmm5,XMMWORD[48+rdi]

+ movups XMMWORD[64+rsi],xmm6

+ movdqu xmm6,XMMWORD[64+rdi]

+ movups XMMWORD[80+rsi],xmm7

+ movdqu xmm7,XMMWORD[80+rdi]

+ movups XMMWORD[96+rsi],xmm8

+ movdqu xmm8,XMMWORD[96+rdi]

+ movups XMMWORD[112+rsi],xmm9

+ lea rsi,[128+rsi]

+ movdqu xmm9,XMMWORD[112+rdi]

+ lea rdi,[128+rdi]

+$L$ecb_enc_loop8_enter:

+

+ call _aesni_encrypt8

+

+ sub rdx,0x80

+ jnc NEAR $L$ecb_enc_loop8

+

+ movups XMMWORD[rsi],xmm2

+ mov rcx,r11

+ movups XMMWORD[16+rsi],xmm3

+ mov eax,r10d

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ movups XMMWORD[80+rsi],xmm7

+ movups XMMWORD[96+rsi],xmm8

+ movups XMMWORD[112+rsi],xmm9

+ lea rsi,[128+rsi]

+ add rdx,0x80

+ jz NEAR $L$ecb_ret

+

+$L$ecb_enc_tail:

+ movups xmm2,XMMWORD[rdi]

+ cmp rdx,0x20

+ jb NEAR $L$ecb_enc_one

+ movups xmm3,XMMWORD[16+rdi]

+ je NEAR $L$ecb_enc_two

+ movups xmm4,XMMWORD[32+rdi]

+ cmp rdx,0x40

+ jb NEAR $L$ecb_enc_three

+ movups xmm5,XMMWORD[48+rdi]

+ je NEAR $L$ecb_enc_four

+ movups xmm6,XMMWORD[64+rdi]

+ cmp rdx,0x60

+ jb NEAR $L$ecb_enc_five

+ movups xmm7,XMMWORD[80+rdi]

+ je NEAR $L$ecb_enc_six

+ movdqu xmm8,XMMWORD[96+rdi]

+ xorps xmm9,xmm9

+ call _aesni_encrypt8

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ movups XMMWORD[80+rsi],xmm7

+ movups XMMWORD[96+rsi],xmm8

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_one:

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_3:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_3

+DB 102,15,56,221,209

+ movups XMMWORD[rsi],xmm2

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_two:

+ call _aesni_encrypt2

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_three:

+ call _aesni_encrypt3

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_four:

+ call _aesni_encrypt4

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_five:

+ xorps xmm7,xmm7

+ call _aesni_encrypt6

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_six:

+ call _aesni_encrypt6

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ movups XMMWORD[80+rsi],xmm7

+ jmp NEAR $L$ecb_ret

+

+ALIGN 16

+$L$ecb_decrypt:

+ cmp rdx,0x80

+ jb NEAR $L$ecb_dec_tail

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqu xmm7,XMMWORD[80+rdi]

+ movdqu xmm8,XMMWORD[96+rdi]

+ movdqu xmm9,XMMWORD[112+rdi]

+ lea rdi,[128+rdi]

+ sub rdx,0x80

+ jmp NEAR $L$ecb_dec_loop8_enter

+ALIGN 16

+$L$ecb_dec_loop8:

+ movups XMMWORD[rsi],xmm2

+ mov rcx,r11

+ movdqu xmm2,XMMWORD[rdi]

+ mov eax,r10d

+ movups XMMWORD[16+rsi],xmm3

+ movdqu xmm3,XMMWORD[16+rdi]

+ movups XMMWORD[32+rsi],xmm4

+ movdqu xmm4,XMMWORD[32+rdi]

+ movups XMMWORD[48+rsi],xmm5

+ movdqu xmm5,XMMWORD[48+rdi]

+ movups XMMWORD[64+rsi],xmm6

+ movdqu xmm6,XMMWORD[64+rdi]

+ movups XMMWORD[80+rsi],xmm7

+ movdqu xmm7,XMMWORD[80+rdi]

+ movups XMMWORD[96+rsi],xmm8

+ movdqu xmm8,XMMWORD[96+rdi]

+ movups XMMWORD[112+rsi],xmm9

+ lea rsi,[128+rsi]

+ movdqu xmm9,XMMWORD[112+rdi]

+ lea rdi,[128+rdi]

+$L$ecb_dec_loop8_enter:

+

+ call _aesni_decrypt8

+

+ movups xmm0,XMMWORD[r11]

+ sub rdx,0x80

+ jnc NEAR $L$ecb_dec_loop8

+

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ mov rcx,r11

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ mov eax,r10d

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ movups XMMWORD[80+rsi],xmm7

+ pxor xmm7,xmm7

+ movups XMMWORD[96+rsi],xmm8

+ pxor xmm8,xmm8

+ movups XMMWORD[112+rsi],xmm9

+ pxor xmm9,xmm9

+ lea rsi,[128+rsi]

+ add rdx,0x80

+ jz NEAR $L$ecb_ret

+

+$L$ecb_dec_tail:

+ movups xmm2,XMMWORD[rdi]

+ cmp rdx,0x20

+ jb NEAR $L$ecb_dec_one

+ movups xmm3,XMMWORD[16+rdi]

+ je NEAR $L$ecb_dec_two

+ movups xmm4,XMMWORD[32+rdi]

+ cmp rdx,0x40

+ jb NEAR $L$ecb_dec_three

+ movups xmm5,XMMWORD[48+rdi]

+ je NEAR $L$ecb_dec_four

+ movups xmm6,XMMWORD[64+rdi]

+ cmp rdx,0x60

+ jb NEAR $L$ecb_dec_five

+ movups xmm7,XMMWORD[80+rdi]

+ je NEAR $L$ecb_dec_six

+ movups xmm8,XMMWORD[96+rdi]

+ movups xmm0,XMMWORD[rcx]

+ xorps xmm9,xmm9

+ call _aesni_decrypt8

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ movups XMMWORD[80+rsi],xmm7

+ pxor xmm7,xmm7

+ movups XMMWORD[96+rsi],xmm8

+ pxor xmm8,xmm8

+ pxor xmm9,xmm9

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_one:

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_4:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_4

+DB 102,15,56,223,209

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_two:

+ call _aesni_decrypt2

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_three:

+ call _aesni_decrypt3

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_four:

+ call _aesni_decrypt4

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_five:

+ xorps xmm7,xmm7

+ call _aesni_decrypt6

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ pxor xmm7,xmm7

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_six:

+ call _aesni_decrypt6

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ movups XMMWORD[80+rsi],xmm7

+ pxor xmm7,xmm7

+

+$L$ecb_ret:

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ movaps xmm6,XMMWORD[rsp]

+ movaps XMMWORD[rsp],xmm0

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ lea rsp,[88+rsp]

+$L$ecb_enc_ret:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ecb_encrypt:

+global aesni_ccm64_encrypt_blocks

+

+ALIGN 16

+aesni_ccm64_encrypt_blocks:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ccm64_encrypt_blocks:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea rsp,[((-88))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+$L$ccm64_enc_body:

+ mov eax,DWORD[240+rcx]

+ movdqu xmm6,XMMWORD[r8]

+ movdqa xmm9,XMMWORD[$L$increment64]

+ movdqa xmm7,XMMWORD[$L$bswap_mask]

+

+ shl eax,4

+ mov r10d,16

+ lea r11,[rcx]

+ movdqu xmm3,XMMWORD[r9]

+ movdqa xmm2,xmm6

+ lea rcx,[32+rax*1+rcx]

+DB 102,15,56,0,247

+ sub r10,rax

+ jmp NEAR $L$ccm64_enc_outer

+ALIGN 16

+$L$ccm64_enc_outer:

+ movups xmm0,XMMWORD[r11]

+ mov rax,r10

+ movups xmm8,XMMWORD[rdi]

+

+ xorps xmm2,xmm0

+ movups xmm1,XMMWORD[16+r11]

+ xorps xmm0,xmm8

+ xorps xmm3,xmm0

+ movups xmm0,XMMWORD[32+r11]

+

+$L$ccm64_enc2_loop:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ccm64_enc2_loop

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ paddq xmm6,xmm9

+ dec rdx

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+

+ lea rdi,[16+rdi]

+ xorps xmm8,xmm2

+ movdqa xmm2,xmm6

+ movups XMMWORD[rsi],xmm8

+DB 102,15,56,0,215

+ lea rsi,[16+rsi]

+ jnz NEAR $L$ccm64_enc_outer

+

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ movups XMMWORD[r9],xmm3

+ pxor xmm3,xmm3

+ pxor xmm8,xmm8

+ pxor xmm6,xmm6

+ movaps xmm6,XMMWORD[rsp]

+ movaps XMMWORD[rsp],xmm0

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ lea rsp,[88+rsp]

+$L$ccm64_enc_ret:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ccm64_encrypt_blocks:

+global aesni_ccm64_decrypt_blocks

+

+ALIGN 16

+aesni_ccm64_decrypt_blocks:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ccm64_decrypt_blocks:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea rsp,[((-88))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+$L$ccm64_dec_body:

+ mov eax,DWORD[240+rcx]

+ movups xmm6,XMMWORD[r8]

+ movdqu xmm3,XMMWORD[r9]

+ movdqa xmm9,XMMWORD[$L$increment64]

+ movdqa xmm7,XMMWORD[$L$bswap_mask]

+

+ movaps xmm2,xmm6

+ mov r10d,eax

+ mov r11,rcx

+DB 102,15,56,0,247

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_5:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_5

+DB 102,15,56,221,209

+ shl r10d,4

+ mov eax,16

+ movups xmm8,XMMWORD[rdi]

+ paddq xmm6,xmm9

+ lea rdi,[16+rdi]

+ sub rax,r10

+ lea rcx,[32+r10*1+r11]

+ mov r10,rax

+ jmp NEAR $L$ccm64_dec_outer

+ALIGN 16

+$L$ccm64_dec_outer:

+ xorps xmm8,xmm2

+ movdqa xmm2,xmm6

+ movups XMMWORD[rsi],xmm8

+ lea rsi,[16+rsi]

+DB 102,15,56,0,215

+

+ sub rdx,1

+ jz NEAR $L$ccm64_dec_break

+

+ movups xmm0,XMMWORD[r11]

+ mov rax,r10

+ movups xmm1,XMMWORD[16+r11]

+ xorps xmm8,xmm0

+ xorps xmm2,xmm0

+ xorps xmm3,xmm8

+ movups xmm0,XMMWORD[32+r11]

+ jmp NEAR $L$ccm64_dec2_loop

+ALIGN 16

+$L$ccm64_dec2_loop:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ccm64_dec2_loop

+ movups xmm8,XMMWORD[rdi]

+ paddq xmm6,xmm9

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+ lea rdi,[16+rdi]

+ jmp NEAR $L$ccm64_dec_outer

+

+ALIGN 16

+$L$ccm64_dec_break:

+

+ mov eax,DWORD[240+r11]

+ movups xmm0,XMMWORD[r11]

+ movups xmm1,XMMWORD[16+r11]

+ xorps xmm8,xmm0

+ lea r11,[32+r11]

+ xorps xmm3,xmm8

+$L$oop_enc1_6:

+DB 102,15,56,220,217

+ dec eax

+ movups xmm1,XMMWORD[r11]

+ lea r11,[16+r11]

+ jnz NEAR $L$oop_enc1_6

+DB 102,15,56,221,217

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ movups XMMWORD[r9],xmm3

+ pxor xmm3,xmm3

+ pxor xmm8,xmm8

+ pxor xmm6,xmm6

+ movaps xmm6,XMMWORD[rsp]

+ movaps XMMWORD[rsp],xmm0

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ lea rsp,[88+rsp]

+$L$ccm64_dec_ret:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ccm64_decrypt_blocks:

+global aesni_ctr32_encrypt_blocks

+

+ALIGN 16

+aesni_ctr32_encrypt_blocks:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ctr32_encrypt_blocks:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+

+

+

+ cmp rdx,1

+ jne NEAR $L$ctr32_bulk

+

+

+

+ movups xmm2,XMMWORD[r8]

+ movups xmm3,XMMWORD[rdi]

+ mov edx,DWORD[240+rcx]

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_7:

+DB 102,15,56,220,209

+ dec edx

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_7

+DB 102,15,56,221,209

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ xorps xmm2,xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[rsi],xmm2

+ xorps xmm2,xmm2

+ jmp NEAR $L$ctr32_epilogue

+

+ALIGN 16

+$L$ctr32_bulk:

+ lea r11,[rsp]

+

+ push rbp

+

+ sub rsp,288

+ and rsp,-16

+ movaps XMMWORD[(-168)+r11],xmm6

+ movaps XMMWORD[(-152)+r11],xmm7

+ movaps XMMWORD[(-136)+r11],xmm8

+ movaps XMMWORD[(-120)+r11],xmm9

+ movaps XMMWORD[(-104)+r11],xmm10

+ movaps XMMWORD[(-88)+r11],xmm11

+ movaps XMMWORD[(-72)+r11],xmm12

+ movaps XMMWORD[(-56)+r11],xmm13

+ movaps XMMWORD[(-40)+r11],xmm14

+ movaps XMMWORD[(-24)+r11],xmm15

+$L$ctr32_body:

+

+

+

+

+ movdqu xmm2,XMMWORD[r8]

+ movdqu xmm0,XMMWORD[rcx]

+ mov r8d,DWORD[12+r8]

+ pxor xmm2,xmm0

+ mov ebp,DWORD[12+rcx]

+ movdqa XMMWORD[rsp],xmm2

+ bswap r8d

+ movdqa xmm3,xmm2

+ movdqa xmm4,xmm2

+ movdqa xmm5,xmm2

+ movdqa XMMWORD[64+rsp],xmm2

+ movdqa XMMWORD[80+rsp],xmm2

+ movdqa XMMWORD[96+rsp],xmm2

+ mov r10,rdx

+ movdqa XMMWORD[112+rsp],xmm2

+

+ lea rax,[1+r8]

+ lea rdx,[2+r8]

+ bswap eax

+ bswap edx

+ xor eax,ebp

+ xor edx,ebp

+DB 102,15,58,34,216,3

+ lea rax,[3+r8]

+ movdqa XMMWORD[16+rsp],xmm3

+DB 102,15,58,34,226,3

+ bswap eax

+ mov rdx,r10

+ lea r10,[4+r8]

+ movdqa XMMWORD[32+rsp],xmm4

+ xor eax,ebp

+ bswap r10d

+DB 102,15,58,34,232,3

+ xor r10d,ebp

+ movdqa XMMWORD[48+rsp],xmm5

+ lea r9,[5+r8]

+ mov DWORD[((64+12))+rsp],r10d

+ bswap r9d

+ lea r10,[6+r8]

+ mov eax,DWORD[240+rcx]

+ xor r9d,ebp

+ bswap r10d

+ mov DWORD[((80+12))+rsp],r9d

+ xor r10d,ebp

+ lea r9,[7+r8]

+ mov DWORD[((96+12))+rsp],r10d

+ bswap r9d

+ mov r10d,DWORD[((OPENSSL_ia32cap_P+4))]

+ xor r9d,ebp

+ and r10d,71303168

+ mov DWORD[((112+12))+rsp],r9d

+

+ movups xmm1,XMMWORD[16+rcx]

+

+ movdqa xmm6,XMMWORD[64+rsp]

+ movdqa xmm7,XMMWORD[80+rsp]

+

+ cmp rdx,8

+ jb NEAR $L$ctr32_tail

+

+ sub rdx,6

+ cmp r10d,4194304

+ je NEAR $L$ctr32_6x

+

+ lea rcx,[128+rcx]

+ sub rdx,2

+ jmp NEAR $L$ctr32_loop8

+

+ALIGN 16

+$L$ctr32_6x:

+ shl eax,4

+ mov r10d,48

+ bswap ebp

+ lea rcx,[32+rax*1+rcx]

+ sub r10,rax

+ jmp NEAR $L$ctr32_loop6

+

+ALIGN 16

+$L$ctr32_loop6:

+ add r8d,6

+ movups xmm0,XMMWORD[((-48))+r10*1+rcx]

+DB 102,15,56,220,209

+ mov eax,r8d

+ xor eax,ebp

+DB 102,15,56,220,217

+DB 0x0f,0x38,0xf1,0x44,0x24,12

+ lea eax,[1+r8]

+DB 102,15,56,220,225

+ xor eax,ebp

+DB 0x0f,0x38,0xf1,0x44,0x24,28

+DB 102,15,56,220,233

+ lea eax,[2+r8]

+ xor eax,ebp

+DB 102,15,56,220,241

+DB 0x0f,0x38,0xf1,0x44,0x24,44

+ lea eax,[3+r8]

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[((-32))+r10*1+rcx]

+ xor eax,ebp

+

+DB 102,15,56,220,208

+DB 0x0f,0x38,0xf1,0x44,0x24,60

+ lea eax,[4+r8]

+DB 102,15,56,220,216

+ xor eax,ebp

+DB 0x0f,0x38,0xf1,0x44,0x24,76

+DB 102,15,56,220,224

+ lea eax,[5+r8]

+ xor eax,ebp

+DB 102,15,56,220,232

+DB 0x0f,0x38,0xf1,0x44,0x24,92

+ mov rax,r10

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-16))+r10*1+rcx]

+

+ call $L$enc_loop6

+

+ movdqu xmm8,XMMWORD[rdi]

+ movdqu xmm9,XMMWORD[16+rdi]

+ movdqu xmm10,XMMWORD[32+rdi]

+ movdqu xmm11,XMMWORD[48+rdi]

+ movdqu xmm12,XMMWORD[64+rdi]

+ movdqu xmm13,XMMWORD[80+rdi]

+ lea rdi,[96+rdi]

+ movups xmm1,XMMWORD[((-64))+r10*1+rcx]

+ pxor xmm8,xmm2

+ movaps xmm2,XMMWORD[rsp]

+ pxor xmm9,xmm3

+ movaps xmm3,XMMWORD[16+rsp]

+ pxor xmm10,xmm4

+ movaps xmm4,XMMWORD[32+rsp]

+ pxor xmm11,xmm5

+ movaps xmm5,XMMWORD[48+rsp]

+ pxor xmm12,xmm6

+ movaps xmm6,XMMWORD[64+rsp]

+ pxor xmm13,xmm7

+ movaps xmm7,XMMWORD[80+rsp]

+ movdqu XMMWORD[rsi],xmm8

+ movdqu XMMWORD[16+rsi],xmm9

+ movdqu XMMWORD[32+rsi],xmm10

+ movdqu XMMWORD[48+rsi],xmm11

+ movdqu XMMWORD[64+rsi],xmm12

+ movdqu XMMWORD[80+rsi],xmm13

+ lea rsi,[96+rsi]

+

+ sub rdx,6

+ jnc NEAR $L$ctr32_loop6

+

+ add rdx,6

+ jz NEAR $L$ctr32_done

+

+ lea eax,[((-48))+r10]

+ lea rcx,[((-80))+r10*1+rcx]

+ neg eax

+ shr eax,4

+ jmp NEAR $L$ctr32_tail

+

+ALIGN 32

+$L$ctr32_loop8:

+ add r8d,8

+ movdqa xmm8,XMMWORD[96+rsp]

+DB 102,15,56,220,209

+ mov r9d,r8d

+ movdqa xmm9,XMMWORD[112+rsp]

+DB 102,15,56,220,217

+ bswap r9d

+ movups xmm0,XMMWORD[((32-128))+rcx]

+DB 102,15,56,220,225

+ xor r9d,ebp

+ nop

+DB 102,15,56,220,233

+ mov DWORD[((0+12))+rsp],r9d

+ lea r9,[1+r8]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((48-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ mov DWORD[((16+12))+rsp],r9d

+ lea r9,[2+r8]

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((64-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ mov DWORD[((32+12))+rsp],r9d

+ lea r9,[3+r8]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((80-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ mov DWORD[((48+12))+rsp],r9d

+ lea r9,[4+r8]

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((96-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ mov DWORD[((64+12))+rsp],r9d

+ lea r9,[5+r8]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((112-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ mov DWORD[((80+12))+rsp],r9d

+ lea r9,[6+r8]

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((128-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ mov DWORD[((96+12))+rsp],r9d

+ lea r9,[7+r8]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((144-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+ xor r9d,ebp

+ movdqu xmm10,XMMWORD[rdi]

+DB 102,15,56,220,232

+ mov DWORD[((112+12))+rsp],r9d

+ cmp eax,11

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((160-128))+rcx]

+

+ jb NEAR $L$ctr32_enc_done

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((176-128))+rcx]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((192-128))+rcx]

+ je NEAR $L$ctr32_enc_done

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((208-128))+rcx]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((224-128))+rcx]

+ jmp NEAR $L$ctr32_enc_done

+

+ALIGN 16

+$L$ctr32_enc_done:

+ movdqu xmm11,XMMWORD[16+rdi]

+ pxor xmm10,xmm0

+ movdqu xmm12,XMMWORD[32+rdi]

+ pxor xmm11,xmm0

+ movdqu xmm13,XMMWORD[48+rdi]

+ pxor xmm12,xmm0

+ movdqu xmm14,XMMWORD[64+rdi]

+ pxor xmm13,xmm0

+ movdqu xmm15,XMMWORD[80+rdi]

+ pxor xmm14,xmm0

+ pxor xmm15,xmm0

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movdqu xmm1,XMMWORD[96+rdi]

+ lea rdi,[128+rdi]

+

+DB 102,65,15,56,221,210

+ pxor xmm1,xmm0

+ movdqu xmm10,XMMWORD[((112-128))+rdi]

+DB 102,65,15,56,221,219

+ pxor xmm10,xmm0

+ movdqa xmm11,XMMWORD[rsp]

+DB 102,65,15,56,221,228

+DB 102,65,15,56,221,237

+ movdqa xmm12,XMMWORD[16+rsp]

+ movdqa xmm13,XMMWORD[32+rsp]

+DB 102,65,15,56,221,246

+DB 102,65,15,56,221,255

+ movdqa xmm14,XMMWORD[48+rsp]

+ movdqa xmm15,XMMWORD[64+rsp]

+DB 102,68,15,56,221,193

+ movdqa xmm0,XMMWORD[80+rsp]

+ movups xmm1,XMMWORD[((16-128))+rcx]

+DB 102,69,15,56,221,202

+

+ movups XMMWORD[rsi],xmm2

+ movdqa xmm2,xmm11

+ movups XMMWORD[16+rsi],xmm3

+ movdqa xmm3,xmm12

+ movups XMMWORD[32+rsi],xmm4

+ movdqa xmm4,xmm13

+ movups XMMWORD[48+rsi],xmm5

+ movdqa xmm5,xmm14

+ movups XMMWORD[64+rsi],xmm6

+ movdqa xmm6,xmm15

+ movups XMMWORD[80+rsi],xmm7

+ movdqa xmm7,xmm0

+ movups XMMWORD[96+rsi],xmm8

+ movups XMMWORD[112+rsi],xmm9

+ lea rsi,[128+rsi]

+

+ sub rdx,8

+ jnc NEAR $L$ctr32_loop8

+

+ add rdx,8

+ jz NEAR $L$ctr32_done

+ lea rcx,[((-128))+rcx]

+

+$L$ctr32_tail:

+

+

+ lea rcx,[16+rcx]

+ cmp rdx,4

+ jb NEAR $L$ctr32_loop3

+ je NEAR $L$ctr32_loop4

+

+

+ shl eax,4

+ movdqa xmm8,XMMWORD[96+rsp]

+ pxor xmm9,xmm9

+

+ movups xmm0,XMMWORD[16+rcx]

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ lea rcx,[((32-16))+rax*1+rcx]

+ neg rax

+DB 102,15,56,220,225

+ add rax,16

+ movups xmm10,XMMWORD[rdi]

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+ movups xmm11,XMMWORD[16+rdi]

+ movups xmm12,XMMWORD[32+rdi]

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+

+ call $L$enc_loop8_enter

+

+ movdqu xmm13,XMMWORD[48+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm10,XMMWORD[64+rdi]

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm4,xmm12

+ movdqu XMMWORD[16+rsi],xmm3

+ pxor xmm5,xmm13

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm6,xmm10

+ movdqu XMMWORD[48+rsi],xmm5

+ movdqu XMMWORD[64+rsi],xmm6

+ cmp rdx,6

+ jb NEAR $L$ctr32_done

+

+ movups xmm11,XMMWORD[80+rdi]

+ xorps xmm7,xmm11

+ movups XMMWORD[80+rsi],xmm7

+ je NEAR $L$ctr32_done

+

+ movups xmm12,XMMWORD[96+rdi]

+ xorps xmm8,xmm12

+ movups XMMWORD[96+rsi],xmm8

+ jmp NEAR $L$ctr32_done

+

+ALIGN 32

+$L$ctr32_loop4:

+DB 102,15,56,220,209

+ lea rcx,[16+rcx]

+ dec eax

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[rcx]

+ jnz NEAR $L$ctr32_loop4

+DB 102,15,56,221,209

+DB 102,15,56,221,217

+ movups xmm10,XMMWORD[rdi]

+ movups xmm11,XMMWORD[16+rdi]

+DB 102,15,56,221,225

+DB 102,15,56,221,233

+ movups xmm12,XMMWORD[32+rdi]

+ movups xmm13,XMMWORD[48+rdi]

+

+ xorps xmm2,xmm10

+ movups XMMWORD[rsi],xmm2

+ xorps xmm3,xmm11

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm4,xmm12

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm5,xmm13

+ movdqu XMMWORD[48+rsi],xmm5

+ jmp NEAR $L$ctr32_done

+

+ALIGN 32

+$L$ctr32_loop3:

+DB 102,15,56,220,209

+ lea rcx,[16+rcx]

+ dec eax

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+ movups xmm1,XMMWORD[rcx]

+ jnz NEAR $L$ctr32_loop3

+DB 102,15,56,221,209

+DB 102,15,56,221,217

+DB 102,15,56,221,225

+

+ movups xmm10,XMMWORD[rdi]

+ xorps xmm2,xmm10

+ movups XMMWORD[rsi],xmm2

+ cmp rdx,2

+ jb NEAR $L$ctr32_done

+

+ movups xmm11,XMMWORD[16+rdi]

+ xorps xmm3,xmm11

+ movups XMMWORD[16+rsi],xmm3

+ je NEAR $L$ctr32_done

+

+ movups xmm12,XMMWORD[32+rdi]

+ xorps xmm4,xmm12

+ movups XMMWORD[32+rsi],xmm4

+

+$L$ctr32_done:

+ xorps xmm0,xmm0

+ xor ebp,ebp

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ movaps xmm6,XMMWORD[((-168))+r11]

+ movaps XMMWORD[(-168)+r11],xmm0

+ movaps xmm7,XMMWORD[((-152))+r11]

+ movaps XMMWORD[(-152)+r11],xmm0

+ movaps xmm8,XMMWORD[((-136))+r11]

+ movaps XMMWORD[(-136)+r11],xmm0

+ movaps xmm9,XMMWORD[((-120))+r11]

+ movaps XMMWORD[(-120)+r11],xmm0

+ movaps xmm10,XMMWORD[((-104))+r11]

+ movaps XMMWORD[(-104)+r11],xmm0

+ movaps xmm11,XMMWORD[((-88))+r11]

+ movaps XMMWORD[(-88)+r11],xmm0

+ movaps xmm12,XMMWORD[((-72))+r11]

+ movaps XMMWORD[(-72)+r11],xmm0

+ movaps xmm13,XMMWORD[((-56))+r11]

+ movaps XMMWORD[(-56)+r11],xmm0

+ movaps xmm14,XMMWORD[((-40))+r11]

+ movaps XMMWORD[(-40)+r11],xmm0

+ movaps xmm15,XMMWORD[((-24))+r11]

+ movaps XMMWORD[(-24)+r11],xmm0

+ movaps XMMWORD[rsp],xmm0

+ movaps XMMWORD[16+rsp],xmm0

+ movaps XMMWORD[32+rsp],xmm0

+ movaps XMMWORD[48+rsp],xmm0

+ movaps XMMWORD[64+rsp],xmm0

+ movaps XMMWORD[80+rsp],xmm0

+ movaps XMMWORD[96+rsp],xmm0

+ movaps XMMWORD[112+rsp],xmm0

+ mov rbp,QWORD[((-8))+r11]

+

+ lea rsp,[r11]

+

+$L$ctr32_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ctr32_encrypt_blocks:

+global aesni_xts_encrypt

+

+ALIGN 16

+aesni_xts_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_xts_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea r11,[rsp]

+

+ push rbp

+

+ sub rsp,272

+ and rsp,-16

+ movaps XMMWORD[(-168)+r11],xmm6

+ movaps XMMWORD[(-152)+r11],xmm7

+ movaps XMMWORD[(-136)+r11],xmm8

+ movaps XMMWORD[(-120)+r11],xmm9

+ movaps XMMWORD[(-104)+r11],xmm10

+ movaps XMMWORD[(-88)+r11],xmm11

+ movaps XMMWORD[(-72)+r11],xmm12

+ movaps XMMWORD[(-56)+r11],xmm13

+ movaps XMMWORD[(-40)+r11],xmm14

+ movaps XMMWORD[(-24)+r11],xmm15

+$L$xts_enc_body:

+ movups xmm2,XMMWORD[r9]

+ mov eax,DWORD[240+r8]

+ mov r10d,DWORD[240+rcx]

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[16+r8]

+ lea r8,[32+r8]

+ xorps xmm2,xmm0

+$L$oop_enc1_8:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[r8]

+ lea r8,[16+r8]

+ jnz NEAR $L$oop_enc1_8

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[rcx]

+ mov rbp,rcx

+ mov eax,r10d

+ shl r10d,4

+ mov r9,rdx

+ and rdx,-16

+

+ movups xmm1,XMMWORD[16+r10*1+rcx]

+

+ movdqa xmm8,XMMWORD[$L$xts_magic]

+ movdqa xmm15,xmm2

+ pshufd xmm9,xmm2,0x5f

+ pxor xmm1,xmm0

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm10,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm10,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm11,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm11,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm12,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm12,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm13,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm13,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm15

+ psrad xmm9,31

+ paddq xmm15,xmm15

+ pand xmm9,xmm8

+ pxor xmm14,xmm0

+ pxor xmm15,xmm9

+ movaps XMMWORD[96+rsp],xmm1

+

+ sub rdx,16*6

+ jc NEAR $L$xts_enc_short

+

+ mov eax,16+96

+ lea rcx,[32+r10*1+rbp]

+ sub rax,r10

+ movups xmm1,XMMWORD[16+rbp]

+ mov r10,rax

+ lea r8,[$L$xts_magic]

+ jmp NEAR $L$xts_enc_grandloop

+

+ALIGN 32

+$L$xts_enc_grandloop:

+ movdqu xmm2,XMMWORD[rdi]

+ movdqa xmm8,xmm0

+ movdqu xmm3,XMMWORD[16+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm4,XMMWORD[32+rdi]

+ pxor xmm3,xmm11

+DB 102,15,56,220,209

+ movdqu xmm5,XMMWORD[48+rdi]

+ pxor xmm4,xmm12

+DB 102,15,56,220,217

+ movdqu xmm6,XMMWORD[64+rdi]

+ pxor xmm5,xmm13

+DB 102,15,56,220,225

+ movdqu xmm7,XMMWORD[80+rdi]

+ pxor xmm8,xmm15

+ movdqa xmm9,XMMWORD[96+rsp]

+ pxor xmm6,xmm14

+DB 102,15,56,220,233

+ movups xmm0,XMMWORD[32+rbp]

+ lea rdi,[96+rdi]

+ pxor xmm7,xmm8

+

+ pxor xmm10,xmm9

+DB 102,15,56,220,241

+ pxor xmm11,xmm9

+ movdqa XMMWORD[rsp],xmm10

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[48+rbp]

+ pxor xmm12,xmm9

+

+DB 102,15,56,220,208

+ pxor xmm13,xmm9

+ movdqa XMMWORD[16+rsp],xmm11

+DB 102,15,56,220,216

+ pxor xmm14,xmm9

+ movdqa XMMWORD[32+rsp],xmm12

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ pxor xmm8,xmm9

+ movdqa XMMWORD[64+rsp],xmm14

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[64+rbp]

+ movdqa XMMWORD[80+rsp],xmm8

+ pshufd xmm9,xmm15,0x5f

+ jmp NEAR $L$xts_enc_loop6

+ALIGN 32

+$L$xts_enc_loop6:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[((-64))+rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-80))+rax*1+rcx]

+ jnz NEAR $L$xts_enc_loop6

+

+ movdqa xmm8,XMMWORD[r8]

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+DB 102,15,56,220,209

+ paddq xmm15,xmm15

+ psrad xmm14,31

+DB 102,15,56,220,217

+ pand xmm14,xmm8

+ movups xmm10,XMMWORD[rbp]

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+ pxor xmm15,xmm14

+ movaps xmm11,xmm10

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[((-64))+rcx]

+

+ movdqa xmm14,xmm9

+DB 102,15,56,220,208

+ paddd xmm9,xmm9

+ pxor xmm10,xmm15

+DB 102,15,56,220,216

+ psrad xmm14,31

+ paddq xmm15,xmm15

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ pand xmm14,xmm8

+ movaps xmm12,xmm11

+DB 102,15,56,220,240

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-48))+rcx]

+

+ paddd xmm9,xmm9

+DB 102,15,56,220,209

+ pxor xmm11,xmm15

+ psrad xmm14,31

+DB 102,15,56,220,217

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movdqa XMMWORD[48+rsp],xmm13

+ pxor xmm15,xmm14

+DB 102,15,56,220,241

+ movaps xmm13,xmm12

+ movdqa xmm14,xmm9

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[((-32))+rcx]

+

+ paddd xmm9,xmm9

+DB 102,15,56,220,208

+ pxor xmm12,xmm15

+ psrad xmm14,31

+DB 102,15,56,220,216

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+ pxor xmm15,xmm14

+ movaps xmm14,xmm13

+DB 102,15,56,220,248

+

+ movdqa xmm0,xmm9

+ paddd xmm9,xmm9

+DB 102,15,56,220,209

+ pxor xmm13,xmm15

+ psrad xmm0,31

+DB 102,15,56,220,217

+ paddq xmm15,xmm15

+ pand xmm0,xmm8

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ pxor xmm15,xmm0

+ movups xmm0,XMMWORD[rbp]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[16+rbp]

+

+ pxor xmm14,xmm15

+DB 102,15,56,221,84,36,0

+ psrad xmm9,31

+ paddq xmm15,xmm15

+DB 102,15,56,221,92,36,16

+DB 102,15,56,221,100,36,32

+ pand xmm9,xmm8

+ mov rax,r10

+DB 102,15,56,221,108,36,48

+DB 102,15,56,221,116,36,64

+DB 102,15,56,221,124,36,80

+ pxor xmm15,xmm9

+

+ lea rsi,[96+rsi]

+ movups XMMWORD[(-96)+rsi],xmm2

+ movups XMMWORD[(-80)+rsi],xmm3

+ movups XMMWORD[(-64)+rsi],xmm4

+ movups XMMWORD[(-48)+rsi],xmm5

+ movups XMMWORD[(-32)+rsi],xmm6

+ movups XMMWORD[(-16)+rsi],xmm7

+ sub rdx,16*6

+ jnc NEAR $L$xts_enc_grandloop

+

+ mov eax,16+96

+ sub eax,r10d

+ mov rcx,rbp

+ shr eax,4

+

+$L$xts_enc_short:

+

+ mov r10d,eax

+ pxor xmm10,xmm0

+ add rdx,16*6

+ jz NEAR $L$xts_enc_done

+

+ pxor xmm11,xmm0

+ cmp rdx,0x20

+ jb NEAR $L$xts_enc_one

+ pxor xmm12,xmm0

+ je NEAR $L$xts_enc_two

+

+ pxor xmm13,xmm0

+ cmp rdx,0x40

+ jb NEAR $L$xts_enc_three

+ pxor xmm14,xmm0

+ je NEAR $L$xts_enc_four

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm5,XMMWORD[48+rdi]

+ pxor xmm3,xmm11

+ movdqu xmm6,XMMWORD[64+rdi]

+ lea rdi,[80+rdi]

+ pxor xmm4,xmm12

+ pxor xmm5,xmm13

+ pxor xmm6,xmm14

+ pxor xmm7,xmm7

+

+ call _aesni_encrypt6

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm15

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ movdqu XMMWORD[rsi],xmm2

+ xorps xmm5,xmm13

+ movdqu XMMWORD[16+rsi],xmm3

+ xorps xmm6,xmm14

+ movdqu XMMWORD[32+rsi],xmm4

+ movdqu XMMWORD[48+rsi],xmm5

+ movdqu XMMWORD[64+rsi],xmm6

+ lea rsi,[80+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_one:

+ movups xmm2,XMMWORD[rdi]

+ lea rdi,[16+rdi]

+ xorps xmm2,xmm10

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_9:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_9

+DB 102,15,56,221,209

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm11

+ movups XMMWORD[rsi],xmm2

+ lea rsi,[16+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_two:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ lea rdi,[32+rdi]

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+

+ call _aesni_encrypt2

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm12

+ xorps xmm3,xmm11

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ lea rsi,[32+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_three:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ movups xmm4,XMMWORD[32+rdi]

+ lea rdi,[48+rdi]

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+

+ call _aesni_encrypt3

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm13

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ lea rsi,[48+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_four:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ movups xmm4,XMMWORD[32+rdi]

+ xorps xmm2,xmm10

+ movups xmm5,XMMWORD[48+rdi]

+ lea rdi,[64+rdi]

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ xorps xmm5,xmm13

+

+ call _aesni_encrypt4

+

+ pxor xmm2,xmm10

+ movdqa xmm10,xmm14

+ pxor xmm3,xmm11

+ pxor xmm4,xmm12

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm5,xmm13

+ movdqu XMMWORD[16+rsi],xmm3

+ movdqu XMMWORD[32+rsi],xmm4

+ movdqu XMMWORD[48+rsi],xmm5

+ lea rsi,[64+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_done:

+ and r9,15

+ jz NEAR $L$xts_enc_ret

+ mov rdx,r9

+

+$L$xts_enc_steal:

+ movzx eax,BYTE[rdi]

+ movzx ecx,BYTE[((-16))+rsi]

+ lea rdi,[1+rdi]

+ mov BYTE[((-16))+rsi],al

+ mov BYTE[rsi],cl

+ lea rsi,[1+rsi]

+ sub rdx,1

+ jnz NEAR $L$xts_enc_steal

+

+ sub rsi,r9

+ mov rcx,rbp

+ mov eax,r10d

+

+ movups xmm2,XMMWORD[((-16))+rsi]

+ xorps xmm2,xmm10

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_10:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_10

+DB 102,15,56,221,209

+ xorps xmm2,xmm10

+ movups XMMWORD[(-16)+rsi],xmm2

+

+$L$xts_enc_ret:

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ movaps xmm6,XMMWORD[((-168))+r11]

+ movaps XMMWORD[(-168)+r11],xmm0

+ movaps xmm7,XMMWORD[((-152))+r11]

+ movaps XMMWORD[(-152)+r11],xmm0

+ movaps xmm8,XMMWORD[((-136))+r11]

+ movaps XMMWORD[(-136)+r11],xmm0

+ movaps xmm9,XMMWORD[((-120))+r11]

+ movaps XMMWORD[(-120)+r11],xmm0

+ movaps xmm10,XMMWORD[((-104))+r11]

+ movaps XMMWORD[(-104)+r11],xmm0

+ movaps xmm11,XMMWORD[((-88))+r11]

+ movaps XMMWORD[(-88)+r11],xmm0

+ movaps xmm12,XMMWORD[((-72))+r11]

+ movaps XMMWORD[(-72)+r11],xmm0

+ movaps xmm13,XMMWORD[((-56))+r11]

+ movaps XMMWORD[(-56)+r11],xmm0

+ movaps xmm14,XMMWORD[((-40))+r11]

+ movaps XMMWORD[(-40)+r11],xmm0

+ movaps xmm15,XMMWORD[((-24))+r11]

+ movaps XMMWORD[(-24)+r11],xmm0

+ movaps XMMWORD[rsp],xmm0

+ movaps XMMWORD[16+rsp],xmm0

+ movaps XMMWORD[32+rsp],xmm0

+ movaps XMMWORD[48+rsp],xmm0

+ movaps XMMWORD[64+rsp],xmm0

+ movaps XMMWORD[80+rsp],xmm0

+ movaps XMMWORD[96+rsp],xmm0

+ mov rbp,QWORD[((-8))+r11]

+

+ lea rsp,[r11]

+

+$L$xts_enc_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_xts_encrypt:

+global aesni_xts_decrypt

+

+ALIGN 16

+aesni_xts_decrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_xts_decrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea r11,[rsp]

+

+ push rbp

+

+ sub rsp,272

+ and rsp,-16

+ movaps XMMWORD[(-168)+r11],xmm6

+ movaps XMMWORD[(-152)+r11],xmm7

+ movaps XMMWORD[(-136)+r11],xmm8

+ movaps XMMWORD[(-120)+r11],xmm9

+ movaps XMMWORD[(-104)+r11],xmm10

+ movaps XMMWORD[(-88)+r11],xmm11

+ movaps XMMWORD[(-72)+r11],xmm12

+ movaps XMMWORD[(-56)+r11],xmm13

+ movaps XMMWORD[(-40)+r11],xmm14

+ movaps XMMWORD[(-24)+r11],xmm15

+$L$xts_dec_body:

+ movups xmm2,XMMWORD[r9]

+ mov eax,DWORD[240+r8]

+ mov r10d,DWORD[240+rcx]

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[16+r8]

+ lea r8,[32+r8]

+ xorps xmm2,xmm0

+$L$oop_enc1_11:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[r8]

+ lea r8,[16+r8]

+ jnz NEAR $L$oop_enc1_11

+DB 102,15,56,221,209

+ xor eax,eax

+ test rdx,15

+ setnz al

+ shl rax,4

+ sub rdx,rax

+

+ movups xmm0,XMMWORD[rcx]

+ mov rbp,rcx

+ mov eax,r10d

+ shl r10d,4

+ mov r9,rdx

+ and rdx,-16

+

+ movups xmm1,XMMWORD[16+r10*1+rcx]

+

+ movdqa xmm8,XMMWORD[$L$xts_magic]

+ movdqa xmm15,xmm2

+ pshufd xmm9,xmm2,0x5f

+ pxor xmm1,xmm0

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm10,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm10,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm11,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm11,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm12,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm12,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm13,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm13,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm15

+ psrad xmm9,31

+ paddq xmm15,xmm15

+ pand xmm9,xmm8

+ pxor xmm14,xmm0

+ pxor xmm15,xmm9

+ movaps XMMWORD[96+rsp],xmm1

+

+ sub rdx,16*6

+ jc NEAR $L$xts_dec_short

+

+ mov eax,16+96

+ lea rcx,[32+r10*1+rbp]

+ sub rax,r10

+ movups xmm1,XMMWORD[16+rbp]

+ mov r10,rax

+ lea r8,[$L$xts_magic]

+ jmp NEAR $L$xts_dec_grandloop

+

+ALIGN 32

+$L$xts_dec_grandloop:

+ movdqu xmm2,XMMWORD[rdi]

+ movdqa xmm8,xmm0

+ movdqu xmm3,XMMWORD[16+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm4,XMMWORD[32+rdi]

+ pxor xmm3,xmm11

+DB 102,15,56,222,209

+ movdqu xmm5,XMMWORD[48+rdi]

+ pxor xmm4,xmm12

+DB 102,15,56,222,217

+ movdqu xmm6,XMMWORD[64+rdi]

+ pxor xmm5,xmm13

+DB 102,15,56,222,225

+ movdqu xmm7,XMMWORD[80+rdi]

+ pxor xmm8,xmm15

+ movdqa xmm9,XMMWORD[96+rsp]

+ pxor xmm6,xmm14

+DB 102,15,56,222,233

+ movups xmm0,XMMWORD[32+rbp]

+ lea rdi,[96+rdi]

+ pxor xmm7,xmm8

+

+ pxor xmm10,xmm9

+DB 102,15,56,222,241

+ pxor xmm11,xmm9

+ movdqa XMMWORD[rsp],xmm10

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[48+rbp]

+ pxor xmm12,xmm9

+

+DB 102,15,56,222,208

+ pxor xmm13,xmm9

+ movdqa XMMWORD[16+rsp],xmm11

+DB 102,15,56,222,216

+ pxor xmm14,xmm9

+ movdqa XMMWORD[32+rsp],xmm12

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ pxor xmm8,xmm9

+ movdqa XMMWORD[64+rsp],xmm14

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[64+rbp]

+ movdqa XMMWORD[80+rsp],xmm8

+ pshufd xmm9,xmm15,0x5f

+ jmp NEAR $L$xts_dec_loop6

+ALIGN 32

+$L$xts_dec_loop6:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[((-64))+rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[((-80))+rax*1+rcx]

+ jnz NEAR $L$xts_dec_loop6

+

+ movdqa xmm8,XMMWORD[r8]

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+DB 102,15,56,222,209

+ paddq xmm15,xmm15

+ psrad xmm14,31

+DB 102,15,56,222,217

+ pand xmm14,xmm8

+ movups xmm10,XMMWORD[rbp]

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+ pxor xmm15,xmm14

+ movaps xmm11,xmm10

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[((-64))+rcx]

+

+ movdqa xmm14,xmm9

+DB 102,15,56,222,208

+ paddd xmm9,xmm9

+ pxor xmm10,xmm15

+DB 102,15,56,222,216

+ psrad xmm14,31

+ paddq xmm15,xmm15

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ pand xmm14,xmm8

+ movaps xmm12,xmm11

+DB 102,15,56,222,240

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[((-48))+rcx]

+

+ paddd xmm9,xmm9

+DB 102,15,56,222,209

+ pxor xmm11,xmm15

+ psrad xmm14,31

+DB 102,15,56,222,217

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movdqa XMMWORD[48+rsp],xmm13

+ pxor xmm15,xmm14

+DB 102,15,56,222,241

+ movaps xmm13,xmm12

+ movdqa xmm14,xmm9

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[((-32))+rcx]

+

+ paddd xmm9,xmm9

+DB 102,15,56,222,208

+ pxor xmm12,xmm15

+ psrad xmm14,31

+DB 102,15,56,222,216

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+ pxor xmm15,xmm14

+ movaps xmm14,xmm13

+DB 102,15,56,222,248

+

+ movdqa xmm0,xmm9

+ paddd xmm9,xmm9

+DB 102,15,56,222,209

+ pxor xmm13,xmm15

+ psrad xmm0,31

+DB 102,15,56,222,217

+ paddq xmm15,xmm15

+ pand xmm0,xmm8

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ pxor xmm15,xmm0

+ movups xmm0,XMMWORD[rbp]

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[16+rbp]

+

+ pxor xmm14,xmm15

+DB 102,15,56,223,84,36,0

+ psrad xmm9,31

+ paddq xmm15,xmm15

+DB 102,15,56,223,92,36,16

+DB 102,15,56,223,100,36,32

+ pand xmm9,xmm8

+ mov rax,r10

+DB 102,15,56,223,108,36,48

+DB 102,15,56,223,116,36,64

+DB 102,15,56,223,124,36,80

+ pxor xmm15,xmm9

+

+ lea rsi,[96+rsi]

+ movups XMMWORD[(-96)+rsi],xmm2

+ movups XMMWORD[(-80)+rsi],xmm3

+ movups XMMWORD[(-64)+rsi],xmm4

+ movups XMMWORD[(-48)+rsi],xmm5

+ movups XMMWORD[(-32)+rsi],xmm6

+ movups XMMWORD[(-16)+rsi],xmm7

+ sub rdx,16*6

+ jnc NEAR $L$xts_dec_grandloop

+

+ mov eax,16+96

+ sub eax,r10d

+ mov rcx,rbp

+ shr eax,4

+

+$L$xts_dec_short:

+

+ mov r10d,eax

+ pxor xmm10,xmm0

+ pxor xmm11,xmm0

+ add rdx,16*6

+ jz NEAR $L$xts_dec_done

+

+ pxor xmm12,xmm0

+ cmp rdx,0x20

+ jb NEAR $L$xts_dec_one

+ pxor xmm13,xmm0

+ je NEAR $L$xts_dec_two

+

+ pxor xmm14,xmm0

+ cmp rdx,0x40

+ jb NEAR $L$xts_dec_three

+ je NEAR $L$xts_dec_four

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm5,XMMWORD[48+rdi]

+ pxor xmm3,xmm11

+ movdqu xmm6,XMMWORD[64+rdi]

+ lea rdi,[80+rdi]

+ pxor xmm4,xmm12

+ pxor xmm5,xmm13

+ pxor xmm6,xmm14

+

+ call _aesni_decrypt6

+

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ movdqu XMMWORD[rsi],xmm2

+ xorps xmm5,xmm13

+ movdqu XMMWORD[16+rsi],xmm3

+ xorps xmm6,xmm14

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm14,xmm14

+ movdqu XMMWORD[48+rsi],xmm5

+ pcmpgtd xmm14,xmm15

+ movdqu XMMWORD[64+rsi],xmm6

+ lea rsi,[80+rsi]

+ pshufd xmm11,xmm14,0x13

+ and r9,15

+ jz NEAR $L$xts_dec_ret

+

+ movdqa xmm10,xmm15

+ paddq xmm15,xmm15

+ pand xmm11,xmm8

+ pxor xmm11,xmm15

+ jmp NEAR $L$xts_dec_done2

+

+ALIGN 16

+$L$xts_dec_one:

+ movups xmm2,XMMWORD[rdi]

+ lea rdi,[16+rdi]

+ xorps xmm2,xmm10

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_12:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_12

+DB 102,15,56,223,209

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm11

+ movups XMMWORD[rsi],xmm2

+ movdqa xmm11,xmm12

+ lea rsi,[16+rsi]

+ jmp NEAR $L$xts_dec_done

+

+ALIGN 16

+$L$xts_dec_two:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ lea rdi,[32+rdi]

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+

+ call _aesni_decrypt2

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm12

+ xorps xmm3,xmm11

+ movdqa xmm11,xmm13

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ lea rsi,[32+rsi]

+ jmp NEAR $L$xts_dec_done

+

+ALIGN 16

+$L$xts_dec_three:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ movups xmm4,XMMWORD[32+rdi]

+ lea rdi,[48+rdi]

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+

+ call _aesni_decrypt3

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm13

+ xorps xmm3,xmm11

+ movdqa xmm11,xmm14

+ xorps xmm4,xmm12

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ lea rsi,[48+rsi]

+ jmp NEAR $L$xts_dec_done

+

+ALIGN 16

+$L$xts_dec_four:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ movups xmm4,XMMWORD[32+rdi]

+ xorps xmm2,xmm10

+ movups xmm5,XMMWORD[48+rdi]

+ lea rdi,[64+rdi]

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ xorps xmm5,xmm13

+

+ call _aesni_decrypt4

+

+ pxor xmm2,xmm10

+ movdqa xmm10,xmm14

+ pxor xmm3,xmm11

+ movdqa xmm11,xmm15

+ pxor xmm4,xmm12

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm5,xmm13

+ movdqu XMMWORD[16+rsi],xmm3

+ movdqu XMMWORD[32+rsi],xmm4

+ movdqu XMMWORD[48+rsi],xmm5

+ lea rsi,[64+rsi]

+ jmp NEAR $L$xts_dec_done

+

+ALIGN 16

+$L$xts_dec_done:

+ and r9,15

+ jz NEAR $L$xts_dec_ret

+$L$xts_dec_done2:

+ mov rdx,r9

+ mov rcx,rbp

+ mov eax,r10d

+

+ movups xmm2,XMMWORD[rdi]

+ xorps xmm2,xmm11

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_13:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_13

+DB 102,15,56,223,209

+ xorps xmm2,xmm11

+ movups XMMWORD[rsi],xmm2

+

+$L$xts_dec_steal:

+ movzx eax,BYTE[16+rdi]

+ movzx ecx,BYTE[rsi]

+ lea rdi,[1+rdi]

+ mov BYTE[rsi],al

+ mov BYTE[16+rsi],cl

+ lea rsi,[1+rsi]

+ sub rdx,1

+ jnz NEAR $L$xts_dec_steal

+

+ sub rsi,r9

+ mov rcx,rbp

+ mov eax,r10d

+

+ movups xmm2,XMMWORD[rsi]

+ xorps xmm2,xmm10

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_14:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_14

+DB 102,15,56,223,209

+ xorps xmm2,xmm10

+ movups XMMWORD[rsi],xmm2

+

+$L$xts_dec_ret:

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ movaps xmm6,XMMWORD[((-168))+r11]

+ movaps XMMWORD[(-168)+r11],xmm0

+ movaps xmm7,XMMWORD[((-152))+r11]

+ movaps XMMWORD[(-152)+r11],xmm0

+ movaps xmm8,XMMWORD[((-136))+r11]

+ movaps XMMWORD[(-136)+r11],xmm0

+ movaps xmm9,XMMWORD[((-120))+r11]

+ movaps XMMWORD[(-120)+r11],xmm0

+ movaps xmm10,XMMWORD[((-104))+r11]

+ movaps XMMWORD[(-104)+r11],xmm0

+ movaps xmm11,XMMWORD[((-88))+r11]

+ movaps XMMWORD[(-88)+r11],xmm0

+ movaps xmm12,XMMWORD[((-72))+r11]

+ movaps XMMWORD[(-72)+r11],xmm0

+ movaps xmm13,XMMWORD[((-56))+r11]

+ movaps XMMWORD[(-56)+r11],xmm0

+ movaps xmm14,XMMWORD[((-40))+r11]

+ movaps XMMWORD[(-40)+r11],xmm0

+ movaps xmm15,XMMWORD[((-24))+r11]

+ movaps XMMWORD[(-24)+r11],xmm0

+ movaps XMMWORD[rsp],xmm0

+ movaps XMMWORD[16+rsp],xmm0

+ movaps XMMWORD[32+rsp],xmm0

+ movaps XMMWORD[48+rsp],xmm0

+ movaps XMMWORD[64+rsp],xmm0

+ movaps XMMWORD[80+rsp],xmm0

+ movaps XMMWORD[96+rsp],xmm0

+ mov rbp,QWORD[((-8))+r11]

+

+ lea rsp,[r11]

+

+$L$xts_dec_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_xts_decrypt:

+global aesni_ocb_encrypt

+

+ALIGN 32

+aesni_ocb_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ocb_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea rax,[rsp]

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ lea rsp,[((-160))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+ movaps XMMWORD[64+rsp],xmm10

+ movaps XMMWORD[80+rsp],xmm11

+ movaps XMMWORD[96+rsp],xmm12

+ movaps XMMWORD[112+rsp],xmm13

+ movaps XMMWORD[128+rsp],xmm14

+ movaps XMMWORD[144+rsp],xmm15

+$L$ocb_enc_body:

+ mov rbx,QWORD[56+rax]

+ mov rbp,QWORD[((56+8))+rax]

+

+ mov r10d,DWORD[240+rcx]

+ mov r11,rcx

+ shl r10d,4

+ movups xmm9,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+r10*1+rcx]

+

+ movdqu xmm15,XMMWORD[r9]

+ pxor xmm9,xmm1

+ pxor xmm15,xmm1

+

+ mov eax,16+32

+ lea rcx,[32+r10*1+r11]

+ movups xmm1,XMMWORD[16+r11]

+ sub rax,r10

+ mov r10,rax

+

+ movdqu xmm10,XMMWORD[rbx]

+ movdqu xmm8,XMMWORD[rbp]

+

+ test r8,1

+ jnz NEAR $L$ocb_enc_odd

+

+ bsf r12,r8

+ add r8,1

+ shl r12,4

+ movdqu xmm7,XMMWORD[r12*1+rbx]

+ movdqu xmm2,XMMWORD[rdi]

+ lea rdi,[16+rdi]

+

+ call __ocb_encrypt1

+

+ movdqa xmm15,xmm7

+ movups XMMWORD[rsi],xmm2

+ lea rsi,[16+rsi]

+ sub rdx,1

+ jz NEAR $L$ocb_enc_done

+

+$L$ocb_enc_odd:

+ lea r12,[1+r8]

+ lea r13,[3+r8]

+ lea r14,[5+r8]

+ lea r8,[6+r8]

+ bsf r12,r12

+ bsf r13,r13

+ bsf r14,r14

+ shl r12,4

+ shl r13,4

+ shl r14,4

+

+ sub rdx,6

+ jc NEAR $L$ocb_enc_short

+ jmp NEAR $L$ocb_enc_grandloop

+

+ALIGN 32

+$L$ocb_enc_grandloop:

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqu xmm7,XMMWORD[80+rdi]

+ lea rdi,[96+rdi]

+

+ call __ocb_encrypt6

+

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ movups XMMWORD[80+rsi],xmm7

+ lea rsi,[96+rsi]

+ sub rdx,6

+ jnc NEAR $L$ocb_enc_grandloop

+

+$L$ocb_enc_short:

+ add rdx,6

+ jz NEAR $L$ocb_enc_done

+

+ movdqu xmm2,XMMWORD[rdi]

+ cmp rdx,2

+ jb NEAR $L$ocb_enc_one

+ movdqu xmm3,XMMWORD[16+rdi]

+ je NEAR $L$ocb_enc_two

+

+ movdqu xmm4,XMMWORD[32+rdi]

+ cmp rdx,4

+ jb NEAR $L$ocb_enc_three

+ movdqu xmm5,XMMWORD[48+rdi]

+ je NEAR $L$ocb_enc_four

+

+ movdqu xmm6,XMMWORD[64+rdi]

+ pxor xmm7,xmm7

+

+ call __ocb_encrypt6

+

+ movdqa xmm15,xmm14

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+

+ jmp NEAR $L$ocb_enc_done

+

+ALIGN 16

+$L$ocb_enc_one:

+ movdqa xmm7,xmm10

+

+ call __ocb_encrypt1

+

+ movdqa xmm15,xmm7

+ movups XMMWORD[rsi],xmm2

+ jmp NEAR $L$ocb_enc_done

+

+ALIGN 16

+$L$ocb_enc_two:

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+

+ call __ocb_encrypt4

+

+ movdqa xmm15,xmm11

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+

+ jmp NEAR $L$ocb_enc_done

+

+ALIGN 16

+$L$ocb_enc_three:

+ pxor xmm5,xmm5

+

+ call __ocb_encrypt4

+

+ movdqa xmm15,xmm12

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+

+ jmp NEAR $L$ocb_enc_done

+

+ALIGN 16

+$L$ocb_enc_four:

+ call __ocb_encrypt4

+

+ movdqa xmm15,xmm13

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+

+$L$ocb_enc_done:

+ pxor xmm15,xmm0

+ movdqu XMMWORD[rbp],xmm8

+ movdqu XMMWORD[r9],xmm15

+

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ movaps xmm6,XMMWORD[rsp]

+ movaps XMMWORD[rsp],xmm0

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ movaps xmm10,XMMWORD[64+rsp]

+ movaps XMMWORD[64+rsp],xmm0

+ movaps xmm11,XMMWORD[80+rsp]

+ movaps XMMWORD[80+rsp],xmm0

+ movaps xmm12,XMMWORD[96+rsp]

+ movaps XMMWORD[96+rsp],xmm0

+ movaps xmm13,XMMWORD[112+rsp]

+ movaps XMMWORD[112+rsp],xmm0

+ movaps xmm14,XMMWORD[128+rsp]

+ movaps XMMWORD[128+rsp],xmm0

+ movaps xmm15,XMMWORD[144+rsp]

+ movaps XMMWORD[144+rsp],xmm0

+ lea rax,[((160+40))+rsp]

+$L$ocb_enc_pop:

+ mov r14,QWORD[((-40))+rax]

+

+ mov r13,QWORD[((-32))+rax]

+

+ mov r12,QWORD[((-24))+rax]

+

+ mov rbp,QWORD[((-16))+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+

+ lea rsp,[rax]

+

+$L$ocb_enc_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ocb_encrypt:

+

+

+ALIGN 32

+__ocb_encrypt6:

+

+ pxor xmm15,xmm9

+ movdqu xmm11,XMMWORD[r12*1+rbx]

+ movdqa xmm12,xmm10

+ movdqu xmm13,XMMWORD[r13*1+rbx]

+ movdqa xmm14,xmm10

+ pxor xmm10,xmm15

+ movdqu xmm15,XMMWORD[r14*1+rbx]

+ pxor xmm11,xmm10

+ pxor xmm8,xmm2

+ pxor xmm2,xmm10

+ pxor xmm12,xmm11

+ pxor xmm8,xmm3

+ pxor xmm3,xmm11

+ pxor xmm13,xmm12

+ pxor xmm8,xmm4

+ pxor xmm4,xmm12

+ pxor xmm14,xmm13

+ pxor xmm8,xmm5

+ pxor xmm5,xmm13

+ pxor xmm15,xmm14

+ pxor xmm8,xmm6

+ pxor xmm6,xmm14

+ pxor xmm8,xmm7

+ pxor xmm7,xmm15

+ movups xmm0,XMMWORD[32+r11]

+

+ lea r12,[1+r8]

+ lea r13,[3+r8]

+ lea r14,[5+r8]

+ add r8,6

+ pxor xmm10,xmm9

+ bsf r12,r12

+ bsf r13,r13

+ bsf r14,r14

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ pxor xmm11,xmm9

+ pxor xmm12,xmm9

+DB 102,15,56,220,241

+ pxor xmm13,xmm9

+ pxor xmm14,xmm9

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[48+r11]

+ pxor xmm15,xmm9

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[64+r11]

+ shl r12,4

+ shl r13,4

+ jmp NEAR $L$ocb_enc_loop6

+

+ALIGN 32

+$L$ocb_enc_loop6:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ocb_enc_loop6

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[16+r11]

+ shl r14,4

+

+DB 102,65,15,56,221,210

+ movdqu xmm10,XMMWORD[rbx]

+ mov rax,r10

+DB 102,65,15,56,221,219

+DB 102,65,15,56,221,228

+DB 102,65,15,56,221,237

+DB 102,65,15,56,221,246

+DB 102,65,15,56,221,255

+ DB 0F3h,0C3h ;repret

+

+

+

+

+ALIGN 32

+__ocb_encrypt4:

+

+ pxor xmm15,xmm9

+ movdqu xmm11,XMMWORD[r12*1+rbx]

+ movdqa xmm12,xmm10

+ movdqu xmm13,XMMWORD[r13*1+rbx]

+ pxor xmm10,xmm15

+ pxor xmm11,xmm10

+ pxor xmm8,xmm2

+ pxor xmm2,xmm10

+ pxor xmm12,xmm11

+ pxor xmm8,xmm3

+ pxor xmm3,xmm11

+ pxor xmm13,xmm12

+ pxor xmm8,xmm4

+ pxor xmm4,xmm12

+ pxor xmm8,xmm5

+ pxor xmm5,xmm13

+ movups xmm0,XMMWORD[32+r11]

+

+ pxor xmm10,xmm9

+ pxor xmm11,xmm9

+ pxor xmm12,xmm9

+ pxor xmm13,xmm9

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[48+r11]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[64+r11]

+ jmp NEAR $L$ocb_enc_loop4

+

+ALIGN 32

+$L$ocb_enc_loop4:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ocb_enc_loop4

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[16+r11]

+ mov rax,r10

+

+DB 102,65,15,56,221,210

+DB 102,65,15,56,221,219

+DB 102,65,15,56,221,228

+DB 102,65,15,56,221,237

+ DB 0F3h,0C3h ;repret

+

+

+

+

+ALIGN 32

+__ocb_encrypt1:

+

+ pxor xmm7,xmm15

+ pxor xmm7,xmm9

+ pxor xmm8,xmm2

+ pxor xmm2,xmm7

+ movups xmm0,XMMWORD[32+r11]

+

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[48+r11]

+ pxor xmm7,xmm9

+

+DB 102,15,56,220,208

+ movups xmm0,XMMWORD[64+r11]

+ jmp NEAR $L$ocb_enc_loop1

+

+ALIGN 32

+$L$ocb_enc_loop1:

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,220,208

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ocb_enc_loop1

+

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[16+r11]

+ mov rax,r10

+

+DB 102,15,56,221,215

+ DB 0F3h,0C3h ;repret

+

+

+

+global aesni_ocb_decrypt

+

+ALIGN 32

+aesni_ocb_decrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ocb_decrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea rax,[rsp]

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ lea rsp,[((-160))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+ movaps XMMWORD[64+rsp],xmm10

+ movaps XMMWORD[80+rsp],xmm11

+ movaps XMMWORD[96+rsp],xmm12

+ movaps XMMWORD[112+rsp],xmm13

+ movaps XMMWORD[128+rsp],xmm14

+ movaps XMMWORD[144+rsp],xmm15

+$L$ocb_dec_body:

+ mov rbx,QWORD[56+rax]

+ mov rbp,QWORD[((56+8))+rax]

+

+ mov r10d,DWORD[240+rcx]

+ mov r11,rcx

+ shl r10d,4

+ movups xmm9,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+r10*1+rcx]

+

+ movdqu xmm15,XMMWORD[r9]

+ pxor xmm9,xmm1

+ pxor xmm15,xmm1

+

+ mov eax,16+32

+ lea rcx,[32+r10*1+r11]

+ movups xmm1,XMMWORD[16+r11]

+ sub rax,r10

+ mov r10,rax

+

+ movdqu xmm10,XMMWORD[rbx]

+ movdqu xmm8,XMMWORD[rbp]

+

+ test r8,1

+ jnz NEAR $L$ocb_dec_odd

+

+ bsf r12,r8

+ add r8,1

+ shl r12,4

+ movdqu xmm7,XMMWORD[r12*1+rbx]

+ movdqu xmm2,XMMWORD[rdi]

+ lea rdi,[16+rdi]

+

+ call __ocb_decrypt1

+

+ movdqa xmm15,xmm7

+ movups XMMWORD[rsi],xmm2

+ xorps xmm8,xmm2

+ lea rsi,[16+rsi]

+ sub rdx,1

+ jz NEAR $L$ocb_dec_done

+

+$L$ocb_dec_odd:

+ lea r12,[1+r8]

+ lea r13,[3+r8]

+ lea r14,[5+r8]

+ lea r8,[6+r8]

+ bsf r12,r12

+ bsf r13,r13

+ bsf r14,r14

+ shl r12,4

+ shl r13,4

+ shl r14,4

+

+ sub rdx,6

+ jc NEAR $L$ocb_dec_short

+ jmp NEAR $L$ocb_dec_grandloop

+

+ALIGN 32

+$L$ocb_dec_grandloop:

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqu xmm7,XMMWORD[80+rdi]

+ lea rdi,[96+rdi]

+

+ call __ocb_decrypt6

+

+ movups XMMWORD[rsi],xmm2

+ pxor xmm8,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm8,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm8,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm8,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm8,xmm6

+ movups XMMWORD[80+rsi],xmm7

+ pxor xmm8,xmm7

+ lea rsi,[96+rsi]

+ sub rdx,6

+ jnc NEAR $L$ocb_dec_grandloop

+

+$L$ocb_dec_short:

+ add rdx,6

+ jz NEAR $L$ocb_dec_done

+

+ movdqu xmm2,XMMWORD[rdi]

+ cmp rdx,2

+ jb NEAR $L$ocb_dec_one

+ movdqu xmm3,XMMWORD[16+rdi]

+ je NEAR $L$ocb_dec_two

+

+ movdqu xmm4,XMMWORD[32+rdi]

+ cmp rdx,4

+ jb NEAR $L$ocb_dec_three

+ movdqu xmm5,XMMWORD[48+rdi]

+ je NEAR $L$ocb_dec_four

+

+ movdqu xmm6,XMMWORD[64+rdi]

+ pxor xmm7,xmm7

+

+ call __ocb_decrypt6

+

+ movdqa xmm15,xmm14

+ movups XMMWORD[rsi],xmm2

+ pxor xmm8,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm8,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm8,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm8,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm8,xmm6

+

+ jmp NEAR $L$ocb_dec_done

+

+ALIGN 16

+$L$ocb_dec_one:

+ movdqa xmm7,xmm10

+

+ call __ocb_decrypt1

+

+ movdqa xmm15,xmm7

+ movups XMMWORD[rsi],xmm2

+ xorps xmm8,xmm2

+ jmp NEAR $L$ocb_dec_done

+

+ALIGN 16

+$L$ocb_dec_two:

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+

+ call __ocb_decrypt4

+

+ movdqa xmm15,xmm11

+ movups XMMWORD[rsi],xmm2

+ xorps xmm8,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ xorps xmm8,xmm3

+

+ jmp NEAR $L$ocb_dec_done

+

+ALIGN 16

+$L$ocb_dec_three:

+ pxor xmm5,xmm5

+

+ call __ocb_decrypt4

+

+ movdqa xmm15,xmm12

+ movups XMMWORD[rsi],xmm2

+ xorps xmm8,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ xorps xmm8,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ xorps xmm8,xmm4

+

+ jmp NEAR $L$ocb_dec_done

+

+ALIGN 16

+$L$ocb_dec_four:

+ call __ocb_decrypt4

+

+ movdqa xmm15,xmm13

+ movups XMMWORD[rsi],xmm2

+ pxor xmm8,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm8,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm8,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm8,xmm5

+

+$L$ocb_dec_done:

+ pxor xmm15,xmm0

+ movdqu XMMWORD[rbp],xmm8

+ movdqu XMMWORD[r9],xmm15

+

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ movaps xmm6,XMMWORD[rsp]

+ movaps XMMWORD[rsp],xmm0

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ movaps xmm10,XMMWORD[64+rsp]

+ movaps XMMWORD[64+rsp],xmm0

+ movaps xmm11,XMMWORD[80+rsp]

+ movaps XMMWORD[80+rsp],xmm0

+ movaps xmm12,XMMWORD[96+rsp]

+ movaps XMMWORD[96+rsp],xmm0

+ movaps xmm13,XMMWORD[112+rsp]

+ movaps XMMWORD[112+rsp],xmm0

+ movaps xmm14,XMMWORD[128+rsp]

+ movaps XMMWORD[128+rsp],xmm0

+ movaps xmm15,XMMWORD[144+rsp]

+ movaps XMMWORD[144+rsp],xmm0

+ lea rax,[((160+40))+rsp]

+$L$ocb_dec_pop:

+ mov r14,QWORD[((-40))+rax]

+

+ mov r13,QWORD[((-32))+rax]

+

+ mov r12,QWORD[((-24))+rax]

+

+ mov rbp,QWORD[((-16))+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+

+ lea rsp,[rax]

+

+$L$ocb_dec_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ocb_decrypt:

+

+

+ALIGN 32

+__ocb_decrypt6:

+

+ pxor xmm15,xmm9

+ movdqu xmm11,XMMWORD[r12*1+rbx]

+ movdqa xmm12,xmm10

+ movdqu xmm13,XMMWORD[r13*1+rbx]

+ movdqa xmm14,xmm10

+ pxor xmm10,xmm15

+ movdqu xmm15,XMMWORD[r14*1+rbx]

+ pxor xmm11,xmm10

+ pxor xmm2,xmm10

+ pxor xmm12,xmm11

+ pxor xmm3,xmm11

+ pxor xmm13,xmm12

+ pxor xmm4,xmm12

+ pxor xmm14,xmm13

+ pxor xmm5,xmm13

+ pxor xmm15,xmm14

+ pxor xmm6,xmm14

+ pxor xmm7,xmm15

+ movups xmm0,XMMWORD[32+r11]

+

+ lea r12,[1+r8]

+ lea r13,[3+r8]

+ lea r14,[5+r8]

+ add r8,6

+ pxor xmm10,xmm9

+ bsf r12,r12

+ bsf r13,r13

+ bsf r14,r14

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ pxor xmm11,xmm9

+ pxor xmm12,xmm9

+DB 102,15,56,222,241

+ pxor xmm13,xmm9

+ pxor xmm14,xmm9

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[48+r11]

+ pxor xmm15,xmm9

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[64+r11]

+ shl r12,4

+ shl r13,4

+ jmp NEAR $L$ocb_dec_loop6

+

+ALIGN 32

+$L$ocb_dec_loop6:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ocb_dec_loop6

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[16+r11]

+ shl r14,4

+

+DB 102,65,15,56,223,210

+ movdqu xmm10,XMMWORD[rbx]

+ mov rax,r10

+DB 102,65,15,56,223,219

+DB 102,65,15,56,223,228

+DB 102,65,15,56,223,237

+DB 102,65,15,56,223,246

+DB 102,65,15,56,223,255

+ DB 0F3h,0C3h ;repret

+

+

+

+

+ALIGN 32

+__ocb_decrypt4:

+

+ pxor xmm15,xmm9

+ movdqu xmm11,XMMWORD[r12*1+rbx]

+ movdqa xmm12,xmm10

+ movdqu xmm13,XMMWORD[r13*1+rbx]

+ pxor xmm10,xmm15

+ pxor xmm11,xmm10

+ pxor xmm2,xmm10

+ pxor xmm12,xmm11

+ pxor xmm3,xmm11

+ pxor xmm13,xmm12

+ pxor xmm4,xmm12

+ pxor xmm5,xmm13

+ movups xmm0,XMMWORD[32+r11]

+

+ pxor xmm10,xmm9

+ pxor xmm11,xmm9

+ pxor xmm12,xmm9

+ pxor xmm13,xmm9

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[48+r11]

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[64+r11]

+ jmp NEAR $L$ocb_dec_loop4

+

+ALIGN 32

+$L$ocb_dec_loop4:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ocb_dec_loop4

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[16+r11]

+ mov rax,r10

+

+DB 102,65,15,56,223,210

+DB 102,65,15,56,223,219

+DB 102,65,15,56,223,228

+DB 102,65,15,56,223,237

+ DB 0F3h,0C3h ;repret

+

+

+

+

+ALIGN 32

+__ocb_decrypt1:

+

+ pxor xmm7,xmm15

+ pxor xmm7,xmm9

+ pxor xmm2,xmm7

+ movups xmm0,XMMWORD[32+r11]

+

+DB 102,15,56,222,209

+ movups xmm1,XMMWORD[48+r11]

+ pxor xmm7,xmm9

+

+DB 102,15,56,222,208

+ movups xmm0,XMMWORD[64+r11]

+ jmp NEAR $L$ocb_dec_loop1

+

+ALIGN 32

+$L$ocb_dec_loop1:

+DB 102,15,56,222,209

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,222,208

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ocb_dec_loop1

+

+DB 102,15,56,222,209

+ movups xmm1,XMMWORD[16+r11]

+ mov rax,r10

+

+DB 102,15,56,223,215

+ DB 0F3h,0C3h ;repret

+

+

+global aesni_cbc_encrypt

+

+ALIGN 16

+aesni_cbc_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_cbc_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ test rdx,rdx

+ jz NEAR $L$cbc_ret

+

+ mov r10d,DWORD[240+rcx]

+ mov r11,rcx

+ test r9d,r9d

+ jz NEAR $L$cbc_decrypt

+

+ movups xmm2,XMMWORD[r8]

+ mov eax,r10d

+ cmp rdx,16

+ jb NEAR $L$cbc_enc_tail

+ sub rdx,16

+ jmp NEAR $L$cbc_enc_loop

+ALIGN 16

+$L$cbc_enc_loop:

+ movups xmm3,XMMWORD[rdi]

+ lea rdi,[16+rdi]

+

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm3,xmm0

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm3

+$L$oop_enc1_15:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_15

+DB 102,15,56,221,209

+ mov eax,r10d

+ mov rcx,r11

+ movups XMMWORD[rsi],xmm2

+ lea rsi,[16+rsi]

+ sub rdx,16

+ jnc NEAR $L$cbc_enc_loop

+ add rdx,16

+ jnz NEAR $L$cbc_enc_tail

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ movups XMMWORD[r8],xmm2

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ jmp NEAR $L$cbc_ret

+

+$L$cbc_enc_tail:

+ mov rcx,rdx

+ xchg rsi,rdi

+ DD 0x9066A4F3

+ mov ecx,16

+ sub rcx,rdx

+ xor eax,eax

+ DD 0x9066AAF3

+ lea rdi,[((-16))+rdi]

+ mov eax,r10d

+ mov rsi,rdi

+ mov rcx,r11

+ xor rdx,rdx

+ jmp NEAR $L$cbc_enc_loop

+

+ALIGN 16

+$L$cbc_decrypt:

+ cmp rdx,16

+ jne NEAR $L$cbc_decrypt_bulk

+

+

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[r8]

+ movdqa xmm4,xmm2

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_16:

+DB 102,15,56,222,209

+ dec r10d

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_16

+DB 102,15,56,223,209

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ movdqu XMMWORD[r8],xmm4

+ xorps xmm2,xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ jmp NEAR $L$cbc_ret

+ALIGN 16

+$L$cbc_decrypt_bulk:

+ lea r11,[rsp]

+

+ push rbp

+

+ sub rsp,176

+ and rsp,-16

+ movaps XMMWORD[16+rsp],xmm6

+ movaps XMMWORD[32+rsp],xmm7

+ movaps XMMWORD[48+rsp],xmm8

+ movaps XMMWORD[64+rsp],xmm9

+ movaps XMMWORD[80+rsp],xmm10

+ movaps XMMWORD[96+rsp],xmm11

+ movaps XMMWORD[112+rsp],xmm12

+ movaps XMMWORD[128+rsp],xmm13

+ movaps XMMWORD[144+rsp],xmm14

+ movaps XMMWORD[160+rsp],xmm15

+$L$cbc_decrypt_body:

+ mov rbp,rcx

+ movups xmm10,XMMWORD[r8]

+ mov eax,r10d

+ cmp rdx,0x50

+ jbe NEAR $L$cbc_dec_tail

+

+ movups xmm0,XMMWORD[rcx]

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqa xmm11,xmm2

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqa xmm12,xmm3

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqa xmm13,xmm4

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqa xmm14,xmm5

+ movdqu xmm7,XMMWORD[80+rdi]

+ movdqa xmm15,xmm6

+ mov r9d,DWORD[((OPENSSL_ia32cap_P+4))]

+ cmp rdx,0x70

+ jbe NEAR $L$cbc_dec_six_or_seven

+

+ and r9d,71303168

+ sub rdx,0x50

+ cmp r9d,4194304

+ je NEAR $L$cbc_dec_loop6_enter

+ sub rdx,0x20

+ lea rcx,[112+rcx]

+ jmp NEAR $L$cbc_dec_loop8_enter

+ALIGN 16

+$L$cbc_dec_loop8:

+ movups XMMWORD[rsi],xmm9

+ lea rsi,[16+rsi]

+$L$cbc_dec_loop8_enter:

+ movdqu xmm8,XMMWORD[96+rdi]

+ pxor xmm2,xmm0

+ movdqu xmm9,XMMWORD[112+rdi]

+ pxor xmm3,xmm0

+ movups xmm1,XMMWORD[((16-112))+rcx]

+ pxor xmm4,xmm0

+ mov rbp,-1

+ cmp rdx,0x70

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+ pxor xmm7,xmm0

+ pxor xmm8,xmm0

+

+DB 102,15,56,222,209

+ pxor xmm9,xmm0

+ movups xmm0,XMMWORD[((32-112))+rcx]

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+ adc rbp,0

+ and rbp,128

+DB 102,68,15,56,222,201

+ add rbp,rdi

+ movups xmm1,XMMWORD[((48-112))+rcx]

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+DB 102,68,15,56,222,192

+DB 102,68,15,56,222,200

+ movups xmm0,XMMWORD[((64-112))+rcx]

+ nop

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+ movups xmm1,XMMWORD[((80-112))+rcx]

+ nop

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+DB 102,68,15,56,222,192

+DB 102,68,15,56,222,200

+ movups xmm0,XMMWORD[((96-112))+rcx]

+ nop

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+ movups xmm1,XMMWORD[((112-112))+rcx]

+ nop

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+DB 102,68,15,56,222,192

+DB 102,68,15,56,222,200

+ movups xmm0,XMMWORD[((128-112))+rcx]

+ nop

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+ movups xmm1,XMMWORD[((144-112))+rcx]

+ cmp eax,11

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+DB 102,68,15,56,222,192

+DB 102,68,15,56,222,200

+ movups xmm0,XMMWORD[((160-112))+rcx]

+ jb NEAR $L$cbc_dec_done

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+ movups xmm1,XMMWORD[((176-112))+rcx]

+ nop

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+DB 102,68,15,56,222,192

+DB 102,68,15,56,222,200

+ movups xmm0,XMMWORD[((192-112))+rcx]

+ je NEAR $L$cbc_dec_done

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+ movups xmm1,XMMWORD[((208-112))+rcx]

+ nop

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+DB 102,68,15,56,222,192

+DB 102,68,15,56,222,200

+ movups xmm0,XMMWORD[((224-112))+rcx]

+ jmp NEAR $L$cbc_dec_done

+ALIGN 16

+$L$cbc_dec_done:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+ pxor xmm10,xmm0

+ pxor xmm11,xmm0

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ pxor xmm12,xmm0

+ pxor xmm13,xmm0

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ pxor xmm14,xmm0

+ pxor xmm15,xmm0

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+ movdqu xmm1,XMMWORD[80+rdi]

+

+DB 102,65,15,56,223,210

+ movdqu xmm10,XMMWORD[96+rdi]

+ pxor xmm1,xmm0

+DB 102,65,15,56,223,219

+ pxor xmm10,xmm0

+ movdqu xmm0,XMMWORD[112+rdi]

+DB 102,65,15,56,223,228

+ lea rdi,[128+rdi]

+ movdqu xmm11,XMMWORD[rbp]

+DB 102,65,15,56,223,237

+DB 102,65,15,56,223,246

+ movdqu xmm12,XMMWORD[16+rbp]

+ movdqu xmm13,XMMWORD[32+rbp]

+DB 102,65,15,56,223,255

+DB 102,68,15,56,223,193

+ movdqu xmm14,XMMWORD[48+rbp]

+ movdqu xmm15,XMMWORD[64+rbp]

+DB 102,69,15,56,223,202

+ movdqa xmm10,xmm0

+ movdqu xmm1,XMMWORD[80+rbp]

+ movups xmm0,XMMWORD[((-112))+rcx]

+

+ movups XMMWORD[rsi],xmm2

+ movdqa xmm2,xmm11

+ movups XMMWORD[16+rsi],xmm3

+ movdqa xmm3,xmm12

+ movups XMMWORD[32+rsi],xmm4

+ movdqa xmm4,xmm13

+ movups XMMWORD[48+rsi],xmm5

+ movdqa xmm5,xmm14

+ movups XMMWORD[64+rsi],xmm6

+ movdqa xmm6,xmm15

+ movups XMMWORD[80+rsi],xmm7

+ movdqa xmm7,xmm1

+ movups XMMWORD[96+rsi],xmm8

+ lea rsi,[112+rsi]

+

+ sub rdx,0x80

+ ja NEAR $L$cbc_dec_loop8

+

+ movaps xmm2,xmm9

+ lea rcx,[((-112))+rcx]

+ add rdx,0x70

+ jle NEAR $L$cbc_dec_clear_tail_collected

+ movups XMMWORD[rsi],xmm9

+ lea rsi,[16+rsi]

+ cmp rdx,0x50

+ jbe NEAR $L$cbc_dec_tail

+

+ movaps xmm2,xmm11

+$L$cbc_dec_six_or_seven:

+ cmp rdx,0x60

+ ja NEAR $L$cbc_dec_seven

+

+ movaps xmm8,xmm7

+ call _aesni_decrypt6

+ pxor xmm2,xmm10

+ movaps xmm10,xmm8

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm4,xmm12

+ movdqu XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ pxor xmm5,xmm13

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ pxor xmm6,xmm14

+ movdqu XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ pxor xmm7,xmm15

+ movdqu XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ lea rsi,[80+rsi]

+ movdqa xmm2,xmm7

+ pxor xmm7,xmm7

+ jmp NEAR $L$cbc_dec_tail_collected

+

+ALIGN 16

+$L$cbc_dec_seven:

+ movups xmm8,XMMWORD[96+rdi]

+ xorps xmm9,xmm9

+ call _aesni_decrypt8

+ movups xmm9,XMMWORD[80+rdi]

+ pxor xmm2,xmm10

+ movups xmm10,XMMWORD[96+rdi]

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm4,xmm12

+ movdqu XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ pxor xmm5,xmm13

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ pxor xmm6,xmm14

+ movdqu XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ pxor xmm7,xmm15

+ movdqu XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ pxor xmm8,xmm9

+ movdqu XMMWORD[80+rsi],xmm7

+ pxor xmm7,xmm7

+ lea rsi,[96+rsi]

+ movdqa xmm2,xmm8

+ pxor xmm8,xmm8

+ pxor xmm9,xmm9

+ jmp NEAR $L$cbc_dec_tail_collected

+

+ALIGN 16

+$L$cbc_dec_loop6:

+ movups XMMWORD[rsi],xmm7

+ lea rsi,[16+rsi]

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqa xmm11,xmm2

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqa xmm12,xmm3

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqa xmm13,xmm4

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqa xmm14,xmm5

+ movdqu xmm7,XMMWORD[80+rdi]

+ movdqa xmm15,xmm6

+$L$cbc_dec_loop6_enter:

+ lea rdi,[96+rdi]

+ movdqa xmm8,xmm7

+

+ call _aesni_decrypt6

+

+ pxor xmm2,xmm10

+ movdqa xmm10,xmm8

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm4,xmm12

+ movdqu XMMWORD[16+rsi],xmm3

+ pxor xmm5,xmm13

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm6,xmm14

+ mov rcx,rbp

+ movdqu XMMWORD[48+rsi],xmm5

+ pxor xmm7,xmm15

+ mov eax,r10d

+ movdqu XMMWORD[64+rsi],xmm6

+ lea rsi,[80+rsi]

+ sub rdx,0x60

+ ja NEAR $L$cbc_dec_loop6

+

+ movdqa xmm2,xmm7

+ add rdx,0x50

+ jle NEAR $L$cbc_dec_clear_tail_collected

+ movups XMMWORD[rsi],xmm7

+ lea rsi,[16+rsi]

+

+$L$cbc_dec_tail:

+ movups xmm2,XMMWORD[rdi]

+ sub rdx,0x10

+ jbe NEAR $L$cbc_dec_one

+

+ movups xmm3,XMMWORD[16+rdi]

+ movaps xmm11,xmm2

+ sub rdx,0x10

+ jbe NEAR $L$cbc_dec_two

+

+ movups xmm4,XMMWORD[32+rdi]

+ movaps xmm12,xmm3

+ sub rdx,0x10

+ jbe NEAR $L$cbc_dec_three

+

+ movups xmm5,XMMWORD[48+rdi]

+ movaps xmm13,xmm4

+ sub rdx,0x10

+ jbe NEAR $L$cbc_dec_four

+

+ movups xmm6,XMMWORD[64+rdi]

+ movaps xmm14,xmm5

+ movaps xmm15,xmm6

+ xorps xmm7,xmm7

+ call _aesni_decrypt6

+ pxor xmm2,xmm10

+ movaps xmm10,xmm15

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm4,xmm12

+ movdqu XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ pxor xmm5,xmm13

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ pxor xmm6,xmm14

+ movdqu XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ lea rsi,[64+rsi]

+ movdqa xmm2,xmm6

+ pxor xmm6,xmm6

+ pxor xmm7,xmm7

+ sub rdx,0x10

+ jmp NEAR $L$cbc_dec_tail_collected

+

+ALIGN 16

+$L$cbc_dec_one:

+ movaps xmm11,xmm2

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_17:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_17

+DB 102,15,56,223,209

+ xorps xmm2,xmm10

+ movaps xmm10,xmm11

+ jmp NEAR $L$cbc_dec_tail_collected

+ALIGN 16

+$L$cbc_dec_two:

+ movaps xmm12,xmm3

+ call _aesni_decrypt2

+ pxor xmm2,xmm10

+ movaps xmm10,xmm12

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ movdqa xmm2,xmm3

+ pxor xmm3,xmm3

+ lea rsi,[16+rsi]

+ jmp NEAR $L$cbc_dec_tail_collected

+ALIGN 16

+$L$cbc_dec_three:

+ movaps xmm13,xmm4

+ call _aesni_decrypt3

+ pxor xmm2,xmm10

+ movaps xmm10,xmm13

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm4,xmm12

+ movdqu XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movdqa xmm2,xmm4

+ pxor xmm4,xmm4

+ lea rsi,[32+rsi]

+ jmp NEAR $L$cbc_dec_tail_collected

+ALIGN 16

+$L$cbc_dec_four:

+ movaps xmm14,xmm5

+ call _aesni_decrypt4

+ pxor xmm2,xmm10

+ movaps xmm10,xmm14

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm4,xmm12

+ movdqu XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ pxor xmm5,xmm13

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movdqa xmm2,xmm5

+ pxor xmm5,xmm5

+ lea rsi,[48+rsi]

+ jmp NEAR $L$cbc_dec_tail_collected

+

+ALIGN 16

+$L$cbc_dec_clear_tail_collected:

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+$L$cbc_dec_tail_collected:

+ movups XMMWORD[r8],xmm10

+ and rdx,15

+ jnz NEAR $L$cbc_dec_tail_partial

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ jmp NEAR $L$cbc_dec_ret

+ALIGN 16

+$L$cbc_dec_tail_partial:

+ movaps XMMWORD[rsp],xmm2

+ pxor xmm2,xmm2

+ mov rcx,16

+ mov rdi,rsi

+ sub rcx,rdx

+ lea rsi,[rsp]

+ DD 0x9066A4F3

+ movdqa XMMWORD[rsp],xmm2

+

+$L$cbc_dec_ret:

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ movaps xmm6,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm7,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm8,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ movaps xmm9,XMMWORD[64+rsp]

+ movaps XMMWORD[64+rsp],xmm0

+ movaps xmm10,XMMWORD[80+rsp]

+ movaps XMMWORD[80+rsp],xmm0

+ movaps xmm11,XMMWORD[96+rsp]

+ movaps XMMWORD[96+rsp],xmm0

+ movaps xmm12,XMMWORD[112+rsp]

+ movaps XMMWORD[112+rsp],xmm0

+ movaps xmm13,XMMWORD[128+rsp]

+ movaps XMMWORD[128+rsp],xmm0

+ movaps xmm14,XMMWORD[144+rsp]

+ movaps XMMWORD[144+rsp],xmm0

+ movaps xmm15,XMMWORD[160+rsp]

+ movaps XMMWORD[160+rsp],xmm0

+ mov rbp,QWORD[((-8))+r11]

+

+ lea rsp,[r11]

+

+$L$cbc_ret:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_cbc_encrypt:

+global aesni_set_decrypt_key

+

+ALIGN 16

+aesni_set_decrypt_key:

+

+DB 0x48,0x83,0xEC,0x08

+

+ call __aesni_set_encrypt_key

+ shl edx,4

+ test eax,eax

+ jnz NEAR $L$dec_key_ret

+ lea rcx,[16+rdx*1+r8]

+

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[rcx]

+ movups XMMWORD[rcx],xmm0

+ movups XMMWORD[r8],xmm1

+ lea r8,[16+r8]

+ lea rcx,[((-16))+rcx]

+

+$L$dec_key_inverse:

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[rcx]

+DB 102,15,56,219,192

+DB 102,15,56,219,201

+ lea r8,[16+r8]

+ lea rcx,[((-16))+rcx]

+ movups XMMWORD[16+rcx],xmm0

+ movups XMMWORD[(-16)+r8],xmm1

+ cmp rcx,r8

+ ja NEAR $L$dec_key_inverse

+

+ movups xmm0,XMMWORD[r8]

+DB 102,15,56,219,192

+ pxor xmm1,xmm1

+ movups XMMWORD[rcx],xmm0

+ pxor xmm0,xmm0

+$L$dec_key_ret:

+ add rsp,8

+

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_set_decrypt_key:

+

+global aesni_set_encrypt_key

+

+ALIGN 16

+aesni_set_encrypt_key:

+__aesni_set_encrypt_key:

+

+DB 0x48,0x83,0xEC,0x08

+

+ mov rax,-1

+ test rcx,rcx

+ jz NEAR $L$enc_key_ret

+ test r8,r8

+ jz NEAR $L$enc_key_ret

+

+ mov r10d,268437504

+ movups xmm0,XMMWORD[rcx]

+ xorps xmm4,xmm4

+ and r10d,DWORD[((OPENSSL_ia32cap_P+4))]

+ lea rax,[16+r8]

+ cmp edx,256

+ je NEAR $L$14rounds

+ cmp edx,192

+ je NEAR $L$12rounds

+ cmp edx,128

+ jne NEAR $L$bad_keybits

+

+$L$10rounds:

+ mov edx,9

+ cmp r10d,268435456

+ je NEAR $L$10rounds_alt

+

+ movups XMMWORD[r8],xmm0

+DB 102,15,58,223,200,1

+ call $L$key_expansion_128_cold

+DB 102,15,58,223,200,2

+ call $L$key_expansion_128

+DB 102,15,58,223,200,4

+ call $L$key_expansion_128

+DB 102,15,58,223,200,8

+ call $L$key_expansion_128

+DB 102,15,58,223,200,16

+ call $L$key_expansion_128

+DB 102,15,58,223,200,32

+ call $L$key_expansion_128

+DB 102,15,58,223,200,64

+ call $L$key_expansion_128

+DB 102,15,58,223,200,128

+ call $L$key_expansion_128

+DB 102,15,58,223,200,27

+ call $L$key_expansion_128

+DB 102,15,58,223,200,54

+ call $L$key_expansion_128

+ movups XMMWORD[rax],xmm0

+ mov DWORD[80+rax],edx

+ xor eax,eax

+ jmp NEAR $L$enc_key_ret

+

+ALIGN 16

+$L$10rounds_alt:

+ movdqa xmm5,XMMWORD[$L$key_rotate]

+ mov r10d,8

+ movdqa xmm4,XMMWORD[$L$key_rcon1]

+ movdqa xmm2,xmm0

+ movdqu XMMWORD[r8],xmm0

+ jmp NEAR $L$oop_key128

+

+ALIGN 16

+$L$oop_key128:

+DB 102,15,56,0,197

+DB 102,15,56,221,196

+ pslld xmm4,1

+ lea rax,[16+rax]

+

+ movdqa xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm2,xmm3

+

+ pxor xmm0,xmm2

+ movdqu XMMWORD[(-16)+rax],xmm0

+ movdqa xmm2,xmm0

+

+ dec r10d

+ jnz NEAR $L$oop_key128

+

+ movdqa xmm4,XMMWORD[$L$key_rcon1b]

+

+DB 102,15,56,0,197

+DB 102,15,56,221,196

+ pslld xmm4,1

+

+ movdqa xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm2,xmm3

+

+ pxor xmm0,xmm2

+ movdqu XMMWORD[rax],xmm0

+

+ movdqa xmm2,xmm0

+DB 102,15,56,0,197

+DB 102,15,56,221,196

+

+ movdqa xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm3,xmm2

+ pslldq xmm2,4

+ pxor xmm2,xmm3

+

+ pxor xmm0,xmm2

+ movdqu XMMWORD[16+rax],xmm0

+

+ mov DWORD[96+rax],edx

+ xor eax,eax

+ jmp NEAR $L$enc_key_ret

+

+ALIGN 16

+$L$12rounds:

+ movq xmm2,QWORD[16+rcx]

+ mov edx,11

+ cmp r10d,268435456

+ je NEAR $L$12rounds_alt

+

+ movups XMMWORD[r8],xmm0

+DB 102,15,58,223,202,1

+ call $L$key_expansion_192a_cold

+DB 102,15,58,223,202,2

+ call $L$key_expansion_192b

+DB 102,15,58,223,202,4

+ call $L$key_expansion_192a

+DB 102,15,58,223,202,8

+ call $L$key_expansion_192b

+DB 102,15,58,223,202,16

+ call $L$key_expansion_192a

+DB 102,15,58,223,202,32

+ call $L$key_expansion_192b

+DB 102,15,58,223,202,64

+ call $L$key_expansion_192a

+DB 102,15,58,223,202,128

+ call $L$key_expansion_192b

+ movups XMMWORD[rax],xmm0

+ mov DWORD[48+rax],edx

+ xor rax,rax

+ jmp NEAR $L$enc_key_ret

+

+ALIGN 16

+$L$12rounds_alt:

+ movdqa xmm5,XMMWORD[$L$key_rotate192]

+ movdqa xmm4,XMMWORD[$L$key_rcon1]

+ mov r10d,8

+ movdqu XMMWORD[r8],xmm0

+ jmp NEAR $L$oop_key192

+

+ALIGN 16

+$L$oop_key192:

+ movq QWORD[rax],xmm2

+ movdqa xmm1,xmm2

+DB 102,15,56,0,213

+DB 102,15,56,221,212

+ pslld xmm4,1

+ lea rax,[24+rax]

+

+ movdqa xmm3,xmm0

+ pslldq xmm0,4

+ pxor xmm3,xmm0

+ pslldq xmm0,4

+ pxor xmm3,xmm0

+ pslldq xmm0,4

+ pxor xmm0,xmm3

+

+ pshufd xmm3,xmm0,0xff

+ pxor xmm3,xmm1

+ pslldq xmm1,4

+ pxor xmm3,xmm1

+

+ pxor xmm0,xmm2

+ pxor xmm2,xmm3

+ movdqu XMMWORD[(-16)+rax],xmm0

+

+ dec r10d

+ jnz NEAR $L$oop_key192

+

+ mov DWORD[32+rax],edx

+ xor eax,eax

+ jmp NEAR $L$enc_key_ret

+

+ALIGN 16

+$L$14rounds:

+ movups xmm2,XMMWORD[16+rcx]

+ mov edx,13

+ lea rax,[16+rax]

+ cmp r10d,268435456

+ je NEAR $L$14rounds_alt

+

+ movups XMMWORD[r8],xmm0

+ movups XMMWORD[16+r8],xmm2

+DB 102,15,58,223,202,1

+ call $L$key_expansion_256a_cold

+DB 102,15,58,223,200,1

+ call $L$key_expansion_256b

+DB 102,15,58,223,202,2

+ call $L$key_expansion_256a

+DB 102,15,58,223,200,2

+ call $L$key_expansion_256b

+DB 102,15,58,223,202,4

+ call $L$key_expansion_256a

+DB 102,15,58,223,200,4

+ call $L$key_expansion_256b

+DB 102,15,58,223,202,8

+ call $L$key_expansion_256a

+DB 102,15,58,223,200,8

+ call $L$key_expansion_256b

+DB 102,15,58,223,202,16

+ call $L$key_expansion_256a

+DB 102,15,58,223,200,16

+ call $L$key_expansion_256b

+DB 102,15,58,223,202,32

+ call $L$key_expansion_256a

+DB 102,15,58,223,200,32

+ call $L$key_expansion_256b

+DB 102,15,58,223,202,64

+ call $L$key_expansion_256a

+ movups XMMWORD[rax],xmm0

+ mov DWORD[16+rax],edx

+ xor rax,rax

+ jmp NEAR $L$enc_key_ret

+

+ALIGN 16

+$L$14rounds_alt:

+ movdqa xmm5,XMMWORD[$L$key_rotate]

+ movdqa xmm4,XMMWORD[$L$key_rcon1]

+ mov r10d,7

+ movdqu XMMWORD[r8],xmm0

+ movdqa xmm1,xmm2

+ movdqu XMMWORD[16+r8],xmm2

+ jmp NEAR $L$oop_key256

+

+ALIGN 16

+$L$oop_key256:

+DB 102,15,56,0,213

+DB 102,15,56,221,212

+

+ movdqa xmm3,xmm0

+ pslldq xmm0,4

+ pxor xmm3,xmm0

+ pslldq xmm0,4

+ pxor xmm3,xmm0

+ pslldq xmm0,4

+ pxor xmm0,xmm3

+ pslld xmm4,1

+

+ pxor xmm0,xmm2

+ movdqu XMMWORD[rax],xmm0

+

+ dec r10d

+ jz NEAR $L$done_key256

+

+ pshufd xmm2,xmm0,0xff

+ pxor xmm3,xmm3

+DB 102,15,56,221,211

+

+ movdqa xmm3,xmm1

+ pslldq xmm1,4

+ pxor xmm3,xmm1

+ pslldq xmm1,4

+ pxor xmm3,xmm1

+ pslldq xmm1,4

+ pxor xmm1,xmm3

+

+ pxor xmm2,xmm1

+ movdqu XMMWORD[16+rax],xmm2

+ lea rax,[32+rax]

+ movdqa xmm1,xmm2

+

+ jmp NEAR $L$oop_key256

+

+$L$done_key256:

+ mov DWORD[16+rax],edx

+ xor eax,eax

+ jmp NEAR $L$enc_key_ret

+

+ALIGN 16

+$L$bad_keybits:

+ mov rax,-2

+$L$enc_key_ret:

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ add rsp,8

+

+ DB 0F3h,0C3h ;repret

+$L$SEH_end_set_encrypt_key:

+

+ALIGN 16

+$L$key_expansion_128:

+ movups XMMWORD[rax],xmm0

+ lea rax,[16+rax]

+$L$key_expansion_128_cold:

+ shufps xmm4,xmm0,16

+ xorps xmm0,xmm4

+ shufps xmm4,xmm0,140

+ xorps xmm0,xmm4

+ shufps xmm1,xmm1,255

+ xorps xmm0,xmm1

+ DB 0F3h,0C3h ;repret

+

+ALIGN 16

+$L$key_expansion_192a:

+ movups XMMWORD[rax],xmm0

+ lea rax,[16+rax]

+$L$key_expansion_192a_cold:

+ movaps xmm5,xmm2

+$L$key_expansion_192b_warm:

+ shufps xmm4,xmm0,16

+ movdqa xmm3,xmm2

+ xorps xmm0,xmm4

+ shufps xmm4,xmm0,140

+ pslldq xmm3,4

+ xorps xmm0,xmm4

+ pshufd xmm1,xmm1,85

+ pxor xmm2,xmm3

+ pxor xmm0,xmm1

+ pshufd xmm3,xmm0,255

+ pxor xmm2,xmm3

+ DB 0F3h,0C3h ;repret

+

+ALIGN 16

+$L$key_expansion_192b:

+ movaps xmm3,xmm0

+ shufps xmm5,xmm0,68

+ movups XMMWORD[rax],xmm5

+ shufps xmm3,xmm2,78

+ movups XMMWORD[16+rax],xmm3

+ lea rax,[32+rax]

+ jmp NEAR $L$key_expansion_192b_warm

+

+ALIGN 16

+$L$key_expansion_256a:

+ movups XMMWORD[rax],xmm2

+ lea rax,[16+rax]

+$L$key_expansion_256a_cold:

+ shufps xmm4,xmm0,16

+ xorps xmm0,xmm4

+ shufps xmm4,xmm0,140

+ xorps xmm0,xmm4

+ shufps xmm1,xmm1,255

+ xorps xmm0,xmm1

+ DB 0F3h,0C3h ;repret

+

+ALIGN 16

+$L$key_expansion_256b:

+ movups XMMWORD[rax],xmm0

+ lea rax,[16+rax]

+

+ shufps xmm4,xmm2,16

+ xorps xmm2,xmm4

+ shufps xmm4,xmm2,140

+ xorps xmm2,xmm4

+ shufps xmm1,xmm1,170

+ xorps xmm2,xmm1

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 64

+$L$bswap_mask:

+DB 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0

+$L$increment32:

+ DD 6,6,6,0

+$L$increment64:

+ DD 1,0,0,0

+$L$xts_magic:

+ DD 0x87,0,1,0

+$L$increment1:

+DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1

+$L$key_rotate:

+ DD 0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d,0x0c0f0e0d

+$L$key_rotate192:

+ DD 0x04070605,0x04070605,0x04070605,0x04070605

+$L$key_rcon1:

+ DD 1,1,1,1

+$L$key_rcon1b:

+ DD 0x1b,0x1b,0x1b,0x1b

+

+DB 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69

+DB 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83

+DB 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115

+DB 115,108,46,111,114,103,62,0

+ALIGN 64

+EXTERN __imp_RtlVirtualUnwind

+

+ALIGN 16

+ecb_ccm64_se_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$common_seh_tail

+

+ mov rax,QWORD[152+r8]

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$common_seh_tail

+

+ lea rsi,[rax]

+ lea rdi,[512+r8]

+ mov ecx,8

+ DD 0xa548f3fc

+ lea rax,[88+rax]

+

+ jmp NEAR $L$common_seh_tail

+

+

+

+ALIGN 16

+ctr_xts_se_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$common_seh_tail

+

+ mov rax,QWORD[152+r8]

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$common_seh_tail

+

+ mov rax,QWORD[208+r8]

+

+ lea rsi,[((-168))+rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+

+ mov rbp,QWORD[((-8))+rax]

+ mov QWORD[160+r8],rbp

+ jmp NEAR $L$common_seh_tail

+

+

+

+ALIGN 16

+ocb_se_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$common_seh_tail

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$common_seh_tail

+

+ mov r10d,DWORD[8+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$ocb_no_xmm

+

+ mov rax,QWORD[152+r8]

+

+ lea rsi,[rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+ lea rax,[((160+40))+rax]

+

+$L$ocb_no_xmm:

+ mov rbx,QWORD[((-8))+rax]

+ mov rbp,QWORD[((-16))+rax]

+ mov r12,QWORD[((-24))+rax]

+ mov r13,QWORD[((-32))+rax]

+ mov r14,QWORD[((-40))+rax]

+

+ mov QWORD[144+r8],rbx

+ mov QWORD[160+r8],rbp

+ mov QWORD[216+r8],r12

+ mov QWORD[224+r8],r13

+ mov QWORD[232+r8],r14

+

+ jmp NEAR $L$common_seh_tail

+

+

+ALIGN 16

+cbc_se_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[152+r8]

+ mov rbx,QWORD[248+r8]

+

+ lea r10,[$L$cbc_decrypt_bulk]

+ cmp rbx,r10

+ jb NEAR $L$common_seh_tail

+

+ mov rax,QWORD[120+r8]

+

+ lea r10,[$L$cbc_decrypt_body]

+ cmp rbx,r10

+ jb NEAR $L$common_seh_tail

+

+ mov rax,QWORD[152+r8]

+

+ lea r10,[$L$cbc_ret]

+ cmp rbx,r10

+ jae NEAR $L$common_seh_tail

+

+ lea rsi,[16+rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+

+ mov rax,QWORD[208+r8]

+

+ mov rbp,QWORD[((-8))+rax]

+ mov QWORD[160+r8],rbp

+

+$L$common_seh_tail:

+ mov rdi,QWORD[8+rax]

+ mov rsi,QWORD[16+rax]

+ mov QWORD[152+r8],rax

+ mov QWORD[168+r8],rsi

+ mov QWORD[176+r8],rdi

+

+ mov rdi,QWORD[40+r9]

+ mov rsi,r8

+ mov ecx,154

+ DD 0xa548f3fc

+

+ mov rsi,r9

+ xor rcx,rcx

+ mov rdx,QWORD[8+rsi]

+ mov r8,QWORD[rsi]

+ mov r9,QWORD[16+rsi]

+ mov r10,QWORD[40+rsi]

+ lea r11,[56+rsi]

+ lea r12,[24+rsi]

+ mov QWORD[32+rsp],r10

+ mov QWORD[40+rsp],r11

+ mov QWORD[48+rsp],r12

+ mov QWORD[56+rsp],rcx

+ call QWORD[__imp_RtlVirtualUnwind]

+

+ mov eax,1

+ add rsp,64

+ popfq

+ pop r15

+ pop r14

+ pop r13

+ pop r12

+ pop rbp

+ pop rbx

+ pop rdi

+ pop rsi

+ DB 0F3h,0C3h ;repret

+

+

+section .pdata rdata align=4

+ALIGN 4

+ DD $L$SEH_begin_aesni_ecb_encrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_ecb_encrypt wrt ..imagebase

+ DD $L$SEH_info_ecb wrt ..imagebase

+

+ DD $L$SEH_begin_aesni_ccm64_encrypt_blocks wrt ..imagebase

+ DD $L$SEH_end_aesni_ccm64_encrypt_blocks wrt ..imagebase

+ DD $L$SEH_info_ccm64_enc wrt ..imagebase

+

+ DD $L$SEH_begin_aesni_ccm64_decrypt_blocks wrt ..imagebase

+ DD $L$SEH_end_aesni_ccm64_decrypt_blocks wrt ..imagebase

+ DD $L$SEH_info_ccm64_dec wrt ..imagebase

+

+ DD $L$SEH_begin_aesni_ctr32_encrypt_blocks wrt ..imagebase

+ DD $L$SEH_end_aesni_ctr32_encrypt_blocks wrt ..imagebase

+ DD $L$SEH_info_ctr32 wrt ..imagebase

+

+ DD $L$SEH_begin_aesni_xts_encrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_xts_encrypt wrt ..imagebase

+ DD $L$SEH_info_xts_enc wrt ..imagebase

+

+ DD $L$SEH_begin_aesni_xts_decrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_xts_decrypt wrt ..imagebase

+ DD $L$SEH_info_xts_dec wrt ..imagebase

+

+ DD $L$SEH_begin_aesni_ocb_encrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_ocb_encrypt wrt ..imagebase

+ DD $L$SEH_info_ocb_enc wrt ..imagebase

+

+ DD $L$SEH_begin_aesni_ocb_decrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_ocb_decrypt wrt ..imagebase

+ DD $L$SEH_info_ocb_dec wrt ..imagebase

+ DD $L$SEH_begin_aesni_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_info_cbc wrt ..imagebase

+

+ DD aesni_set_decrypt_key wrt ..imagebase

+ DD $L$SEH_end_set_decrypt_key wrt ..imagebase

+ DD $L$SEH_info_key wrt ..imagebase

+

+ DD aesni_set_encrypt_key wrt ..imagebase

+ DD $L$SEH_end_set_encrypt_key wrt ..imagebase

+ DD $L$SEH_info_key wrt ..imagebase

+section .xdata rdata align=8

+ALIGN 8

+$L$SEH_info_ecb:

+DB 9,0,0,0

+ DD ecb_ccm64_se_handler wrt ..imagebase

+ DD $L$ecb_enc_body wrt ..imagebase,$L$ecb_enc_ret
wrt ..imagebase

+$L$SEH_info_ccm64_enc:

+DB 9,0,0,0

+ DD ecb_ccm64_se_handler wrt ..imagebase

+ DD $L$ccm64_enc_body wrt ..imagebase,$L$ccm64_enc_ret
wrt ..imagebase

+$L$SEH_info_ccm64_dec:

+DB 9,0,0,0

+ DD ecb_ccm64_se_handler wrt ..imagebase

+ DD $L$ccm64_dec_body wrt ..imagebase,$L$ccm64_dec_ret
wrt ..imagebase

+$L$SEH_info_ctr32:

+DB 9,0,0,0

+ DD ctr_xts_se_handler wrt ..imagebase

+ DD $L$ctr32_body wrt ..imagebase,$L$ctr32_epilogue
wrt ..imagebase

+$L$SEH_info_xts_enc:

+DB 9,0,0,0

+ DD ctr_xts_se_handler wrt ..imagebase

+ DD $L$xts_enc_body wrt ..imagebase,$L$xts_enc_epilogue
wrt ..imagebase

+$L$SEH_info_xts_dec:

+DB 9,0,0,0

+ DD ctr_xts_se_handler wrt ..imagebase

+ DD $L$xts_dec_body wrt ..imagebase,$L$xts_dec_epilogue
wrt ..imagebase

+$L$SEH_info_ocb_enc:

+DB 9,0,0,0

+ DD ocb_se_handler wrt ..imagebase

+ DD $L$ocb_enc_body wrt ..imagebase,$L$ocb_enc_epilogue
wrt ..imagebase

+ DD $L$ocb_enc_pop wrt ..imagebase

+ DD 0

+$L$SEH_info_ocb_dec:

+DB 9,0,0,0

+ DD ocb_se_handler wrt ..imagebase

+ DD $L$ocb_dec_body wrt ..imagebase,$L$ocb_dec_epilogue
wrt ..imagebase

+ DD $L$ocb_dec_pop wrt ..imagebase

+ DD 0

+$L$SEH_info_cbc:

+DB 9,0,0,0

+ DD cbc_se_handler wrt ..imagebase

+$L$SEH_info_key:

+DB 0x01,0x04,0x01,0x00

+DB 0x04,0x02,0x00,0x00

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-
x86_64.nasm
b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-x86_64.nasm
new file mode 100644
index 0000000000..1c911fa294
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-x86_64.nasm
@@ -0,0 +1,1173 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/vpaes-x86_64.pl

+;

+; Copyright 2011-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+ALIGN 16

+_vpaes_encrypt_core:

+

+ mov r9,rdx

+ mov r11,16

+ mov eax,DWORD[240+rdx]

+ movdqa xmm1,xmm9

+ movdqa xmm2,XMMWORD[$L$k_ipt]

+ pandn xmm1,xmm0

+ movdqu xmm5,XMMWORD[r9]

+ psrld xmm1,4

+ pand xmm0,xmm9

+DB 102,15,56,0,208

+ movdqa xmm0,XMMWORD[(($L$k_ipt+16))]

+DB 102,15,56,0,193

+ pxor xmm2,xmm5

+ add r9,16

+ pxor xmm0,xmm2

+ lea r10,[$L$k_mc_backward]

+ jmp NEAR $L$enc_entry

+

+ALIGN 16

+$L$enc_loop:

+

+ movdqa xmm4,xmm13

+ movdqa xmm0,xmm12

+DB 102,15,56,0,226

+DB 102,15,56,0,195

+ pxor xmm4,xmm5

+ movdqa xmm5,xmm15

+ pxor xmm0,xmm4

+ movdqa xmm1,XMMWORD[((-64))+r10*1+r11]

+DB 102,15,56,0,234

+ movdqa xmm4,XMMWORD[r10*1+r11]

+ movdqa xmm2,xmm14

+DB 102,15,56,0,211

+ movdqa xmm3,xmm0

+ pxor xmm2,xmm5

+DB 102,15,56,0,193

+ add r9,16

+ pxor xmm0,xmm2

+DB 102,15,56,0,220

+ add r11,16

+ pxor xmm3,xmm0

+DB 102,15,56,0,193

+ and r11,0x30

+ sub rax,1

+ pxor xmm0,xmm3

+

+$L$enc_entry:

+

+ movdqa xmm1,xmm9

+ movdqa xmm5,xmm11

+ pandn xmm1,xmm0

+ psrld xmm1,4

+ pand xmm0,xmm9

+DB 102,15,56,0,232

+ movdqa xmm3,xmm10

+ pxor xmm0,xmm1

+DB 102,15,56,0,217

+ movdqa xmm4,xmm10

+ pxor xmm3,xmm5

+DB 102,15,56,0,224

+ movdqa xmm2,xmm10

+ pxor xmm4,xmm5

+DB 102,15,56,0,211

+ movdqa xmm3,xmm10

+ pxor xmm2,xmm0

+DB 102,15,56,0,220

+ movdqu xmm5,XMMWORD[r9]

+ pxor xmm3,xmm1

+ jnz NEAR $L$enc_loop

+

+

+ movdqa xmm4,XMMWORD[((-96))+r10]

+ movdqa xmm0,XMMWORD[((-80))+r10]

+DB 102,15,56,0,226

+ pxor xmm4,xmm5

+DB 102,15,56,0,195

+ movdqa xmm1,XMMWORD[64+r10*1+r11]

+ pxor xmm0,xmm4

+DB 102,15,56,0,193

+ DB 0F3h,0C3h ;repret

+

+

+

+

+

+

+

+

+

+ALIGN 16

+_vpaes_decrypt_core:

+

+ mov r9,rdx

+ mov eax,DWORD[240+rdx]

+ movdqa xmm1,xmm9

+ movdqa xmm2,XMMWORD[$L$k_dipt]

+ pandn xmm1,xmm0

+ mov r11,rax

+ psrld xmm1,4

+ movdqu xmm5,XMMWORD[r9]

+ shl r11,4

+ pand xmm0,xmm9

+DB 102,15,56,0,208

+ movdqa xmm0,XMMWORD[(($L$k_dipt+16))]

+ xor r11,0x30

+ lea r10,[$L$k_dsbd]

+DB 102,15,56,0,193

+ and r11,0x30

+ pxor xmm2,xmm5

+ movdqa xmm5,XMMWORD[(($L$k_mc_forward+48))]

+ pxor xmm0,xmm2

+ add r9,16

+ add r11,r10

+ jmp NEAR $L$dec_entry

+

+ALIGN 16

+$L$dec_loop:

+

+

+

+ movdqa xmm4,XMMWORD[((-32))+r10]

+ movdqa xmm1,XMMWORD[((-16))+r10]

+DB 102,15,56,0,226

+DB 102,15,56,0,203

+ pxor xmm0,xmm4

+ movdqa xmm4,XMMWORD[r10]

+ pxor xmm0,xmm1

+ movdqa xmm1,XMMWORD[16+r10]

+

+DB 102,15,56,0,226

+DB 102,15,56,0,197

+DB 102,15,56,0,203

+ pxor xmm0,xmm4

+ movdqa xmm4,XMMWORD[32+r10]

+ pxor xmm0,xmm1

+ movdqa xmm1,XMMWORD[48+r10]

+

+DB 102,15,56,0,226

+DB 102,15,56,0,197

+DB 102,15,56,0,203

+ pxor xmm0,xmm4

+ movdqa xmm4,XMMWORD[64+r10]

+ pxor xmm0,xmm1

+ movdqa xmm1,XMMWORD[80+r10]

+

+DB 102,15,56,0,226

+DB 102,15,56,0,197

+DB 102,15,56,0,203

+ pxor xmm0,xmm4

+ add r9,16

+DB 102,15,58,15,237,12

+ pxor xmm0,xmm1

+ sub rax,1

+

+$L$dec_entry:

+

+ movdqa xmm1,xmm9

+ pandn xmm1,xmm0

+ movdqa xmm2,xmm11

+ psrld xmm1,4

+ pand xmm0,xmm9

+DB 102,15,56,0,208

+ movdqa xmm3,xmm10

+ pxor xmm0,xmm1

+DB 102,15,56,0,217

+ movdqa xmm4,xmm10

+ pxor xmm3,xmm2

+DB 102,15,56,0,224

+ pxor xmm4,xmm2

+ movdqa xmm2,xmm10

+DB 102,15,56,0,211

+ movdqa xmm3,xmm10

+ pxor xmm2,xmm0

+DB 102,15,56,0,220

+ movdqu xmm0,XMMWORD[r9]

+ pxor xmm3,xmm1

+ jnz NEAR $L$dec_loop

+

+

+ movdqa xmm4,XMMWORD[96+r10]

+DB 102,15,56,0,226

+ pxor xmm4,xmm0

+ movdqa xmm0,XMMWORD[112+r10]

+ movdqa xmm2,XMMWORD[((-352))+r11]

+DB 102,15,56,0,195

+ pxor xmm0,xmm4

+DB 102,15,56,0,194

+ DB 0F3h,0C3h ;repret

+

+

+

+

+

+

+

+

+

+ALIGN 16

+_vpaes_schedule_core:

+

+

+

+

+

+

+ call _vpaes_preheat

+ movdqa xmm8,XMMWORD[$L$k_rcon]

+ movdqu xmm0,XMMWORD[rdi]

+

+

+ movdqa xmm3,xmm0

+ lea r11,[$L$k_ipt]

+ call _vpaes_schedule_transform

+ movdqa xmm7,xmm0

+

+ lea r10,[$L$k_sr]

+ test rcx,rcx

+ jnz NEAR $L$schedule_am_decrypting

+

+

+ movdqu XMMWORD[rdx],xmm0

+ jmp NEAR $L$schedule_go

+

+$L$schedule_am_decrypting:

+

+ movdqa xmm1,XMMWORD[r10*1+r8]

+DB 102,15,56,0,217

+ movdqu XMMWORD[rdx],xmm3

+ xor r8,0x30

+

+$L$schedule_go:

+ cmp esi,192

+ ja NEAR $L$schedule_256

+ je NEAR $L$schedule_192

+

+

+

+

+

+

+

+

+

+

+$L$schedule_128:

+ mov esi,10

+

+$L$oop_schedule_128:

+ call _vpaes_schedule_round

+ dec rsi

+ jz NEAR $L$schedule_mangle_last

+ call _vpaes_schedule_mangle

+ jmp NEAR $L$oop_schedule_128

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+ALIGN 16

+$L$schedule_192:

+ movdqu xmm0,XMMWORD[8+rdi]

+ call _vpaes_schedule_transform

+ movdqa xmm6,xmm0

+ pxor xmm4,xmm4

+ movhlps xmm6,xmm4

+ mov esi,4

+

+$L$oop_schedule_192:

+ call _vpaes_schedule_round

+DB 102,15,58,15,198,8

+ call _vpaes_schedule_mangle

+ call _vpaes_schedule_192_smear

+ call _vpaes_schedule_mangle

+ call _vpaes_schedule_round

+ dec rsi

+ jz NEAR $L$schedule_mangle_last

+ call _vpaes_schedule_mangle

+ call _vpaes_schedule_192_smear

+ jmp NEAR $L$oop_schedule_192

+

+

+

+

+

+

+

+

+

+

+

+ALIGN 16

+$L$schedule_256:

+ movdqu xmm0,XMMWORD[16+rdi]

+ call _vpaes_schedule_transform

+ mov esi,7

+

+$L$oop_schedule_256:

+ call _vpaes_schedule_mangle

+ movdqa xmm6,xmm0

+

+

+ call _vpaes_schedule_round

+ dec rsi

+ jz NEAR $L$schedule_mangle_last

+ call _vpaes_schedule_mangle

+

+

+ pshufd xmm0,xmm0,0xFF

+ movdqa xmm5,xmm7

+ movdqa xmm7,xmm6

+ call _vpaes_schedule_low_round

+ movdqa xmm7,xmm5

+

+ jmp NEAR $L$oop_schedule_256

+

+

+

+

+

+

+

+

+

+

+

+

+ALIGN 16

+$L$schedule_mangle_last:

+

+ lea r11,[$L$k_deskew]

+ test rcx,rcx

+ jnz NEAR $L$schedule_mangle_last_dec

+

+

+ movdqa xmm1,XMMWORD[r10*1+r8]

+DB 102,15,56,0,193

+ lea r11,[$L$k_opt]

+ add rdx,32

+

+$L$schedule_mangle_last_dec:

+ add rdx,-16

+ pxor xmm0,XMMWORD[$L$k_s63]

+ call _vpaes_schedule_transform

+ movdqu XMMWORD[rdx],xmm0

+

+

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ pxor xmm6,xmm6

+ pxor xmm7,xmm7

+ DB 0F3h,0C3h ;repret

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+ALIGN 16

+_vpaes_schedule_192_smear:

+

+ pshufd xmm1,xmm6,0x80

+ pshufd xmm0,xmm7,0xFE

+ pxor xmm6,xmm1

+ pxor xmm1,xmm1

+ pxor xmm6,xmm0

+ movdqa xmm0,xmm6

+ movhlps xmm6,xmm1

+ DB 0F3h,0C3h ;repret

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+ALIGN 16

+_vpaes_schedule_round:

+

+

+ pxor xmm1,xmm1

+DB 102,65,15,58,15,200,15

+DB 102,69,15,58,15,192,15

+ pxor xmm7,xmm1

+

+

+ pshufd xmm0,xmm0,0xFF

+DB 102,15,58,15,192,1

+

+

+

+

+_vpaes_schedule_low_round:

+

+ movdqa xmm1,xmm7

+ pslldq xmm7,4

+ pxor xmm7,xmm1

+ movdqa xmm1,xmm7

+ pslldq xmm7,8

+ pxor xmm7,xmm1

+ pxor xmm7,XMMWORD[$L$k_s63]

+

+

+ movdqa xmm1,xmm9

+ pandn xmm1,xmm0

+ psrld xmm1,4

+ pand xmm0,xmm9

+ movdqa xmm2,xmm11

+DB 102,15,56,0,208

+ pxor xmm0,xmm1

+ movdqa xmm3,xmm10

+DB 102,15,56,0,217

+ pxor xmm3,xmm2

+ movdqa xmm4,xmm10

+DB 102,15,56,0,224

+ pxor xmm4,xmm2

+ movdqa xmm2,xmm10

+DB 102,15,56,0,211

+ pxor xmm2,xmm0

+ movdqa xmm3,xmm10

+DB 102,15,56,0,220

+ pxor xmm3,xmm1

+ movdqa xmm4,xmm13

+DB 102,15,56,0,226

+ movdqa xmm0,xmm12

+DB 102,15,56,0,195

+ pxor xmm0,xmm4

+

+

+ pxor xmm0,xmm7

+ movdqa xmm7,xmm0

+ DB 0F3h,0C3h ;repret

+

+

+

+

+

+

+

+

+

+

+

+

+

+ALIGN 16

+_vpaes_schedule_transform:

+

+ movdqa xmm1,xmm9

+ pandn xmm1,xmm0

+ psrld xmm1,4

+ pand xmm0,xmm9

+ movdqa xmm2,XMMWORD[r11]

+DB 102,15,56,0,208

+ movdqa xmm0,XMMWORD[16+r11]

+DB 102,15,56,0,193

+ pxor xmm0,xmm2

+ DB 0F3h,0C3h ;repret

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+ALIGN 16

+_vpaes_schedule_mangle:

+

+ movdqa xmm4,xmm0

+ movdqa xmm5,XMMWORD[$L$k_mc_forward]

+ test rcx,rcx

+ jnz NEAR $L$schedule_mangle_dec

+

+

+ add rdx,16

+ pxor xmm4,XMMWORD[$L$k_s63]

+DB 102,15,56,0,229

+ movdqa xmm3,xmm4

+DB 102,15,56,0,229

+ pxor xmm3,xmm4

+DB 102,15,56,0,229

+ pxor xmm3,xmm4

+

+ jmp NEAR $L$schedule_mangle_both

+ALIGN 16

+$L$schedule_mangle_dec:

+

+ lea r11,[$L$k_dksd]

+ movdqa xmm1,xmm9

+ pandn xmm1,xmm4

+ psrld xmm1,4

+ pand xmm4,xmm9

+

+ movdqa xmm2,XMMWORD[r11]

+DB 102,15,56,0,212

+ movdqa xmm3,XMMWORD[16+r11]

+DB 102,15,56,0,217

+ pxor xmm3,xmm2

+DB 102,15,56,0,221

+

+ movdqa xmm2,XMMWORD[32+r11]

+DB 102,15,56,0,212

+ pxor xmm2,xmm3

+ movdqa xmm3,XMMWORD[48+r11]

+DB 102,15,56,0,217

+ pxor xmm3,xmm2

+DB 102,15,56,0,221

+

+ movdqa xmm2,XMMWORD[64+r11]

+DB 102,15,56,0,212

+ pxor xmm2,xmm3

+ movdqa xmm3,XMMWORD[80+r11]

+DB 102,15,56,0,217

+ pxor xmm3,xmm2

+DB 102,15,56,0,221

+

+ movdqa xmm2,XMMWORD[96+r11]

+DB 102,15,56,0,212

+ pxor xmm2,xmm3

+ movdqa xmm3,XMMWORD[112+r11]

+DB 102,15,56,0,217

+ pxor xmm3,xmm2

+

+ add rdx,-16

+

+$L$schedule_mangle_both:

+ movdqa xmm1,XMMWORD[r10*1+r8]

+DB 102,15,56,0,217

+ add r8,-16

+ and r8,0x30

+ movdqu XMMWORD[rdx],xmm3

+ DB 0F3h,0C3h ;repret

+

+

+

+

+

+

+global vpaes_set_encrypt_key

+

+ALIGN 16

+vpaes_set_encrypt_key:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_vpaes_set_encrypt_key:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ lea rsp,[((-184))+rsp]

+ movaps XMMWORD[16+rsp],xmm6

+ movaps XMMWORD[32+rsp],xmm7

+ movaps XMMWORD[48+rsp],xmm8

+ movaps XMMWORD[64+rsp],xmm9

+ movaps XMMWORD[80+rsp],xmm10

+ movaps XMMWORD[96+rsp],xmm11

+ movaps XMMWORD[112+rsp],xmm12

+ movaps XMMWORD[128+rsp],xmm13

+ movaps XMMWORD[144+rsp],xmm14

+ movaps XMMWORD[160+rsp],xmm15

+$L$enc_key_body:

+ mov eax,esi

+ shr eax,5

+ add eax,5

+ mov DWORD[240+rdx],eax

+

+ mov ecx,0

+ mov r8d,0x30

+ call _vpaes_schedule_core

+ movaps xmm6,XMMWORD[16+rsp]

+ movaps xmm7,XMMWORD[32+rsp]

+ movaps xmm8,XMMWORD[48+rsp]

+ movaps xmm9,XMMWORD[64+rsp]

+ movaps xmm10,XMMWORD[80+rsp]

+ movaps xmm11,XMMWORD[96+rsp]

+ movaps xmm12,XMMWORD[112+rsp]

+ movaps xmm13,XMMWORD[128+rsp]

+ movaps xmm14,XMMWORD[144+rsp]

+ movaps xmm15,XMMWORD[160+rsp]

+ lea rsp,[184+rsp]

+$L$enc_key_epilogue:

+ xor eax,eax

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_vpaes_set_encrypt_key:

+

+global vpaes_set_decrypt_key

+

+ALIGN 16

+vpaes_set_decrypt_key:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_vpaes_set_decrypt_key:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ lea rsp,[((-184))+rsp]

+ movaps XMMWORD[16+rsp],xmm6

+ movaps XMMWORD[32+rsp],xmm7

+ movaps XMMWORD[48+rsp],xmm8

+ movaps XMMWORD[64+rsp],xmm9

+ movaps XMMWORD[80+rsp],xmm10

+ movaps XMMWORD[96+rsp],xmm11

+ movaps XMMWORD[112+rsp],xmm12

+ movaps XMMWORD[128+rsp],xmm13

+ movaps XMMWORD[144+rsp],xmm14

+ movaps XMMWORD[160+rsp],xmm15

+$L$dec_key_body:

+ mov eax,esi

+ shr eax,5

+ add eax,5

+ mov DWORD[240+rdx],eax

+ shl eax,4

+ lea rdx,[16+rax*1+rdx]

+

+ mov ecx,1

+ mov r8d,esi

+ shr r8d,1

+ and r8d,32

+ xor r8d,32

+ call _vpaes_schedule_core

+ movaps xmm6,XMMWORD[16+rsp]

+ movaps xmm7,XMMWORD[32+rsp]

+ movaps xmm8,XMMWORD[48+rsp]

+ movaps xmm9,XMMWORD[64+rsp]

+ movaps xmm10,XMMWORD[80+rsp]

+ movaps xmm11,XMMWORD[96+rsp]

+ movaps xmm12,XMMWORD[112+rsp]

+ movaps xmm13,XMMWORD[128+rsp]

+ movaps xmm14,XMMWORD[144+rsp]

+ movaps xmm15,XMMWORD[160+rsp]

+ lea rsp,[184+rsp]

+$L$dec_key_epilogue:

+ xor eax,eax

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_vpaes_set_decrypt_key:

+

+global vpaes_encrypt

+

+ALIGN 16

+vpaes_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_vpaes_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ lea rsp,[((-184))+rsp]

+ movaps XMMWORD[16+rsp],xmm6

+ movaps XMMWORD[32+rsp],xmm7

+ movaps XMMWORD[48+rsp],xmm8

+ movaps XMMWORD[64+rsp],xmm9

+ movaps XMMWORD[80+rsp],xmm10

+ movaps XMMWORD[96+rsp],xmm11

+ movaps XMMWORD[112+rsp],xmm12

+ movaps XMMWORD[128+rsp],xmm13

+ movaps XMMWORD[144+rsp],xmm14

+ movaps XMMWORD[160+rsp],xmm15

+$L$enc_body:

+ movdqu xmm0,XMMWORD[rdi]

+ call _vpaes_preheat

+ call _vpaes_encrypt_core

+ movdqu XMMWORD[rsi],xmm0

+ movaps xmm6,XMMWORD[16+rsp]

+ movaps xmm7,XMMWORD[32+rsp]

+ movaps xmm8,XMMWORD[48+rsp]

+ movaps xmm9,XMMWORD[64+rsp]

+ movaps xmm10,XMMWORD[80+rsp]

+ movaps xmm11,XMMWORD[96+rsp]

+ movaps xmm12,XMMWORD[112+rsp]

+ movaps xmm13,XMMWORD[128+rsp]

+ movaps xmm14,XMMWORD[144+rsp]

+ movaps xmm15,XMMWORD[160+rsp]

+ lea rsp,[184+rsp]

+$L$enc_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_vpaes_encrypt:

+

+global vpaes_decrypt

+

+ALIGN 16

+vpaes_decrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_vpaes_decrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ lea rsp,[((-184))+rsp]

+ movaps XMMWORD[16+rsp],xmm6

+ movaps XMMWORD[32+rsp],xmm7

+ movaps XMMWORD[48+rsp],xmm8

+ movaps XMMWORD[64+rsp],xmm9

+ movaps XMMWORD[80+rsp],xmm10

+ movaps XMMWORD[96+rsp],xmm11

+ movaps XMMWORD[112+rsp],xmm12

+ movaps XMMWORD[128+rsp],xmm13

+ movaps XMMWORD[144+rsp],xmm14

+ movaps XMMWORD[160+rsp],xmm15

+$L$dec_body:

+ movdqu xmm0,XMMWORD[rdi]

+ call _vpaes_preheat

+ call _vpaes_decrypt_core

+ movdqu XMMWORD[rsi],xmm0

+ movaps xmm6,XMMWORD[16+rsp]

+ movaps xmm7,XMMWORD[32+rsp]

+ movaps xmm8,XMMWORD[48+rsp]

+ movaps xmm9,XMMWORD[64+rsp]

+ movaps xmm10,XMMWORD[80+rsp]

+ movaps xmm11,XMMWORD[96+rsp]

+ movaps xmm12,XMMWORD[112+rsp]

+ movaps xmm13,XMMWORD[128+rsp]

+ movaps xmm14,XMMWORD[144+rsp]

+ movaps xmm15,XMMWORD[160+rsp]

+ lea rsp,[184+rsp]

+$L$dec_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_vpaes_decrypt:

+global vpaes_cbc_encrypt

+

+ALIGN 16

+vpaes_cbc_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_vpaes_cbc_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ xchg rdx,rcx

+ sub rcx,16

+ jc NEAR $L$cbc_abort

+ lea rsp,[((-184))+rsp]

+ movaps XMMWORD[16+rsp],xmm6

+ movaps XMMWORD[32+rsp],xmm7

+ movaps XMMWORD[48+rsp],xmm8

+ movaps XMMWORD[64+rsp],xmm9

+ movaps XMMWORD[80+rsp],xmm10

+ movaps XMMWORD[96+rsp],xmm11

+ movaps XMMWORD[112+rsp],xmm12

+ movaps XMMWORD[128+rsp],xmm13

+ movaps XMMWORD[144+rsp],xmm14

+ movaps XMMWORD[160+rsp],xmm15

+$L$cbc_body:

+ movdqu xmm6,XMMWORD[r8]

+ sub rsi,rdi

+ call _vpaes_preheat

+ cmp r9d,0

+ je NEAR $L$cbc_dec_loop

+ jmp NEAR $L$cbc_enc_loop

+ALIGN 16

+$L$cbc_enc_loop:

+ movdqu xmm0,XMMWORD[rdi]

+ pxor xmm0,xmm6

+ call _vpaes_encrypt_core

+ movdqa xmm6,xmm0

+ movdqu XMMWORD[rdi*1+rsi],xmm0

+ lea rdi,[16+rdi]

+ sub rcx,16

+ jnc NEAR $L$cbc_enc_loop

+ jmp NEAR $L$cbc_done

+ALIGN 16

+$L$cbc_dec_loop:

+ movdqu xmm0,XMMWORD[rdi]

+ movdqa xmm7,xmm0

+ call _vpaes_decrypt_core

+ pxor xmm0,xmm6

+ movdqa xmm6,xmm7

+ movdqu XMMWORD[rdi*1+rsi],xmm0

+ lea rdi,[16+rdi]

+ sub rcx,16

+ jnc NEAR $L$cbc_dec_loop

+$L$cbc_done:

+ movdqu XMMWORD[r8],xmm6

+ movaps xmm6,XMMWORD[16+rsp]

+ movaps xmm7,XMMWORD[32+rsp]

+ movaps xmm8,XMMWORD[48+rsp]

+ movaps xmm9,XMMWORD[64+rsp]

+ movaps xmm10,XMMWORD[80+rsp]

+ movaps xmm11,XMMWORD[96+rsp]

+ movaps xmm12,XMMWORD[112+rsp]

+ movaps xmm13,XMMWORD[128+rsp]

+ movaps xmm14,XMMWORD[144+rsp]

+ movaps xmm15,XMMWORD[160+rsp]

+ lea rsp,[184+rsp]

+$L$cbc_epilogue:

+$L$cbc_abort:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_vpaes_cbc_encrypt:

+

+

+

+

+

+

+

+ALIGN 16

+_vpaes_preheat:

+

+ lea r10,[$L$k_s0F]

+ movdqa xmm10,XMMWORD[((-32))+r10]

+ movdqa xmm11,XMMWORD[((-16))+r10]

+ movdqa xmm9,XMMWORD[r10]

+ movdqa xmm13,XMMWORD[48+r10]

+ movdqa xmm12,XMMWORD[64+r10]

+ movdqa xmm15,XMMWORD[80+r10]

+ movdqa xmm14,XMMWORD[96+r10]

+ DB 0F3h,0C3h ;repret

+

+

+

+

+

+

+

+

+ALIGN 64

+_vpaes_consts:

+$L$k_inv:

+ DQ 0x0E05060F0D080180,0x040703090A0B0C02

+ DQ 0x01040A060F0B0780,0x030D0E0C02050809

+

+$L$k_s0F:

+ DQ 0x0F0F0F0F0F0F0F0F,0x0F0F0F0F0F0F0F0F

+

+$L$k_ipt:

+ DQ 0xC2B2E8985A2A7000,0xCABAE09052227808

+ DQ 0x4C01307D317C4D00,0xCD80B1FCB0FDCC81

+

+$L$k_sb1:

+ DQ 0xB19BE18FCB503E00,0xA5DF7A6E142AF544

+ DQ 0x3618D415FAE22300,0x3BF7CCC10D2ED9EF

+$L$k_sb2:

+ DQ 0xE27A93C60B712400,0x5EB7E955BC982FCD

+ DQ 0x69EB88400AE12900,0xC2A163C8AB82234A

+$L$k_sbo:

+ DQ 0xD0D26D176FBDC700,0x15AABF7AC502A878

+ DQ 0xCFE474A55FBB6A00,0x8E1E90D1412B35FA

+

+$L$k_mc_forward:

+ DQ 0x0407060500030201,0x0C0F0E0D080B0A09

+ DQ 0x080B0A0904070605,0x000302010C0F0E0D

+ DQ 0x0C0F0E0D080B0A09,0x0407060500030201

+ DQ 0x000302010C0F0E0D,0x080B0A0904070605

+

+$L$k_mc_backward:

+ DQ 0x0605040702010003,0x0E0D0C0F0A09080B

+ DQ 0x020100030E0D0C0F,0x0A09080B06050407

+ DQ 0x0E0D0C0F0A09080B,0x0605040702010003

+ DQ 0x0A09080B06050407,0x020100030E0D0C0F

+

+$L$k_sr:

+ DQ 0x0706050403020100,0x0F0E0D0C0B0A0908

+ DQ 0x030E09040F0A0500,0x0B06010C07020D08

+ DQ 0x0F060D040B020900,0x070E050C030A0108

+ DQ 0x0B0E0104070A0D00,0x0306090C0F020508

+

+$L$k_rcon:

+ DQ 0x1F8391B9AF9DEEB6,0x702A98084D7C7D81

+

+$L$k_s63:

+ DQ 0x5B5B5B5B5B5B5B5B,0x5B5B5B5B5B5B5B5B

+

+$L$k_opt:

+ DQ 0xFF9F4929D6B66000,0xF7974121DEBE6808

+ DQ 0x01EDBD5150BCEC00,0xE10D5DB1B05C0CE0

+

+$L$k_deskew:

+ DQ 0x07E4A34047A4E300,0x1DFEB95A5DBEF91A

+ DQ 0x5F36B5DC83EA6900,0x2841C2ABF49D1E77

+

+

+

+

+

+$L$k_dksd:

+ DQ 0xFEB91A5DA3E44700,0x0740E3A45A1DBEF9

+ DQ 0x41C277F4B5368300,0x5FDC69EAAB289D1E

+$L$k_dksb:

+ DQ 0x9A4FCA1F8550D500,0x03D653861CC94C99

+ DQ 0x115BEDA7B6FC4A00,0xD993256F7E3482C8

+$L$k_dkse:

+ DQ 0xD5031CCA1FC9D600,0x53859A4C994F5086

+ DQ 0xA23196054FDC7BE8,0xCD5EF96A20B31487

+$L$k_dks9:

+ DQ 0xB6116FC87ED9A700,0x4AED933482255BFC

+ DQ 0x4576516227143300,0x8BB89FACE9DAFDCE

+

+

+

+

+

+$L$k_dipt:

+ DQ 0x0F505B040B545F00,0x154A411E114E451A

+ DQ 0x86E383E660056500,0x12771772F491F194

+

+$L$k_dsb9:

+ DQ 0x851C03539A86D600,0xCAD51F504F994CC9

+ DQ 0xC03B1789ECD74900,0x725E2C9EB2FBA565

+$L$k_dsbd:

+ DQ 0x7D57CCDFE6B1A200,0xF56E9B13882A4439

+ DQ 0x3CE2FAF724C6CB00,0x2931180D15DEEFD3

+$L$k_dsbb:

+ DQ 0xD022649296B44200,0x602646F6B0F2D404

+ DQ 0xC19498A6CD596700,0xF3FF0C3E3255AA6B

+$L$k_dsbe:

+ DQ 0x46F2929626D4D000,0x2242600464B4F6B0

+ DQ 0x0C55A6CDFFAAC100,0x9467F36B98593E32

+$L$k_dsbo:

+ DQ 0x1387EA537EF94000,0xC7AA6DB9D4943E2D

+ DQ 0x12D7560F93441D00,0xCA4B8159D8C58E9C

+DB 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105

+DB 111,110,32,65,69,83,32,102,111,114,32,120,56,54,95,54

+DB 52,47,83,83,83,69,51,44,32,77,105,107,101,32,72,97

+DB 109,98,117,114,103,32,40,83,116,97,110,102,111,114,100,32

+DB 85,110,105,118,101,114,115,105,116,121,41,0

+ALIGN 64

+

+EXTERN __imp_RtlVirtualUnwind

+

+ALIGN 16

+se_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$in_prologue

+

+ mov rax,QWORD[152+r8]

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$in_prologue

+

+ lea rsi,[16+rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+ lea rax,[184+rax]

+

+$L$in_prologue:

+ mov rdi,QWORD[8+rax]

+ mov rsi,QWORD[16+rax]

+ mov QWORD[152+r8],rax

+ mov QWORD[168+r8],rsi

+ mov QWORD[176+r8],rdi

+

+ mov rdi,QWORD[40+r9]

+ mov rsi,r8

+ mov ecx,154

+ DD 0xa548f3fc

+

+ mov rsi,r9

+ xor rcx,rcx

+ mov rdx,QWORD[8+rsi]

+ mov r8,QWORD[rsi]

+ mov r9,QWORD[16+rsi]

+ mov r10,QWORD[40+rsi]

+ lea r11,[56+rsi]

+ lea r12,[24+rsi]

+ mov QWORD[32+rsp],r10

+ mov QWORD[40+rsp],r11

+ mov QWORD[48+rsp],r12

+ mov QWORD[56+rsp],rcx

+ call QWORD[__imp_RtlVirtualUnwind]

+

+ mov eax,1

+ add rsp,64

+ popfq

+ pop r15

+ pop r14

+ pop r13

+ pop r12

+ pop rbp

+ pop rbx

+ pop rdi

+ pop rsi

+ DB 0F3h,0C3h ;repret

+

+

+section .pdata rdata align=4

+ALIGN 4

+ DD $L$SEH_begin_vpaes_set_encrypt_key wrt ..imagebase

+ DD $L$SEH_end_vpaes_set_encrypt_key wrt ..imagebase

+ DD $L$SEH_info_vpaes_set_encrypt_key wrt ..imagebase

+

+ DD $L$SEH_begin_vpaes_set_decrypt_key wrt ..imagebase

+ DD $L$SEH_end_vpaes_set_decrypt_key wrt ..imagebase

+ DD $L$SEH_info_vpaes_set_decrypt_key wrt ..imagebase

+

+ DD $L$SEH_begin_vpaes_encrypt wrt ..imagebase

+ DD $L$SEH_end_vpaes_encrypt wrt ..imagebase

+ DD $L$SEH_info_vpaes_encrypt wrt ..imagebase

+

+ DD $L$SEH_begin_vpaes_decrypt wrt ..imagebase

+ DD $L$SEH_end_vpaes_decrypt wrt ..imagebase

+ DD $L$SEH_info_vpaes_decrypt wrt ..imagebase

+

+ DD $L$SEH_begin_vpaes_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_end_vpaes_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_info_vpaes_cbc_encrypt wrt ..imagebase

+

+section .xdata rdata align=8

+ALIGN 8

+$L$SEH_info_vpaes_set_encrypt_key:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$enc_key_body wrt ..imagebase,$L$enc_key_epilogue
wrt ..imagebase

+$L$SEH_info_vpaes_set_decrypt_key:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$dec_key_body wrt ..imagebase,$L$dec_key_epilogue
wrt ..imagebase

+$L$SEH_info_vpaes_encrypt:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$enc_body wrt ..imagebase,$L$enc_epilogue wrt ..imagebase

+$L$SEH_info_vpaes_decrypt:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$dec_body wrt ..imagebase,$L$dec_epilogue wrt ..imagebase

+$L$SEH_info_vpaes_cbc_encrypt:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$cbc_body wrt ..imagebase,$L$cbc_epilogue wrt ..imagebase

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-
x86_64.nasm b/CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-
x86_64.nasm
new file mode 100644
index 0000000000..60f283d5fb
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm
@@ -0,0 +1,1569 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/modes/asm/ghash-x86_64.pl

+;

+; Copyright 2010-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+EXTERN OPENSSL_ia32cap_P

+

+global gcm_gmult_4bit

+

+ALIGN 16

+gcm_gmult_4bit:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_gcm_gmult_4bit:

+ mov rdi,rcx

+ mov rsi,rdx

+

+

+

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ push r15

+

+ sub rsp,280

+

+$L$gmult_prologue:

+

+ movzx r8,BYTE[15+rdi]

+ lea r11,[$L$rem_4bit]

+ xor rax,rax

+ xor rbx,rbx

+ mov al,r8b

+ mov bl,r8b

+ shl al,4

+ mov rcx,14

+ mov r8,QWORD[8+rax*1+rsi]

+ mov r9,QWORD[rax*1+rsi]

+ and bl,0xf0

+ mov rdx,r8

+ jmp NEAR $L$oop1

+

+ALIGN 16

+$L$oop1:

+ shr r8,4

+ and rdx,0xf

+ mov r10,r9

+ mov al,BYTE[rcx*1+rdi]

+ shr r9,4

+ xor r8,QWORD[8+rbx*1+rsi]

+ shl r10,60

+ xor r9,QWORD[rbx*1+rsi]

+ mov bl,al

+ xor r9,QWORD[rdx*8+r11]

+ mov rdx,r8

+ shl al,4

+ xor r8,r10

+ dec rcx

+ js NEAR $L$break1

+

+ shr r8,4

+ and rdx,0xf

+ mov r10,r9

+ shr r9,4

+ xor r8,QWORD[8+rax*1+rsi]

+ shl r10,60

+ xor r9,QWORD[rax*1+rsi]

+ and bl,0xf0

+ xor r9,QWORD[rdx*8+r11]

+ mov rdx,r8

+ xor r8,r10

+ jmp NEAR $L$oop1

+

+ALIGN 16

+$L$break1:

+ shr r8,4

+ and rdx,0xf

+ mov r10,r9

+ shr r9,4

+ xor r8,QWORD[8+rax*1+rsi]

+ shl r10,60

+ xor r9,QWORD[rax*1+rsi]

+ and bl,0xf0

+ xor r9,QWORD[rdx*8+r11]

+ mov rdx,r8

+ xor r8,r10

+

+ shr r8,4

+ and rdx,0xf

+ mov r10,r9

+ shr r9,4

+ xor r8,QWORD[8+rbx*1+rsi]

+ shl r10,60

+ xor r9,QWORD[rbx*1+rsi]

+ xor r8,r10

+ xor r9,QWORD[rdx*8+r11]

+

+ bswap r8

+ bswap r9

+ mov QWORD[8+rdi],r8

+ mov QWORD[rdi],r9

+

+ lea rsi,[((280+48))+rsp]

+

+ mov rbx,QWORD[((-8))+rsi]

+

+ lea rsp,[rsi]

+

+$L$gmult_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_gcm_gmult_4bit:

+global gcm_ghash_4bit

+

+ALIGN 16

+gcm_ghash_4bit:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_gcm_ghash_4bit:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+

+

+

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ push r15

+

+ sub rsp,280

+

+$L$ghash_prologue:

+ mov r14,rdx

+ mov r15,rcx

+ sub rsi,-128

+ lea rbp,[((16+128))+rsp]

+ xor edx,edx

+ mov r8,QWORD[((0+0-128))+rsi]

+ mov rax,QWORD[((0+8-128))+rsi]

+ mov dl,al

+ shr rax,4

+ mov r10,r8

+ shr r8,4

+ mov r9,QWORD[((16+0-128))+rsi]

+ shl dl,4

+ mov rbx,QWORD[((16+8-128))+rsi]

+ shl r10,60

+ mov BYTE[rsp],dl

+ or rax,r10

+ mov dl,bl

+ shr rbx,4

+ mov r10,r9

+ shr r9,4

+ mov QWORD[rbp],r8

+ mov r8,QWORD[((32+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((0-128))+rbp],rax

+ mov rax,QWORD[((32+8-128))+rsi]

+ shl r10,60

+ mov BYTE[1+rsp],dl

+ or rbx,r10

+ mov dl,al

+ shr rax,4

+ mov r10,r8

+ shr r8,4

+ mov QWORD[8+rbp],r9

+ mov r9,QWORD[((48+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((8-128))+rbp],rbx

+ mov rbx,QWORD[((48+8-128))+rsi]

+ shl r10,60

+ mov BYTE[2+rsp],dl

+ or rax,r10

+ mov dl,bl

+ shr rbx,4

+ mov r10,r9

+ shr r9,4

+ mov QWORD[16+rbp],r8

+ mov r8,QWORD[((64+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((16-128))+rbp],rax

+ mov rax,QWORD[((64+8-128))+rsi]

+ shl r10,60

+ mov BYTE[3+rsp],dl

+ or rbx,r10

+ mov dl,al

+ shr rax,4

+ mov r10,r8

+ shr r8,4

+ mov QWORD[24+rbp],r9

+ mov r9,QWORD[((80+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((24-128))+rbp],rbx

+ mov rbx,QWORD[((80+8-128))+rsi]

+ shl r10,60

+ mov BYTE[4+rsp],dl

+ or rax,r10

+ mov dl,bl

+ shr rbx,4

+ mov r10,r9

+ shr r9,4

+ mov QWORD[32+rbp],r8

+ mov r8,QWORD[((96+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((32-128))+rbp],rax

+ mov rax,QWORD[((96+8-128))+rsi]

+ shl r10,60

+ mov BYTE[5+rsp],dl

+ or rbx,r10

+ mov dl,al

+ shr rax,4

+ mov r10,r8

+ shr r8,4

+ mov QWORD[40+rbp],r9

+ mov r9,QWORD[((112+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((40-128))+rbp],rbx

+ mov rbx,QWORD[((112+8-128))+rsi]

+ shl r10,60

+ mov BYTE[6+rsp],dl

+ or rax,r10

+ mov dl,bl

+ shr rbx,4

+ mov r10,r9

+ shr r9,4

+ mov QWORD[48+rbp],r8

+ mov r8,QWORD[((128+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((48-128))+rbp],rax

+ mov rax,QWORD[((128+8-128))+rsi]

+ shl r10,60

+ mov BYTE[7+rsp],dl

+ or rbx,r10

+ mov dl,al

+ shr rax,4

+ mov r10,r8

+ shr r8,4

+ mov QWORD[56+rbp],r9

+ mov r9,QWORD[((144+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((56-128))+rbp],rbx

+ mov rbx,QWORD[((144+8-128))+rsi]

+ shl r10,60

+ mov BYTE[8+rsp],dl

+ or rax,r10

+ mov dl,bl

+ shr rbx,4

+ mov r10,r9

+ shr r9,4

+ mov QWORD[64+rbp],r8

+ mov r8,QWORD[((160+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((64-128))+rbp],rax

+ mov rax,QWORD[((160+8-128))+rsi]

+ shl r10,60

+ mov BYTE[9+rsp],dl

+ or rbx,r10

+ mov dl,al

+ shr rax,4

+ mov r10,r8

+ shr r8,4

+ mov QWORD[72+rbp],r9

+ mov r9,QWORD[((176+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((72-128))+rbp],rbx

+ mov rbx,QWORD[((176+8-128))+rsi]

+ shl r10,60

+ mov BYTE[10+rsp],dl

+ or rax,r10

+ mov dl,bl

+ shr rbx,4

+ mov r10,r9

+ shr r9,4

+ mov QWORD[80+rbp],r8

+ mov r8,QWORD[((192+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((80-128))+rbp],rax

+ mov rax,QWORD[((192+8-128))+rsi]

+ shl r10,60

+ mov BYTE[11+rsp],dl

+ or rbx,r10

+ mov dl,al

+ shr rax,4

+ mov r10,r8

+ shr r8,4

+ mov QWORD[88+rbp],r9

+ mov r9,QWORD[((208+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((88-128))+rbp],rbx

+ mov rbx,QWORD[((208+8-128))+rsi]

+ shl r10,60

+ mov BYTE[12+rsp],dl

+ or rax,r10

+ mov dl,bl

+ shr rbx,4

+ mov r10,r9

+ shr r9,4

+ mov QWORD[96+rbp],r8

+ mov r8,QWORD[((224+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((96-128))+rbp],rax

+ mov rax,QWORD[((224+8-128))+rsi]

+ shl r10,60

+ mov BYTE[13+rsp],dl

+ or rbx,r10

+ mov dl,al

+ shr rax,4

+ mov r10,r8

+ shr r8,4

+ mov QWORD[104+rbp],r9

+ mov r9,QWORD[((240+0-128))+rsi]

+ shl dl,4

+ mov QWORD[((104-128))+rbp],rbx

+ mov rbx,QWORD[((240+8-128))+rsi]

+ shl r10,60

+ mov BYTE[14+rsp],dl

+ or rax,r10

+ mov dl,bl

+ shr rbx,4

+ mov r10,r9

+ shr r9,4

+ mov QWORD[112+rbp],r8

+ shl dl,4

+ mov QWORD[((112-128))+rbp],rax

+ shl r10,60

+ mov BYTE[15+rsp],dl

+ or rbx,r10

+ mov QWORD[120+rbp],r9

+ mov QWORD[((120-128))+rbp],rbx

+ add rsi,-128

+ mov r8,QWORD[8+rdi]

+ mov r9,QWORD[rdi]

+ add r15,r14

+ lea r11,[$L$rem_8bit]

+ jmp NEAR $L$outer_loop

+ALIGN 16

+$L$outer_loop:

+ xor r9,QWORD[r14]

+ mov rdx,QWORD[8+r14]

+ lea r14,[16+r14]

+ xor rdx,r8

+ mov QWORD[rdi],r9

+ mov QWORD[8+rdi],rdx

+ shr rdx,32

+ xor rax,rax

+ rol edx,8

+ mov al,dl

+ movzx ebx,dl

+ shl al,4

+ shr ebx,4

+ rol edx,8

+ mov r8,QWORD[8+rax*1+rsi]

+ mov r9,QWORD[rax*1+rsi]

+ mov al,dl

+ movzx ecx,dl

+ shl al,4

+ movzx r12,BYTE[rbx*1+rsp]

+ shr ecx,4

+ xor r12,r8

+ mov r10,r9

+ shr r8,8

+ movzx r12,r12b

+ shr r9,8

+ xor r8,QWORD[((-128))+rbx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rbx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r12,WORD[r12*2+r11]

+ movzx ebx,dl

+ shl al,4

+ movzx r13,BYTE[rcx*1+rsp]

+ shr ebx,4

+ shl r12,48

+ xor r13,r8

+ mov r10,r9

+ xor r9,r12

+ shr r8,8

+ movzx r13,r13b

+ shr r9,8

+ xor r8,QWORD[((-128))+rcx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rcx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r13,WORD[r13*2+r11]

+ movzx ecx,dl

+ shl al,4

+ movzx r12,BYTE[rbx*1+rsp]

+ shr ecx,4

+ shl r13,48

+ xor r12,r8

+ mov r10,r9

+ xor r9,r13

+ shr r8,8

+ movzx r12,r12b

+ mov edx,DWORD[8+rdi]

+ shr r9,8

+ xor r8,QWORD[((-128))+rbx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rbx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r12,WORD[r12*2+r11]

+ movzx ebx,dl

+ shl al,4

+ movzx r13,BYTE[rcx*1+rsp]

+ shr ebx,4

+ shl r12,48

+ xor r13,r8

+ mov r10,r9

+ xor r9,r12

+ shr r8,8

+ movzx r13,r13b

+ shr r9,8

+ xor r8,QWORD[((-128))+rcx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rcx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r13,WORD[r13*2+r11]

+ movzx ecx,dl

+ shl al,4

+ movzx r12,BYTE[rbx*1+rsp]

+ shr ecx,4

+ shl r13,48

+ xor r12,r8

+ mov r10,r9

+ xor r9,r13

+ shr r8,8

+ movzx r12,r12b

+ shr r9,8

+ xor r8,QWORD[((-128))+rbx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rbx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r12,WORD[r12*2+r11]

+ movzx ebx,dl

+ shl al,4

+ movzx r13,BYTE[rcx*1+rsp]

+ shr ebx,4

+ shl r12,48

+ xor r13,r8

+ mov r10,r9

+ xor r9,r12

+ shr r8,8

+ movzx r13,r13b

+ shr r9,8

+ xor r8,QWORD[((-128))+rcx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rcx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r13,WORD[r13*2+r11]

+ movzx ecx,dl

+ shl al,4

+ movzx r12,BYTE[rbx*1+rsp]

+ shr ecx,4

+ shl r13,48

+ xor r12,r8

+ mov r10,r9

+ xor r9,r13

+ shr r8,8

+ movzx r12,r12b

+ mov edx,DWORD[4+rdi]

+ shr r9,8

+ xor r8,QWORD[((-128))+rbx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rbx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r12,WORD[r12*2+r11]

+ movzx ebx,dl

+ shl al,4

+ movzx r13,BYTE[rcx*1+rsp]

+ shr ebx,4

+ shl r12,48

+ xor r13,r8

+ mov r10,r9

+ xor r9,r12

+ shr r8,8

+ movzx r13,r13b

+ shr r9,8

+ xor r8,QWORD[((-128))+rcx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rcx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r13,WORD[r13*2+r11]

+ movzx ecx,dl

+ shl al,4

+ movzx r12,BYTE[rbx*1+rsp]

+ shr ecx,4

+ shl r13,48

+ xor r12,r8

+ mov r10,r9

+ xor r9,r13

+ shr r8,8

+ movzx r12,r12b

+ shr r9,8

+ xor r8,QWORD[((-128))+rbx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rbx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r12,WORD[r12*2+r11]

+ movzx ebx,dl

+ shl al,4

+ movzx r13,BYTE[rcx*1+rsp]

+ shr ebx,4

+ shl r12,48

+ xor r13,r8

+ mov r10,r9

+ xor r9,r12

+ shr r8,8

+ movzx r13,r13b

+ shr r9,8

+ xor r8,QWORD[((-128))+rcx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rcx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r13,WORD[r13*2+r11]

+ movzx ecx,dl

+ shl al,4

+ movzx r12,BYTE[rbx*1+rsp]

+ shr ecx,4

+ shl r13,48

+ xor r12,r8

+ mov r10,r9

+ xor r9,r13

+ shr r8,8

+ movzx r12,r12b

+ mov edx,DWORD[rdi]

+ shr r9,8

+ xor r8,QWORD[((-128))+rbx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rbx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r12,WORD[r12*2+r11]

+ movzx ebx,dl

+ shl al,4

+ movzx r13,BYTE[rcx*1+rsp]

+ shr ebx,4

+ shl r12,48

+ xor r13,r8

+ mov r10,r9

+ xor r9,r12

+ shr r8,8

+ movzx r13,r13b

+ shr r9,8

+ xor r8,QWORD[((-128))+rcx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rcx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r13,WORD[r13*2+r11]

+ movzx ecx,dl

+ shl al,4

+ movzx r12,BYTE[rbx*1+rsp]

+ shr ecx,4

+ shl r13,48

+ xor r12,r8

+ mov r10,r9

+ xor r9,r13

+ shr r8,8

+ movzx r12,r12b

+ shr r9,8

+ xor r8,QWORD[((-128))+rbx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rbx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r12,WORD[r12*2+r11]

+ movzx ebx,dl

+ shl al,4

+ movzx r13,BYTE[rcx*1+rsp]

+ shr ebx,4

+ shl r12,48

+ xor r13,r8

+ mov r10,r9

+ xor r9,r12

+ shr r8,8

+ movzx r13,r13b

+ shr r9,8

+ xor r8,QWORD[((-128))+rcx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rcx*8+rbp]

+ rol edx,8

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ mov al,dl

+ xor r8,r10

+ movzx r13,WORD[r13*2+r11]

+ movzx ecx,dl

+ shl al,4

+ movzx r12,BYTE[rbx*1+rsp]

+ and ecx,240

+ shl r13,48

+ xor r12,r8

+ mov r10,r9

+ xor r9,r13

+ shr r8,8

+ movzx r12,r12b

+ mov edx,DWORD[((-4))+rdi]

+ shr r9,8

+ xor r8,QWORD[((-128))+rbx*8+rbp]

+ shl r10,56

+ xor r9,QWORD[rbx*8+rbp]

+ movzx r12,WORD[r12*2+r11]

+ xor r8,QWORD[8+rax*1+rsi]

+ xor r9,QWORD[rax*1+rsi]

+ shl r12,48

+ xor r8,r10

+ xor r9,r12

+ movzx r13,r8b

+ shr r8,4

+ mov r10,r9

+ shl r13b,4

+ shr r9,4

+ xor r8,QWORD[8+rcx*1+rsi]

+ movzx r13,WORD[r13*2+r11]

+ shl r10,60

+ xor r9,QWORD[rcx*1+rsi]

+ xor r8,r10

+ shl r13,48

+ bswap r8

+ xor r9,r13

+ bswap r9

+ cmp r14,r15

+ jb NEAR $L$outer_loop

+ mov QWORD[8+rdi],r8

+ mov QWORD[rdi],r9

+

+ lea rsi,[((280+48))+rsp]

+

+ mov r15,QWORD[((-48))+rsi]

+

+ mov r14,QWORD[((-40))+rsi]

+

+ mov r13,QWORD[((-32))+rsi]

+

+ mov r12,QWORD[((-24))+rsi]

+

+ mov rbp,QWORD[((-16))+rsi]

+

+ mov rbx,QWORD[((-8))+rsi]

+

+ lea rsp,[rsi]

+

+$L$ghash_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_gcm_ghash_4bit:

+global gcm_init_clmul

+

+ALIGN 16

+gcm_init_clmul:

+

+$L$_init_clmul:

+$L$SEH_begin_gcm_init_clmul:

+

+DB 0x48,0x83,0xec,0x18

+DB 0x0f,0x29,0x34,0x24

+ movdqu xmm2,XMMWORD[rdx]

+ pshufd xmm2,xmm2,78

+

+

+ pshufd xmm4,xmm2,255

+ movdqa xmm3,xmm2

+ psllq xmm2,1

+ pxor xmm5,xmm5

+ psrlq xmm3,63

+ pcmpgtd xmm5,xmm4

+ pslldq xmm3,8

+ por xmm2,xmm3

+

+

+ pand xmm5,XMMWORD[$L$0x1c2_polynomial]

+ pxor xmm2,xmm5

+

+

+ pshufd xmm6,xmm2,78

+ movdqa xmm0,xmm2

+ pxor xmm6,xmm2

+ movdqa xmm1,xmm0

+ pshufd xmm3,xmm0,78

+ pxor xmm3,xmm0

+DB 102,15,58,68,194,0

+DB 102,15,58,68,202,17

+DB 102,15,58,68,222,0

+ pxor xmm3,xmm0

+ pxor xmm3,xmm1

+

+ movdqa xmm4,xmm3

+ psrldq xmm3,8

+ pslldq xmm4,8

+ pxor xmm1,xmm3

+ pxor xmm0,xmm4

+

+ movdqa xmm4,xmm0

+ movdqa xmm3,xmm0

+ psllq xmm0,5

+ pxor xmm3,xmm0

+ psllq xmm0,1

+ pxor xmm0,xmm3

+ psllq xmm0,57

+ movdqa xmm3,xmm0

+ pslldq xmm0,8

+ psrldq xmm3,8

+ pxor xmm0,xmm4

+ pxor xmm1,xmm3

+

+

+ movdqa xmm4,xmm0

+ psrlq xmm0,1

+ pxor xmm1,xmm4

+ pxor xmm4,xmm0

+ psrlq xmm0,5

+ pxor xmm0,xmm4

+ psrlq xmm0,1

+ pxor xmm0,xmm1

+ pshufd xmm3,xmm2,78

+ pshufd xmm4,xmm0,78

+ pxor xmm3,xmm2

+ movdqu XMMWORD[rcx],xmm2

+ pxor xmm4,xmm0

+ movdqu XMMWORD[16+rcx],xmm0

+DB 102,15,58,15,227,8

+ movdqu XMMWORD[32+rcx],xmm4

+ movdqa xmm1,xmm0

+ pshufd xmm3,xmm0,78

+ pxor xmm3,xmm0

+DB 102,15,58,68,194,0

+DB 102,15,58,68,202,17

+DB 102,15,58,68,222,0

+ pxor xmm3,xmm0

+ pxor xmm3,xmm1

+

+ movdqa xmm4,xmm3

+ psrldq xmm3,8

+ pslldq xmm4,8

+ pxor xmm1,xmm3

+ pxor xmm0,xmm4

+

+ movdqa xmm4,xmm0

+ movdqa xmm3,xmm0

+ psllq xmm0,5

+ pxor xmm3,xmm0

+ psllq xmm0,1

+ pxor xmm0,xmm3

+ psllq xmm0,57

+ movdqa xmm3,xmm0

+ pslldq xmm0,8

+ psrldq xmm3,8

+ pxor xmm0,xmm4

+ pxor xmm1,xmm3

+

+

+ movdqa xmm4,xmm0

+ psrlq xmm0,1

+ pxor xmm1,xmm4

+ pxor xmm4,xmm0

+ psrlq xmm0,5

+ pxor xmm0,xmm4

+ psrlq xmm0,1

+ pxor xmm0,xmm1

+ movdqa xmm5,xmm0

+ movdqa xmm1,xmm0

+ pshufd xmm3,xmm0,78

+ pxor xmm3,xmm0

+DB 102,15,58,68,194,0

+DB 102,15,58,68,202,17

+DB 102,15,58,68,222,0

+ pxor xmm3,xmm0

+ pxor xmm3,xmm1

+

+ movdqa xmm4,xmm3

+ psrldq xmm3,8

+ pslldq xmm4,8

+ pxor xmm1,xmm3

+ pxor xmm0,xmm4

+

+ movdqa xmm4,xmm0

+ movdqa xmm3,xmm0

+ psllq xmm0,5

+ pxor xmm3,xmm0

+ psllq xmm0,1

+ pxor xmm0,xmm3

+ psllq xmm0,57

+ movdqa xmm3,xmm0

+ pslldq xmm0,8

+ psrldq xmm3,8

+ pxor xmm0,xmm4

+ pxor xmm1,xmm3

+

+

+ movdqa xmm4,xmm0

+ psrlq xmm0,1

+ pxor xmm1,xmm4

+ pxor xmm4,xmm0

+ psrlq xmm0,5

+ pxor xmm0,xmm4

+ psrlq xmm0,1

+ pxor xmm0,xmm1

+ pshufd xmm3,xmm5,78

+ pshufd xmm4,xmm0,78

+ pxor xmm3,xmm5

+ movdqu XMMWORD[48+rcx],xmm5

+ pxor xmm4,xmm0

+ movdqu XMMWORD[64+rcx],xmm0

+DB 102,15,58,15,227,8

+ movdqu XMMWORD[80+rcx],xmm4

+ movaps xmm6,XMMWORD[rsp]

+ lea rsp,[24+rsp]

+$L$SEH_end_gcm_init_clmul:

+ DB 0F3h,0C3h ;repret

+

+

+global gcm_gmult_clmul

+

+ALIGN 16

+gcm_gmult_clmul:

+

+$L$_gmult_clmul:

+ movdqu xmm0,XMMWORD[rcx]

+ movdqa xmm5,XMMWORD[$L$bswap_mask]

+ movdqu xmm2,XMMWORD[rdx]

+ movdqu xmm4,XMMWORD[32+rdx]

+DB 102,15,56,0,197

+ movdqa xmm1,xmm0

+ pshufd xmm3,xmm0,78

+ pxor xmm3,xmm0

+DB 102,15,58,68,194,0

+DB 102,15,58,68,202,17

+DB 102,15,58,68,220,0

+ pxor xmm3,xmm0

+ pxor xmm3,xmm1

+

+ movdqa xmm4,xmm3

+ psrldq xmm3,8

+ pslldq xmm4,8

+ pxor xmm1,xmm3

+ pxor xmm0,xmm4

+

+ movdqa xmm4,xmm0

+ movdqa xmm3,xmm0

+ psllq xmm0,5

+ pxor xmm3,xmm0

+ psllq xmm0,1

+ pxor xmm0,xmm3

+ psllq xmm0,57

+ movdqa xmm3,xmm0

+ pslldq xmm0,8

+ psrldq xmm3,8

+ pxor xmm0,xmm4

+ pxor xmm1,xmm3

+

+

+ movdqa xmm4,xmm0

+ psrlq xmm0,1

+ pxor xmm1,xmm4

+ pxor xmm4,xmm0

+ psrlq xmm0,5

+ pxor xmm0,xmm4

+ psrlq xmm0,1

+ pxor xmm0,xmm1

+DB 102,15,56,0,197

+ movdqu XMMWORD[rcx],xmm0

+ DB 0F3h,0C3h ;repret

+

+

+global gcm_ghash_clmul

+

+ALIGN 32

+gcm_ghash_clmul:

+

+$L$_ghash_clmul:

+ lea rax,[((-136))+rsp]

+$L$SEH_begin_gcm_ghash_clmul:

+

+DB 0x48,0x8d,0x60,0xe0

+DB 0x0f,0x29,0x70,0xe0

+DB 0x0f,0x29,0x78,0xf0

+DB 0x44,0x0f,0x29,0x00

+DB 0x44,0x0f,0x29,0x48,0x10

+DB 0x44,0x0f,0x29,0x50,0x20

+DB 0x44,0x0f,0x29,0x58,0x30

+DB 0x44,0x0f,0x29,0x60,0x40

+DB 0x44,0x0f,0x29,0x68,0x50

+DB 0x44,0x0f,0x29,0x70,0x60

+DB 0x44,0x0f,0x29,0x78,0x70

+ movdqa xmm10,XMMWORD[$L$bswap_mask]

+

+ movdqu xmm0,XMMWORD[rcx]

+ movdqu xmm2,XMMWORD[rdx]

+ movdqu xmm7,XMMWORD[32+rdx]

+DB 102,65,15,56,0,194

+

+ sub r9,0x10

+ jz NEAR $L$odd_tail

+

+ movdqu xmm6,XMMWORD[16+rdx]

+ mov eax,DWORD[((OPENSSL_ia32cap_P+4))]

+ cmp r9,0x30

+ jb NEAR $L$skip4x

+

+ and eax,71303168

+ cmp eax,4194304

+ je NEAR $L$skip4x

+

+ sub r9,0x30

+ mov rax,0xA040608020C0E000

+ movdqu xmm14,XMMWORD[48+rdx]

+ movdqu xmm15,XMMWORD[64+rdx]

+

+

+

+

+ movdqu xmm3,XMMWORD[48+r8]

+ movdqu xmm11,XMMWORD[32+r8]

+DB 102,65,15,56,0,218

+DB 102,69,15,56,0,218

+ movdqa xmm5,xmm3

+ pshufd xmm4,xmm3,78

+ pxor xmm4,xmm3

+DB 102,15,58,68,218,0

+DB 102,15,58,68,234,17

+DB 102,15,58,68,231,0

+

+ movdqa xmm13,xmm11

+ pshufd xmm12,xmm11,78

+ pxor xmm12,xmm11

+DB 102,68,15,58,68,222,0

+DB 102,68,15,58,68,238,17

+DB 102,68,15,58,68,231,16

+ xorps xmm3,xmm11

+ xorps xmm5,xmm13

+ movups xmm7,XMMWORD[80+rdx]

+ xorps xmm4,xmm12

+

+ movdqu xmm11,XMMWORD[16+r8]

+ movdqu xmm8,XMMWORD[r8]

+DB 102,69,15,56,0,218

+DB 102,69,15,56,0,194

+ movdqa xmm13,xmm11

+ pshufd xmm12,xmm11,78

+ pxor xmm0,xmm8

+ pxor xmm12,xmm11

+DB 102,69,15,58,68,222,0

+ movdqa xmm1,xmm0

+ pshufd xmm8,xmm0,78

+ pxor xmm8,xmm0

+DB 102,69,15,58,68,238,17

+DB 102,68,15,58,68,231,0

+ xorps xmm3,xmm11

+ xorps xmm5,xmm13

+

+ lea r8,[64+r8]

+ sub r9,0x40

+ jc NEAR $L$tail4x

+

+ jmp NEAR $L$mod4_loop

+ALIGN 32

+$L$mod4_loop:

+DB 102,65,15,58,68,199,0

+ xorps xmm4,xmm12

+ movdqu xmm11,XMMWORD[48+r8]

+DB 102,69,15,56,0,218

+DB 102,65,15,58,68,207,17

+ xorps xmm0,xmm3

+ movdqu xmm3,XMMWORD[32+r8]

+ movdqa xmm13,xmm11

+DB 102,68,15,58,68,199,16

+ pshufd xmm12,xmm11,78

+ xorps xmm1,xmm5

+ pxor xmm12,xmm11

+DB 102,65,15,56,0,218

+ movups xmm7,XMMWORD[32+rdx]

+ xorps xmm8,xmm4

+DB 102,68,15,58,68,218,0

+ pshufd xmm4,xmm3,78

+

+ pxor xmm8,xmm0

+ movdqa xmm5,xmm3

+ pxor xmm8,xmm1

+ pxor xmm4,xmm3

+ movdqa xmm9,xmm8

+DB 102,68,15,58,68,234,17

+ pslldq xmm8,8

+ psrldq xmm9,8

+ pxor xmm0,xmm8

+ movdqa xmm8,XMMWORD[$L$7_mask]

+ pxor xmm1,xmm9

+DB 102,76,15,110,200

+

+ pand xmm8,xmm0

+DB 102,69,15,56,0,200

+ pxor xmm9,xmm0

+DB 102,68,15,58,68,231,0

+ psllq xmm9,57

+ movdqa xmm8,xmm9

+ pslldq xmm9,8

+DB 102,15,58,68,222,0

+ psrldq xmm8,8

+ pxor xmm0,xmm9

+ pxor xmm1,xmm8

+ movdqu xmm8,XMMWORD[r8]

+

+ movdqa xmm9,xmm0

+ psrlq xmm0,1

+DB 102,15,58,68,238,17

+ xorps xmm3,xmm11

+ movdqu xmm11,XMMWORD[16+r8]

+DB 102,69,15,56,0,218

+DB 102,15,58,68,231,16

+ xorps xmm5,xmm13

+ movups xmm7,XMMWORD[80+rdx]

+DB 102,69,15,56,0,194

+ pxor xmm1,xmm9

+ pxor xmm9,xmm0

+ psrlq xmm0,5

+

+ movdqa xmm13,xmm11

+ pxor xmm4,xmm12

+ pshufd xmm12,xmm11,78

+ pxor xmm0,xmm9

+ pxor xmm1,xmm8

+ pxor xmm12,xmm11

+DB 102,69,15,58,68,222,0

+ psrlq xmm0,1

+ pxor xmm0,xmm1

+ movdqa xmm1,xmm0

+DB 102,69,15,58,68,238,17

+ xorps xmm3,xmm11

+ pshufd xmm8,xmm0,78

+ pxor xmm8,xmm0

+

+DB 102,68,15,58,68,231,0

+ xorps xmm5,xmm13

+

+ lea r8,[64+r8]

+ sub r9,0x40

+ jnc NEAR $L$mod4_loop

+

+$L$tail4x:

+DB 102,65,15,58,68,199,0

+DB 102,65,15,58,68,207,17

+DB 102,68,15,58,68,199,16

+ xorps xmm4,xmm12

+ xorps xmm0,xmm3

+ xorps xmm1,xmm5

+ pxor xmm1,xmm0

+ pxor xmm8,xmm4

+

+ pxor xmm8,xmm1

+ pxor xmm1,xmm0

+

+ movdqa xmm9,xmm8

+ psrldq xmm8,8

+ pslldq xmm9,8

+ pxor xmm1,xmm8

+ pxor xmm0,xmm9

+

+ movdqa xmm4,xmm0

+ movdqa xmm3,xmm0

+ psllq xmm0,5

+ pxor xmm3,xmm0

+ psllq xmm0,1

+ pxor xmm0,xmm3

+ psllq xmm0,57

+ movdqa xmm3,xmm0

+ pslldq xmm0,8

+ psrldq xmm3,8

+ pxor xmm0,xmm4

+ pxor xmm1,xmm3

+

+

+ movdqa xmm4,xmm0

+ psrlq xmm0,1

+ pxor xmm1,xmm4

+ pxor xmm4,xmm0

+ psrlq xmm0,5

+ pxor xmm0,xmm4

+ psrlq xmm0,1

+ pxor xmm0,xmm1

+ add r9,0x40

+ jz NEAR $L$done

+ movdqu xmm7,XMMWORD[32+rdx]

+ sub r9,0x10

+ jz NEAR $L$odd_tail

+$L$skip4x:

+

+

+

+

+

+ movdqu xmm8,XMMWORD[r8]

+ movdqu xmm3,XMMWORD[16+r8]

+DB 102,69,15,56,0,194

+DB 102,65,15,56,0,218

+ pxor xmm0,xmm8

+

+ movdqa xmm5,xmm3

+ pshufd xmm4,xmm3,78

+ pxor xmm4,xmm3

+DB 102,15,58,68,218,0

+DB 102,15,58,68,234,17

+DB 102,15,58,68,231,0

+

+ lea r8,[32+r8]

+ nop

+ sub r9,0x20

+ jbe NEAR $L$even_tail

+ nop

+ jmp NEAR $L$mod_loop

+

+ALIGN 32

+$L$mod_loop:

+ movdqa xmm1,xmm0

+ movdqa xmm8,xmm4

+ pshufd xmm4,xmm0,78

+ pxor xmm4,xmm0

+

+DB 102,15,58,68,198,0

+DB 102,15,58,68,206,17

+DB 102,15,58,68,231,16

+

+ pxor xmm0,xmm3

+ pxor xmm1,xmm5

+ movdqu xmm9,XMMWORD[r8]

+ pxor xmm8,xmm0

+DB 102,69,15,56,0,202

+ movdqu xmm3,XMMWORD[16+r8]

+

+ pxor xmm8,xmm1

+ pxor xmm1,xmm9

+ pxor xmm4,xmm8

+DB 102,65,15,56,0,218

+ movdqa xmm8,xmm4

+ psrldq xmm8,8

+ pslldq xmm4,8

+ pxor xmm1,xmm8

+ pxor xmm0,xmm4

+

+ movdqa xmm5,xmm3

+

+ movdqa xmm9,xmm0

+ movdqa xmm8,xmm0

+ psllq xmm0,5

+ pxor xmm8,xmm0

+DB 102,15,58,68,218,0

+ psllq xmm0,1

+ pxor xmm0,xmm8

+ psllq xmm0,57

+ movdqa xmm8,xmm0

+ pslldq xmm0,8

+ psrldq xmm8,8

+ pxor xmm0,xmm9

+ pshufd xmm4,xmm5,78

+ pxor xmm1,xmm8

+ pxor xmm4,xmm5

+

+ movdqa xmm9,xmm0

+ psrlq xmm0,1

+DB 102,15,58,68,234,17

+ pxor xmm1,xmm9

+ pxor xmm9,xmm0

+ psrlq xmm0,5

+ pxor xmm0,xmm9

+ lea r8,[32+r8]

+ psrlq xmm0,1

+DB 102,15,58,68,231,0

+ pxor xmm0,xmm1

+

+ sub r9,0x20

+ ja NEAR $L$mod_loop

+

+$L$even_tail:

+ movdqa xmm1,xmm0

+ movdqa xmm8,xmm4

+ pshufd xmm4,xmm0,78

+ pxor xmm4,xmm0

+

+DB 102,15,58,68,198,0

+DB 102,15,58,68,206,17

+DB 102,15,58,68,231,16

+

+ pxor xmm0,xmm3

+ pxor xmm1,xmm5

+ pxor xmm8,xmm0

+ pxor xmm8,xmm1

+ pxor xmm4,xmm8

+ movdqa xmm8,xmm4

+ psrldq xmm8,8

+ pslldq xmm4,8

+ pxor xmm1,xmm8

+ pxor xmm0,xmm4

+

+ movdqa xmm4,xmm0

+ movdqa xmm3,xmm0

+ psllq xmm0,5

+ pxor xmm3,xmm0

+ psllq xmm0,1

+ pxor xmm0,xmm3

+ psllq xmm0,57

+ movdqa xmm3,xmm0

+ pslldq xmm0,8

+ psrldq xmm3,8

+ pxor xmm0,xmm4

+ pxor xmm1,xmm3

+

+

+ movdqa xmm4,xmm0

+ psrlq xmm0,1

+ pxor xmm1,xmm4

+ pxor xmm4,xmm0

+ psrlq xmm0,5

+ pxor xmm0,xmm4

+ psrlq xmm0,1

+ pxor xmm0,xmm1

+ test r9,r9

+ jnz NEAR $L$done

+

+$L$odd_tail:

+ movdqu xmm8,XMMWORD[r8]

+DB 102,69,15,56,0,194

+ pxor xmm0,xmm8

+ movdqa xmm1,xmm0

+ pshufd xmm3,xmm0,78

+ pxor xmm3,xmm0

+DB 102,15,58,68,194,0

+DB 102,15,58,68,202,17

+DB 102,15,58,68,223,0

+ pxor xmm3,xmm0

+ pxor xmm3,xmm1

+

+ movdqa xmm4,xmm3

+ psrldq xmm3,8

+ pslldq xmm4,8

+ pxor xmm1,xmm3

+ pxor xmm0,xmm4

+

+ movdqa xmm4,xmm0

+ movdqa xmm3,xmm0

+ psllq xmm0,5

+ pxor xmm3,xmm0

+ psllq xmm0,1

+ pxor xmm0,xmm3

+ psllq xmm0,57

+ movdqa xmm3,xmm0

+ pslldq xmm0,8

+ psrldq xmm3,8

+ pxor xmm0,xmm4

+ pxor xmm1,xmm3

+

+

+ movdqa xmm4,xmm0

+ psrlq xmm0,1

+ pxor xmm1,xmm4

+ pxor xmm4,xmm0

+ psrlq xmm0,5

+ pxor xmm0,xmm4

+ psrlq xmm0,1

+ pxor xmm0,xmm1

+$L$done:

+DB 102,65,15,56,0,194

+ movdqu XMMWORD[rcx],xmm0

+ movaps xmm6,XMMWORD[rsp]

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps xmm10,XMMWORD[64+rsp]

+ movaps xmm11,XMMWORD[80+rsp]

+ movaps xmm12,XMMWORD[96+rsp]

+ movaps xmm13,XMMWORD[112+rsp]

+ movaps xmm14,XMMWORD[128+rsp]

+ movaps xmm15,XMMWORD[144+rsp]

+ lea rsp,[168+rsp]

+$L$SEH_end_gcm_ghash_clmul:

+ DB 0F3h,0C3h ;repret

+

+

+global gcm_init_avx

+

+ALIGN 32

+gcm_init_avx:

+

+ jmp NEAR $L$_init_clmul

+

+

+global gcm_gmult_avx

+

+ALIGN 32

+gcm_gmult_avx:

+

+ jmp NEAR $L$_gmult_clmul

+

+

+global gcm_ghash_avx

+

+ALIGN 32

+gcm_ghash_avx:

+

+ jmp NEAR $L$_ghash_clmul

+

+

+ALIGN 64

+$L$bswap_mask:

+DB 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0

+$L$0x1c2_polynomial:

+DB 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc2

+$L$7_mask:

+ DD 7,0,7,0

+$L$7_mask_poly:

+ DD 7,0,450,0

+ALIGN 64

+

+$L$rem_4bit:

+ DD 0,0,0,471859200,0,943718400,0,610271232

+ DD 0,1887436800,0,1822425088,0,1220542464,0,1423966208

+ DD 0,3774873600,0,4246732800,0,3644850176,0,3311403008

+ DD 0,2441084928,0,2376073216,0,2847932416,0,3051356160

+

+$L$rem_8bit:

+ DW 0x0000,0x01C2,0x0384,0x0246,0x0708,0x06CA,0x048C,0x054E

+ DW 0x0E10,0x0FD2,0x0D94,0x0C56,0x0918,0x08DA,0x0A9C,0x0B5E

+ DW 0x1C20,0x1DE2,0x1FA4,0x1E66,0x1B28,0x1AEA,0x18AC,0x196E

+ DW 0x1230,0x13F2,0x11B4,0x1076,0x1538,0x14FA,0x16BC,0x177E

+ DW 0x3840,0x3982,0x3BC4,0x3A06,0x3F48,0x3E8A,0x3CCC,0x3D0E

+ DW 0x3650,0x3792,0x35D4,0x3416,0x3158,0x309A,0x32DC,0x331E

+ DW 0x2460,0x25A2,0x27E4,0x2626,0x2368,0x22AA,0x20EC,0x212E

+ DW 0x2A70,0x2BB2,0x29F4,0x2836,0x2D78,0x2CBA,0x2EFC,0x2F3E

+ DW 0x7080,0x7142,0x7304,0x72C6,0x7788,0x764A,0x740C,0x75CE

+ DW 0x7E90,0x7F52,0x7D14,0x7CD6,0x7998,0x785A,0x7A1C,0x7BDE

+ DW 0x6CA0,0x6D62,0x6F24,0x6EE6,0x6BA8,0x6A6A,0x682C,0x69EE

+ DW 0x62B0,0x6372,0x6134,0x60F6,0x65B8,0x647A,0x663C,0x67FE

+ DW 0x48C0,0x4902,0x4B44,0x4A86,0x4FC8,0x4E0A,0x4C4C,0x4D8E

+ DW 0x46D0,0x4712,0x4554,0x4496,0x41D8,0x401A,0x425C,0x439E

+ DW 0x54E0,0x5522,0x5764,0x56A6,0x53E8,0x522A,0x506C,0x51AE

+ DW 0x5AF0,0x5B32,0x5974,0x58B6,0x5DF8,0x5C3A,0x5E7C,0x5FBE

+ DW 0xE100,0xE0C2,0xE284,0xE346,0xE608,0xE7CA,0xE58C,0xE44E

+ DW 0xEF10,0xEED2,0xEC94,0xED56,0xE818,0xE9DA,0xEB9C,0xEA5E

+ DW 0xFD20,0xFCE2,0xFEA4,0xFF66,0xFA28,0xFBEA,0xF9AC,0xF86E

+ DW 0xF330,0xF2F2,0xF0B4,0xF176,0xF438,0xF5FA,0xF7BC,0xF67E

+ DW
0xD940,0xD882,0xDAC4,0xDB06,0xDE48,0xDF8A,0xDDCC,0xDC0E

+ DW
0xD750,0xD692,0xD4D4,0xD516,0xD058,0xD19A,0xD3DC,0xD21E

+ DW
0xC560,0xC4A2,0xC6E4,0xC726,0xC268,0xC3AA,0xC1EC,0xC02E

+ DW
0xCB70,0xCAB2,0xC8F4,0xC936,0xCC78,0xCDBA,0xCFFC,0xCE3E

+ DW 0x9180,0x9042,0x9204,0x93C6,0x9688,0x974A,0x950C,0x94CE

+ DW 0x9F90,0x9E52,0x9C14,0x9DD6,0x9898,0x995A,0x9B1C,0x9ADE

+ DW 0x8DA0,0x8C62,0x8E24,0x8FE6,0x8AA8,0x8B6A,0x892C,0x88EE

+ DW 0x83B0,0x8272,0x8034,0x81F6,0x84B8,0x857A,0x873C,0x86FE

+ DW
0xA9C0,0xA802,0xAA44,0xAB86,0xAEC8,0xAF0A,0xAD4C,0xAC8E

+ DW
0xA7D0,0xA612,0xA454,0xA596,0xA0D8,0xA11A,0xA35C,0xA29E

+ DW
0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE

+ DW
0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE

+

+DB 71,72,65,83,72,32,102,111,114,32,120,56,54,95,54,52

+DB 44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32

+DB 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111

+DB 114,103,62,0

+ALIGN 64

+EXTERN __imp_RtlVirtualUnwind

+

+ALIGN 16

+se_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$in_prologue

+

+ mov rax,QWORD[152+r8]

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$in_prologue

+

+ lea rax,[((48+280))+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+ mov rbp,QWORD[((-16))+rax]

+ mov r12,QWORD[((-24))+rax]

+ mov r13,QWORD[((-32))+rax]

+ mov r14,QWORD[((-40))+rax]

+ mov r15,QWORD[((-48))+rax]

+ mov QWORD[144+r8],rbx

+ mov QWORD[160+r8],rbp

+ mov QWORD[216+r8],r12

+ mov QWORD[224+r8],r13

+ mov QWORD[232+r8],r14

+ mov QWORD[240+r8],r15

+

+$L$in_prologue:

+ mov rdi,QWORD[8+rax]

+ mov rsi,QWORD[16+rax]

+ mov QWORD[152+r8],rax

+ mov QWORD[168+r8],rsi

+ mov QWORD[176+r8],rdi

+

+ mov rdi,QWORD[40+r9]

+ mov rsi,r8

+ mov ecx,154

+ DD 0xa548f3fc

+

+ mov rsi,r9

+ xor rcx,rcx

+ mov rdx,QWORD[8+rsi]

+ mov r8,QWORD[rsi]

+ mov r9,QWORD[16+rsi]

+ mov r10,QWORD[40+rsi]

+ lea r11,[56+rsi]

+ lea r12,[24+rsi]

+ mov QWORD[32+rsp],r10

+ mov QWORD[40+rsp],r11

+ mov QWORD[48+rsp],r12

+ mov QWORD[56+rsp],rcx

+ call QWORD[__imp_RtlVirtualUnwind]

+

+ mov eax,1

+ add rsp,64

+ popfq

+ pop r15

+ pop r14

+ pop r13

+ pop r12

+ pop rbp

+ pop rbx

+ pop rdi

+ pop rsi

+ DB 0F3h,0C3h ;repret

+

+

+section .pdata rdata align=4

+ALIGN 4

+ DD $L$SEH_begin_gcm_gmult_4bit wrt ..imagebase

+ DD $L$SEH_end_gcm_gmult_4bit wrt ..imagebase

+ DD $L$SEH_info_gcm_gmult_4bit wrt ..imagebase

+

+ DD $L$SEH_begin_gcm_ghash_4bit wrt ..imagebase

+ DD $L$SEH_end_gcm_ghash_4bit wrt ..imagebase

+ DD $L$SEH_info_gcm_ghash_4bit wrt ..imagebase

+

+ DD $L$SEH_begin_gcm_init_clmul wrt ..imagebase

+ DD $L$SEH_end_gcm_init_clmul wrt ..imagebase

+ DD $L$SEH_info_gcm_init_clmul wrt ..imagebase

+

+ DD $L$SEH_begin_gcm_ghash_clmul wrt ..imagebase

+ DD $L$SEH_end_gcm_ghash_clmul wrt ..imagebase

+ DD $L$SEH_info_gcm_ghash_clmul wrt ..imagebase

+section .xdata rdata align=8

+ALIGN 8

+$L$SEH_info_gcm_gmult_4bit:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$gmult_prologue wrt ..imagebase,$L$gmult_epilogue
wrt ..imagebase

+$L$SEH_info_gcm_ghash_4bit:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$ghash_prologue wrt ..imagebase,$L$ghash_epilogue
wrt ..imagebase

+$L$SEH_info_gcm_init_clmul:

+DB 0x01,0x08,0x03,0x00

+DB 0x08,0x68,0x00,0x00

+DB 0x04,0x22,0x00,0x00

+$L$SEH_info_gcm_ghash_clmul:

+DB 0x01,0x33,0x16,0x00

+DB 0x33,0xf8,0x09,0x00

+DB 0x2e,0xe8,0x08,0x00

+DB 0x29,0xd8,0x07,0x00

+DB 0x24,0xc8,0x06,0x00

+DB 0x1f,0xb8,0x05,0x00

+DB 0x1a,0xa8,0x04,0x00

+DB 0x15,0x98,0x03,0x00

+DB 0x10,0x88,0x02,0x00

+DB 0x0c,0x78,0x01,0x00

+DB 0x08,0x68,0x00,0x00

+DB 0x04,0x01,0x15,0x00

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-
x86_64.nasm b/CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-
x86_64.nasm
new file mode 100644
index 0000000000..f3b7b0e35e
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-x86_64.nasm
@@ -0,0 +1,3137 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/sha/asm/sha1-mb-x86_64.pl

+;

+; Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+

+EXTERN OPENSSL_ia32cap_P

+

+global sha1_multi_block

+

+ALIGN 32

+sha1_multi_block:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_sha1_multi_block:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ mov rcx,QWORD[((OPENSSL_ia32cap_P+4))]

+ bt rcx,61

+ jc NEAR _shaext_shortcut

+ mov rax,rsp

+

+ push rbx

+

+ push rbp

+

+ lea rsp,[((-168))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+ movaps XMMWORD[(-120)+rax],xmm10

+ movaps XMMWORD[(-104)+rax],xmm11

+ movaps XMMWORD[(-88)+rax],xmm12

+ movaps XMMWORD[(-72)+rax],xmm13

+ movaps XMMWORD[(-56)+rax],xmm14

+ movaps XMMWORD[(-40)+rax],xmm15

+ sub rsp,288

+ and rsp,-256

+ mov QWORD[272+rsp],rax

+

+$L$body:

+ lea rbp,[K_XX_XX]

+ lea rbx,[256+rsp]

+

+$L$oop_grande:

+ mov DWORD[280+rsp],edx

+ xor edx,edx

+ mov r8,QWORD[rsi]

+ mov ecx,DWORD[8+rsi]

+ cmp ecx,edx

+ cmovg edx,ecx

+ test ecx,ecx

+ mov DWORD[rbx],ecx

+ cmovle r8,rbp

+ mov r9,QWORD[16+rsi]

+ mov ecx,DWORD[24+rsi]

+ cmp ecx,edx

+ cmovg edx,ecx

+ test ecx,ecx

+ mov DWORD[4+rbx],ecx

+ cmovle r9,rbp

+ mov r10,QWORD[32+rsi]

+ mov ecx,DWORD[40+rsi]

+ cmp ecx,edx

+ cmovg edx,ecx

+ test ecx,ecx

+ mov DWORD[8+rbx],ecx

+ cmovle r10,rbp

+ mov r11,QWORD[48+rsi]

+ mov ecx,DWORD[56+rsi]

+ cmp ecx,edx

+ cmovg edx,ecx

+ test ecx,ecx

+ mov DWORD[12+rbx],ecx

+ cmovle r11,rbp

+ test edx,edx

+ jz NEAR $L$done

+

+ movdqu xmm10,XMMWORD[rdi]

+ lea rax,[128+rsp]

+ movdqu xmm11,XMMWORD[32+rdi]

+ movdqu xmm12,XMMWORD[64+rdi]

+ movdqu xmm13,XMMWORD[96+rdi]

+ movdqu xmm14,XMMWORD[128+rdi]

+ movdqa xmm5,XMMWORD[96+rbp]

+ movdqa xmm15,XMMWORD[((-32))+rbp]

+ jmp NEAR $L$oop

+

+ALIGN 32

+$L$oop:

+ movd xmm0,DWORD[r8]

+ lea r8,[64+r8]

+ movd xmm2,DWORD[r9]

+ lea r9,[64+r9]

+ movd xmm3,DWORD[r10]

+ lea r10,[64+r10]

+ movd xmm4,DWORD[r11]

+ lea r11,[64+r11]

+ punpckldq xmm0,xmm3

+ movd xmm1,DWORD[((-60))+r8]

+ punpckldq xmm2,xmm4

+ movd xmm9,DWORD[((-60))+r9]

+ punpckldq xmm0,xmm2

+ movd xmm8,DWORD[((-60))+r10]

+DB 102,15,56,0,197

+ movd xmm7,DWORD[((-60))+r11]

+ punpckldq xmm1,xmm8

+ movdqa xmm8,xmm10

+ paddd xmm14,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm11

+ movdqa xmm6,xmm11

+ pslld xmm8,5

+ pandn xmm7,xmm13

+ pand xmm6,xmm12

+ punpckldq xmm1,xmm9

+ movdqa xmm9,xmm10

+

+ movdqa XMMWORD[(0-128)+rax],xmm0

+ paddd xmm14,xmm0

+ movd xmm2,DWORD[((-56))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm11

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-56))+r9]

+ pslld xmm7,30

+ paddd xmm14,xmm6

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+DB 102,15,56,0,205

+ movd xmm8,DWORD[((-56))+r10]

+ por xmm11,xmm7

+ movd xmm7,DWORD[((-56))+r11]

+ punpckldq xmm2,xmm8

+ movdqa xmm8,xmm14

+ paddd xmm13,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm10

+ movdqa xmm6,xmm10

+ pslld xmm8,5

+ pandn xmm7,xmm12

+ pand xmm6,xmm11

+ punpckldq xmm2,xmm9

+ movdqa xmm9,xmm14

+

+ movdqa XMMWORD[(16-128)+rax],xmm1

+ paddd xmm13,xmm1

+ movd xmm3,DWORD[((-52))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm10

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-52))+r9]

+ pslld xmm7,30

+ paddd xmm13,xmm6

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+DB 102,15,56,0,213

+ movd xmm8,DWORD[((-52))+r10]

+ por xmm10,xmm7

+ movd xmm7,DWORD[((-52))+r11]

+ punpckldq xmm3,xmm8

+ movdqa xmm8,xmm13

+ paddd xmm12,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm14

+ movdqa xmm6,xmm14

+ pslld xmm8,5

+ pandn xmm7,xmm11

+ pand xmm6,xmm10

+ punpckldq xmm3,xmm9

+ movdqa xmm9,xmm13

+

+ movdqa XMMWORD[(32-128)+rax],xmm2

+ paddd xmm12,xmm2

+ movd xmm4,DWORD[((-48))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm14

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-48))+r9]

+ pslld xmm7,30

+ paddd xmm12,xmm6

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+DB 102,15,56,0,221

+ movd xmm8,DWORD[((-48))+r10]

+ por xmm14,xmm7

+ movd xmm7,DWORD[((-48))+r11]

+ punpckldq xmm4,xmm8

+ movdqa xmm8,xmm12

+ paddd xmm11,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm13

+ movdqa xmm6,xmm13

+ pslld xmm8,5

+ pandn xmm7,xmm10

+ pand xmm6,xmm14

+ punpckldq xmm4,xmm9

+ movdqa xmm9,xmm12

+

+ movdqa XMMWORD[(48-128)+rax],xmm3

+ paddd xmm11,xmm3

+ movd xmm0,DWORD[((-44))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm13

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-44))+r9]

+ pslld xmm7,30

+ paddd xmm11,xmm6

+

+ psrld xmm13,2

+ paddd xmm11,xmm8

+DB 102,15,56,0,229

+ movd xmm8,DWORD[((-44))+r10]

+ por xmm13,xmm7

+ movd xmm7,DWORD[((-44))+r11]

+ punpckldq xmm0,xmm8

+ movdqa xmm8,xmm11

+ paddd xmm10,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm12

+ movdqa xmm6,xmm12

+ pslld xmm8,5

+ pandn xmm7,xmm14

+ pand xmm6,xmm13

+ punpckldq xmm0,xmm9

+ movdqa xmm9,xmm11

+

+ movdqa XMMWORD[(64-128)+rax],xmm4

+ paddd xmm10,xmm4

+ movd xmm1,DWORD[((-40))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm12

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-40))+r9]

+ pslld xmm7,30

+ paddd xmm10,xmm6

+

+ psrld xmm12,2

+ paddd xmm10,xmm8

+DB 102,15,56,0,197

+ movd xmm8,DWORD[((-40))+r10]

+ por xmm12,xmm7

+ movd xmm7,DWORD[((-40))+r11]

+ punpckldq xmm1,xmm8

+ movdqa xmm8,xmm10

+ paddd xmm14,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm11

+ movdqa xmm6,xmm11

+ pslld xmm8,5

+ pandn xmm7,xmm13

+ pand xmm6,xmm12

+ punpckldq xmm1,xmm9

+ movdqa xmm9,xmm10

+

+ movdqa XMMWORD[(80-128)+rax],xmm0

+ paddd xmm14,xmm0

+ movd xmm2,DWORD[((-36))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm11

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-36))+r9]

+ pslld xmm7,30

+ paddd xmm14,xmm6

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+DB 102,15,56,0,205

+ movd xmm8,DWORD[((-36))+r10]

+ por xmm11,xmm7

+ movd xmm7,DWORD[((-36))+r11]

+ punpckldq xmm2,xmm8

+ movdqa xmm8,xmm14

+ paddd xmm13,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm10

+ movdqa xmm6,xmm10

+ pslld xmm8,5

+ pandn xmm7,xmm12

+ pand xmm6,xmm11

+ punpckldq xmm2,xmm9

+ movdqa xmm9,xmm14

+

+ movdqa XMMWORD[(96-128)+rax],xmm1

+ paddd xmm13,xmm1

+ movd xmm3,DWORD[((-32))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm10

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-32))+r9]

+ pslld xmm7,30

+ paddd xmm13,xmm6

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+DB 102,15,56,0,213

+ movd xmm8,DWORD[((-32))+r10]

+ por xmm10,xmm7

+ movd xmm7,DWORD[((-32))+r11]

+ punpckldq xmm3,xmm8

+ movdqa xmm8,xmm13

+ paddd xmm12,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm14

+ movdqa xmm6,xmm14

+ pslld xmm8,5

+ pandn xmm7,xmm11

+ pand xmm6,xmm10

+ punpckldq xmm3,xmm9

+ movdqa xmm9,xmm13

+

+ movdqa XMMWORD[(112-128)+rax],xmm2

+ paddd xmm12,xmm2

+ movd xmm4,DWORD[((-28))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm14

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-28))+r9]

+ pslld xmm7,30

+ paddd xmm12,xmm6

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+DB 102,15,56,0,221

+ movd xmm8,DWORD[((-28))+r10]

+ por xmm14,xmm7

+ movd xmm7,DWORD[((-28))+r11]

+ punpckldq xmm4,xmm8

+ movdqa xmm8,xmm12

+ paddd xmm11,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm13

+ movdqa xmm6,xmm13

+ pslld xmm8,5

+ pandn xmm7,xmm10

+ pand xmm6,xmm14

+ punpckldq xmm4,xmm9

+ movdqa xmm9,xmm12

+

+ movdqa XMMWORD[(128-128)+rax],xmm3

+ paddd xmm11,xmm3

+ movd xmm0,DWORD[((-24))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm13

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-24))+r9]

+ pslld xmm7,30

+ paddd xmm11,xmm6

+

+ psrld xmm13,2

+ paddd xmm11,xmm8

+DB 102,15,56,0,229

+ movd xmm8,DWORD[((-24))+r10]

+ por xmm13,xmm7

+ movd xmm7,DWORD[((-24))+r11]

+ punpckldq xmm0,xmm8

+ movdqa xmm8,xmm11

+ paddd xmm10,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm12

+ movdqa xmm6,xmm12

+ pslld xmm8,5

+ pandn xmm7,xmm14

+ pand xmm6,xmm13

+ punpckldq xmm0,xmm9

+ movdqa xmm9,xmm11

+

+ movdqa XMMWORD[(144-128)+rax],xmm4

+ paddd xmm10,xmm4

+ movd xmm1,DWORD[((-20))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm12

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-20))+r9]

+ pslld xmm7,30

+ paddd xmm10,xmm6

+

+ psrld xmm12,2

+ paddd xmm10,xmm8

+DB 102,15,56,0,197

+ movd xmm8,DWORD[((-20))+r10]

+ por xmm12,xmm7

+ movd xmm7,DWORD[((-20))+r11]

+ punpckldq xmm1,xmm8

+ movdqa xmm8,xmm10

+ paddd xmm14,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm11

+ movdqa xmm6,xmm11

+ pslld xmm8,5

+ pandn xmm7,xmm13

+ pand xmm6,xmm12

+ punpckldq xmm1,xmm9

+ movdqa xmm9,xmm10

+

+ movdqa XMMWORD[(160-128)+rax],xmm0

+ paddd xmm14,xmm0

+ movd xmm2,DWORD[((-16))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm11

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-16))+r9]

+ pslld xmm7,30

+ paddd xmm14,xmm6

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+DB 102,15,56,0,205

+ movd xmm8,DWORD[((-16))+r10]

+ por xmm11,xmm7

+ movd xmm7,DWORD[((-16))+r11]

+ punpckldq xmm2,xmm8

+ movdqa xmm8,xmm14

+ paddd xmm13,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm10

+ movdqa xmm6,xmm10

+ pslld xmm8,5

+ pandn xmm7,xmm12

+ pand xmm6,xmm11

+ punpckldq xmm2,xmm9

+ movdqa xmm9,xmm14

+

+ movdqa XMMWORD[(176-128)+rax],xmm1

+ paddd xmm13,xmm1

+ movd xmm3,DWORD[((-12))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm10

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-12))+r9]

+ pslld xmm7,30

+ paddd xmm13,xmm6

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+DB 102,15,56,0,213

+ movd xmm8,DWORD[((-12))+r10]

+ por xmm10,xmm7

+ movd xmm7,DWORD[((-12))+r11]

+ punpckldq xmm3,xmm8

+ movdqa xmm8,xmm13

+ paddd xmm12,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm14

+ movdqa xmm6,xmm14

+ pslld xmm8,5

+ pandn xmm7,xmm11

+ pand xmm6,xmm10

+ punpckldq xmm3,xmm9

+ movdqa xmm9,xmm13

+

+ movdqa XMMWORD[(192-128)+rax],xmm2

+ paddd xmm12,xmm2

+ movd xmm4,DWORD[((-8))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm14

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-8))+r9]

+ pslld xmm7,30

+ paddd xmm12,xmm6

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+DB 102,15,56,0,221

+ movd xmm8,DWORD[((-8))+r10]

+ por xmm14,xmm7

+ movd xmm7,DWORD[((-8))+r11]

+ punpckldq xmm4,xmm8

+ movdqa xmm8,xmm12

+ paddd xmm11,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm13

+ movdqa xmm6,xmm13

+ pslld xmm8,5

+ pandn xmm7,xmm10

+ pand xmm6,xmm14

+ punpckldq xmm4,xmm9

+ movdqa xmm9,xmm12

+

+ movdqa XMMWORD[(208-128)+rax],xmm3

+ paddd xmm11,xmm3

+ movd xmm0,DWORD[((-4))+r8]

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm13

+

+ por xmm8,xmm9

+ movd xmm9,DWORD[((-4))+r9]

+ pslld xmm7,30

+ paddd xmm11,xmm6

+

+ psrld xmm13,2

+ paddd xmm11,xmm8

+DB 102,15,56,0,229

+ movd xmm8,DWORD[((-4))+r10]

+ por xmm13,xmm7

+ movdqa xmm1,XMMWORD[((0-128))+rax]

+ movd xmm7,DWORD[((-4))+r11]

+ punpckldq xmm0,xmm8

+ movdqa xmm8,xmm11

+ paddd xmm10,xmm15

+ punpckldq xmm9,xmm7

+ movdqa xmm7,xmm12

+ movdqa xmm6,xmm12

+ pslld xmm8,5

+ prefetcht0 [63+r8]

+ pandn xmm7,xmm14

+ pand xmm6,xmm13

+ punpckldq xmm0,xmm9

+ movdqa xmm9,xmm11

+

+ movdqa XMMWORD[(224-128)+rax],xmm4

+ paddd xmm10,xmm4

+ psrld xmm9,27

+ pxor xmm6,xmm7

+ movdqa xmm7,xmm12

+ prefetcht0 [63+r9]

+

+ por xmm8,xmm9

+ pslld xmm7,30

+ paddd xmm10,xmm6

+ prefetcht0 [63+r10]

+

+ psrld xmm12,2

+ paddd xmm10,xmm8

+DB 102,15,56,0,197

+ prefetcht0 [63+r11]

+ por xmm12,xmm7

+ movdqa xmm2,XMMWORD[((16-128))+rax]

+ pxor xmm1,xmm3

+ movdqa xmm3,XMMWORD[((32-128))+rax]

+

+ movdqa xmm8,xmm10

+ pxor xmm1,XMMWORD[((128-128))+rax]

+ paddd xmm14,xmm15

+ movdqa xmm7,xmm11

+ pslld xmm8,5

+ pxor xmm1,xmm3

+ movdqa xmm6,xmm11

+ pandn xmm7,xmm13

+ movdqa xmm5,xmm1

+ pand xmm6,xmm12

+ movdqa xmm9,xmm10

+ psrld xmm5,31

+ paddd xmm1,xmm1

+

+ movdqa XMMWORD[(240-128)+rax],xmm0

+ paddd xmm14,xmm0

+ psrld xmm9,27

+ pxor xmm6,xmm7

+

+ movdqa xmm7,xmm11

+ por xmm8,xmm9

+ pslld xmm7,30

+ paddd xmm14,xmm6

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+ por xmm1,xmm5

+ por xmm11,xmm7

+ pxor xmm2,xmm4

+ movdqa xmm4,XMMWORD[((48-128))+rax]

+

+ movdqa xmm8,xmm14

+ pxor xmm2,XMMWORD[((144-128))+rax]

+ paddd xmm13,xmm15

+ movdqa xmm7,xmm10

+ pslld xmm8,5

+ pxor xmm2,xmm4

+ movdqa xmm6,xmm10

+ pandn xmm7,xmm12

+ movdqa xmm5,xmm2

+ pand xmm6,xmm11

+ movdqa xmm9,xmm14

+ psrld xmm5,31

+ paddd xmm2,xmm2

+

+ movdqa XMMWORD[(0-128)+rax],xmm1

+ paddd xmm13,xmm1

+ psrld xmm9,27

+ pxor xmm6,xmm7

+

+ movdqa xmm7,xmm10

+ por xmm8,xmm9

+ pslld xmm7,30

+ paddd xmm13,xmm6

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+ por xmm2,xmm5

+ por xmm10,xmm7

+ pxor xmm3,xmm0

+ movdqa xmm0,XMMWORD[((64-128))+rax]

+

+ movdqa xmm8,xmm13

+ pxor xmm3,XMMWORD[((160-128))+rax]

+ paddd xmm12,xmm15

+ movdqa xmm7,xmm14

+ pslld xmm8,5

+ pxor xmm3,xmm0

+ movdqa xmm6,xmm14

+ pandn xmm7,xmm11

+ movdqa xmm5,xmm3

+ pand xmm6,xmm10

+ movdqa xmm9,xmm13

+ psrld xmm5,31

+ paddd xmm3,xmm3

+

+ movdqa XMMWORD[(16-128)+rax],xmm2

+ paddd xmm12,xmm2

+ psrld xmm9,27

+ pxor xmm6,xmm7

+

+ movdqa xmm7,xmm14

+ por xmm8,xmm9

+ pslld xmm7,30

+ paddd xmm12,xmm6

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+ por xmm3,xmm5

+ por xmm14,xmm7

+ pxor xmm4,xmm1

+ movdqa xmm1,XMMWORD[((80-128))+rax]

+

+ movdqa xmm8,xmm12

+ pxor xmm4,XMMWORD[((176-128))+rax]

+ paddd xmm11,xmm15

+ movdqa xmm7,xmm13

+ pslld xmm8,5

+ pxor xmm4,xmm1

+ movdqa xmm6,xmm13

+ pandn xmm7,xmm10

+ movdqa xmm5,xmm4

+ pand xmm6,xmm14

+ movdqa xmm9,xmm12

+ psrld xmm5,31

+ paddd xmm4,xmm4

+

+ movdqa XMMWORD[(32-128)+rax],xmm3

+ paddd xmm11,xmm3

+ psrld xmm9,27

+ pxor xmm6,xmm7

+

+ movdqa xmm7,xmm13

+ por xmm8,xmm9

+ pslld xmm7,30

+ paddd xmm11,xmm6

+

+ psrld xmm13,2

+ paddd xmm11,xmm8

+ por xmm4,xmm5

+ por xmm13,xmm7

+ pxor xmm0,xmm2

+ movdqa xmm2,XMMWORD[((96-128))+rax]

+

+ movdqa xmm8,xmm11

+ pxor xmm0,XMMWORD[((192-128))+rax]

+ paddd xmm10,xmm15

+ movdqa xmm7,xmm12

+ pslld xmm8,5

+ pxor xmm0,xmm2

+ movdqa xmm6,xmm12

+ pandn xmm7,xmm14

+ movdqa xmm5,xmm0

+ pand xmm6,xmm13

+ movdqa xmm9,xmm11

+ psrld xmm5,31

+ paddd xmm0,xmm0

+

+ movdqa XMMWORD[(48-128)+rax],xmm4

+ paddd xmm10,xmm4

+ psrld xmm9,27

+ pxor xmm6,xmm7

+

+ movdqa xmm7,xmm12

+ por xmm8,xmm9

+ pslld xmm7,30

+ paddd xmm10,xmm6

+

+ psrld xmm12,2

+ paddd xmm10,xmm8

+ por xmm0,xmm5

+ por xmm12,xmm7

+ movdqa xmm15,XMMWORD[rbp]

+ pxor xmm1,xmm3

+ movdqa xmm3,XMMWORD[((112-128))+rax]

+

+ movdqa xmm8,xmm10

+ movdqa xmm6,xmm13

+ pxor xmm1,XMMWORD[((208-128))+rax]

+ paddd xmm14,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm11

+

+ movdqa xmm9,xmm10

+ movdqa XMMWORD[(64-128)+rax],xmm0

+ paddd xmm14,xmm0

+ pxor xmm1,xmm3

+ psrld xmm9,27

+ pxor xmm6,xmm12

+ movdqa xmm7,xmm11

+

+ pslld xmm7,30

+ movdqa xmm5,xmm1

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm14,xmm6

+ paddd xmm1,xmm1

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+ por xmm1,xmm5

+ por xmm11,xmm7

+ pxor xmm2,xmm4

+ movdqa xmm4,XMMWORD[((128-128))+rax]

+

+ movdqa xmm8,xmm14

+ movdqa xmm6,xmm12

+ pxor xmm2,XMMWORD[((224-128))+rax]

+ paddd xmm13,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm10

+

+ movdqa xmm9,xmm14

+ movdqa XMMWORD[(80-128)+rax],xmm1

+ paddd xmm13,xmm1

+ pxor xmm2,xmm4

+ psrld xmm9,27

+ pxor xmm6,xmm11

+ movdqa xmm7,xmm10

+

+ pslld xmm7,30

+ movdqa xmm5,xmm2

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm13,xmm6

+ paddd xmm2,xmm2

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+ por xmm2,xmm5

+ por xmm10,xmm7

+ pxor xmm3,xmm0

+ movdqa xmm0,XMMWORD[((144-128))+rax]

+

+ movdqa xmm8,xmm13

+ movdqa xmm6,xmm11

+ pxor xmm3,XMMWORD[((240-128))+rax]

+ paddd xmm12,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm14

+

+ movdqa xmm9,xmm13

+ movdqa XMMWORD[(96-128)+rax],xmm2

+ paddd xmm12,xmm2

+ pxor xmm3,xmm0

+ psrld xmm9,27

+ pxor xmm6,xmm10

+ movdqa xmm7,xmm14

+

+ pslld xmm7,30

+ movdqa xmm5,xmm3

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm12,xmm6

+ paddd xmm3,xmm3

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+ por xmm3,xmm5

+ por xmm14,xmm7

+ pxor xmm4,xmm1

+ movdqa xmm1,XMMWORD[((160-128))+rax]

+

+ movdqa xmm8,xmm12

+ movdqa xmm6,xmm10

+ pxor xmm4,XMMWORD[((0-128))+rax]

+ paddd xmm11,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm13

+

+ movdqa xmm9,xmm12

+ movdqa XMMWORD[(112-128)+rax],xmm3

+ paddd xmm11,xmm3

+ pxor xmm4,xmm1

+ psrld xmm9,27

+ pxor xmm6,xmm14

+ movdqa xmm7,xmm13

+

+ pslld xmm7,30

+ movdqa xmm5,xmm4

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm11,xmm6

+ paddd xmm4,xmm4

+

+ psrld xmm13,2

+ paddd xmm11,xmm8

+ por xmm4,xmm5

+ por xmm13,xmm7

+ pxor xmm0,xmm2

+ movdqa xmm2,XMMWORD[((176-128))+rax]

+

+ movdqa xmm8,xmm11

+ movdqa xmm6,xmm14

+ pxor xmm0,XMMWORD[((16-128))+rax]

+ paddd xmm10,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm12

+

+ movdqa xmm9,xmm11

+ movdqa XMMWORD[(128-128)+rax],xmm4

+ paddd xmm10,xmm4

+ pxor xmm0,xmm2

+ psrld xmm9,27

+ pxor xmm6,xmm13

+ movdqa xmm7,xmm12

+

+ pslld xmm7,30

+ movdqa xmm5,xmm0

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm10,xmm6

+ paddd xmm0,xmm0

+

+ psrld xmm12,2

+ paddd xmm10,xmm8

+ por xmm0,xmm5

+ por xmm12,xmm7

+ pxor xmm1,xmm3

+ movdqa xmm3,XMMWORD[((192-128))+rax]

+

+ movdqa xmm8,xmm10

+ movdqa xmm6,xmm13

+ pxor xmm1,XMMWORD[((32-128))+rax]

+ paddd xmm14,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm11

+

+ movdqa xmm9,xmm10

+ movdqa XMMWORD[(144-128)+rax],xmm0

+ paddd xmm14,xmm0

+ pxor xmm1,xmm3

+ psrld xmm9,27

+ pxor xmm6,xmm12

+ movdqa xmm7,xmm11

+

+ pslld xmm7,30

+ movdqa xmm5,xmm1

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm14,xmm6

+ paddd xmm1,xmm1

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+ por xmm1,xmm5

+ por xmm11,xmm7

+ pxor xmm2,xmm4

+ movdqa xmm4,XMMWORD[((208-128))+rax]

+

+ movdqa xmm8,xmm14

+ movdqa xmm6,xmm12

+ pxor xmm2,XMMWORD[((48-128))+rax]

+ paddd xmm13,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm10

+

+ movdqa xmm9,xmm14

+ movdqa XMMWORD[(160-128)+rax],xmm1

+ paddd xmm13,xmm1

+ pxor xmm2,xmm4

+ psrld xmm9,27

+ pxor xmm6,xmm11

+ movdqa xmm7,xmm10

+

+ pslld xmm7,30

+ movdqa xmm5,xmm2

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm13,xmm6

+ paddd xmm2,xmm2

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+ por xmm2,xmm5

+ por xmm10,xmm7

+ pxor xmm3,xmm0

+ movdqa xmm0,XMMWORD[((224-128))+rax]

+

+ movdqa xmm8,xmm13

+ movdqa xmm6,xmm11

+ pxor xmm3,XMMWORD[((64-128))+rax]

+ paddd xmm12,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm14

+

+ movdqa xmm9,xmm13

+ movdqa XMMWORD[(176-128)+rax],xmm2

+ paddd xmm12,xmm2

+ pxor xmm3,xmm0

+ psrld xmm9,27

+ pxor xmm6,xmm10

+ movdqa xmm7,xmm14

+

+ pslld xmm7,30

+ movdqa xmm5,xmm3

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm12,xmm6

+ paddd xmm3,xmm3

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+ por xmm3,xmm5

+ por xmm14,xmm7

+ pxor xmm4,xmm1

+ movdqa xmm1,XMMWORD[((240-128))+rax]

+

+ movdqa xmm8,xmm12

+ movdqa xmm6,xmm10

+ pxor xmm4,XMMWORD[((80-128))+rax]

+ paddd xmm11,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm13

+

+ movdqa xmm9,xmm12

+ movdqa XMMWORD[(192-128)+rax],xmm3

+ paddd xmm11,xmm3

+ pxor xmm4,xmm1

+ psrld xmm9,27

+ pxor xmm6,xmm14

+ movdqa xmm7,xmm13

+

+ pslld xmm7,30

+ movdqa xmm5,xmm4

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm11,xmm6

+ paddd xmm4,xmm4

+

+ psrld xmm13,2

+ paddd xmm11,xmm8

+ por xmm4,xmm5

+ por xmm13,xmm7

+ pxor xmm0,xmm2

+ movdqa xmm2,XMMWORD[((0-128))+rax]

+

+ movdqa xmm8,xmm11

+ movdqa xmm6,xmm14

+ pxor xmm0,XMMWORD[((96-128))+rax]

+ paddd xmm10,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm12

+

+ movdqa xmm9,xmm11

+ movdqa XMMWORD[(208-128)+rax],xmm4

+ paddd xmm10,xmm4

+ pxor xmm0,xmm2

+ psrld xmm9,27

+ pxor xmm6,xmm13

+ movdqa xmm7,xmm12

+

+ pslld xmm7,30

+ movdqa xmm5,xmm0

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm10,xmm6

+ paddd xmm0,xmm0

+

+ psrld xmm12,2

+ paddd xmm10,xmm8

+ por xmm0,xmm5

+ por xmm12,xmm7

+ pxor xmm1,xmm3

+ movdqa xmm3,XMMWORD[((16-128))+rax]

+

+ movdqa xmm8,xmm10

+ movdqa xmm6,xmm13

+ pxor xmm1,XMMWORD[((112-128))+rax]

+ paddd xmm14,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm11

+

+ movdqa xmm9,xmm10

+ movdqa XMMWORD[(224-128)+rax],xmm0

+ paddd xmm14,xmm0

+ pxor xmm1,xmm3

+ psrld xmm9,27

+ pxor xmm6,xmm12

+ movdqa xmm7,xmm11

+

+ pslld xmm7,30

+ movdqa xmm5,xmm1

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm14,xmm6

+ paddd xmm1,xmm1

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+ por xmm1,xmm5

+ por xmm11,xmm7

+ pxor xmm2,xmm4

+ movdqa xmm4,XMMWORD[((32-128))+rax]

+

+ movdqa xmm8,xmm14

+ movdqa xmm6,xmm12

+ pxor xmm2,XMMWORD[((128-128))+rax]

+ paddd xmm13,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm10

+

+ movdqa xmm9,xmm14

+ movdqa XMMWORD[(240-128)+rax],xmm1

+ paddd xmm13,xmm1

+ pxor xmm2,xmm4

+ psrld xmm9,27

+ pxor xmm6,xmm11

+ movdqa xmm7,xmm10

+

+ pslld xmm7,30

+ movdqa xmm5,xmm2

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm13,xmm6

+ paddd xmm2,xmm2

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+ por xmm2,xmm5

+ por xmm10,xmm7

+ pxor xmm3,xmm0

+ movdqa xmm0,XMMWORD[((48-128))+rax]

+

+ movdqa xmm8,xmm13

+ movdqa xmm6,xmm11

+ pxor xmm3,XMMWORD[((144-128))+rax]

+ paddd xmm12,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm14

+

+ movdqa xmm9,xmm13

+ movdqa XMMWORD[(0-128)+rax],xmm2

+ paddd xmm12,xmm2

+ pxor xmm3,xmm0

+ psrld xmm9,27

+ pxor xmm6,xmm10

+ movdqa xmm7,xmm14

+

+ pslld xmm7,30

+ movdqa xmm5,xmm3

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm12,xmm6

+ paddd xmm3,xmm3

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+ por xmm3,xmm5

+ por xmm14,xmm7

+ pxor xmm4,xmm1

+ movdqa xmm1,XMMWORD[((64-128))+rax]

+

+ movdqa xmm8,xmm12

+ movdqa xmm6,xmm10

+ pxor xmm4,XMMWORD[((160-128))+rax]

+ paddd xmm11,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm13

+

+ movdqa xmm9,xmm12

+ movdqa XMMWORD[(16-128)+rax],xmm3

+ paddd xmm11,xmm3

+ pxor xmm4,xmm1

+ psrld xmm9,27

+ pxor xmm6,xmm14

+ movdqa xmm7,xmm13

+

+ pslld xmm7,30

+ movdqa xmm5,xmm4

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm11,xmm6

+ paddd xmm4,xmm4

+

+ psrld xmm13,2

+ paddd xmm11,xmm8

+ por xmm4,xmm5

+ por xmm13,xmm7

+ pxor xmm0,xmm2

+ movdqa xmm2,XMMWORD[((80-128))+rax]

+

+ movdqa xmm8,xmm11

+ movdqa xmm6,xmm14

+ pxor xmm0,XMMWORD[((176-128))+rax]

+ paddd xmm10,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm12

+

+ movdqa xmm9,xmm11

+ movdqa XMMWORD[(32-128)+rax],xmm4

+ paddd xmm10,xmm4

+ pxor xmm0,xmm2

+ psrld xmm9,27

+ pxor xmm6,xmm13

+ movdqa xmm7,xmm12

+

+ pslld xmm7,30

+ movdqa xmm5,xmm0

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm10,xmm6

+ paddd xmm0,xmm0

+

+ psrld xmm12,2

+ paddd xmm10,xmm8

+ por xmm0,xmm5

+ por xmm12,xmm7

+ pxor xmm1,xmm3

+ movdqa xmm3,XMMWORD[((96-128))+rax]

+

+ movdqa xmm8,xmm10

+ movdqa xmm6,xmm13

+ pxor xmm1,XMMWORD[((192-128))+rax]

+ paddd xmm14,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm11

+

+ movdqa xmm9,xmm10

+ movdqa XMMWORD[(48-128)+rax],xmm0

+ paddd xmm14,xmm0

+ pxor xmm1,xmm3

+ psrld xmm9,27

+ pxor xmm6,xmm12

+ movdqa xmm7,xmm11

+

+ pslld xmm7,30

+ movdqa xmm5,xmm1

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm14,xmm6

+ paddd xmm1,xmm1

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+ por xmm1,xmm5

+ por xmm11,xmm7

+ pxor xmm2,xmm4

+ movdqa xmm4,XMMWORD[((112-128))+rax]

+

+ movdqa xmm8,xmm14

+ movdqa xmm6,xmm12

+ pxor xmm2,XMMWORD[((208-128))+rax]

+ paddd xmm13,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm10

+

+ movdqa xmm9,xmm14

+ movdqa XMMWORD[(64-128)+rax],xmm1

+ paddd xmm13,xmm1

+ pxor xmm2,xmm4

+ psrld xmm9,27

+ pxor xmm6,xmm11

+ movdqa xmm7,xmm10

+

+ pslld xmm7,30

+ movdqa xmm5,xmm2

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm13,xmm6

+ paddd xmm2,xmm2

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+ por xmm2,xmm5

+ por xmm10,xmm7

+ pxor xmm3,xmm0

+ movdqa xmm0,XMMWORD[((128-128))+rax]

+

+ movdqa xmm8,xmm13

+ movdqa xmm6,xmm11

+ pxor xmm3,XMMWORD[((224-128))+rax]

+ paddd xmm12,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm14

+

+ movdqa xmm9,xmm13

+ movdqa XMMWORD[(80-128)+rax],xmm2

+ paddd xmm12,xmm2

+ pxor xmm3,xmm0

+ psrld xmm9,27

+ pxor xmm6,xmm10

+ movdqa xmm7,xmm14

+

+ pslld xmm7,30

+ movdqa xmm5,xmm3

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm12,xmm6

+ paddd xmm3,xmm3

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+ por xmm3,xmm5

+ por xmm14,xmm7

+ pxor xmm4,xmm1

+ movdqa xmm1,XMMWORD[((144-128))+rax]

+

+ movdqa xmm8,xmm12

+ movdqa xmm6,xmm10

+ pxor xmm4,XMMWORD[((240-128))+rax]

+ paddd xmm11,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm13

+

+ movdqa xmm9,xmm12

+ movdqa XMMWORD[(96-128)+rax],xmm3

+ paddd xmm11,xmm3

+ pxor xmm4,xmm1

+ psrld xmm9,27

+ pxor xmm6,xmm14

+ movdqa xmm7,xmm13

+

+ pslld xmm7,30

+ movdqa xmm5,xmm4

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm11,xmm6

+ paddd xmm4,xmm4

+

+ psrld xmm13,2

+ paddd xmm11,xmm8

+ por xmm4,xmm5

+ por xmm13,xmm7

+ pxor xmm0,xmm2

+ movdqa xmm2,XMMWORD[((160-128))+rax]

+

+ movdqa xmm8,xmm11

+ movdqa xmm6,xmm14

+ pxor xmm0,XMMWORD[((0-128))+rax]

+ paddd xmm10,xmm15

+ pslld xmm8,5

+ pxor xmm6,xmm12

+

+ movdqa xmm9,xmm11

+ movdqa XMMWORD[(112-128)+rax],xmm4

+ paddd xmm10,xmm4

+ pxor xmm0,xmm2

+ psrld xmm9,27

+ pxor xmm6,xmm13

+ movdqa xmm7,xmm12

+

+ pslld xmm7,30

+ movdqa xmm5,xmm0

+ por xmm8,xmm9

+ psrld xmm5,31

+ paddd xmm10,xmm6

+ paddd xmm0,xmm0

+

+ psrld xmm12,2

+ paddd xmm10,xmm8

+ por xmm0,xmm5

+ por xmm12,xmm7

+ movdqa xmm15,XMMWORD[32+rbp]

+ pxor xmm1,xmm3

+ movdqa xmm3,XMMWORD[((176-128))+rax]

+

+ movdqa xmm8,xmm10

+ movdqa xmm7,xmm13

+ pxor xmm1,XMMWORD[((16-128))+rax]

+ pxor xmm1,xmm3

+ paddd xmm14,xmm15

+ pslld xmm8,5

+ movdqa xmm9,xmm10

+ pand xmm7,xmm12

+

+ movdqa xmm6,xmm13

+ movdqa xmm5,xmm1

+ psrld xmm9,27

+ paddd xmm14,xmm7

+ pxor xmm6,xmm12

+

+ movdqa XMMWORD[(128-128)+rax],xmm0

+ paddd xmm14,xmm0

+ por xmm8,xmm9

+ psrld xmm5,31

+ pand xmm6,xmm11

+ movdqa xmm7,xmm11

+

+ pslld xmm7,30

+ paddd xmm1,xmm1

+ paddd xmm14,xmm6

+

+ psrld xmm11,2

+ paddd xmm14,xmm8

+ por xmm1,xmm5

+ por xmm11,xmm7

+ pxor xmm2,xmm4

+ movdqa xmm4,XMMWORD[((192-128))+rax]

+

+ movdqa xmm8,xmm14

+ movdqa xmm7,xmm12

+ pxor xmm2,XMMWORD[((32-128))+rax]

+ pxor xmm2,xmm4

+ paddd xmm13,xmm15

+ pslld xmm8,5

+ movdqa xmm9,xmm14

+ pand xmm7,xmm11

+

+ movdqa xmm6,xmm12

+ movdqa xmm5,xmm2

+ psrld xmm9,27

+ paddd xmm13,xmm7

+ pxor xmm6,xmm11

+

+ movdqa XMMWORD[(144-128)+rax],xmm1

+ paddd xmm13,xmm1

+ por xmm8,xmm9

+ psrld xmm5,31

+ pand xmm6,xmm10

+ movdqa xmm7,xmm10

+

+ pslld xmm7,30

+ paddd xmm2,xmm2

+ paddd xmm13,xmm6

+

+ psrld xmm10,2

+ paddd xmm13,xmm8

+ por xmm2,xmm5

+ por xmm10,xmm7

+ pxor xmm3,xmm0

+ movdqa xmm0,XMMWORD[((208-128))+rax]

+

+ movdqa xmm8,xmm13

+ movdqa xmm7,xmm11

+ pxor xmm3,XMMWORD[((48-128))+rax]

+ pxor xmm3,xmm0

+ paddd xmm12,xmm15

+ pslld xmm8,5

+ movdqa xmm9,xmm13

+ pand xmm7,xmm10

+

+ movdqa xmm6,xmm11

+ movdqa xmm5,xmm3

+ psrld xmm9,27

+ paddd xmm12,xmm7

+ pxor xmm6,xmm10

+

+ movdqa XMMWORD[(160-128)+rax],xmm2

+ paddd xmm12,xmm2

+ por xmm8,xmm9

+ psrld xmm5,31

+ pand xmm6,xmm14

+ movdqa xmm7,xmm14

+

+ pslld xmm7,30

+ paddd xmm3,xmm3

+ paddd xmm12,xmm6

+

+ psrld xmm14,2

+ paddd xmm12,xmm8

+ por xmm3,xmm5

+ por xmm14,xmm7

+ pxor xmm4,xmm1

+ movdqa xmm1,XMMWORD[((224-128))+rax]

+

+ movdqa xmm8,xmm12

+ movdqa xmm7,xmm10

+ pxor xmm4,XMMWORD[((64-128))+rax]

+ pxor xmm4,xmm1

+ paddd xmm11,xmm15

+ pslld xmm8,5

+
This message has been truncated.


Re: [PATCH edk2-platforms v1-resend 0/7] Updates to support Dynamic AML

Alexei Fedorov
 

Reviewed-by: Alexei Fedorov <Alexei.Fedorov@...>


Re: [PATCH v2 2/2] CryptoPkg/OpensslLib: Commit the auto-generated assembly files for X64

Michael D Kinney
 

Hi Jiewen,

For this use case, generating the files as part of the build process would add
a dependency in pearl.

Based on other recent CryptoPkg changes and some being discussed in BZ, I am
seeing more changes to the OpenSLL .pl configuration files, and I am concerned
that based on platform requirements, we may need to build OpenSSL with
different .pl config file settings which would also add a pearl dependency
to the build.

So exploring what it would take to add the pearl dependency to the build system
is worth exploring and if successful would eliminate the need to checkin these
types of autogenerated files. This would also reduce maintenance of the
auto-genererated files when EDK II moves to a new version of OpenSSL.

@Cristopher - Can you please share a branch that uses pearl to generate the files
instead of checking them in? I would like the BaseTools maintainers to review
that and evaluate adding the pearl dependency. Hopefully, we can make the
pearl dependency detectable so it is only required if the build requires it.

Thanks,

Mike

-----Original Message-----
From: Yao, Jiewen <jiewen.yao@intel.com>
Sent: Thursday, August 13, 2020 8:25 AM
To: Zurcher, Christopher J <christopher.j.zurcher@intel.com>; devel@edk2.groups.io
Cc: Wang, Jian J <jian.j.wang@intel.com>; Lu, XiaoyuX <xiaoyux.lu@intel.com>; Kinney, Michael D
<michael.d.kinney@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: RE: [PATCH v2 2/2] CryptoPkg/OpensslLib: Commit the auto-generated assembly files for X64

+ Mike Kinney

I am not sure if it is a right way to check in auto-generated file.
That means, whenever we upgrade the openssl, we need manually generate them again.
Any step by step, or readme to tell us how to do that?

Mike, would you please double confirm what is the right way for auto-generated file in EDKII?


-----Original Message-----
From: Zurcher, Christopher J <christopher.j.zurcher@intel.com>
Sent: Tuesday, August 4, 2020 8:24 AM
To: devel@edk2.groups.io
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>;
Lu, XiaoyuX <xiaoyux.lu@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2 2/2] CryptoPkg/OpensslLib: Commit the auto-generated
assembly files for X64

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2507

Adding the auto-generated assembly files for the X64 architecture.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
---
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-x86_64.nasm | 732
+++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-x86_64.nasm |
1916 ++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-x86_64.nasm |
78 +
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm | 5103
++++++++++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-x86_64.nasm | 1173
+++++
CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm |
1569 ++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-x86_64.nasm | 3137
++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-x86_64.nasm | 2884
+++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-mb-x86_64.nasm |
3461 +++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-x86_64.nasm | 3313
+++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha512-x86_64.nasm | 1938
++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/x86_64cpuid.nasm | 491 ++
12 files changed, 25795 insertions(+)

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-
x86_64.nasm b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-
x86_64.nasm
new file mode 100644
index 0000000000..1a3ed1dd35
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-x86_64.nasm
@@ -0,0 +1,732 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/aesni-mb-x86_64.pl

+;

+; Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+

+EXTERN OPENSSL_ia32cap_P

+

+global aesni_multi_cbc_encrypt

+

+ALIGN 32

+aesni_multi_cbc_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_multi_cbc_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ mov rax,rsp

+

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ push r15

+

+ lea rsp,[((-168))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+ movaps XMMWORD[64+rsp],xmm10

+ movaps XMMWORD[80+rsp],xmm11

+ movaps XMMWORD[96+rsp],xmm12

+ movaps XMMWORD[(-104)+rax],xmm13

+ movaps XMMWORD[(-88)+rax],xmm14

+ movaps XMMWORD[(-72)+rax],xmm15

+

+

+

+

+

+

+ sub rsp,48

+ and rsp,-64

+ mov QWORD[16+rsp],rax

+

+

+$L$enc4x_body:

+ movdqu xmm12,XMMWORD[rsi]

+ lea rsi,[120+rsi]

+ lea rdi,[80+rdi]

+

+$L$enc4x_loop_grande:

+ mov DWORD[24+rsp],edx

+ xor edx,edx

+ mov ecx,DWORD[((-64))+rdi]

+ mov r8,QWORD[((-80))+rdi]

+ cmp ecx,edx

+ mov r12,QWORD[((-72))+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm2,XMMWORD[((-56))+rdi]

+ mov DWORD[32+rsp],ecx

+ cmovle r8,rsp

+ mov ecx,DWORD[((-24))+rdi]

+ mov r9,QWORD[((-40))+rdi]

+ cmp ecx,edx

+ mov r13,QWORD[((-32))+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm3,XMMWORD[((-16))+rdi]

+ mov DWORD[36+rsp],ecx

+ cmovle r9,rsp

+ mov ecx,DWORD[16+rdi]

+ mov r10,QWORD[rdi]

+ cmp ecx,edx

+ mov r14,QWORD[8+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm4,XMMWORD[24+rdi]

+ mov DWORD[40+rsp],ecx

+ cmovle r10,rsp

+ mov ecx,DWORD[56+rdi]

+ mov r11,QWORD[40+rdi]

+ cmp ecx,edx

+ mov r15,QWORD[48+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm5,XMMWORD[64+rdi]

+ mov DWORD[44+rsp],ecx

+ cmovle r11,rsp

+ test edx,edx

+ jz NEAR $L$enc4x_done

+

+ movups xmm1,XMMWORD[((16-120))+rsi]

+ pxor xmm2,xmm12

+ movups xmm0,XMMWORD[((32-120))+rsi]

+ pxor xmm3,xmm12

+ mov eax,DWORD[((240-120))+rsi]

+ pxor xmm4,xmm12

+ movdqu xmm6,XMMWORD[r8]

+ pxor xmm5,xmm12

+ movdqu xmm7,XMMWORD[r9]

+ pxor xmm2,xmm6

+ movdqu xmm8,XMMWORD[r10]

+ pxor xmm3,xmm7

+ movdqu xmm9,XMMWORD[r11]

+ pxor xmm4,xmm8

+ pxor xmm5,xmm9

+ movdqa xmm10,XMMWORD[32+rsp]

+ xor rbx,rbx

+ jmp NEAR $L$oop_enc4x

+

+ALIGN 32

+$L$oop_enc4x:

+ add rbx,16

+ lea rbp,[16+rsp]

+ mov ecx,1

+ sub rbp,rbx

+

+DB 102,15,56,220,209

+ prefetcht0 [31+rbx*1+r8]

+ prefetcht0 [31+rbx*1+r9]

+DB 102,15,56,220,217

+ prefetcht0 [31+rbx*1+r10]

+ prefetcht0 [31+rbx*1+r10]

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((48-120))+rsi]

+ cmp ecx,DWORD[32+rsp]

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+ cmovge r8,rbp

+ cmovg r12,rbp

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((-56))+rsi]

+ cmp ecx,DWORD[36+rsp]

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+ cmovge r9,rbp

+ cmovg r13,rbp

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((-40))+rsi]

+ cmp ecx,DWORD[40+rsp]

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+ cmovge r10,rbp

+ cmovg r14,rbp

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((-24))+rsi]

+ cmp ecx,DWORD[44+rsp]

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+ cmovge r11,rbp

+ cmovg r15,rbp

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((-8))+rsi]

+ movdqa xmm11,xmm10

+DB 102,15,56,220,208

+ prefetcht0 [15+rbx*1+r12]

+ prefetcht0 [15+rbx*1+r13]

+DB 102,15,56,220,216

+ prefetcht0 [15+rbx*1+r14]

+ prefetcht0 [15+rbx*1+r15]

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((128-120))+rsi]

+ pxor xmm12,xmm12

+

+DB 102,15,56,220,209

+ pcmpgtd xmm11,xmm12

+ movdqu xmm12,XMMWORD[((-120))+rsi]

+DB 102,15,56,220,217

+ paddd xmm10,xmm11

+ movdqa XMMWORD[32+rsp],xmm10

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((144-120))+rsi]

+

+ cmp eax,11

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((160-120))+rsi]

+

+ jb NEAR $L$enc4x_tail

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((176-120))+rsi]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((192-120))+rsi]

+

+ je NEAR $L$enc4x_tail

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[((208-120))+rsi]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((224-120))+rsi]

+ jmp NEAR $L$enc4x_tail

+

+ALIGN 32

+$L$enc4x_tail:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movdqu xmm6,XMMWORD[rbx*1+r8]

+ movdqu xmm1,XMMWORD[((16-120))+rsi]

+

+DB 102,15,56,221,208

+ movdqu xmm7,XMMWORD[rbx*1+r9]

+ pxor xmm6,xmm12

+DB 102,15,56,221,216

+ movdqu xmm8,XMMWORD[rbx*1+r10]

+ pxor xmm7,xmm12

+DB 102,15,56,221,224

+ movdqu xmm9,XMMWORD[rbx*1+r11]

+ pxor xmm8,xmm12

+DB 102,15,56,221,232

+ movdqu xmm0,XMMWORD[((32-120))+rsi]

+ pxor xmm9,xmm12

+

+ movups XMMWORD[(-16)+rbx*1+r12],xmm2

+ pxor xmm2,xmm6

+ movups XMMWORD[(-16)+rbx*1+r13],xmm3

+ pxor xmm3,xmm7

+ movups XMMWORD[(-16)+rbx*1+r14],xmm4

+ pxor xmm4,xmm8

+ movups XMMWORD[(-16)+rbx*1+r15],xmm5

+ pxor xmm5,xmm9

+

+ dec edx

+ jnz NEAR $L$oop_enc4x

+

+ mov rax,QWORD[16+rsp]

+

+ mov edx,DWORD[24+rsp]

+

+

+

+

+

+

+

+

+

+

+ lea rdi,[160+rdi]

+ dec edx

+ jnz NEAR $L$enc4x_loop_grande

+

+$L$enc4x_done:

+ movaps xmm6,XMMWORD[((-216))+rax]

+ movaps xmm7,XMMWORD[((-200))+rax]

+ movaps xmm8,XMMWORD[((-184))+rax]

+ movaps xmm9,XMMWORD[((-168))+rax]

+ movaps xmm10,XMMWORD[((-152))+rax]

+ movaps xmm11,XMMWORD[((-136))+rax]

+ movaps xmm12,XMMWORD[((-120))+rax]

+

+

+

+ mov r15,QWORD[((-48))+rax]

+

+ mov r14,QWORD[((-40))+rax]

+

+ mov r13,QWORD[((-32))+rax]

+

+ mov r12,QWORD[((-24))+rax]

+

+ mov rbp,QWORD[((-16))+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+

+ lea rsp,[rax]

+

+$L$enc4x_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_multi_cbc_encrypt:

+

+global aesni_multi_cbc_decrypt

+

+ALIGN 32

+aesni_multi_cbc_decrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_multi_cbc_decrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+

+

+

+ mov rax,rsp

+

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ push r15

+

+ lea rsp,[((-168))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+ movaps XMMWORD[64+rsp],xmm10

+ movaps XMMWORD[80+rsp],xmm11

+ movaps XMMWORD[96+rsp],xmm12

+ movaps XMMWORD[(-104)+rax],xmm13

+ movaps XMMWORD[(-88)+rax],xmm14

+ movaps XMMWORD[(-72)+rax],xmm15

+

+

+

+

+

+

+ sub rsp,48

+ and rsp,-64

+ mov QWORD[16+rsp],rax

+

+

+$L$dec4x_body:

+ movdqu xmm12,XMMWORD[rsi]

+ lea rsi,[120+rsi]

+ lea rdi,[80+rdi]

+

+$L$dec4x_loop_grande:

+ mov DWORD[24+rsp],edx

+ xor edx,edx

+ mov ecx,DWORD[((-64))+rdi]

+ mov r8,QWORD[((-80))+rdi]

+ cmp ecx,edx

+ mov r12,QWORD[((-72))+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm6,XMMWORD[((-56))+rdi]

+ mov DWORD[32+rsp],ecx

+ cmovle r8,rsp

+ mov ecx,DWORD[((-24))+rdi]

+ mov r9,QWORD[((-40))+rdi]

+ cmp ecx,edx

+ mov r13,QWORD[((-32))+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm7,XMMWORD[((-16))+rdi]

+ mov DWORD[36+rsp],ecx

+ cmovle r9,rsp

+ mov ecx,DWORD[16+rdi]

+ mov r10,QWORD[rdi]

+ cmp ecx,edx

+ mov r14,QWORD[8+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm8,XMMWORD[24+rdi]

+ mov DWORD[40+rsp],ecx

+ cmovle r10,rsp

+ mov ecx,DWORD[56+rdi]

+ mov r11,QWORD[40+rdi]

+ cmp ecx,edx

+ mov r15,QWORD[48+rdi]

+ cmovg edx,ecx

+ test ecx,ecx

+ movdqu xmm9,XMMWORD[64+rdi]

+ mov DWORD[44+rsp],ecx

+ cmovle r11,rsp

+ test edx,edx

+ jz NEAR $L$dec4x_done

+

+ movups xmm1,XMMWORD[((16-120))+rsi]

+ movups xmm0,XMMWORD[((32-120))+rsi]

+ mov eax,DWORD[((240-120))+rsi]

+ movdqu xmm2,XMMWORD[r8]

+ movdqu xmm3,XMMWORD[r9]

+ pxor xmm2,xmm12

+ movdqu xmm4,XMMWORD[r10]

+ pxor xmm3,xmm12

+ movdqu xmm5,XMMWORD[r11]

+ pxor xmm4,xmm12

+ pxor xmm5,xmm12

+ movdqa xmm10,XMMWORD[32+rsp]

+ xor rbx,rbx

+ jmp NEAR $L$oop_dec4x

+

+ALIGN 32

+$L$oop_dec4x:

+ add rbx,16

+ lea rbp,[16+rsp]

+ mov ecx,1

+ sub rbp,rbx

+

+DB 102,15,56,222,209

+ prefetcht0 [31+rbx*1+r8]

+ prefetcht0 [31+rbx*1+r9]

+DB 102,15,56,222,217

+ prefetcht0 [31+rbx*1+r10]

+ prefetcht0 [31+rbx*1+r11]

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((48-120))+rsi]

+ cmp ecx,DWORD[32+rsp]

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+ cmovge r8,rbp

+ cmovg r12,rbp

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((-56))+rsi]

+ cmp ecx,DWORD[36+rsp]

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+ cmovge r9,rbp

+ cmovg r13,rbp

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((-40))+rsi]

+ cmp ecx,DWORD[40+rsp]

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+ cmovge r10,rbp

+ cmovg r14,rbp

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((-24))+rsi]

+ cmp ecx,DWORD[44+rsp]

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+ cmovge r11,rbp

+ cmovg r15,rbp

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((-8))+rsi]

+ movdqa xmm11,xmm10

+DB 102,15,56,222,208

+ prefetcht0 [15+rbx*1+r12]

+ prefetcht0 [15+rbx*1+r13]

+DB 102,15,56,222,216

+ prefetcht0 [15+rbx*1+r14]

+ prefetcht0 [15+rbx*1+r15]

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((128-120))+rsi]

+ pxor xmm12,xmm12

+

+DB 102,15,56,222,209

+ pcmpgtd xmm11,xmm12

+ movdqu xmm12,XMMWORD[((-120))+rsi]

+DB 102,15,56,222,217

+ paddd xmm10,xmm11

+ movdqa XMMWORD[32+rsp],xmm10

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((144-120))+rsi]

+

+ cmp eax,11

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((160-120))+rsi]

+

+ jb NEAR $L$dec4x_tail

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((176-120))+rsi]

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((192-120))+rsi]

+

+ je NEAR $L$dec4x_tail

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[((208-120))+rsi]

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((224-120))+rsi]

+ jmp NEAR $L$dec4x_tail

+

+ALIGN 32

+$L$dec4x_tail:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+ pxor xmm6,xmm0

+ pxor xmm7,xmm0

+DB 102,15,56,222,233

+ movdqu xmm1,XMMWORD[((16-120))+rsi]

+ pxor xmm8,xmm0

+ pxor xmm9,xmm0

+ movdqu xmm0,XMMWORD[((32-120))+rsi]

+

+DB 102,15,56,223,214

+DB 102,15,56,223,223

+ movdqu xmm6,XMMWORD[((-16))+rbx*1+r8]

+ movdqu xmm7,XMMWORD[((-16))+rbx*1+r9]

+DB 102,65,15,56,223,224

+DB 102,65,15,56,223,233

+ movdqu xmm8,XMMWORD[((-16))+rbx*1+r10]

+ movdqu xmm9,XMMWORD[((-16))+rbx*1+r11]

+

+ movups XMMWORD[(-16)+rbx*1+r12],xmm2

+ movdqu xmm2,XMMWORD[rbx*1+r8]

+ movups XMMWORD[(-16)+rbx*1+r13],xmm3

+ movdqu xmm3,XMMWORD[rbx*1+r9]

+ pxor xmm2,xmm12

+ movups XMMWORD[(-16)+rbx*1+r14],xmm4

+ movdqu xmm4,XMMWORD[rbx*1+r10]

+ pxor xmm3,xmm12

+ movups XMMWORD[(-16)+rbx*1+r15],xmm5

+ movdqu xmm5,XMMWORD[rbx*1+r11]

+ pxor xmm4,xmm12

+ pxor xmm5,xmm12

+

+ dec edx

+ jnz NEAR $L$oop_dec4x

+

+ mov rax,QWORD[16+rsp]

+

+ mov edx,DWORD[24+rsp]

+

+ lea rdi,[160+rdi]

+ dec edx

+ jnz NEAR $L$dec4x_loop_grande

+

+$L$dec4x_done:

+ movaps xmm6,XMMWORD[((-216))+rax]

+ movaps xmm7,XMMWORD[((-200))+rax]

+ movaps xmm8,XMMWORD[((-184))+rax]

+ movaps xmm9,XMMWORD[((-168))+rax]

+ movaps xmm10,XMMWORD[((-152))+rax]

+ movaps xmm11,XMMWORD[((-136))+rax]

+ movaps xmm12,XMMWORD[((-120))+rax]

+

+

+

+ mov r15,QWORD[((-48))+rax]

+

+ mov r14,QWORD[((-40))+rax]

+

+ mov r13,QWORD[((-32))+rax]

+

+ mov r12,QWORD[((-24))+rax]

+

+ mov rbp,QWORD[((-16))+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+

+ lea rsp,[rax]

+

+$L$dec4x_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_multi_cbc_decrypt:

+EXTERN __imp_RtlVirtualUnwind

+

+ALIGN 16

+se_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$in_prologue

+

+ mov rax,QWORD[152+r8]

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$in_prologue

+

+ mov rax,QWORD[16+rax]

+

+ mov rbx,QWORD[((-8))+rax]

+ mov rbp,QWORD[((-16))+rax]

+ mov r12,QWORD[((-24))+rax]

+ mov r13,QWORD[((-32))+rax]

+ mov r14,QWORD[((-40))+rax]

+ mov r15,QWORD[((-48))+rax]

+ mov QWORD[144+r8],rbx

+ mov QWORD[160+r8],rbp

+ mov QWORD[216+r8],r12

+ mov QWORD[224+r8],r13

+ mov QWORD[232+r8],r14

+ mov QWORD[240+r8],r15

+

+ lea rsi,[((-56-160))+rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+

+$L$in_prologue:

+ mov rdi,QWORD[8+rax]

+ mov rsi,QWORD[16+rax]

+ mov QWORD[152+r8],rax

+ mov QWORD[168+r8],rsi

+ mov QWORD[176+r8],rdi

+

+ mov rdi,QWORD[40+r9]

+ mov rsi,r8

+ mov ecx,154

+ DD 0xa548f3fc

+

+ mov rsi,r9

+ xor rcx,rcx

+ mov rdx,QWORD[8+rsi]

+ mov r8,QWORD[rsi]

+ mov r9,QWORD[16+rsi]

+ mov r10,QWORD[40+rsi]

+ lea r11,[56+rsi]

+ lea r12,[24+rsi]

+ mov QWORD[32+rsp],r10

+ mov QWORD[40+rsp],r11

+ mov QWORD[48+rsp],r12

+ mov QWORD[56+rsp],rcx

+ call QWORD[__imp_RtlVirtualUnwind]

+

+ mov eax,1

+ add rsp,64

+ popfq

+ pop r15

+ pop r14

+ pop r13

+ pop r12

+ pop rbp

+ pop rbx

+ pop rdi

+ pop rsi

+ DB 0F3h,0C3h ;repret

+

+

+section .pdata rdata align=4

+ALIGN 4

+ DD $L$SEH_begin_aesni_multi_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_multi_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_info_aesni_multi_cbc_encrypt wrt ..imagebase

+ DD $L$SEH_begin_aesni_multi_cbc_decrypt wrt ..imagebase

+ DD $L$SEH_end_aesni_multi_cbc_decrypt wrt ..imagebase

+ DD $L$SEH_info_aesni_multi_cbc_decrypt wrt ..imagebase

+section .xdata rdata align=8

+ALIGN 8

+$L$SEH_info_aesni_multi_cbc_encrypt:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$enc4x_body wrt ..imagebase,$L$enc4x_epilogue
wrt ..imagebase

+$L$SEH_info_aesni_multi_cbc_decrypt:

+DB 9,0,0,0

+ DD se_handler wrt ..imagebase

+ DD $L$dec4x_body wrt ..imagebase,$L$dec4x_epilogue
wrt ..imagebase

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-
x86_64.nasm b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-
x86_64.nasm
new file mode 100644
index 0000000000..f4fd9ca50d
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-x86_64.nasm
@@ -0,0 +1,1916 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/aesni-sha1-x86_64.pl

+;

+; Copyright 2011-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+EXTERN OPENSSL_ia32cap_P

+

+global aesni_cbc_sha1_enc

+

+ALIGN 32

+aesni_cbc_sha1_enc:

+

+

+ mov r10d,DWORD[((OPENSSL_ia32cap_P+0))]

+ mov r11,QWORD[((OPENSSL_ia32cap_P+4))]

+ bt r11,61

+ jc NEAR aesni_cbc_sha1_enc_shaext

+ jmp NEAR aesni_cbc_sha1_enc_ssse3

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 32

+aesni_cbc_sha1_enc_ssse3:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_cbc_sha1_enc_ssse3:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ mov r10,QWORD[56+rsp]

+

+

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ push r15

+

+ lea rsp,[((-264))+rsp]

+

+

+

+ movaps XMMWORD[(96+0)+rsp],xmm6

+ movaps XMMWORD[(96+16)+rsp],xmm7

+ movaps XMMWORD[(96+32)+rsp],xmm8

+ movaps XMMWORD[(96+48)+rsp],xmm9

+ movaps XMMWORD[(96+64)+rsp],xmm10

+ movaps XMMWORD[(96+80)+rsp],xmm11

+ movaps XMMWORD[(96+96)+rsp],xmm12

+ movaps XMMWORD[(96+112)+rsp],xmm13

+ movaps XMMWORD[(96+128)+rsp],xmm14

+ movaps XMMWORD[(96+144)+rsp],xmm15

+$L$prologue_ssse3:

+ mov r12,rdi

+ mov r13,rsi

+ mov r14,rdx

+ lea r15,[112+rcx]

+ movdqu xmm2,XMMWORD[r8]

+ mov QWORD[88+rsp],r8

+ shl r14,6

+ sub r13,r12

+ mov r8d,DWORD[((240-112))+r15]

+ add r14,r10

+

+ lea r11,[K_XX_XX]

+ mov eax,DWORD[r9]

+ mov ebx,DWORD[4+r9]

+ mov ecx,DWORD[8+r9]

+ mov edx,DWORD[12+r9]

+ mov esi,ebx

+ mov ebp,DWORD[16+r9]

+ mov edi,ecx

+ xor edi,edx

+ and esi,edi

+

+ movdqa xmm3,XMMWORD[64+r11]

+ movdqa xmm13,XMMWORD[r11]

+ movdqu xmm4,XMMWORD[r10]

+ movdqu xmm5,XMMWORD[16+r10]

+ movdqu xmm6,XMMWORD[32+r10]

+ movdqu xmm7,XMMWORD[48+r10]

+DB 102,15,56,0,227

+DB 102,15,56,0,235

+DB 102,15,56,0,243

+ add r10,64

+ paddd xmm4,xmm13

+DB 102,15,56,0,251

+ paddd xmm5,xmm13

+ paddd xmm6,xmm13

+ movdqa XMMWORD[rsp],xmm4

+ psubd xmm4,xmm13

+ movdqa XMMWORD[16+rsp],xmm5

+ psubd xmm5,xmm13

+ movdqa XMMWORD[32+rsp],xmm6

+ psubd xmm6,xmm13

+ movups xmm15,XMMWORD[((-112))+r15]

+ movups xmm0,XMMWORD[((16-112))+r15]

+ jmp NEAR $L$oop_ssse3

+ALIGN 32

+$L$oop_ssse3:

+ ror ebx,2

+ movups xmm14,XMMWORD[r12]

+ xorps xmm14,xmm15

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+r15]

+DB 102,15,56,220,208

+ pshufd xmm8,xmm4,238

+ xor esi,edx

+ movdqa xmm12,xmm7

+ paddd xmm13,xmm7

+ mov edi,eax

+ add ebp,DWORD[rsp]

+ punpcklqdq xmm8,xmm5

+ xor ebx,ecx

+ rol eax,5

+ add ebp,esi

+ psrldq xmm12,4

+ and edi,ebx

+ xor ebx,ecx

+ pxor xmm8,xmm4

+ add ebp,eax

+ ror eax,7

+ pxor xmm12,xmm6

+ xor edi,ecx

+ mov esi,ebp

+ add edx,DWORD[4+rsp]

+ pxor xmm8,xmm12

+ xor eax,ebx

+ rol ebp,5

+ movdqa XMMWORD[48+rsp],xmm13

+ add edx,edi

+ movups xmm0,XMMWORD[((-64))+r15]

+DB 102,15,56,220,209

+ and esi,eax

+ movdqa xmm3,xmm8

+ xor eax,ebx

+ add edx,ebp

+ ror ebp,7

+ movdqa xmm12,xmm8

+ xor esi,ebx

+ pslldq xmm3,12

+ paddd xmm8,xmm8

+ mov edi,edx

+ add ecx,DWORD[8+rsp]

+ psrld xmm12,31

+ xor ebp,eax

+ rol edx,5

+ add ecx,esi

+ movdqa xmm13,xmm3

+ and edi,ebp

+ xor ebp,eax

+ psrld xmm3,30

+ add ecx,edx

+ ror edx,7

+ por xmm8,xmm12

+ xor edi,eax

+ mov esi,ecx

+ add ebx,DWORD[12+rsp]

+ movups xmm1,XMMWORD[((-48))+r15]

+DB 102,15,56,220,208

+ pslld xmm13,2

+ pxor xmm8,xmm3

+ xor edx,ebp

+ movdqa xmm3,XMMWORD[r11]

+ rol ecx,5

+ add ebx,edi

+ and esi,edx

+ pxor xmm8,xmm13

+ xor edx,ebp

+ add ebx,ecx

+ ror ecx,7

+ pshufd xmm9,xmm5,238

+ xor esi,ebp

+ movdqa xmm13,xmm8

+ paddd xmm3,xmm8

+ mov edi,ebx

+ add eax,DWORD[16+rsp]

+ punpcklqdq xmm9,xmm6

+ xor ecx,edx

+ rol ebx,5

+ add eax,esi

+ psrldq xmm13,4

+ and edi,ecx

+ xor ecx,edx

+ pxor xmm9,xmm5

+ add eax,ebx

+ ror ebx,7

+ movups xmm0,XMMWORD[((-32))+r15]

+DB 102,15,56,220,209

+ pxor xmm13,xmm7

+ xor edi,edx

+ mov esi,eax

+ add ebp,DWORD[20+rsp]

+ pxor xmm9,xmm13

+ xor ebx,ecx

+ rol eax,5

+ movdqa XMMWORD[rsp],xmm3

+ add ebp,edi

+ and esi,ebx

+ movdqa xmm12,xmm9

+ xor ebx,ecx

+ add ebp,eax

+ ror eax,7

+ movdqa xmm13,xmm9

+ xor esi,ecx

+ pslldq xmm12,12

+ paddd xmm9,xmm9

+ mov edi,ebp

+ add edx,DWORD[24+rsp]

+ psrld xmm13,31

+ xor eax,ebx

+ rol ebp,5

+ add edx,esi

+ movups xmm1,XMMWORD[((-16))+r15]

+DB 102,15,56,220,208

+ movdqa xmm3,xmm12

+ and edi,eax

+ xor eax,ebx

+ psrld xmm12,30

+ add edx,ebp

+ ror ebp,7

+ por xmm9,xmm13

+ xor edi,ebx

+ mov esi,edx

+ add ecx,DWORD[28+rsp]

+ pslld xmm3,2

+ pxor xmm9,xmm12

+ xor ebp,eax

+ movdqa xmm12,XMMWORD[16+r11]

+ rol edx,5

+ add ecx,edi

+ and esi,ebp

+ pxor xmm9,xmm3

+ xor ebp,eax

+ add ecx,edx

+ ror edx,7

+ pshufd xmm10,xmm6,238

+ xor esi,eax

+ movdqa xmm3,xmm9

+ paddd xmm12,xmm9

+ mov edi,ecx

+ add ebx,DWORD[32+rsp]

+ movups xmm0,XMMWORD[r15]

+DB 102,15,56,220,209

+ punpcklqdq xmm10,xmm7

+ xor edx,ebp

+ rol ecx,5

+ add ebx,esi

+ psrldq xmm3,4

+ and edi,edx

+ xor edx,ebp

+ pxor xmm10,xmm6

+ add ebx,ecx

+ ror ecx,7

+ pxor xmm3,xmm8

+ xor edi,ebp

+ mov esi,ebx

+ add eax,DWORD[36+rsp]

+ pxor xmm10,xmm3

+ xor ecx,edx

+ rol ebx,5

+ movdqa XMMWORD[16+rsp],xmm12

+ add eax,edi

+ and esi,ecx

+ movdqa xmm13,xmm10

+ xor ecx,edx

+ add eax,ebx

+ ror ebx,7

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ movdqa xmm3,xmm10

+ xor esi,edx

+ pslldq xmm13,12

+ paddd xmm10,xmm10

+ mov edi,eax

+ add ebp,DWORD[40+rsp]

+ psrld xmm3,31

+ xor ebx,ecx

+ rol eax,5

+ add ebp,esi

+ movdqa xmm12,xmm13

+ and edi,ebx

+ xor ebx,ecx

+ psrld xmm13,30

+ add ebp,eax

+ ror eax,7

+ por xmm10,xmm3

+ xor edi,ecx

+ mov esi,ebp

+ add edx,DWORD[44+rsp]

+ pslld xmm12,2

+ pxor xmm10,xmm13

+ xor eax,ebx

+ movdqa xmm13,XMMWORD[16+r11]

+ rol ebp,5

+ add edx,edi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ and esi,eax

+ pxor xmm10,xmm12

+ xor eax,ebx

+ add edx,ebp

+ ror ebp,7

+ pshufd xmm11,xmm7,238

+ xor esi,ebx

+ movdqa xmm12,xmm10

+ paddd xmm13,xmm10

+ mov edi,edx

+ add ecx,DWORD[48+rsp]

+ punpcklqdq xmm11,xmm8

+ xor ebp,eax

+ rol edx,5

+ add ecx,esi

+ psrldq xmm12,4

+ and edi,ebp

+ xor ebp,eax

+ pxor xmm11,xmm7

+ add ecx,edx

+ ror edx,7

+ pxor xmm12,xmm9

+ xor edi,eax

+ mov esi,ecx

+ add ebx,DWORD[52+rsp]

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ pxor xmm11,xmm12

+ xor edx,ebp

+ rol ecx,5

+ movdqa XMMWORD[32+rsp],xmm13

+ add ebx,edi

+ and esi,edx

+ movdqa xmm3,xmm11

+ xor edx,ebp

+ add ebx,ecx

+ ror ecx,7

+ movdqa xmm12,xmm11

+ xor esi,ebp

+ pslldq xmm3,12

+ paddd xmm11,xmm11

+ mov edi,ebx

+ add eax,DWORD[56+rsp]

+ psrld xmm12,31

+ xor ecx,edx

+ rol ebx,5

+ add eax,esi

+ movdqa xmm13,xmm3

+ and edi,ecx

+ xor ecx,edx

+ psrld xmm3,30

+ add eax,ebx

+ ror ebx,7

+ cmp r8d,11

+ jb NEAR $L$aesenclast1

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast1

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast1:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ por xmm11,xmm12

+ xor edi,edx

+ mov esi,eax

+ add ebp,DWORD[60+rsp]

+ pslld xmm13,2

+ pxor xmm11,xmm3

+ xor ebx,ecx

+ movdqa xmm3,XMMWORD[16+r11]

+ rol eax,5

+ add ebp,edi

+ and esi,ebx

+ pxor xmm11,xmm13

+ pshufd xmm13,xmm10,238

+ xor ebx,ecx

+ add ebp,eax

+ ror eax,7

+ pxor xmm4,xmm8

+ xor esi,ecx

+ mov edi,ebp

+ add edx,DWORD[rsp]

+ punpcklqdq xmm13,xmm11

+ xor eax,ebx

+ rol ebp,5

+ pxor xmm4,xmm5

+ add edx,esi

+ movups xmm14,XMMWORD[16+r12]

+ xorps xmm14,xmm15

+ movups XMMWORD[r13*1+r12],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+r15]

+DB 102,15,56,220,208

+ and edi,eax

+ movdqa xmm12,xmm3

+ xor eax,ebx

+ paddd xmm3,xmm11

+ add edx,ebp

+ pxor xmm4,xmm13

+ ror ebp,7

+ xor edi,ebx

+ mov esi,edx

+ add ecx,DWORD[4+rsp]

+ movdqa xmm13,xmm4

+ xor ebp,eax

+ rol edx,5

+ movdqa XMMWORD[48+rsp],xmm3

+ add ecx,edi

+ and esi,ebp

+ xor ebp,eax

+ pslld xmm4,2

+ add ecx,edx

+ ror edx,7

+ psrld xmm13,30

+ xor esi,eax

+ mov edi,ecx

+ add ebx,DWORD[8+rsp]

+ movups xmm0,XMMWORD[((-64))+r15]

+DB 102,15,56,220,209

+ por xmm4,xmm13

+ xor edx,ebp

+ rol ecx,5

+ pshufd xmm3,xmm11,238

+ add ebx,esi

+ and edi,edx

+ xor edx,ebp

+ add ebx,ecx

+ add eax,DWORD[12+rsp]

+ xor edi,ebp

+ mov esi,ebx

+ rol ebx,5

+ add eax,edi

+ xor esi,edx

+ ror ecx,7

+ add eax,ebx

+ pxor xmm5,xmm9

+ add ebp,DWORD[16+rsp]

+ movups xmm1,XMMWORD[((-48))+r15]

+DB 102,15,56,220,208

+ xor esi,ecx

+ punpcklqdq xmm3,xmm4

+ mov edi,eax

+ rol eax,5

+ pxor xmm5,xmm6

+ add ebp,esi

+ xor edi,ecx

+ movdqa xmm13,xmm12

+ ror ebx,7

+ paddd xmm12,xmm4

+ add ebp,eax

+ pxor xmm5,xmm3

+ add edx,DWORD[20+rsp]

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ movdqa xmm3,xmm5

+ add edx,edi

+ xor esi,ebx

+ movdqa XMMWORD[rsp],xmm12

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[24+rsp]

+ pslld xmm5,2

+ xor esi,eax

+ mov edi,edx

+ psrld xmm3,30

+ rol edx,5

+ add ecx,esi

+ movups xmm0,XMMWORD[((-32))+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ ror ebp,7

+ por xmm5,xmm3

+ add ecx,edx

+ add ebx,DWORD[28+rsp]

+ pshufd xmm12,xmm4,238

+ xor edi,ebp

+ mov esi,ecx

+ rol ecx,5

+ add ebx,edi

+ xor esi,ebp

+ ror edx,7

+ add ebx,ecx

+ pxor xmm6,xmm10

+ add eax,DWORD[32+rsp]

+ xor esi,edx

+ punpcklqdq xmm12,xmm5

+ mov edi,ebx

+ rol ebx,5

+ pxor xmm6,xmm7

+ add eax,esi

+ xor edi,edx

+ movdqa xmm3,XMMWORD[32+r11]

+ ror ecx,7

+ paddd xmm13,xmm5

+ add eax,ebx

+ pxor xmm6,xmm12

+ add ebp,DWORD[36+rsp]

+ movups xmm1,XMMWORD[((-16))+r15]

+DB 102,15,56,220,208

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ movdqa xmm12,xmm6

+ add ebp,edi

+ xor esi,ecx

+ movdqa XMMWORD[16+rsp],xmm13

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[40+rsp]

+ pslld xmm6,2

+ xor esi,ebx

+ mov edi,ebp

+ psrld xmm12,30

+ rol ebp,5

+ add edx,esi

+ xor edi,ebx

+ ror eax,7

+ por xmm6,xmm12

+ add edx,ebp

+ add ecx,DWORD[44+rsp]

+ pshufd xmm13,xmm5,238

+ xor edi,eax

+ mov esi,edx

+ rol edx,5

+ add ecx,edi

+ movups xmm0,XMMWORD[r15]

+DB 102,15,56,220,209

+ xor esi,eax

+ ror ebp,7

+ add ecx,edx

+ pxor xmm7,xmm11

+ add ebx,DWORD[48+rsp]

+ xor esi,ebp

+ punpcklqdq xmm13,xmm6

+ mov edi,ecx

+ rol ecx,5

+ pxor xmm7,xmm8

+ add ebx,esi

+ xor edi,ebp

+ movdqa xmm12,xmm3

+ ror edx,7

+ paddd xmm3,xmm6

+ add ebx,ecx

+ pxor xmm7,xmm13

+ add eax,DWORD[52+rsp]

+ xor edi,edx

+ mov esi,ebx

+ rol ebx,5

+ movdqa xmm13,xmm7

+ add eax,edi

+ xor esi,edx

+ movdqa XMMWORD[32+rsp],xmm3

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[56+rsp]

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ pslld xmm7,2

+ xor esi,ecx

+ mov edi,eax

+ psrld xmm13,30

+ rol eax,5

+ add ebp,esi

+ xor edi,ecx

+ ror ebx,7

+ por xmm7,xmm13

+ add ebp,eax

+ add edx,DWORD[60+rsp]

+ pshufd xmm3,xmm6,238

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ add edx,edi

+ xor esi,ebx

+ ror eax,7

+ add edx,ebp

+ pxor xmm8,xmm4

+ add ecx,DWORD[rsp]

+ xor esi,eax

+ punpcklqdq xmm3,xmm7

+ mov edi,edx

+ rol edx,5

+ pxor xmm8,xmm9

+ add ecx,esi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ movdqa xmm13,xmm12

+ ror ebp,7

+ paddd xmm12,xmm7

+ add ecx,edx

+ pxor xmm8,xmm3

+ add ebx,DWORD[4+rsp]

+ xor edi,ebp

+ mov esi,ecx

+ rol ecx,5

+ movdqa xmm3,xmm8

+ add ebx,edi

+ xor esi,ebp

+ movdqa XMMWORD[48+rsp],xmm12

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[8+rsp]

+ pslld xmm8,2

+ xor esi,edx

+ mov edi,ebx

+ psrld xmm3,30

+ rol ebx,5

+ add eax,esi

+ xor edi,edx

+ ror ecx,7

+ por xmm8,xmm3

+ add eax,ebx

+ add ebp,DWORD[12+rsp]

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ pshufd xmm12,xmm7,238

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ add ebp,edi

+ xor esi,ecx

+ ror ebx,7

+ add ebp,eax

+ pxor xmm9,xmm5

+ add edx,DWORD[16+rsp]

+ xor esi,ebx

+ punpcklqdq xmm12,xmm8

+ mov edi,ebp

+ rol ebp,5

+ pxor xmm9,xmm10

+ add edx,esi

+ xor edi,ebx

+ movdqa xmm3,xmm13

+ ror eax,7

+ paddd xmm13,xmm8

+ add edx,ebp

+ pxor xmm9,xmm12

+ add ecx,DWORD[20+rsp]

+ xor edi,eax

+ mov esi,edx

+ rol edx,5

+ movdqa xmm12,xmm9

+ add ecx,edi

+ cmp r8d,11

+ jb NEAR $L$aesenclast2

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast2

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast2:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ xor esi,eax

+ movdqa XMMWORD[rsp],xmm13

+ ror ebp,7

+ add ecx,edx

+ add ebx,DWORD[24+rsp]

+ pslld xmm9,2

+ xor esi,ebp

+ mov edi,ecx

+ psrld xmm12,30

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ por xmm9,xmm12

+ add ebx,ecx

+ add eax,DWORD[28+rsp]

+ pshufd xmm13,xmm8,238

+ ror ecx,7

+ mov esi,ebx

+ xor edi,edx

+ rol ebx,5

+ add eax,edi

+ xor esi,ecx

+ xor ecx,edx

+ add eax,ebx

+ pxor xmm10,xmm6

+ add ebp,DWORD[32+rsp]

+ movups xmm14,XMMWORD[32+r12]

+ xorps xmm14,xmm15

+ movups XMMWORD[16+r12*1+r13],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+r15]

+DB 102,15,56,220,208

+ and esi,ecx

+ xor ecx,edx

+ ror ebx,7

+ punpcklqdq xmm13,xmm9

+ mov edi,eax

+ xor esi,ecx

+ pxor xmm10,xmm11

+ rol eax,5

+ add ebp,esi

+ movdqa xmm12,xmm3

+ xor edi,ebx

+ paddd xmm3,xmm9

+ xor ebx,ecx

+ pxor xmm10,xmm13

+ add ebp,eax

+ add edx,DWORD[36+rsp]

+ and edi,ebx

+ xor ebx,ecx

+ ror eax,7

+ movdqa xmm13,xmm10

+ mov esi,ebp

+ xor edi,ebx

+ movdqa XMMWORD[16+rsp],xmm3

+ rol ebp,5

+ add edx,edi

+ movups xmm0,XMMWORD[((-64))+r15]

+DB 102,15,56,220,209

+ xor esi,eax

+ pslld xmm10,2

+ xor eax,ebx

+ add edx,ebp

+ psrld xmm13,30

+ add ecx,DWORD[40+rsp]

+ and esi,eax

+ xor eax,ebx

+ por xmm10,xmm13

+ ror ebp,7

+ mov edi,edx

+ xor esi,eax

+ rol edx,5

+ pshufd xmm3,xmm9,238

+ add ecx,esi

+ xor edi,ebp

+ xor ebp,eax

+ add ecx,edx

+ add ebx,DWORD[44+rsp]

+ and edi,ebp

+ xor ebp,eax

+ ror edx,7

+ movups xmm1,XMMWORD[((-48))+r15]

+DB 102,15,56,220,208

+ mov esi,ecx

+ xor edi,ebp

+ rol ecx,5

+ add ebx,edi

+ xor esi,edx

+ xor edx,ebp

+ add ebx,ecx

+ pxor xmm11,xmm7

+ add eax,DWORD[48+rsp]

+ and esi,edx

+ xor edx,ebp

+ ror ecx,7

+ punpcklqdq xmm3,xmm10

+ mov edi,ebx

+ xor esi,edx

+ pxor xmm11,xmm4

+ rol ebx,5

+ add eax,esi

+ movdqa xmm13,XMMWORD[48+r11]

+ xor edi,ecx

+ paddd xmm12,xmm10

+ xor ecx,edx

+ pxor xmm11,xmm3

+ add eax,ebx

+ add ebp,DWORD[52+rsp]

+ movups xmm0,XMMWORD[((-32))+r15]

+DB 102,15,56,220,209

+ and edi,ecx

+ xor ecx,edx

+ ror ebx,7

+ movdqa xmm3,xmm11

+ mov esi,eax

+ xor edi,ecx

+ movdqa XMMWORD[32+rsp],xmm12

+ rol eax,5

+ add ebp,edi

+ xor esi,ebx

+ pslld xmm11,2

+ xor ebx,ecx

+ add ebp,eax

+ psrld xmm3,30

+ add edx,DWORD[56+rsp]

+ and esi,ebx

+ xor ebx,ecx

+ por xmm11,xmm3

+ ror eax,7

+ mov edi,ebp

+ xor esi,ebx

+ rol ebp,5

+ pshufd xmm12,xmm10,238

+ add edx,esi

+ movups xmm1,XMMWORD[((-16))+r15]

+DB 102,15,56,220,208

+ xor edi,eax

+ xor eax,ebx

+ add edx,ebp

+ add ecx,DWORD[60+rsp]

+ and edi,eax

+ xor eax,ebx

+ ror ebp,7

+ mov esi,edx

+ xor edi,eax

+ rol edx,5

+ add ecx,edi

+ xor esi,ebp

+ xor ebp,eax

+ add ecx,edx

+ pxor xmm4,xmm8

+ add ebx,DWORD[rsp]

+ and esi,ebp

+ xor ebp,eax

+ ror edx,7

+ movups xmm0,XMMWORD[r15]

+DB 102,15,56,220,209

+ punpcklqdq xmm12,xmm11

+ mov edi,ecx

+ xor esi,ebp

+ pxor xmm4,xmm5

+ rol ecx,5

+ add ebx,esi

+ movdqa xmm3,xmm13

+ xor edi,edx

+ paddd xmm13,xmm11

+ xor edx,ebp

+ pxor xmm4,xmm12

+ add ebx,ecx

+ add eax,DWORD[4+rsp]

+ and edi,edx

+ xor edx,ebp

+ ror ecx,7

+ movdqa xmm12,xmm4

+ mov esi,ebx

+ xor edi,edx

+ movdqa XMMWORD[48+rsp],xmm13

+ rol ebx,5

+ add eax,edi

+ xor esi,ecx

+ pslld xmm4,2

+ xor ecx,edx

+ add eax,ebx

+ psrld xmm12,30

+ add ebp,DWORD[8+rsp]

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ and esi,ecx

+ xor ecx,edx

+ por xmm4,xmm12

+ ror ebx,7

+ mov edi,eax

+ xor esi,ecx

+ rol eax,5

+ pshufd xmm13,xmm11,238

+ add ebp,esi

+ xor edi,ebx

+ xor ebx,ecx

+ add ebp,eax

+ add edx,DWORD[12+rsp]

+ and edi,ebx

+ xor ebx,ecx

+ ror eax,7

+ mov esi,ebp

+ xor edi,ebx

+ rol ebp,5

+ add edx,edi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ xor esi,eax

+ xor eax,ebx

+ add edx,ebp

+ pxor xmm5,xmm9

+ add ecx,DWORD[16+rsp]

+ and esi,eax

+ xor eax,ebx

+ ror ebp,7

+ punpcklqdq xmm13,xmm4

+ mov edi,edx

+ xor esi,eax

+ pxor xmm5,xmm6

+ rol edx,5

+ add ecx,esi

+ movdqa xmm12,xmm3

+ xor edi,ebp

+ paddd xmm3,xmm4

+ xor ebp,eax

+ pxor xmm5,xmm13

+ add ecx,edx

+ add ebx,DWORD[20+rsp]

+ and edi,ebp

+ xor ebp,eax

+ ror edx,7

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ movdqa xmm13,xmm5

+ mov esi,ecx

+ xor edi,ebp

+ movdqa XMMWORD[rsp],xmm3

+ rol ecx,5

+ add ebx,edi

+ xor esi,edx

+ pslld xmm5,2

+ xor edx,ebp

+ add ebx,ecx

+ psrld xmm13,30

+ add eax,DWORD[24+rsp]

+ and esi,edx

+ xor edx,ebp

+ por xmm5,xmm13

+ ror ecx,7

+ mov edi,ebx

+ xor esi,edx

+ rol ebx,5

+ pshufd xmm3,xmm4,238

+ add eax,esi

+ xor edi,ecx

+ xor ecx,edx

+ add eax,ebx

+ add ebp,DWORD[28+rsp]

+ cmp r8d,11

+ jb NEAR $L$aesenclast3

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast3

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast3:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ and edi,ecx

+ xor ecx,edx

+ ror ebx,7

+ mov esi,eax

+ xor edi,ecx

+ rol eax,5

+ add ebp,edi

+ xor esi,ebx

+ xor ebx,ecx

+ add ebp,eax

+ pxor xmm6,xmm10

+ add edx,DWORD[32+rsp]

+ and esi,ebx

+ xor ebx,ecx

+ ror eax,7

+ punpcklqdq xmm3,xmm5

+ mov edi,ebp

+ xor esi,ebx

+ pxor xmm6,xmm7

+ rol ebp,5

+ add edx,esi

+ movups xmm14,XMMWORD[48+r12]

+ xorps xmm14,xmm15

+ movups XMMWORD[32+r12*1+r13],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+r15]

+DB 102,15,56,220,208

+ movdqa xmm13,xmm12

+ xor edi,eax

+ paddd xmm12,xmm5

+ xor eax,ebx

+ pxor xmm6,xmm3

+ add edx,ebp

+ add ecx,DWORD[36+rsp]

+ and edi,eax

+ xor eax,ebx

+ ror ebp,7

+ movdqa xmm3,xmm6

+ mov esi,edx

+ xor edi,eax

+ movdqa XMMWORD[16+rsp],xmm12

+ rol edx,5

+ add ecx,edi

+ xor esi,ebp

+ pslld xmm6,2

+ xor ebp,eax

+ add ecx,edx

+ psrld xmm3,30

+ add ebx,DWORD[40+rsp]

+ and esi,ebp

+ xor ebp,eax

+ por xmm6,xmm3

+ ror edx,7

+ movups xmm0,XMMWORD[((-64))+r15]

+DB 102,15,56,220,209

+ mov edi,ecx

+ xor esi,ebp

+ rol ecx,5

+ pshufd xmm12,xmm5,238

+ add ebx,esi

+ xor edi,edx

+ xor edx,ebp

+ add ebx,ecx

+ add eax,DWORD[44+rsp]

+ and edi,edx

+ xor edx,ebp

+ ror ecx,7

+ mov esi,ebx

+ xor edi,edx

+ rol ebx,5

+ add eax,edi

+ xor esi,edx

+ add eax,ebx

+ pxor xmm7,xmm11

+ add ebp,DWORD[48+rsp]

+ movups xmm1,XMMWORD[((-48))+r15]

+DB 102,15,56,220,208

+ xor esi,ecx

+ punpcklqdq xmm12,xmm6

+ mov edi,eax

+ rol eax,5

+ pxor xmm7,xmm8

+ add ebp,esi

+ xor edi,ecx

+ movdqa xmm3,xmm13

+ ror ebx,7

+ paddd xmm13,xmm6

+ add ebp,eax

+ pxor xmm7,xmm12

+ add edx,DWORD[52+rsp]

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ movdqa xmm12,xmm7

+ add edx,edi

+ xor esi,ebx

+ movdqa XMMWORD[32+rsp],xmm13

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[56+rsp]

+ pslld xmm7,2

+ xor esi,eax

+ mov edi,edx

+ psrld xmm12,30

+ rol edx,5

+ add ecx,esi

+ movups xmm0,XMMWORD[((-32))+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ ror ebp,7

+ por xmm7,xmm12

+ add ecx,edx

+ add ebx,DWORD[60+rsp]

+ xor edi,ebp

+ mov esi,ecx

+ rol ecx,5

+ add ebx,edi

+ xor esi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[rsp]

+ xor esi,edx

+ mov edi,ebx

+ rol ebx,5

+ paddd xmm3,xmm7

+ add eax,esi

+ xor edi,edx

+ movdqa XMMWORD[48+rsp],xmm3

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[4+rsp]

+ movups xmm1,XMMWORD[((-16))+r15]

+DB 102,15,56,220,208

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ add ebp,edi

+ xor esi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[8+rsp]

+ xor esi,ebx

+ mov edi,ebp

+ rol ebp,5

+ add edx,esi

+ xor edi,ebx

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[12+rsp]

+ xor edi,eax

+ mov esi,edx

+ rol edx,5

+ add ecx,edi

+ movups xmm0,XMMWORD[r15]

+DB 102,15,56,220,209

+ xor esi,eax

+ ror ebp,7

+ add ecx,edx

+ cmp r10,r14

+ je NEAR $L$done_ssse3

+ movdqa xmm3,XMMWORD[64+r11]

+ movdqa xmm13,XMMWORD[r11]

+ movdqu xmm4,XMMWORD[r10]

+ movdqu xmm5,XMMWORD[16+r10]

+ movdqu xmm6,XMMWORD[32+r10]

+ movdqu xmm7,XMMWORD[48+r10]

+DB 102,15,56,0,227

+ add r10,64

+ add ebx,DWORD[16+rsp]

+ xor esi,ebp

+ mov edi,ecx

+DB 102,15,56,0,235

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ paddd xmm4,xmm13

+ add ebx,ecx

+ add eax,DWORD[20+rsp]

+ xor edi,edx

+ mov esi,ebx

+ movdqa XMMWORD[rsp],xmm4

+ rol ebx,5

+ add eax,edi

+ xor esi,edx

+ ror ecx,7

+ psubd xmm4,xmm13

+ add eax,ebx

+ add ebp,DWORD[24+rsp]

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ xor esi,ecx

+ mov edi,eax

+ rol eax,5

+ add ebp,esi

+ xor edi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[28+rsp]

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ add edx,edi

+ xor esi,ebx

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[32+rsp]

+ xor esi,eax

+ mov edi,edx

+DB 102,15,56,0,243

+ rol edx,5

+ add ecx,esi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ ror ebp,7

+ paddd xmm5,xmm13

+ add ecx,edx

+ add ebx,DWORD[36+rsp]

+ xor edi,ebp

+ mov esi,ecx

+ movdqa XMMWORD[16+rsp],xmm5

+ rol ecx,5

+ add ebx,edi

+ xor esi,ebp

+ ror edx,7

+ psubd xmm5,xmm13

+ add ebx,ecx

+ add eax,DWORD[40+rsp]

+ xor esi,edx

+ mov edi,ebx

+ rol ebx,5

+ add eax,esi

+ xor edi,edx

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[44+rsp]

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ add ebp,edi

+ xor esi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[48+rsp]

+ xor esi,ebx

+ mov edi,ebp

+DB 102,15,56,0,251

+ rol ebp,5

+ add edx,esi

+ xor edi,ebx

+ ror eax,7

+ paddd xmm6,xmm13

+ add edx,ebp

+ add ecx,DWORD[52+rsp]

+ xor edi,eax

+ mov esi,edx

+ movdqa XMMWORD[32+rsp],xmm6

+ rol edx,5

+ add ecx,edi

+ cmp r8d,11

+ jb NEAR $L$aesenclast4

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast4

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast4:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ xor esi,eax

+ ror ebp,7

+ psubd xmm6,xmm13

+ add ecx,edx

+ add ebx,DWORD[56+rsp]

+ xor esi,ebp

+ mov edi,ecx

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[60+rsp]

+ xor edi,edx

+ mov esi,ebx

+ rol ebx,5

+ add eax,edi

+ ror ecx,7

+ add eax,ebx

+ movups XMMWORD[48+r12*1+r13],xmm2

+ lea r12,[64+r12]

+

+ add eax,DWORD[r9]

+ add esi,DWORD[4+r9]

+ add ecx,DWORD[8+r9]

+ add edx,DWORD[12+r9]

+ mov DWORD[r9],eax

+ add ebp,DWORD[16+r9]

+ mov DWORD[4+r9],esi

+ mov ebx,esi

+ mov DWORD[8+r9],ecx

+ mov edi,ecx

+ mov DWORD[12+r9],edx

+ xor edi,edx

+ mov DWORD[16+r9],ebp

+ and esi,edi

+ jmp NEAR $L$oop_ssse3

+

+$L$done_ssse3:

+ add ebx,DWORD[16+rsp]

+ xor esi,ebp

+ mov edi,ecx

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[20+rsp]

+ xor edi,edx

+ mov esi,ebx

+ rol ebx,5

+ add eax,edi

+ xor esi,edx

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[24+rsp]

+ movups xmm1,XMMWORD[16+r15]

+DB 102,15,56,220,208

+ xor esi,ecx

+ mov edi,eax

+ rol eax,5

+ add ebp,esi

+ xor edi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[28+rsp]

+ xor edi,ebx

+ mov esi,ebp

+ rol ebp,5

+ add edx,edi

+ xor esi,ebx

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[32+rsp]

+ xor esi,eax

+ mov edi,edx

+ rol edx,5

+ add ecx,esi

+ movups xmm0,XMMWORD[32+r15]

+DB 102,15,56,220,209

+ xor edi,eax

+ ror ebp,7

+ add ecx,edx

+ add ebx,DWORD[36+rsp]

+ xor edi,ebp

+ mov esi,ecx

+ rol ecx,5

+ add ebx,edi

+ xor esi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[40+rsp]

+ xor esi,edx

+ mov edi,ebx

+ rol ebx,5

+ add eax,esi

+ xor edi,edx

+ ror ecx,7

+ add eax,ebx

+ add ebp,DWORD[44+rsp]

+ movups xmm1,XMMWORD[48+r15]

+DB 102,15,56,220,208

+ xor edi,ecx

+ mov esi,eax

+ rol eax,5

+ add ebp,edi

+ xor esi,ecx

+ ror ebx,7

+ add ebp,eax

+ add edx,DWORD[48+rsp]

+ xor esi,ebx

+ mov edi,ebp

+ rol ebp,5

+ add edx,esi

+ xor edi,ebx

+ ror eax,7

+ add edx,ebp

+ add ecx,DWORD[52+rsp]

+ xor edi,eax

+ mov esi,edx

+ rol edx,5

+ add ecx,edi

+ cmp r8d,11

+ jb NEAR $L$aesenclast5

+ movups xmm0,XMMWORD[64+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+r15]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast5

+ movups xmm0,XMMWORD[96+r15]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+r15]

+DB 102,15,56,220,208

+$L$aesenclast5:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+r15]

+ xor esi,eax

+ ror ebp,7

+ add ecx,edx

+ add ebx,DWORD[56+rsp]

+ xor esi,ebp

+ mov edi,ecx

+ rol ecx,5

+ add ebx,esi

+ xor edi,ebp

+ ror edx,7

+ add ebx,ecx

+ add eax,DWORD[60+rsp]

+ xor edi,edx

+ mov esi,ebx

+ rol ebx,5

+ add eax,edi

+ ror ecx,7

+ add eax,ebx

+ movups XMMWORD[48+r12*1+r13],xmm2

+ mov r8,QWORD[88+rsp]

+

+ add eax,DWORD[r9]

+ add esi,DWORD[4+r9]

+ add ecx,DWORD[8+r9]

+ mov DWORD[r9],eax

+ add edx,DWORD[12+r9]

+ mov DWORD[4+r9],esi

+ add ebp,DWORD[16+r9]

+ mov DWORD[8+r9],ecx

+ mov DWORD[12+r9],edx

+ mov DWORD[16+r9],ebp

+ movups XMMWORD[r8],xmm2

+ movaps xmm6,XMMWORD[((96+0))+rsp]

+ movaps xmm7,XMMWORD[((96+16))+rsp]

+ movaps xmm8,XMMWORD[((96+32))+rsp]

+ movaps xmm9,XMMWORD[((96+48))+rsp]

+ movaps xmm10,XMMWORD[((96+64))+rsp]

+ movaps xmm11,XMMWORD[((96+80))+rsp]

+ movaps xmm12,XMMWORD[((96+96))+rsp]

+ movaps xmm13,XMMWORD[((96+112))+rsp]

+ movaps xmm14,XMMWORD[((96+128))+rsp]

+ movaps xmm15,XMMWORD[((96+144))+rsp]

+ lea rsi,[264+rsp]

+

+ mov r15,QWORD[rsi]

+

+ mov r14,QWORD[8+rsi]

+

+ mov r13,QWORD[16+rsi]

+

+ mov r12,QWORD[24+rsi]

+

+ mov rbp,QWORD[32+rsi]

+

+ mov rbx,QWORD[40+rsi]

+

+ lea rsp,[48+rsi]

+

+$L$epilogue_ssse3:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_cbc_sha1_enc_ssse3:

+ALIGN 64

+K_XX_XX:

+ DD 0x5a827999,0x5a827999,0x5a827999,0x5a827999

+ DD 0x6ed9eba1,0x6ed9eba1,0x6ed9eba1,0x6ed9eba1

+ DD 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc

+ DD 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6

+ DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f

+DB 0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0

+

+DB 65,69,83,78,73,45,67,66,67,43,83,72,65,49,32,115

+DB 116,105,116,99,104,32,102,111,114,32,120,56,54,95,54,52

+DB 44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32

+DB 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111

+DB 114,103,62,0

+ALIGN 64

+

+ALIGN 32

+aesni_cbc_sha1_enc_shaext:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_cbc_sha1_enc_shaext:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ mov r10,QWORD[56+rsp]

+ lea rsp,[((-168))+rsp]

+ movaps XMMWORD[(-8-160)+rax],xmm6

+ movaps XMMWORD[(-8-144)+rax],xmm7

+ movaps XMMWORD[(-8-128)+rax],xmm8

+ movaps XMMWORD[(-8-112)+rax],xmm9

+ movaps XMMWORD[(-8-96)+rax],xmm10

+ movaps XMMWORD[(-8-80)+rax],xmm11

+ movaps XMMWORD[(-8-64)+rax],xmm12

+ movaps XMMWORD[(-8-48)+rax],xmm13

+ movaps XMMWORD[(-8-32)+rax],xmm14

+ movaps XMMWORD[(-8-16)+rax],xmm15

+$L$prologue_shaext:

+ movdqu xmm8,XMMWORD[r9]

+ movd xmm9,DWORD[16+r9]

+ movdqa xmm7,XMMWORD[((K_XX_XX+80))]

+

+ mov r11d,DWORD[240+rcx]

+ sub rsi,rdi

+ movups xmm15,XMMWORD[rcx]

+ movups xmm2,XMMWORD[r8]

+ movups xmm0,XMMWORD[16+rcx]

+ lea rcx,[112+rcx]

+

+ pshufd xmm8,xmm8,27

+ pshufd xmm9,xmm9,27

+ jmp NEAR $L$oop_shaext

+

+ALIGN 16

+$L$oop_shaext:

+ movups xmm14,XMMWORD[rdi]

+ xorps xmm14,xmm15

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+rcx]

+DB 102,15,56,220,208

+ movdqu xmm3,XMMWORD[r10]

+ movdqa xmm12,xmm9

+DB 102,15,56,0,223

+ movdqu xmm4,XMMWORD[16+r10]

+ movdqa xmm11,xmm8

+ movups xmm0,XMMWORD[((-64))+rcx]

+DB 102,15,56,220,209

+DB 102,15,56,0,231

+

+ paddd xmm9,xmm3

+ movdqu xmm5,XMMWORD[32+r10]

+ lea r10,[64+r10]

+ pxor xmm3,xmm12

+ movups xmm1,XMMWORD[((-48))+rcx]

+DB 102,15,56,220,208

+ pxor xmm3,xmm12

+ movdqa xmm10,xmm8

+DB 102,15,56,0,239

+DB 69,15,58,204,193,0

+DB 68,15,56,200,212

+ movups xmm0,XMMWORD[((-32))+rcx]

+DB 102,15,56,220,209

+DB 15,56,201,220

+ movdqu xmm6,XMMWORD[((-16))+r10]

+ movdqa xmm9,xmm8

+DB 102,15,56,0,247

+ movups xmm1,XMMWORD[((-16))+rcx]

+DB 102,15,56,220,208

+DB 69,15,58,204,194,0

+DB 68,15,56,200,205

+ pxor xmm3,xmm5

+DB 15,56,201,229

+ movups xmm0,XMMWORD[rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,0

+DB 68,15,56,200,214

+ movups xmm1,XMMWORD[16+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,222

+ pxor xmm4,xmm6

+DB 15,56,201,238

+ movups xmm0,XMMWORD[32+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,0

+DB 68,15,56,200,203

+ movups xmm1,XMMWORD[48+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,227

+ pxor xmm5,xmm3

+DB 15,56,201,243

+ cmp r11d,11

+ jb NEAR $L$aesenclast6

+ movups xmm0,XMMWORD[64+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+rcx]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast6

+ movups xmm0,XMMWORD[96+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+rcx]

+DB 102,15,56,220,208

+$L$aesenclast6:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+rcx]

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,0

+DB 68,15,56,200,212

+ movups xmm14,XMMWORD[16+rdi]

+ xorps xmm14,xmm15

+ movups XMMWORD[rdi*1+rsi],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,236

+ pxor xmm6,xmm4

+DB 15,56,201,220

+ movups xmm0,XMMWORD[((-64))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,1

+DB 68,15,56,200,205

+ movups xmm1,XMMWORD[((-48))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,245

+ pxor xmm3,xmm5

+DB 15,56,201,229

+ movups xmm0,XMMWORD[((-32))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,1

+DB 68,15,56,200,214

+ movups xmm1,XMMWORD[((-16))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,222

+ pxor xmm4,xmm6

+DB 15,56,201,238

+ movups xmm0,XMMWORD[rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,1

+DB 68,15,56,200,203

+ movups xmm1,XMMWORD[16+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,227

+ pxor xmm5,xmm3

+DB 15,56,201,243

+ movups xmm0,XMMWORD[32+rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,1

+DB 68,15,56,200,212

+ movups xmm1,XMMWORD[48+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,236

+ pxor xmm6,xmm4

+DB 15,56,201,220

+ cmp r11d,11

+ jb NEAR $L$aesenclast7

+ movups xmm0,XMMWORD[64+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+rcx]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast7

+ movups xmm0,XMMWORD[96+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+rcx]

+DB 102,15,56,220,208

+$L$aesenclast7:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+rcx]

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,1

+DB 68,15,56,200,205

+ movups xmm14,XMMWORD[32+rdi]

+ xorps xmm14,xmm15

+ movups XMMWORD[16+rdi*1+rsi],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,245

+ pxor xmm3,xmm5

+DB 15,56,201,229

+ movups xmm0,XMMWORD[((-64))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,2

+DB 68,15,56,200,214

+ movups xmm1,XMMWORD[((-48))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,222

+ pxor xmm4,xmm6

+DB 15,56,201,238

+ movups xmm0,XMMWORD[((-32))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,2

+DB 68,15,56,200,203

+ movups xmm1,XMMWORD[((-16))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,227

+ pxor xmm5,xmm3

+DB 15,56,201,243

+ movups xmm0,XMMWORD[rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,2

+DB 68,15,56,200,212

+ movups xmm1,XMMWORD[16+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,236

+ pxor xmm6,xmm4

+DB 15,56,201,220

+ movups xmm0,XMMWORD[32+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,2

+DB 68,15,56,200,205

+ movups xmm1,XMMWORD[48+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,245

+ pxor xmm3,xmm5

+DB 15,56,201,229

+ cmp r11d,11

+ jb NEAR $L$aesenclast8

+ movups xmm0,XMMWORD[64+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+rcx]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast8

+ movups xmm0,XMMWORD[96+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+rcx]

+DB 102,15,56,220,208

+$L$aesenclast8:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+rcx]

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,2

+DB 68,15,56,200,214

+ movups xmm14,XMMWORD[48+rdi]

+ xorps xmm14,xmm15

+ movups XMMWORD[32+rdi*1+rsi],xmm2

+ xorps xmm2,xmm14

+ movups xmm1,XMMWORD[((-80))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,222

+ pxor xmm4,xmm6

+DB 15,56,201,238

+ movups xmm0,XMMWORD[((-64))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,3

+DB 68,15,56,200,203

+ movups xmm1,XMMWORD[((-48))+rcx]

+DB 102,15,56,220,208

+DB 15,56,202,227

+ pxor xmm5,xmm3

+DB 15,56,201,243

+ movups xmm0,XMMWORD[((-32))+rcx]

+DB 102,15,56,220,209

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,3

+DB 68,15,56,200,212

+DB 15,56,202,236

+ pxor xmm6,xmm4

+ movups xmm1,XMMWORD[((-16))+rcx]

+DB 102,15,56,220,208

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,3

+DB 68,15,56,200,205

+DB 15,56,202,245

+ movups xmm0,XMMWORD[rcx]

+DB 102,15,56,220,209

+ movdqa xmm5,xmm12

+ movdqa xmm10,xmm8

+DB 69,15,58,204,193,3

+DB 68,15,56,200,214

+ movups xmm1,XMMWORD[16+rcx]

+DB 102,15,56,220,208

+ movdqa xmm9,xmm8

+DB 69,15,58,204,194,3

+DB 68,15,56,200,205

+ movups xmm0,XMMWORD[32+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[48+rcx]

+DB 102,15,56,220,208

+ cmp r11d,11

+ jb NEAR $L$aesenclast9

+ movups xmm0,XMMWORD[64+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[80+rcx]

+DB 102,15,56,220,208

+ je NEAR $L$aesenclast9

+ movups xmm0,XMMWORD[96+rcx]

+DB 102,15,56,220,209

+ movups xmm1,XMMWORD[112+rcx]

+DB 102,15,56,220,208

+$L$aesenclast9:

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[((16-112))+rcx]

+ dec rdx

+

+ paddd xmm8,xmm11

+ movups XMMWORD[48+rdi*1+rsi],xmm2

+ lea rdi,[64+rdi]

+ jnz NEAR $L$oop_shaext

+

+ pshufd xmm8,xmm8,27

+ pshufd xmm9,xmm9,27

+ movups XMMWORD[r8],xmm2

+ movdqu XMMWORD[r9],xmm8

+ movd DWORD[16+r9],xmm9

+ movaps xmm6,XMMWORD[((-8-160))+rax]

+ movaps xmm7,XMMWORD[((-8-144))+rax]

+ movaps xmm8,XMMWORD[((-8-128))+rax]

+ movaps xmm9,XMMWORD[((-8-112))+rax]

+ movaps xmm10,XMMWORD[((-8-96))+rax]

+ movaps xmm11,XMMWORD[((-8-80))+rax]

+ movaps xmm12,XMMWORD[((-8-64))+rax]

+ movaps xmm13,XMMWORD[((-8-48))+rax]

+ movaps xmm14,XMMWORD[((-8-32))+rax]

+ movaps xmm15,XMMWORD[((-8-16))+rax]

+ mov rsp,rax

+$L$epilogue_shaext:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_cbc_sha1_enc_shaext:

+EXTERN __imp_RtlVirtualUnwind

+

+ALIGN 16

+ssse3_handler:

+ push rsi

+ push rdi

+ push rbx

+ push rbp

+ push r12

+ push r13

+ push r14

+ push r15

+ pushfq

+ sub rsp,64

+

+ mov rax,QWORD[120+r8]

+ mov rbx,QWORD[248+r8]

+

+ mov rsi,QWORD[8+r9]

+ mov r11,QWORD[56+r9]

+

+ mov r10d,DWORD[r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jb NEAR $L$common_seh_tail

+

+ mov rax,QWORD[152+r8]

+

+ mov r10d,DWORD[4+r11]

+ lea r10,[r10*1+rsi]

+ cmp rbx,r10

+ jae NEAR $L$common_seh_tail

+ lea r10,[aesni_cbc_sha1_enc_shaext]

+ cmp rbx,r10

+ jb NEAR $L$seh_no_shaext

+

+ lea rsi,[rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+ lea rax,[168+rax]

+ jmp NEAR $L$common_seh_tail

+$L$seh_no_shaext:

+ lea rsi,[96+rax]

+ lea rdi,[512+r8]

+ mov ecx,20

+ DD 0xa548f3fc

+ lea rax,[264+rax]

+

+ mov r15,QWORD[rax]

+ mov r14,QWORD[8+rax]

+ mov r13,QWORD[16+rax]

+ mov r12,QWORD[24+rax]

+ mov rbp,QWORD[32+rax]

+ mov rbx,QWORD[40+rax]

+ lea rax,[48+rax]

+ mov QWORD[144+r8],rbx

+ mov QWORD[160+r8],rbp

+ mov QWORD[216+r8],r12

+ mov QWORD[224+r8],r13

+ mov QWORD[232+r8],r14

+ mov QWORD[240+r8],r15

+

+$L$common_seh_tail:

+ mov rdi,QWORD[8+rax]

+ mov rsi,QWORD[16+rax]

+ mov QWORD[152+r8],rax

+ mov QWORD[168+r8],rsi

+ mov QWORD[176+r8],rdi

+

+ mov rdi,QWORD[40+r9]

+ mov rsi,r8

+ mov ecx,154

+ DD 0xa548f3fc

+

+ mov rsi,r9

+ xor rcx,rcx

+ mov rdx,QWORD[8+rsi]

+ mov r8,QWORD[rsi]

+ mov r9,QWORD[16+rsi]

+ mov r10,QWORD[40+rsi]

+ lea r11,[56+rsi]

+ lea r12,[24+rsi]

+ mov QWORD[32+rsp],r10

+ mov QWORD[40+rsp],r11

+ mov QWORD[48+rsp],r12

+ mov QWORD[56+rsp],rcx

+ call QWORD[__imp_RtlVirtualUnwind]

+

+ mov eax,1

+ add rsp,64

+ popfq

+ pop r15

+ pop r14

+ pop r13

+ pop r12

+ pop rbp

+ pop rbx

+ pop rdi

+ pop rsi

+ DB 0F3h,0C3h ;repret

+

+

+section .pdata rdata align=4

+ALIGN 4

+ DD $L$SEH_begin_aesni_cbc_sha1_enc_ssse3 wrt ..imagebase

+ DD $L$SEH_end_aesni_cbc_sha1_enc_ssse3 wrt ..imagebase

+ DD $L$SEH_info_aesni_cbc_sha1_enc_ssse3 wrt ..imagebase

+ DD $L$SEH_begin_aesni_cbc_sha1_enc_shaext wrt ..imagebase

+ DD $L$SEH_end_aesni_cbc_sha1_enc_shaext wrt ..imagebase

+ DD $L$SEH_info_aesni_cbc_sha1_enc_shaext wrt ..imagebase

+section .xdata rdata align=8

+ALIGN 8

+$L$SEH_info_aesni_cbc_sha1_enc_ssse3:

+DB 9,0,0,0

+ DD ssse3_handler wrt ..imagebase

+ DD $L$prologue_ssse3 wrt ..imagebase,$L$epilogue_ssse3
wrt ..imagebase

+$L$SEH_info_aesni_cbc_sha1_enc_shaext:

+DB 9,0,0,0

+ DD ssse3_handler wrt ..imagebase

+ DD $L$prologue_shaext wrt ..imagebase,$L$epilogue_shaext
wrt ..imagebase

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-
x86_64.nasm b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-
x86_64.nasm
new file mode 100644
index 0000000000..f5c250b904
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-
x86_64.nasm
@@ -0,0 +1,78 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/aesni-sha256-x86_64.pl

+;

+; Copyright 2013-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+

+EXTERN OPENSSL_ia32cap_P

+global aesni_cbc_sha256_enc

+

+ALIGN 16

+aesni_cbc_sha256_enc:

+

+ xor eax,eax

+ cmp rcx,0

+ je NEAR $L$probe

+ ud2

+$L$probe:

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 64

+

+K256:

+ DD 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5

+ DD 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5

+ DD 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5

+ DD 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5

+ DD 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3

+ DD 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3

+ DD 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174

+ DD 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174

+ DD 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc

+ DD 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc

+ DD 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da

+ DD 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da

+ DD 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7

+ DD 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7

+ DD 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967

+ DD 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967

+ DD 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13

+ DD 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13

+ DD 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85

+ DD 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85

+ DD 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3

+ DD 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3

+ DD 0xd192e819,0xd6990624,0xf40e3585,0x106aa070

+ DD 0xd192e819,0xd6990624,0xf40e3585,0x106aa070

+ DD 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5

+ DD 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5

+ DD 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3

+ DD 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3

+ DD 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208

+ DD 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208

+ DD 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2

+ DD 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2

+

+ DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f

+ DD 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f

+ DD 0,0,0,0,0,0,0,0,-1,-1,-1,-1

+ DD 0,0,0,0,0,0,0,0

+DB 65,69,83,78,73,45,67,66,67,43,83,72,65,50,53,54

+DB 32,115,116,105,116,99,104,32,102,111,114,32,120,56,54,95

+DB 54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98

+DB 121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108

+DB 46,111,114,103,62,0

+ALIGN 64

diff --git a/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm
b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm
new file mode 100644
index 0000000000..57ee23ea8c
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm
@@ -0,0 +1,5103 @@
+; WARNING: do not edit!

+; Generated from openssl/crypto/aes/asm/aesni-x86_64.pl

+;

+; Copyright 2009-2020 The OpenSSL Project Authors. All Rights Reserved.

+;

+; Licensed under the OpenSSL license (the "License"). You may not use

+; this file except in compliance with the License. You can obtain a copy

+; in the file LICENSE in the source distribution or at

+; https://www.openssl.org/source/license.html

+

+default rel

+%define XMMWORD

+%define YMMWORD

+%define ZMMWORD

+section .text code align=64

+

+EXTERN OPENSSL_ia32cap_P

+global aesni_encrypt

+

+ALIGN 16

+aesni_encrypt:

+

+ movups xmm2,XMMWORD[rcx]

+ mov eax,DWORD[240+r8]

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[16+r8]

+ lea r8,[32+r8]

+ xorps xmm2,xmm0

+$L$oop_enc1_1:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[r8]

+ lea r8,[16+r8]

+ jnz NEAR $L$oop_enc1_1

+DB 102,15,56,221,209

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ movups XMMWORD[rdx],xmm2

+ pxor xmm2,xmm2

+ DB 0F3h,0C3h ;repret

+

+

+

+global aesni_decrypt

+

+ALIGN 16

+aesni_decrypt:

+

+ movups xmm2,XMMWORD[rcx]

+ mov eax,DWORD[240+r8]

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[16+r8]

+ lea r8,[32+r8]

+ xorps xmm2,xmm0

+$L$oop_dec1_2:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[r8]

+ lea r8,[16+r8]

+ jnz NEAR $L$oop_dec1_2

+DB 102,15,56,223,209

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ movups XMMWORD[rdx],xmm2

+ pxor xmm2,xmm2

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt2:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+ add rax,16

+

+$L$enc_loop2:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop2

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt2:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+ add rax,16

+

+$L$dec_loop2:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop2

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt3:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ xorps xmm4,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+ add rax,16

+

+$L$enc_loop3:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop3

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+DB 102,15,56,221,224

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt3:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ xorps xmm4,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+ add rax,16

+

+$L$dec_loop3:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop3

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+DB 102,15,56,223,224

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt4:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ xorps xmm4,xmm0

+ xorps xmm5,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 0x0f,0x1f,0x00

+ add rax,16

+

+$L$enc_loop4:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop4

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+DB 102,15,56,221,224

+DB 102,15,56,221,232

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt4:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ xorps xmm4,xmm0

+ xorps xmm5,xmm0

+ movups xmm0,XMMWORD[32+rcx]

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 0x0f,0x1f,0x00

+ add rax,16

+

+$L$dec_loop4:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop4

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+DB 102,15,56,223,224

+DB 102,15,56,223,232

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt6:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ pxor xmm3,xmm0

+ pxor xmm4,xmm0

+DB 102,15,56,220,209

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 102,15,56,220,217

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+DB 102,15,56,220,225

+ pxor xmm7,xmm0

+ movups xmm0,XMMWORD[rax*1+rcx]

+ add rax,16

+ jmp NEAR $L$enc_loop6_enter

+ALIGN 16

+$L$enc_loop6:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+$L$enc_loop6_enter:

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop6

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+DB 102,15,56,221,224

+DB 102,15,56,221,232

+DB 102,15,56,221,240

+DB 102,15,56,221,248

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt6:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ pxor xmm3,xmm0

+ pxor xmm4,xmm0

+DB 102,15,56,222,209

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 102,15,56,222,217

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+DB 102,15,56,222,225

+ pxor xmm7,xmm0

+ movups xmm0,XMMWORD[rax*1+rcx]

+ add rax,16

+ jmp NEAR $L$dec_loop6_enter

+ALIGN 16

+$L$dec_loop6:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+$L$dec_loop6_enter:

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop6

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+DB 102,15,56,223,224

+DB 102,15,56,223,232

+DB 102,15,56,223,240

+DB 102,15,56,223,248

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_encrypt8:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ pxor xmm4,xmm0

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 102,15,56,220,209

+ pxor xmm7,xmm0

+ pxor xmm8,xmm0

+DB 102,15,56,220,217

+ pxor xmm9,xmm0

+ movups xmm0,XMMWORD[rax*1+rcx]

+ add rax,16

+ jmp NEAR $L$enc_loop8_inner

+ALIGN 16

+$L$enc_loop8:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+$L$enc_loop8_inner:

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+$L$enc_loop8_enter:

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$enc_loop8

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+DB 102,15,56,221,224

+DB 102,15,56,221,232

+DB 102,15,56,221,240

+DB 102,15,56,221,248

+DB 102,68,15,56,221,192

+DB 102,68,15,56,221,200

+ DB 0F3h,0C3h ;repret

+

+

+

+ALIGN 16

+_aesni_decrypt8:

+

+ movups xmm0,XMMWORD[rcx]

+ shl eax,4

+ movups xmm1,XMMWORD[16+rcx]

+ xorps xmm2,xmm0

+ xorps xmm3,xmm0

+ pxor xmm4,xmm0

+ pxor xmm5,xmm0

+ pxor xmm6,xmm0

+ lea rcx,[32+rax*1+rcx]

+ neg rax

+DB 102,15,56,222,209

+ pxor xmm7,xmm0

+ pxor xmm8,xmm0

+DB 102,15,56,222,217

+ pxor xmm9,xmm0

+ movups xmm0,XMMWORD[rax*1+rcx]

+ add rax,16

+ jmp NEAR $L$dec_loop8_inner

+ALIGN 16

+$L$dec_loop8:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+$L$dec_loop8_inner:

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+$L$dec_loop8_enter:

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+DB 102,68,15,56,222,192

+DB 102,68,15,56,222,200

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$dec_loop8

+

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+DB 102,68,15,56,222,193

+DB 102,68,15,56,222,201

+DB 102,15,56,223,208

+DB 102,15,56,223,216

+DB 102,15,56,223,224

+DB 102,15,56,223,232

+DB 102,15,56,223,240

+DB 102,15,56,223,248

+DB 102,68,15,56,223,192

+DB 102,68,15,56,223,200

+ DB 0F3h,0C3h ;repret

+

+

+global aesni_ecb_encrypt

+

+ALIGN 16

+aesni_ecb_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ecb_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+

+

+

+ lea rsp,[((-88))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+$L$ecb_enc_body:

+ and rdx,-16

+ jz NEAR $L$ecb_ret

+

+ mov eax,DWORD[240+rcx]

+ movups xmm0,XMMWORD[rcx]

+ mov r11,rcx

+ mov r10d,eax

+ test r8d,r8d

+ jz NEAR $L$ecb_decrypt

+

+ cmp rdx,0x80

+ jb NEAR $L$ecb_enc_tail

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqu xmm7,XMMWORD[80+rdi]

+ movdqu xmm8,XMMWORD[96+rdi]

+ movdqu xmm9,XMMWORD[112+rdi]

+ lea rdi,[128+rdi]

+ sub rdx,0x80

+ jmp NEAR $L$ecb_enc_loop8_enter

+ALIGN 16

+$L$ecb_enc_loop8:

+ movups XMMWORD[rsi],xmm2

+ mov rcx,r11

+ movdqu xmm2,XMMWORD[rdi]

+ mov eax,r10d

+ movups XMMWORD[16+rsi],xmm3

+ movdqu xmm3,XMMWORD[16+rdi]

+ movups XMMWORD[32+rsi],xmm4

+ movdqu xmm4,XMMWORD[32+rdi]

+ movups XMMWORD[48+rsi],xmm5

+ movdqu xmm5,XMMWORD[48+rdi]

+ movups XMMWORD[64+rsi],xmm6

+ movdqu xmm6,XMMWORD[64+rdi]

+ movups XMMWORD[80+rsi],xmm7

+ movdqu xmm7,XMMWORD[80+rdi]

+ movups XMMWORD[96+rsi],xmm8

+ movdqu xmm8,XMMWORD[96+rdi]

+ movups XMMWORD[112+rsi],xmm9

+ lea rsi,[128+rsi]

+ movdqu xmm9,XMMWORD[112+rdi]

+ lea rdi,[128+rdi]

+$L$ecb_enc_loop8_enter:

+

+ call _aesni_encrypt8

+

+ sub rdx,0x80

+ jnc NEAR $L$ecb_enc_loop8

+

+ movups XMMWORD[rsi],xmm2

+ mov rcx,r11

+ movups XMMWORD[16+rsi],xmm3

+ mov eax,r10d

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ movups XMMWORD[80+rsi],xmm7

+ movups XMMWORD[96+rsi],xmm8

+ movups XMMWORD[112+rsi],xmm9

+ lea rsi,[128+rsi]

+ add rdx,0x80

+ jz NEAR $L$ecb_ret

+

+$L$ecb_enc_tail:

+ movups xmm2,XMMWORD[rdi]

+ cmp rdx,0x20

+ jb NEAR $L$ecb_enc_one

+ movups xmm3,XMMWORD[16+rdi]

+ je NEAR $L$ecb_enc_two

+ movups xmm4,XMMWORD[32+rdi]

+ cmp rdx,0x40

+ jb NEAR $L$ecb_enc_three

+ movups xmm5,XMMWORD[48+rdi]

+ je NEAR $L$ecb_enc_four

+ movups xmm6,XMMWORD[64+rdi]

+ cmp rdx,0x60

+ jb NEAR $L$ecb_enc_five

+ movups xmm7,XMMWORD[80+rdi]

+ je NEAR $L$ecb_enc_six

+ movdqu xmm8,XMMWORD[96+rdi]

+ xorps xmm9,xmm9

+ call _aesni_encrypt8

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ movups XMMWORD[80+rsi],xmm7

+ movups XMMWORD[96+rsi],xmm8

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_one:

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_3:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_3

+DB 102,15,56,221,209

+ movups XMMWORD[rsi],xmm2

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_two:

+ call _aesni_encrypt2

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_three:

+ call _aesni_encrypt3

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_four:

+ call _aesni_encrypt4

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_five:

+ xorps xmm7,xmm7

+ call _aesni_encrypt6

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_enc_six:

+ call _aesni_encrypt6

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ movups XMMWORD[80+rsi],xmm7

+ jmp NEAR $L$ecb_ret

+

+ALIGN 16

+$L$ecb_decrypt:

+ cmp rdx,0x80

+ jb NEAR $L$ecb_dec_tail

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqu xmm7,XMMWORD[80+rdi]

+ movdqu xmm8,XMMWORD[96+rdi]

+ movdqu xmm9,XMMWORD[112+rdi]

+ lea rdi,[128+rdi]

+ sub rdx,0x80

+ jmp NEAR $L$ecb_dec_loop8_enter

+ALIGN 16

+$L$ecb_dec_loop8:

+ movups XMMWORD[rsi],xmm2

+ mov rcx,r11

+ movdqu xmm2,XMMWORD[rdi]

+ mov eax,r10d

+ movups XMMWORD[16+rsi],xmm3

+ movdqu xmm3,XMMWORD[16+rdi]

+ movups XMMWORD[32+rsi],xmm4

+ movdqu xmm4,XMMWORD[32+rdi]

+ movups XMMWORD[48+rsi],xmm5

+ movdqu xmm5,XMMWORD[48+rdi]

+ movups XMMWORD[64+rsi],xmm6

+ movdqu xmm6,XMMWORD[64+rdi]

+ movups XMMWORD[80+rsi],xmm7

+ movdqu xmm7,XMMWORD[80+rdi]

+ movups XMMWORD[96+rsi],xmm8

+ movdqu xmm8,XMMWORD[96+rdi]

+ movups XMMWORD[112+rsi],xmm9

+ lea rsi,[128+rsi]

+ movdqu xmm9,XMMWORD[112+rdi]

+ lea rdi,[128+rdi]

+$L$ecb_dec_loop8_enter:

+

+ call _aesni_decrypt8

+

+ movups xmm0,XMMWORD[r11]

+ sub rdx,0x80

+ jnc NEAR $L$ecb_dec_loop8

+

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ mov rcx,r11

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ mov eax,r10d

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ movups XMMWORD[80+rsi],xmm7

+ pxor xmm7,xmm7

+ movups XMMWORD[96+rsi],xmm8

+ pxor xmm8,xmm8

+ movups XMMWORD[112+rsi],xmm9

+ pxor xmm9,xmm9

+ lea rsi,[128+rsi]

+ add rdx,0x80

+ jz NEAR $L$ecb_ret

+

+$L$ecb_dec_tail:

+ movups xmm2,XMMWORD[rdi]

+ cmp rdx,0x20

+ jb NEAR $L$ecb_dec_one

+ movups xmm3,XMMWORD[16+rdi]

+ je NEAR $L$ecb_dec_two

+ movups xmm4,XMMWORD[32+rdi]

+ cmp rdx,0x40

+ jb NEAR $L$ecb_dec_three

+ movups xmm5,XMMWORD[48+rdi]

+ je NEAR $L$ecb_dec_four

+ movups xmm6,XMMWORD[64+rdi]

+ cmp rdx,0x60

+ jb NEAR $L$ecb_dec_five

+ movups xmm7,XMMWORD[80+rdi]

+ je NEAR $L$ecb_dec_six

+ movups xmm8,XMMWORD[96+rdi]

+ movups xmm0,XMMWORD[rcx]

+ xorps xmm9,xmm9

+ call _aesni_decrypt8

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ movups XMMWORD[80+rsi],xmm7

+ pxor xmm7,xmm7

+ movups XMMWORD[96+rsi],xmm8

+ pxor xmm8,xmm8

+ pxor xmm9,xmm9

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_one:

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_4:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_4

+DB 102,15,56,223,209

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_two:

+ call _aesni_decrypt2

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_three:

+ call _aesni_decrypt3

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_four:

+ call _aesni_decrypt4

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_five:

+ xorps xmm7,xmm7

+ call _aesni_decrypt6

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ pxor xmm7,xmm7

+ jmp NEAR $L$ecb_ret

+ALIGN 16

+$L$ecb_dec_six:

+ call _aesni_decrypt6

+ movups XMMWORD[rsi],xmm2

+ pxor xmm2,xmm2

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[32+rsi],xmm4

+ pxor xmm4,xmm4

+ movups XMMWORD[48+rsi],xmm5

+ pxor xmm5,xmm5

+ movups XMMWORD[64+rsi],xmm6

+ pxor xmm6,xmm6

+ movups XMMWORD[80+rsi],xmm7

+ pxor xmm7,xmm7

+

+$L$ecb_ret:

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ movaps xmm6,XMMWORD[rsp]

+ movaps XMMWORD[rsp],xmm0

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ lea rsp,[88+rsp]

+$L$ecb_enc_ret:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ecb_encrypt:

+global aesni_ccm64_encrypt_blocks

+

+ALIGN 16

+aesni_ccm64_encrypt_blocks:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ccm64_encrypt_blocks:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea rsp,[((-88))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+$L$ccm64_enc_body:

+ mov eax,DWORD[240+rcx]

+ movdqu xmm6,XMMWORD[r8]

+ movdqa xmm9,XMMWORD[$L$increment64]

+ movdqa xmm7,XMMWORD[$L$bswap_mask]

+

+ shl eax,4

+ mov r10d,16

+ lea r11,[rcx]

+ movdqu xmm3,XMMWORD[r9]

+ movdqa xmm2,xmm6

+ lea rcx,[32+rax*1+rcx]

+DB 102,15,56,0,247

+ sub r10,rax

+ jmp NEAR $L$ccm64_enc_outer

+ALIGN 16

+$L$ccm64_enc_outer:

+ movups xmm0,XMMWORD[r11]

+ mov rax,r10

+ movups xmm8,XMMWORD[rdi]

+

+ xorps xmm2,xmm0

+ movups xmm1,XMMWORD[16+r11]

+ xorps xmm0,xmm8

+ xorps xmm3,xmm0

+ movups xmm0,XMMWORD[32+r11]

+

+$L$ccm64_enc2_loop:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ccm64_enc2_loop

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ paddq xmm6,xmm9

+ dec rdx

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+

+ lea rdi,[16+rdi]

+ xorps xmm8,xmm2

+ movdqa xmm2,xmm6

+ movups XMMWORD[rsi],xmm8

+DB 102,15,56,0,215

+ lea rsi,[16+rsi]

+ jnz NEAR $L$ccm64_enc_outer

+

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ movups XMMWORD[r9],xmm3

+ pxor xmm3,xmm3

+ pxor xmm8,xmm8

+ pxor xmm6,xmm6

+ movaps xmm6,XMMWORD[rsp]

+ movaps XMMWORD[rsp],xmm0

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ lea rsp,[88+rsp]

+$L$ccm64_enc_ret:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ccm64_encrypt_blocks:

+global aesni_ccm64_decrypt_blocks

+

+ALIGN 16

+aesni_ccm64_decrypt_blocks:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ccm64_decrypt_blocks:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea rsp,[((-88))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+$L$ccm64_dec_body:

+ mov eax,DWORD[240+rcx]

+ movups xmm6,XMMWORD[r8]

+ movdqu xmm3,XMMWORD[r9]

+ movdqa xmm9,XMMWORD[$L$increment64]

+ movdqa xmm7,XMMWORD[$L$bswap_mask]

+

+ movaps xmm2,xmm6

+ mov r10d,eax

+ mov r11,rcx

+DB 102,15,56,0,247

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_5:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_5

+DB 102,15,56,221,209

+ shl r10d,4

+ mov eax,16

+ movups xmm8,XMMWORD[rdi]

+ paddq xmm6,xmm9

+ lea rdi,[16+rdi]

+ sub rax,r10

+ lea rcx,[32+r10*1+r11]

+ mov r10,rax

+ jmp NEAR $L$ccm64_dec_outer

+ALIGN 16

+$L$ccm64_dec_outer:

+ xorps xmm8,xmm2

+ movdqa xmm2,xmm6

+ movups XMMWORD[rsi],xmm8

+ lea rsi,[16+rsi]

+DB 102,15,56,0,215

+

+ sub rdx,1

+ jz NEAR $L$ccm64_dec_break

+

+ movups xmm0,XMMWORD[r11]

+ mov rax,r10

+ movups xmm1,XMMWORD[16+r11]

+ xorps xmm8,xmm0

+ xorps xmm2,xmm0

+ xorps xmm3,xmm8

+ movups xmm0,XMMWORD[32+r11]

+ jmp NEAR $L$ccm64_dec2_loop

+ALIGN 16

+$L$ccm64_dec2_loop:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ movups xmm1,XMMWORD[rax*1+rcx]

+ add rax,32

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ movups xmm0,XMMWORD[((-16))+rax*1+rcx]

+ jnz NEAR $L$ccm64_dec2_loop

+ movups xmm8,XMMWORD[rdi]

+ paddq xmm6,xmm9

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,221,208

+DB 102,15,56,221,216

+ lea rdi,[16+rdi]

+ jmp NEAR $L$ccm64_dec_outer

+

+ALIGN 16

+$L$ccm64_dec_break:

+

+ mov eax,DWORD[240+r11]

+ movups xmm0,XMMWORD[r11]

+ movups xmm1,XMMWORD[16+r11]

+ xorps xmm8,xmm0

+ lea r11,[32+r11]

+ xorps xmm3,xmm8

+$L$oop_enc1_6:

+DB 102,15,56,220,217

+ dec eax

+ movups xmm1,XMMWORD[r11]

+ lea r11,[16+r11]

+ jnz NEAR $L$oop_enc1_6

+DB 102,15,56,221,217

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ movups XMMWORD[r9],xmm3

+ pxor xmm3,xmm3

+ pxor xmm8,xmm8

+ pxor xmm6,xmm6

+ movaps xmm6,XMMWORD[rsp]

+ movaps XMMWORD[rsp],xmm0

+ movaps xmm7,XMMWORD[16+rsp]

+ movaps XMMWORD[16+rsp],xmm0

+ movaps xmm8,XMMWORD[32+rsp]

+ movaps XMMWORD[32+rsp],xmm0

+ movaps xmm9,XMMWORD[48+rsp]

+ movaps XMMWORD[48+rsp],xmm0

+ lea rsp,[88+rsp]

+$L$ccm64_dec_ret:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ccm64_decrypt_blocks:

+global aesni_ctr32_encrypt_blocks

+

+ALIGN 16

+aesni_ctr32_encrypt_blocks:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ctr32_encrypt_blocks:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+

+

+

+ cmp rdx,1

+ jne NEAR $L$ctr32_bulk

+

+

+

+ movups xmm2,XMMWORD[r8]

+ movups xmm3,XMMWORD[rdi]

+ mov edx,DWORD[240+rcx]

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_7:

+DB 102,15,56,220,209

+ dec edx

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_7

+DB 102,15,56,221,209

+ pxor xmm0,xmm0

+ pxor xmm1,xmm1

+ xorps xmm2,xmm3

+ pxor xmm3,xmm3

+ movups XMMWORD[rsi],xmm2

+ xorps xmm2,xmm2

+ jmp NEAR $L$ctr32_epilogue

+

+ALIGN 16

+$L$ctr32_bulk:

+ lea r11,[rsp]

+

+ push rbp

+

+ sub rsp,288

+ and rsp,-16

+ movaps XMMWORD[(-168)+r11],xmm6

+ movaps XMMWORD[(-152)+r11],xmm7

+ movaps XMMWORD[(-136)+r11],xmm8

+ movaps XMMWORD[(-120)+r11],xmm9

+ movaps XMMWORD[(-104)+r11],xmm10

+ movaps XMMWORD[(-88)+r11],xmm11

+ movaps XMMWORD[(-72)+r11],xmm12

+ movaps XMMWORD[(-56)+r11],xmm13

+ movaps XMMWORD[(-40)+r11],xmm14

+ movaps XMMWORD[(-24)+r11],xmm15

+$L$ctr32_body:

+

+

+

+

+ movdqu xmm2,XMMWORD[r8]

+ movdqu xmm0,XMMWORD[rcx]

+ mov r8d,DWORD[12+r8]

+ pxor xmm2,xmm0

+ mov ebp,DWORD[12+rcx]

+ movdqa XMMWORD[rsp],xmm2

+ bswap r8d

+ movdqa xmm3,xmm2

+ movdqa xmm4,xmm2

+ movdqa xmm5,xmm2

+ movdqa XMMWORD[64+rsp],xmm2

+ movdqa XMMWORD[80+rsp],xmm2

+ movdqa XMMWORD[96+rsp],xmm2

+ mov r10,rdx

+ movdqa XMMWORD[112+rsp],xmm2

+

+ lea rax,[1+r8]

+ lea rdx,[2+r8]

+ bswap eax

+ bswap edx

+ xor eax,ebp

+ xor edx,ebp

+DB 102,15,58,34,216,3

+ lea rax,[3+r8]

+ movdqa XMMWORD[16+rsp],xmm3

+DB 102,15,58,34,226,3

+ bswap eax

+ mov rdx,r10

+ lea r10,[4+r8]

+ movdqa XMMWORD[32+rsp],xmm4

+ xor eax,ebp

+ bswap r10d

+DB 102,15,58,34,232,3

+ xor r10d,ebp

+ movdqa XMMWORD[48+rsp],xmm5

+ lea r9,[5+r8]

+ mov DWORD[((64+12))+rsp],r10d

+ bswap r9d

+ lea r10,[6+r8]

+ mov eax,DWORD[240+rcx]

+ xor r9d,ebp

+ bswap r10d

+ mov DWORD[((80+12))+rsp],r9d

+ xor r10d,ebp

+ lea r9,[7+r8]

+ mov DWORD[((96+12))+rsp],r10d

+ bswap r9d

+ mov r10d,DWORD[((OPENSSL_ia32cap_P+4))]

+ xor r9d,ebp

+ and r10d,71303168

+ mov DWORD[((112+12))+rsp],r9d

+

+ movups xmm1,XMMWORD[16+rcx]

+

+ movdqa xmm6,XMMWORD[64+rsp]

+ movdqa xmm7,XMMWORD[80+rsp]

+

+ cmp rdx,8

+ jb NEAR $L$ctr32_tail

+

+ sub rdx,6

+ cmp r10d,4194304

+ je NEAR $L$ctr32_6x

+

+ lea rcx,[128+rcx]

+ sub rdx,2

+ jmp NEAR $L$ctr32_loop8

+

+ALIGN 16

+$L$ctr32_6x:

+ shl eax,4

+ mov r10d,48

+ bswap ebp

+ lea rcx,[32+rax*1+rcx]

+ sub r10,rax

+ jmp NEAR $L$ctr32_loop6

+

+ALIGN 16

+$L$ctr32_loop6:

+ add r8d,6

+ movups xmm0,XMMWORD[((-48))+r10*1+rcx]

+DB 102,15,56,220,209

+ mov eax,r8d

+ xor eax,ebp

+DB 102,15,56,220,217

+DB 0x0f,0x38,0xf1,0x44,0x24,12

+ lea eax,[1+r8]

+DB 102,15,56,220,225

+ xor eax,ebp

+DB 0x0f,0x38,0xf1,0x44,0x24,28

+DB 102,15,56,220,233

+ lea eax,[2+r8]

+ xor eax,ebp

+DB 102,15,56,220,241

+DB 0x0f,0x38,0xf1,0x44,0x24,44

+ lea eax,[3+r8]

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[((-32))+r10*1+rcx]

+ xor eax,ebp

+

+DB 102,15,56,220,208

+DB 0x0f,0x38,0xf1,0x44,0x24,60

+ lea eax,[4+r8]

+DB 102,15,56,220,216

+ xor eax,ebp

+DB 0x0f,0x38,0xf1,0x44,0x24,76

+DB 102,15,56,220,224

+ lea eax,[5+r8]

+ xor eax,ebp

+DB 102,15,56,220,232

+DB 0x0f,0x38,0xf1,0x44,0x24,92

+ mov rax,r10

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-16))+r10*1+rcx]

+

+ call $L$enc_loop6

+

+ movdqu xmm8,XMMWORD[rdi]

+ movdqu xmm9,XMMWORD[16+rdi]

+ movdqu xmm10,XMMWORD[32+rdi]

+ movdqu xmm11,XMMWORD[48+rdi]

+ movdqu xmm12,XMMWORD[64+rdi]

+ movdqu xmm13,XMMWORD[80+rdi]

+ lea rdi,[96+rdi]

+ movups xmm1,XMMWORD[((-64))+r10*1+rcx]

+ pxor xmm8,xmm2

+ movaps xmm2,XMMWORD[rsp]

+ pxor xmm9,xmm3

+ movaps xmm3,XMMWORD[16+rsp]

+ pxor xmm10,xmm4

+ movaps xmm4,XMMWORD[32+rsp]

+ pxor xmm11,xmm5

+ movaps xmm5,XMMWORD[48+rsp]

+ pxor xmm12,xmm6

+ movaps xmm6,XMMWORD[64+rsp]

+ pxor xmm13,xmm7

+ movaps xmm7,XMMWORD[80+rsp]

+ movdqu XMMWORD[rsi],xmm8

+ movdqu XMMWORD[16+rsi],xmm9

+ movdqu XMMWORD[32+rsi],xmm10

+ movdqu XMMWORD[48+rsi],xmm11

+ movdqu XMMWORD[64+rsi],xmm12

+ movdqu XMMWORD[80+rsi],xmm13

+ lea rsi,[96+rsi]

+

+ sub rdx,6

+ jnc NEAR $L$ctr32_loop6

+

+ add rdx,6

+ jz NEAR $L$ctr32_done

+

+ lea eax,[((-48))+r10]

+ lea rcx,[((-80))+r10*1+rcx]

+ neg eax

+ shr eax,4

+ jmp NEAR $L$ctr32_tail

+

+ALIGN 32

+$L$ctr32_loop8:

+ add r8d,8

+ movdqa xmm8,XMMWORD[96+rsp]

+DB 102,15,56,220,209

+ mov r9d,r8d

+ movdqa xmm9,XMMWORD[112+rsp]

+DB 102,15,56,220,217

+ bswap r9d

+ movups xmm0,XMMWORD[((32-128))+rcx]

+DB 102,15,56,220,225

+ xor r9d,ebp

+ nop

+DB 102,15,56,220,233

+ mov DWORD[((0+12))+rsp],r9d

+ lea r9,[1+r8]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((48-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ mov DWORD[((16+12))+rsp],r9d

+ lea r9,[2+r8]

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((64-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ mov DWORD[((32+12))+rsp],r9d

+ lea r9,[3+r8]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((80-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ mov DWORD[((48+12))+rsp],r9d

+ lea r9,[4+r8]

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((96-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ mov DWORD[((64+12))+rsp],r9d

+ lea r9,[5+r8]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((112-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ mov DWORD[((80+12))+rsp],r9d

+ lea r9,[6+r8]

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((128-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ xor r9d,ebp

+DB 0x66,0x90

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ mov DWORD[((96+12))+rsp],r9d

+ lea r9,[7+r8]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((144-128))+rcx]

+ bswap r9d

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+ xor r9d,ebp

+ movdqu xmm10,XMMWORD[rdi]

+DB 102,15,56,220,232

+ mov DWORD[((112+12))+rsp],r9d

+ cmp eax,11

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((160-128))+rcx]

+

+ jb NEAR $L$ctr32_enc_done

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((176-128))+rcx]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((192-128))+rcx]

+ je NEAR $L$ctr32_enc_done

+

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movups xmm1,XMMWORD[((208-128))+rcx]

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+DB 102,68,15,56,220,192

+DB 102,68,15,56,220,200

+ movups xmm0,XMMWORD[((224-128))+rcx]

+ jmp NEAR $L$ctr32_enc_done

+

+ALIGN 16

+$L$ctr32_enc_done:

+ movdqu xmm11,XMMWORD[16+rdi]

+ pxor xmm10,xmm0

+ movdqu xmm12,XMMWORD[32+rdi]

+ pxor xmm11,xmm0

+ movdqu xmm13,XMMWORD[48+rdi]

+ pxor xmm12,xmm0

+ movdqu xmm14,XMMWORD[64+rdi]

+ pxor xmm13,xmm0

+ movdqu xmm15,XMMWORD[80+rdi]

+ pxor xmm14,xmm0

+ pxor xmm15,xmm0

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+DB 102,68,15,56,220,201

+ movdqu xmm1,XMMWORD[96+rdi]

+ lea rdi,[128+rdi]

+

+DB 102,65,15,56,221,210

+ pxor xmm1,xmm0

+ movdqu xmm10,XMMWORD[((112-128))+rdi]

+DB 102,65,15,56,221,219

+ pxor xmm10,xmm0

+ movdqa xmm11,XMMWORD[rsp]

+DB 102,65,15,56,221,228

+DB 102,65,15,56,221,237

+ movdqa xmm12,XMMWORD[16+rsp]

+ movdqa xmm13,XMMWORD[32+rsp]

+DB 102,65,15,56,221,246

+DB 102,65,15,56,221,255

+ movdqa xmm14,XMMWORD[48+rsp]

+ movdqa xmm15,XMMWORD[64+rsp]

+DB 102,68,15,56,221,193

+ movdqa xmm0,XMMWORD[80+rsp]

+ movups xmm1,XMMWORD[((16-128))+rcx]

+DB 102,69,15,56,221,202

+

+ movups XMMWORD[rsi],xmm2

+ movdqa xmm2,xmm11

+ movups XMMWORD[16+rsi],xmm3

+ movdqa xmm3,xmm12

+ movups XMMWORD[32+rsi],xmm4

+ movdqa xmm4,xmm13

+ movups XMMWORD[48+rsi],xmm5

+ movdqa xmm5,xmm14

+ movups XMMWORD[64+rsi],xmm6

+ movdqa xmm6,xmm15

+ movups XMMWORD[80+rsi],xmm7

+ movdqa xmm7,xmm0

+ movups XMMWORD[96+rsi],xmm8

+ movups XMMWORD[112+rsi],xmm9

+ lea rsi,[128+rsi]

+

+ sub rdx,8

+ jnc NEAR $L$ctr32_loop8

+

+ add rdx,8

+ jz NEAR $L$ctr32_done

+ lea rcx,[((-128))+rcx]

+

+$L$ctr32_tail:

+

+

+ lea rcx,[16+rcx]

+ cmp rdx,4

+ jb NEAR $L$ctr32_loop3

+ je NEAR $L$ctr32_loop4

+

+

+ shl eax,4

+ movdqa xmm8,XMMWORD[96+rsp]

+ pxor xmm9,xmm9

+

+ movups xmm0,XMMWORD[16+rcx]

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+ lea rcx,[((32-16))+rax*1+rcx]

+ neg rax

+DB 102,15,56,220,225

+ add rax,16

+ movups xmm10,XMMWORD[rdi]

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+ movups xmm11,XMMWORD[16+rdi]

+ movups xmm12,XMMWORD[32+rdi]

+DB 102,15,56,220,249

+DB 102,68,15,56,220,193

+

+ call $L$enc_loop8_enter

+

+ movdqu xmm13,XMMWORD[48+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm10,XMMWORD[64+rdi]

+ pxor xmm3,xmm11

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm4,xmm12

+ movdqu XMMWORD[16+rsi],xmm3

+ pxor xmm5,xmm13

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm6,xmm10

+ movdqu XMMWORD[48+rsi],xmm5

+ movdqu XMMWORD[64+rsi],xmm6

+ cmp rdx,6

+ jb NEAR $L$ctr32_done

+

+ movups xmm11,XMMWORD[80+rdi]

+ xorps xmm7,xmm11

+ movups XMMWORD[80+rsi],xmm7

+ je NEAR $L$ctr32_done

+

+ movups xmm12,XMMWORD[96+rdi]

+ xorps xmm8,xmm12

+ movups XMMWORD[96+rsi],xmm8

+ jmp NEAR $L$ctr32_done

+

+ALIGN 32

+$L$ctr32_loop4:

+DB 102,15,56,220,209

+ lea rcx,[16+rcx]

+ dec eax

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movups xmm1,XMMWORD[rcx]

+ jnz NEAR $L$ctr32_loop4

+DB 102,15,56,221,209

+DB 102,15,56,221,217

+ movups xmm10,XMMWORD[rdi]

+ movups xmm11,XMMWORD[16+rdi]

+DB 102,15,56,221,225

+DB 102,15,56,221,233

+ movups xmm12,XMMWORD[32+rdi]

+ movups xmm13,XMMWORD[48+rdi]

+

+ xorps xmm2,xmm10

+ movups XMMWORD[rsi],xmm2

+ xorps xmm3,xmm11

+ movups XMMWORD[16+rsi],xmm3

+ pxor xmm4,xmm12

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm5,xmm13

+ movdqu XMMWORD[48+rsi],xmm5

+ jmp NEAR $L$ctr32_done

+

+ALIGN 32

+$L$ctr32_loop3:

+DB 102,15,56,220,209

+ lea rcx,[16+rcx]

+ dec eax

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+ movups xmm1,XMMWORD[rcx]

+ jnz NEAR $L$ctr32_loop3

+DB 102,15,56,221,209

+DB 102,15,56,221,217

+DB 102,15,56,221,225

+

+ movups xmm10,XMMWORD[rdi]

+ xorps xmm2,xmm10

+ movups XMMWORD[rsi],xmm2

+ cmp rdx,2

+ jb NEAR $L$ctr32_done

+

+ movups xmm11,XMMWORD[16+rdi]

+ xorps xmm3,xmm11

+ movups XMMWORD[16+rsi],xmm3

+ je NEAR $L$ctr32_done

+

+ movups xmm12,XMMWORD[32+rdi]

+ xorps xmm4,xmm12

+ movups XMMWORD[32+rsi],xmm4

+

+$L$ctr32_done:

+ xorps xmm0,xmm0

+ xor ebp,ebp

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ movaps xmm6,XMMWORD[((-168))+r11]

+ movaps XMMWORD[(-168)+r11],xmm0

+ movaps xmm7,XMMWORD[((-152))+r11]

+ movaps XMMWORD[(-152)+r11],xmm0

+ movaps xmm8,XMMWORD[((-136))+r11]

+ movaps XMMWORD[(-136)+r11],xmm0

+ movaps xmm9,XMMWORD[((-120))+r11]

+ movaps XMMWORD[(-120)+r11],xmm0

+ movaps xmm10,XMMWORD[((-104))+r11]

+ movaps XMMWORD[(-104)+r11],xmm0

+ movaps xmm11,XMMWORD[((-88))+r11]

+ movaps XMMWORD[(-88)+r11],xmm0

+ movaps xmm12,XMMWORD[((-72))+r11]

+ movaps XMMWORD[(-72)+r11],xmm0

+ movaps xmm13,XMMWORD[((-56))+r11]

+ movaps XMMWORD[(-56)+r11],xmm0

+ movaps xmm14,XMMWORD[((-40))+r11]

+ movaps XMMWORD[(-40)+r11],xmm0

+ movaps xmm15,XMMWORD[((-24))+r11]

+ movaps XMMWORD[(-24)+r11],xmm0

+ movaps XMMWORD[rsp],xmm0

+ movaps XMMWORD[16+rsp],xmm0

+ movaps XMMWORD[32+rsp],xmm0

+ movaps XMMWORD[48+rsp],xmm0

+ movaps XMMWORD[64+rsp],xmm0

+ movaps XMMWORD[80+rsp],xmm0

+ movaps XMMWORD[96+rsp],xmm0

+ movaps XMMWORD[112+rsp],xmm0

+ mov rbp,QWORD[((-8))+r11]

+

+ lea rsp,[r11]

+

+$L$ctr32_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_ctr32_encrypt_blocks:

+global aesni_xts_encrypt

+

+ALIGN 16

+aesni_xts_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_xts_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea r11,[rsp]

+

+ push rbp

+

+ sub rsp,272

+ and rsp,-16

+ movaps XMMWORD[(-168)+r11],xmm6

+ movaps XMMWORD[(-152)+r11],xmm7

+ movaps XMMWORD[(-136)+r11],xmm8

+ movaps XMMWORD[(-120)+r11],xmm9

+ movaps XMMWORD[(-104)+r11],xmm10

+ movaps XMMWORD[(-88)+r11],xmm11

+ movaps XMMWORD[(-72)+r11],xmm12

+ movaps XMMWORD[(-56)+r11],xmm13

+ movaps XMMWORD[(-40)+r11],xmm14

+ movaps XMMWORD[(-24)+r11],xmm15

+$L$xts_enc_body:

+ movups xmm2,XMMWORD[r9]

+ mov eax,DWORD[240+r8]

+ mov r10d,DWORD[240+rcx]

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[16+r8]

+ lea r8,[32+r8]

+ xorps xmm2,xmm0

+$L$oop_enc1_8:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[r8]

+ lea r8,[16+r8]

+ jnz NEAR $L$oop_enc1_8

+DB 102,15,56,221,209

+ movups xmm0,XMMWORD[rcx]

+ mov rbp,rcx

+ mov eax,r10d

+ shl r10d,4

+ mov r9,rdx

+ and rdx,-16

+

+ movups xmm1,XMMWORD[16+r10*1+rcx]

+

+ movdqa xmm8,XMMWORD[$L$xts_magic]

+ movdqa xmm15,xmm2

+ pshufd xmm9,xmm2,0x5f

+ pxor xmm1,xmm0

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm10,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm10,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm11,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm11,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm12,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm12,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm13,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm13,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm15

+ psrad xmm9,31

+ paddq xmm15,xmm15

+ pand xmm9,xmm8

+ pxor xmm14,xmm0

+ pxor xmm15,xmm9

+ movaps XMMWORD[96+rsp],xmm1

+

+ sub rdx,16*6

+ jc NEAR $L$xts_enc_short

+

+ mov eax,16+96

+ lea rcx,[32+r10*1+rbp]

+ sub rax,r10

+ movups xmm1,XMMWORD[16+rbp]

+ mov r10,rax

+ lea r8,[$L$xts_magic]

+ jmp NEAR $L$xts_enc_grandloop

+

+ALIGN 32

+$L$xts_enc_grandloop:

+ movdqu xmm2,XMMWORD[rdi]

+ movdqa xmm8,xmm0

+ movdqu xmm3,XMMWORD[16+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm4,XMMWORD[32+rdi]

+ pxor xmm3,xmm11

+DB 102,15,56,220,209

+ movdqu xmm5,XMMWORD[48+rdi]

+ pxor xmm4,xmm12

+DB 102,15,56,220,217

+ movdqu xmm6,XMMWORD[64+rdi]

+ pxor xmm5,xmm13

+DB 102,15,56,220,225

+ movdqu xmm7,XMMWORD[80+rdi]

+ pxor xmm8,xmm15

+ movdqa xmm9,XMMWORD[96+rsp]

+ pxor xmm6,xmm14

+DB 102,15,56,220,233

+ movups xmm0,XMMWORD[32+rbp]

+ lea rdi,[96+rdi]

+ pxor xmm7,xmm8

+

+ pxor xmm10,xmm9

+DB 102,15,56,220,241

+ pxor xmm11,xmm9

+ movdqa XMMWORD[rsp],xmm10

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[48+rbp]

+ pxor xmm12,xmm9

+

+DB 102,15,56,220,208

+ pxor xmm13,xmm9

+ movdqa XMMWORD[16+rsp],xmm11

+DB 102,15,56,220,216

+ pxor xmm14,xmm9

+ movdqa XMMWORD[32+rsp],xmm12

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ pxor xmm8,xmm9

+ movdqa XMMWORD[64+rsp],xmm14

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[64+rbp]

+ movdqa XMMWORD[80+rsp],xmm8

+ pshufd xmm9,xmm15,0x5f

+ jmp NEAR $L$xts_enc_loop6

+ALIGN 32

+$L$xts_enc_loop6:

+DB 102,15,56,220,209

+DB 102,15,56,220,217

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[((-64))+rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,220,208

+DB 102,15,56,220,216

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-80))+rax*1+rcx]

+ jnz NEAR $L$xts_enc_loop6

+

+ movdqa xmm8,XMMWORD[r8]

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+DB 102,15,56,220,209

+ paddq xmm15,xmm15

+ psrad xmm14,31

+DB 102,15,56,220,217

+ pand xmm14,xmm8

+ movups xmm10,XMMWORD[rbp]

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+DB 102,15,56,220,241

+ pxor xmm15,xmm14

+ movaps xmm11,xmm10

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[((-64))+rcx]

+

+ movdqa xmm14,xmm9

+DB 102,15,56,220,208

+ paddd xmm9,xmm9

+ pxor xmm10,xmm15

+DB 102,15,56,220,216

+ psrad xmm14,31

+ paddq xmm15,xmm15

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+ pand xmm14,xmm8

+ movaps xmm12,xmm11

+DB 102,15,56,220,240

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+DB 102,15,56,220,248

+ movups xmm0,XMMWORD[((-48))+rcx]

+

+ paddd xmm9,xmm9

+DB 102,15,56,220,209

+ pxor xmm11,xmm15

+ psrad xmm14,31

+DB 102,15,56,220,217

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ movdqa XMMWORD[48+rsp],xmm13

+ pxor xmm15,xmm14

+DB 102,15,56,220,241

+ movaps xmm13,xmm12

+ movdqa xmm14,xmm9

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[((-32))+rcx]

+

+ paddd xmm9,xmm9

+DB 102,15,56,220,208

+ pxor xmm12,xmm15

+ psrad xmm14,31

+DB 102,15,56,220,216

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+DB 102,15,56,220,224

+DB 102,15,56,220,232

+DB 102,15,56,220,240

+ pxor xmm15,xmm14

+ movaps xmm14,xmm13

+DB 102,15,56,220,248

+

+ movdqa xmm0,xmm9

+ paddd xmm9,xmm9

+DB 102,15,56,220,209

+ pxor xmm13,xmm15

+ psrad xmm0,31

+DB 102,15,56,220,217

+ paddq xmm15,xmm15

+ pand xmm0,xmm8

+DB 102,15,56,220,225

+DB 102,15,56,220,233

+ pxor xmm15,xmm0

+ movups xmm0,XMMWORD[rbp]

+DB 102,15,56,220,241

+DB 102,15,56,220,249

+ movups xmm1,XMMWORD[16+rbp]

+

+ pxor xmm14,xmm15

+DB 102,15,56,221,84,36,0

+ psrad xmm9,31

+ paddq xmm15,xmm15

+DB 102,15,56,221,92,36,16

+DB 102,15,56,221,100,36,32

+ pand xmm9,xmm8

+ mov rax,r10

+DB 102,15,56,221,108,36,48

+DB 102,15,56,221,116,36,64

+DB 102,15,56,221,124,36,80

+ pxor xmm15,xmm9

+

+ lea rsi,[96+rsi]

+ movups XMMWORD[(-96)+rsi],xmm2

+ movups XMMWORD[(-80)+rsi],xmm3

+ movups XMMWORD[(-64)+rsi],xmm4

+ movups XMMWORD[(-48)+rsi],xmm5

+ movups XMMWORD[(-32)+rsi],xmm6

+ movups XMMWORD[(-16)+rsi],xmm7

+ sub rdx,16*6

+ jnc NEAR $L$xts_enc_grandloop

+

+ mov eax,16+96

+ sub eax,r10d

+ mov rcx,rbp

+ shr eax,4

+

+$L$xts_enc_short:

+

+ mov r10d,eax

+ pxor xmm10,xmm0

+ add rdx,16*6

+ jz NEAR $L$xts_enc_done

+

+ pxor xmm11,xmm0

+ cmp rdx,0x20

+ jb NEAR $L$xts_enc_one

+ pxor xmm12,xmm0

+ je NEAR $L$xts_enc_two

+

+ pxor xmm13,xmm0

+ cmp rdx,0x40

+ jb NEAR $L$xts_enc_three

+ pxor xmm14,xmm0

+ je NEAR $L$xts_enc_four

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm5,XMMWORD[48+rdi]

+ pxor xmm3,xmm11

+ movdqu xmm6,XMMWORD[64+rdi]

+ lea rdi,[80+rdi]

+ pxor xmm4,xmm12

+ pxor xmm5,xmm13

+ pxor xmm6,xmm14

+ pxor xmm7,xmm7

+

+ call _aesni_encrypt6

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm15

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ movdqu XMMWORD[rsi],xmm2

+ xorps xmm5,xmm13

+ movdqu XMMWORD[16+rsi],xmm3

+ xorps xmm6,xmm14

+ movdqu XMMWORD[32+rsi],xmm4

+ movdqu XMMWORD[48+rsi],xmm5

+ movdqu XMMWORD[64+rsi],xmm6

+ lea rsi,[80+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_one:

+ movups xmm2,XMMWORD[rdi]

+ lea rdi,[16+rdi]

+ xorps xmm2,xmm10

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_9:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_9

+DB 102,15,56,221,209

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm11

+ movups XMMWORD[rsi],xmm2

+ lea rsi,[16+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_two:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ lea rdi,[32+rdi]

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+

+ call _aesni_encrypt2

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm12

+ xorps xmm3,xmm11

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ lea rsi,[32+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_three:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ movups xmm4,XMMWORD[32+rdi]

+ lea rdi,[48+rdi]

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+

+ call _aesni_encrypt3

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm13

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ lea rsi,[48+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_four:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ movups xmm4,XMMWORD[32+rdi]

+ xorps xmm2,xmm10

+ movups xmm5,XMMWORD[48+rdi]

+ lea rdi,[64+rdi]

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ xorps xmm5,xmm13

+

+ call _aesni_encrypt4

+

+ pxor xmm2,xmm10

+ movdqa xmm10,xmm14

+ pxor xmm3,xmm11

+ pxor xmm4,xmm12

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm5,xmm13

+ movdqu XMMWORD[16+rsi],xmm3

+ movdqu XMMWORD[32+rsi],xmm4

+ movdqu XMMWORD[48+rsi],xmm5

+ lea rsi,[64+rsi]

+ jmp NEAR $L$xts_enc_done

+

+ALIGN 16

+$L$xts_enc_done:

+ and r9,15

+ jz NEAR $L$xts_enc_ret

+ mov rdx,r9

+

+$L$xts_enc_steal:

+ movzx eax,BYTE[rdi]

+ movzx ecx,BYTE[((-16))+rsi]

+ lea rdi,[1+rdi]

+ mov BYTE[((-16))+rsi],al

+ mov BYTE[rsi],cl

+ lea rsi,[1+rsi]

+ sub rdx,1

+ jnz NEAR $L$xts_enc_steal

+

+ sub rsi,r9

+ mov rcx,rbp

+ mov eax,r10d

+

+ movups xmm2,XMMWORD[((-16))+rsi]

+ xorps xmm2,xmm10

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_enc1_10:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_enc1_10

+DB 102,15,56,221,209

+ xorps xmm2,xmm10

+ movups XMMWORD[(-16)+rsi],xmm2

+

+$L$xts_enc_ret:

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ movaps xmm6,XMMWORD[((-168))+r11]

+ movaps XMMWORD[(-168)+r11],xmm0

+ movaps xmm7,XMMWORD[((-152))+r11]

+ movaps XMMWORD[(-152)+r11],xmm0

+ movaps xmm8,XMMWORD[((-136))+r11]

+ movaps XMMWORD[(-136)+r11],xmm0

+ movaps xmm9,XMMWORD[((-120))+r11]

+ movaps XMMWORD[(-120)+r11],xmm0

+ movaps xmm10,XMMWORD[((-104))+r11]

+ movaps XMMWORD[(-104)+r11],xmm0

+ movaps xmm11,XMMWORD[((-88))+r11]

+ movaps XMMWORD[(-88)+r11],xmm0

+ movaps xmm12,XMMWORD[((-72))+r11]

+ movaps XMMWORD[(-72)+r11],xmm0

+ movaps xmm13,XMMWORD[((-56))+r11]

+ movaps XMMWORD[(-56)+r11],xmm0

+ movaps xmm14,XMMWORD[((-40))+r11]

+ movaps XMMWORD[(-40)+r11],xmm0

+ movaps xmm15,XMMWORD[((-24))+r11]

+ movaps XMMWORD[(-24)+r11],xmm0

+ movaps XMMWORD[rsp],xmm0

+ movaps XMMWORD[16+rsp],xmm0

+ movaps XMMWORD[32+rsp],xmm0

+ movaps XMMWORD[48+rsp],xmm0

+ movaps XMMWORD[64+rsp],xmm0

+ movaps XMMWORD[80+rsp],xmm0

+ movaps XMMWORD[96+rsp],xmm0

+ mov rbp,QWORD[((-8))+r11]

+

+ lea rsp,[r11]

+

+$L$xts_enc_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_xts_encrypt:

+global aesni_xts_decrypt

+

+ALIGN 16

+aesni_xts_decrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_xts_decrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea r11,[rsp]

+

+ push rbp

+

+ sub rsp,272

+ and rsp,-16

+ movaps XMMWORD[(-168)+r11],xmm6

+ movaps XMMWORD[(-152)+r11],xmm7

+ movaps XMMWORD[(-136)+r11],xmm8

+ movaps XMMWORD[(-120)+r11],xmm9

+ movaps XMMWORD[(-104)+r11],xmm10

+ movaps XMMWORD[(-88)+r11],xmm11

+ movaps XMMWORD[(-72)+r11],xmm12

+ movaps XMMWORD[(-56)+r11],xmm13

+ movaps XMMWORD[(-40)+r11],xmm14

+ movaps XMMWORD[(-24)+r11],xmm15

+$L$xts_dec_body:

+ movups xmm2,XMMWORD[r9]

+ mov eax,DWORD[240+r8]

+ mov r10d,DWORD[240+rcx]

+ movups xmm0,XMMWORD[r8]

+ movups xmm1,XMMWORD[16+r8]

+ lea r8,[32+r8]

+ xorps xmm2,xmm0

+$L$oop_enc1_11:

+DB 102,15,56,220,209

+ dec eax

+ movups xmm1,XMMWORD[r8]

+ lea r8,[16+r8]

+ jnz NEAR $L$oop_enc1_11

+DB 102,15,56,221,209

+ xor eax,eax

+ test rdx,15

+ setnz al

+ shl rax,4

+ sub rdx,rax

+

+ movups xmm0,XMMWORD[rcx]

+ mov rbp,rcx

+ mov eax,r10d

+ shl r10d,4

+ mov r9,rdx

+ and rdx,-16

+

+ movups xmm1,XMMWORD[16+r10*1+rcx]

+

+ movdqa xmm8,XMMWORD[$L$xts_magic]

+ movdqa xmm15,xmm2

+ pshufd xmm9,xmm2,0x5f

+ pxor xmm1,xmm0

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm10,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm10,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm11,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm11,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm12,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm12,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+ movdqa xmm13,xmm15

+ psrad xmm14,31

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+ pxor xmm13,xmm0

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm15

+ psrad xmm9,31

+ paddq xmm15,xmm15

+ pand xmm9,xmm8

+ pxor xmm14,xmm0

+ pxor xmm15,xmm9

+ movaps XMMWORD[96+rsp],xmm1

+

+ sub rdx,16*6

+ jc NEAR $L$xts_dec_short

+

+ mov eax,16+96

+ lea rcx,[32+r10*1+rbp]

+ sub rax,r10

+ movups xmm1,XMMWORD[16+rbp]

+ mov r10,rax

+ lea r8,[$L$xts_magic]

+ jmp NEAR $L$xts_dec_grandloop

+

+ALIGN 32

+$L$xts_dec_grandloop:

+ movdqu xmm2,XMMWORD[rdi]

+ movdqa xmm8,xmm0

+ movdqu xmm3,XMMWORD[16+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm4,XMMWORD[32+rdi]

+ pxor xmm3,xmm11

+DB 102,15,56,222,209

+ movdqu xmm5,XMMWORD[48+rdi]

+ pxor xmm4,xmm12

+DB 102,15,56,222,217

+ movdqu xmm6,XMMWORD[64+rdi]

+ pxor xmm5,xmm13

+DB 102,15,56,222,225

+ movdqu xmm7,XMMWORD[80+rdi]

+ pxor xmm8,xmm15

+ movdqa xmm9,XMMWORD[96+rsp]

+ pxor xmm6,xmm14

+DB 102,15,56,222,233

+ movups xmm0,XMMWORD[32+rbp]

+ lea rdi,[96+rdi]

+ pxor xmm7,xmm8

+

+ pxor xmm10,xmm9

+DB 102,15,56,222,241

+ pxor xmm11,xmm9

+ movdqa XMMWORD[rsp],xmm10

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[48+rbp]

+ pxor xmm12,xmm9

+

+DB 102,15,56,222,208

+ pxor xmm13,xmm9

+ movdqa XMMWORD[16+rsp],xmm11

+DB 102,15,56,222,216

+ pxor xmm14,xmm9

+ movdqa XMMWORD[32+rsp],xmm12

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ pxor xmm8,xmm9

+ movdqa XMMWORD[64+rsp],xmm14

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[64+rbp]

+ movdqa XMMWORD[80+rsp],xmm8

+ pshufd xmm9,xmm15,0x5f

+ jmp NEAR $L$xts_dec_loop6

+ALIGN 32

+$L$xts_dec_loop6:

+DB 102,15,56,222,209

+DB 102,15,56,222,217

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[((-64))+rax*1+rcx]

+ add rax,32

+

+DB 102,15,56,222,208

+DB 102,15,56,222,216

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[((-80))+rax*1+rcx]

+ jnz NEAR $L$xts_dec_loop6

+

+ movdqa xmm8,XMMWORD[r8]

+ movdqa xmm14,xmm9

+ paddd xmm9,xmm9

+DB 102,15,56,222,209

+ paddq xmm15,xmm15

+ psrad xmm14,31

+DB 102,15,56,222,217

+ pand xmm14,xmm8

+ movups xmm10,XMMWORD[rbp]

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+DB 102,15,56,222,241

+ pxor xmm15,xmm14

+ movaps xmm11,xmm10

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[((-64))+rcx]

+

+ movdqa xmm14,xmm9

+DB 102,15,56,222,208

+ paddd xmm9,xmm9

+ pxor xmm10,xmm15

+DB 102,15,56,222,216

+ psrad xmm14,31

+ paddq xmm15,xmm15

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+ pand xmm14,xmm8

+ movaps xmm12,xmm11

+DB 102,15,56,222,240

+ pxor xmm15,xmm14

+ movdqa xmm14,xmm9

+DB 102,15,56,222,248

+ movups xmm0,XMMWORD[((-48))+rcx]

+

+ paddd xmm9,xmm9

+DB 102,15,56,222,209

+ pxor xmm11,xmm15

+ psrad xmm14,31

+DB 102,15,56,222,217

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ movdqa XMMWORD[48+rsp],xmm13

+ pxor xmm15,xmm14

+DB 102,15,56,222,241

+ movaps xmm13,xmm12

+ movdqa xmm14,xmm9

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[((-32))+rcx]

+

+ paddd xmm9,xmm9

+DB 102,15,56,222,208

+ pxor xmm12,xmm15

+ psrad xmm14,31

+DB 102,15,56,222,216

+ paddq xmm15,xmm15

+ pand xmm14,xmm8

+DB 102,15,56,222,224

+DB 102,15,56,222,232

+DB 102,15,56,222,240

+ pxor xmm15,xmm14

+ movaps xmm14,xmm13

+DB 102,15,56,222,248

+

+ movdqa xmm0,xmm9

+ paddd xmm9,xmm9

+DB 102,15,56,222,209

+ pxor xmm13,xmm15

+ psrad xmm0,31

+DB 102,15,56,222,217

+ paddq xmm15,xmm15

+ pand xmm0,xmm8

+DB 102,15,56,222,225

+DB 102,15,56,222,233

+ pxor xmm15,xmm0

+ movups xmm0,XMMWORD[rbp]

+DB 102,15,56,222,241

+DB 102,15,56,222,249

+ movups xmm1,XMMWORD[16+rbp]

+

+ pxor xmm14,xmm15

+DB 102,15,56,223,84,36,0

+ psrad xmm9,31

+ paddq xmm15,xmm15

+DB 102,15,56,223,92,36,16

+DB 102,15,56,223,100,36,32

+ pand xmm9,xmm8

+ mov rax,r10

+DB 102,15,56,223,108,36,48

+DB 102,15,56,223,116,36,64

+DB 102,15,56,223,124,36,80

+ pxor xmm15,xmm9

+

+ lea rsi,[96+rsi]

+ movups XMMWORD[(-96)+rsi],xmm2

+ movups XMMWORD[(-80)+rsi],xmm3

+ movups XMMWORD[(-64)+rsi],xmm4

+ movups XMMWORD[(-48)+rsi],xmm5

+ movups XMMWORD[(-32)+rsi],xmm6

+ movups XMMWORD[(-16)+rsi],xmm7

+ sub rdx,16*6

+ jnc NEAR $L$xts_dec_grandloop

+

+ mov eax,16+96

+ sub eax,r10d

+ mov rcx,rbp

+ shr eax,4

+

+$L$xts_dec_short:

+

+ mov r10d,eax

+ pxor xmm10,xmm0

+ pxor xmm11,xmm0

+ add rdx,16*6

+ jz NEAR $L$xts_dec_done

+

+ pxor xmm12,xmm0

+ cmp rdx,0x20

+ jb NEAR $L$xts_dec_one

+ pxor xmm13,xmm0

+ je NEAR $L$xts_dec_two

+

+ pxor xmm14,xmm0

+ cmp rdx,0x40

+ jb NEAR $L$xts_dec_three

+ je NEAR $L$xts_dec_four

+

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ pxor xmm2,xmm10

+ movdqu xmm5,XMMWORD[48+rdi]

+ pxor xmm3,xmm11

+ movdqu xmm6,XMMWORD[64+rdi]

+ lea rdi,[80+rdi]

+ pxor xmm4,xmm12

+ pxor xmm5,xmm13

+ pxor xmm6,xmm14

+

+ call _aesni_decrypt6

+

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ movdqu XMMWORD[rsi],xmm2

+ xorps xmm5,xmm13

+ movdqu XMMWORD[16+rsi],xmm3

+ xorps xmm6,xmm14

+ movdqu XMMWORD[32+rsi],xmm4

+ pxor xmm14,xmm14

+ movdqu XMMWORD[48+rsi],xmm5

+ pcmpgtd xmm14,xmm15

+ movdqu XMMWORD[64+rsi],xmm6

+ lea rsi,[80+rsi]

+ pshufd xmm11,xmm14,0x13

+ and r9,15

+ jz NEAR $L$xts_dec_ret

+

+ movdqa xmm10,xmm15

+ paddq xmm15,xmm15

+ pand xmm11,xmm8

+ pxor xmm11,xmm15

+ jmp NEAR $L$xts_dec_done2

+

+ALIGN 16

+$L$xts_dec_one:

+ movups xmm2,XMMWORD[rdi]

+ lea rdi,[16+rdi]

+ xorps xmm2,xmm10

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_12:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_12

+DB 102,15,56,223,209

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm11

+ movups XMMWORD[rsi],xmm2

+ movdqa xmm11,xmm12

+ lea rsi,[16+rsi]

+ jmp NEAR $L$xts_dec_done

+

+ALIGN 16

+$L$xts_dec_two:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ lea rdi,[32+rdi]

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+

+ call _aesni_decrypt2

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm12

+ xorps xmm3,xmm11

+ movdqa xmm11,xmm13

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ lea rsi,[32+rsi]

+ jmp NEAR $L$xts_dec_done

+

+ALIGN 16

+$L$xts_dec_three:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ movups xmm4,XMMWORD[32+rdi]

+ lea rdi,[48+rdi]

+ xorps xmm2,xmm10

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+

+ call _aesni_decrypt3

+

+ xorps xmm2,xmm10

+ movdqa xmm10,xmm13

+ xorps xmm3,xmm11

+ movdqa xmm11,xmm14

+ xorps xmm4,xmm12

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ lea rsi,[48+rsi]

+ jmp NEAR $L$xts_dec_done

+

+ALIGN 16

+$L$xts_dec_four:

+ movups xmm2,XMMWORD[rdi]

+ movups xmm3,XMMWORD[16+rdi]

+ movups xmm4,XMMWORD[32+rdi]

+ xorps xmm2,xmm10

+ movups xmm5,XMMWORD[48+rdi]

+ lea rdi,[64+rdi]

+ xorps xmm3,xmm11

+ xorps xmm4,xmm12

+ xorps xmm5,xmm13

+

+ call _aesni_decrypt4

+

+ pxor xmm2,xmm10

+ movdqa xmm10,xmm14

+ pxor xmm3,xmm11

+ movdqa xmm11,xmm15

+ pxor xmm4,xmm12

+ movdqu XMMWORD[rsi],xmm2

+ pxor xmm5,xmm13

+ movdqu XMMWORD[16+rsi],xmm3

+ movdqu XMMWORD[32+rsi],xmm4

+ movdqu XMMWORD[48+rsi],xmm5

+ lea rsi,[64+rsi]

+ jmp NEAR $L$xts_dec_done

+

+ALIGN 16

+$L$xts_dec_done:

+ and r9,15

+ jz NEAR $L$xts_dec_ret

+$L$xts_dec_done2:

+ mov rdx,r9

+ mov rcx,rbp

+ mov eax,r10d

+

+ movups xmm2,XMMWORD[rdi]

+ xorps xmm2,xmm11

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_13:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_13

+DB 102,15,56,223,209

+ xorps xmm2,xmm11

+ movups XMMWORD[rsi],xmm2

+

+$L$xts_dec_steal:

+ movzx eax,BYTE[16+rdi]

+ movzx ecx,BYTE[rsi]

+ lea rdi,[1+rdi]

+ mov BYTE[rsi],al

+ mov BYTE[16+rsi],cl

+ lea rsi,[1+rsi]

+ sub rdx,1

+ jnz NEAR $L$xts_dec_steal

+

+ sub rsi,r9

+ mov rcx,rbp

+ mov eax,r10d

+

+ movups xmm2,XMMWORD[rsi]

+ xorps xmm2,xmm10

+ movups xmm0,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+rcx]

+ lea rcx,[32+rcx]

+ xorps xmm2,xmm0

+$L$oop_dec1_14:

+DB 102,15,56,222,209

+ dec eax

+ movups xmm1,XMMWORD[rcx]

+ lea rcx,[16+rcx]

+ jnz NEAR $L$oop_dec1_14

+DB 102,15,56,223,209

+ xorps xmm2,xmm10

+ movups XMMWORD[rsi],xmm2

+

+$L$xts_dec_ret:

+ xorps xmm0,xmm0

+ pxor xmm1,xmm1

+ pxor xmm2,xmm2

+ pxor xmm3,xmm3

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+ movaps xmm6,XMMWORD[((-168))+r11]

+ movaps XMMWORD[(-168)+r11],xmm0

+ movaps xmm7,XMMWORD[((-152))+r11]

+ movaps XMMWORD[(-152)+r11],xmm0

+ movaps xmm8,XMMWORD[((-136))+r11]

+ movaps XMMWORD[(-136)+r11],xmm0

+ movaps xmm9,XMMWORD[((-120))+r11]

+ movaps XMMWORD[(-120)+r11],xmm0

+ movaps xmm10,XMMWORD[((-104))+r11]

+ movaps XMMWORD[(-104)+r11],xmm0

+ movaps xmm11,XMMWORD[((-88))+r11]

+ movaps XMMWORD[(-88)+r11],xmm0

+ movaps xmm12,XMMWORD[((-72))+r11]

+ movaps XMMWORD[(-72)+r11],xmm0

+ movaps xmm13,XMMWORD[((-56))+r11]

+ movaps XMMWORD[(-56)+r11],xmm0

+ movaps xmm14,XMMWORD[((-40))+r11]

+ movaps XMMWORD[(-40)+r11],xmm0

+ movaps xmm15,XMMWORD[((-24))+r11]

+ movaps XMMWORD[(-24)+r11],xmm0

+ movaps XMMWORD[rsp],xmm0

+ movaps XMMWORD[16+rsp],xmm0

+ movaps XMMWORD[32+rsp],xmm0

+ movaps XMMWORD[48+rsp],xmm0

+ movaps XMMWORD[64+rsp],xmm0

+ movaps XMMWORD[80+rsp],xmm0

+ movaps XMMWORD[96+rsp],xmm0

+ mov rbp,QWORD[((-8))+r11]

+

+ lea rsp,[r11]

+

+$L$xts_dec_epilogue:

+ mov rdi,QWORD[8+rsp] ;WIN64 epilogue

+ mov rsi,QWORD[16+rsp]

+ DB 0F3h,0C3h ;repret

+

+$L$SEH_end_aesni_xts_decrypt:

+global aesni_ocb_encrypt

+

+ALIGN 32

+aesni_ocb_encrypt:

+ mov QWORD[8+rsp],rdi ;WIN64 prologue

+ mov QWORD[16+rsp],rsi

+ mov rax,rsp

+$L$SEH_begin_aesni_ocb_encrypt:

+ mov rdi,rcx

+ mov rsi,rdx

+ mov rdx,r8

+ mov rcx,r9

+ mov r8,QWORD[40+rsp]

+ mov r9,QWORD[48+rsp]

+

+

+

+ lea rax,[rsp]

+ push rbx

+

+ push rbp

+

+ push r12

+

+ push r13

+

+ push r14

+

+ lea rsp,[((-160))+rsp]

+ movaps XMMWORD[rsp],xmm6

+ movaps XMMWORD[16+rsp],xmm7

+ movaps XMMWORD[32+rsp],xmm8

+ movaps XMMWORD[48+rsp],xmm9

+ movaps XMMWORD[64+rsp],xmm10

+ movaps XMMWORD[80+rsp],xmm11

+ movaps XMMWORD[96+rsp],xmm12

+ movaps XMMWORD[112+rsp],xmm13

+ movaps XMMWORD[128+rsp],xmm14

+ movaps XMMWORD[144+rsp],xmm15

+$L$ocb_enc_body:

+ mov rbx,QWORD[56+rax]

+ mov rbp,QWORD[((56+8))+rax]

+

+ mov r10d,DWORD[240+rcx]

+ mov r11,rcx

+ shl r10d,4

+ movups xmm9,XMMWORD[rcx]

+ movups xmm1,XMMWORD[16+r10*1+rcx]

+

+ movdqu xmm15,XMMWORD[r9]

+ pxor xmm9,xmm1

+ pxor xmm15,xmm1

+

+ mov eax,16+32

+ lea rcx,[32+r10*1+r11]

+ movups xmm1,XMMWORD[16+r11]

+ sub rax,r10

+ mov r10,rax

+

+ movdqu xmm10,XMMWORD[rbx]

+ movdqu xmm8,XMMWORD[rbp]

+

+ test r8,1

+ jnz NEAR $L$ocb_enc_odd

+

+ bsf r12,r8

+ add r8,1

+ shl r12,4

+ movdqu xmm7,XMMWORD[r12*1+rbx]

+ movdqu xmm2,XMMWORD[rdi]

+ lea rdi,[16+rdi]

+

+ call __ocb_encrypt1

+

+ movdqa xmm15,xmm7

+ movups XMMWORD[rsi],xmm2

+ lea rsi,[16+rsi]

+ sub rdx,1

+ jz NEAR $L$ocb_enc_done

+

+$L$ocb_enc_odd:

+ lea r12,[1+r8]

+ lea r13,[3+r8]

+ lea r14,[5+r8]

+ lea r8,[6+r8]

+ bsf r12,r12

+ bsf r13,r13

+ bsf r14,r14

+ shl r12,4

+ shl r13,4

+ shl r14,4

+

+ sub rdx,6

+ jc NEAR $L$ocb_enc_short

+ jmp NEAR $L$ocb_enc_grandloop

+

+ALIGN 32

+$L$ocb_enc_grandloop:

+ movdqu xmm2,XMMWORD[rdi]

+ movdqu xmm3,XMMWORD[16+rdi]

+ movdqu xmm4,XMMWORD[32+rdi]

+ movdqu xmm5,XMMWORD[48+rdi]

+ movdqu xmm6,XMMWORD[64+rdi]

+ movdqu xmm7,XMMWORD[80+rdi]

+ lea rdi,[96+rdi]

+

+ call __ocb_encrypt6

+

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+ movups XMMWORD[80+rsi],xmm7

+ lea rsi,[96+rsi]

+ sub rdx,6

+ jnc NEAR $L$ocb_enc_grandloop

+

+$L$ocb_enc_short:

+ add rdx,6

+ jz NEAR $L$ocb_enc_done

+

+ movdqu xmm2,XMMWORD[rdi]

+ cmp rdx,2

+ jb NEAR $L$ocb_enc_one

+ movdqu xmm3,XMMWORD[16+rdi]

+ je NEAR $L$ocb_enc_two

+

+ movdqu xmm4,XMMWORD[32+rdi]

+ cmp rdx,4

+ jb NEAR $L$ocb_enc_three

+ movdqu xmm5,XMMWORD[48+rdi]

+ je NEAR $L$ocb_enc_four

+

+ movdqu xmm6,XMMWORD[64+rdi]

+ pxor xmm7,xmm7

+

+ call __ocb_encrypt6

+

+ movdqa xmm15,xmm14

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+ movups XMMWORD[48+rsi],xmm5

+ movups XMMWORD[64+rsi],xmm6

+

+ jmp NEAR $L$ocb_enc_done

+

+ALIGN 16

+$L$ocb_enc_one:

+ movdqa xmm7,xmm10

+

+ call __ocb_encrypt1

+

+ movdqa xmm15,xmm7

+ movups XMMWORD[rsi],xmm2

+ jmp NEAR $L$ocb_enc_done

+

+ALIGN 16

+$L$ocb_enc_two:

+ pxor xmm4,xmm4

+ pxor xmm5,xmm5

+

+ call __ocb_encrypt4

+

+ movdqa xmm15,xmm11

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+

+ jmp NEAR $L$ocb_enc_done

+

+ALIGN 16

+$L$ocb_enc_three:

+ pxor xmm5,xmm5

+

+ call __ocb_encrypt4

+

+ movdqa xmm15,xmm12

+ movups XMMWORD[rsi],xmm2

+ movups XMMWORD[16+rsi],xmm3

+ movups XMMWORD[32+rsi],xmm4

+

+ jmp NEAR $L$ocb_enc_done

+

+AL