KeCreateEnclave
INT64 __stdcall KeCreateEnclave(
PVOID EnclaveControlAddress,
PVOID EnclaveBaseAddress,
UINT64 EnclaveSize,
PVOID ControlInformation,
UINT64 *ReturnedFlags,
UINT64 *ReturnedError){
_QWORD *v6;
bool v8;
int v10;
__int64 v11;
int *v12;
_DWORD *v13;
v6 = (_QWORD *)((unsigned __int64)&v11 & 0xFFFFFFFFFFFFFFC0ui64);
v8 = (KeFeatureBits & 0x10000000000i64) == 0;
*v13 = 0;
if( v8 )
return 3221225659i64;
if( !_bittest64((const signed __int64 *)&KeFeatureBits, 0x2Bu) && ((unsigned __int16)ReturnedError & 0x100) != 0
|| *(_QWORD *)ControlInformation != EnclaveSize )
{
return 3221225485i64;
}
if( ((unsigned __int8)ReturnedError & 1) != 0 )
{
if( (*((_DWORD *)ControlInformation + 12) & 4) == 0 )
return 3221225485i64;
}
else if( (*((_DWORD *)ControlInformation + 12) & 4) != 0 )
{
return 3221225485i64;
}
*((_QWORD *)ControlInformation + 1) = EnclaveBaseAddress;
*v12 = 0;
v10 = *v12;
if( (*((_BYTE *)ControlInformation + 48) & 2) != 0 )
v10 = 2;
*v12 = v10;
memset((INT64)(v6 + 8), 0i64);
*(_QWORD *)(((unsigned __int64)&v11 & 0xFFFFFFFFFFFFFFC0ui64) + 0x10) = ((unsigned __int64)&v11 & 0xFFFFFFFFFFFFFFC0ui64)
+ 64;
*v6 = 0i64;
*(_QWORD *)(((unsigned __int64)&v11 & 0xFFFFFFFFFFFFFFC0ui64) + 8) = ControlInformation;
*(_QWORD *)(((unsigned __int64)&v11 & 0xFFFFFFFFFFFFFFC0ui64) + 0x18) = 0i64;
KiEncls(0i64);
return 0i64;
}Referenced by:
MiCreateHardwareEnclave