ホーム › System.Environment › VBS_ENCLAVE_REPORT
VBS_ENCLAVE_REPORT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ReportSize | DWORD | 4 | +0 | +0 | レポート全体のバイトサイズ。 |
| ReportVersion | DWORD | 4 | +4 | +4 | レポートフォーマットのバージョン。 |
| EnclaveData | BYTE | 64 | +8 | +8 | エンクレーブが提供したカスタムデータ(可変)。 |
| EnclaveIdentity | ENCLAVE_IDENTITY | 152 | +72 | +72 | レポート対象エンクレーブの識別情報(ENCLAVE_IDENTITY)。 |
各言語での定義
#include <windows.h>
// ENCLAVE_IDENTITY (x64 152 / x86 152 バイト)
#pragma pack(push, 1)
typedef struct ENCLAVE_IDENTITY {
BYTE OwnerId[32];
BYTE UniqueId[32];
BYTE AuthorId[32];
BYTE FamilyId[16];
BYTE ImageId[16];
DWORD EnclaveSvn;
DWORD SecureKernelSvn;
DWORD PlatformSvn;
DWORD Flags;
DWORD SigningLevel;
DWORD EnclaveType;
} ENCLAVE_IDENTITY;
#pragma pack(pop)
// VBS_ENCLAVE_REPORT (x64 224 / x86 224 バイト)
#pragma pack(push, 1)
typedef struct VBS_ENCLAVE_REPORT {
DWORD ReportSize;
DWORD ReportVersion;
BYTE EnclaveData[64];
ENCLAVE_IDENTITY EnclaveIdentity;
} VBS_ENCLAVE_REPORT;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct ENCLAVE_IDENTITY
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] OwnerId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] UniqueId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] AuthorId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] FamilyId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] ImageId;
public uint EnclaveSvn;
public uint SecureKernelSvn;
public uint PlatformSvn;
public uint Flags;
public uint SigningLevel;
public uint EnclaveType;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct VBS_ENCLAVE_REPORT
{
public uint ReportSize;
public uint ReportVersion;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] EnclaveData;
public ENCLAVE_IDENTITY EnclaveIdentity;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure ENCLAVE_IDENTITY
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public OwnerId() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public UniqueId() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public AuthorId() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public FamilyId() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public ImageId() As Byte
Public EnclaveSvn As UInteger
Public SecureKernelSvn As UInteger
Public PlatformSvn As UInteger
Public Flags As UInteger
Public SigningLevel As UInteger
Public EnclaveType As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure VBS_ENCLAVE_REPORT
Public ReportSize As UInteger
Public ReportVersion As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public EnclaveData() As Byte
Public EnclaveIdentity As ENCLAVE_IDENTITY
End Structureimport ctypes
from ctypes import wintypes
class ENCLAVE_IDENTITY(ctypes.Structure):
_pack_ = 1
_fields_ = [
("OwnerId", ctypes.c_ubyte * 32),
("UniqueId", ctypes.c_ubyte * 32),
("AuthorId", ctypes.c_ubyte * 32),
("FamilyId", ctypes.c_ubyte * 16),
("ImageId", ctypes.c_ubyte * 16),
("EnclaveSvn", wintypes.DWORD),
("SecureKernelSvn", wintypes.DWORD),
("PlatformSvn", wintypes.DWORD),
("Flags", wintypes.DWORD),
("SigningLevel", wintypes.DWORD),
("EnclaveType", wintypes.DWORD),
]
class VBS_ENCLAVE_REPORT(ctypes.Structure):
_pack_ = 1
_fields_ = [
("ReportSize", wintypes.DWORD),
("ReportVersion", wintypes.DWORD),
("EnclaveData", ctypes.c_ubyte * 64),
("EnclaveIdentity", ENCLAVE_IDENTITY),
]#[repr(C, packed(1))]
pub struct ENCLAVE_IDENTITY {
pub OwnerId: [u8; 32],
pub UniqueId: [u8; 32],
pub AuthorId: [u8; 32],
pub FamilyId: [u8; 16],
pub ImageId: [u8; 16],
pub EnclaveSvn: u32,
pub SecureKernelSvn: u32,
pub PlatformSvn: u32,
pub Flags: u32,
pub SigningLevel: u32,
pub EnclaveType: u32,
}
#[repr(C, packed(1))]
pub struct VBS_ENCLAVE_REPORT {
pub ReportSize: u32,
pub ReportVersion: u32,
pub EnclaveData: [u8; 64],
pub EnclaveIdentity: ENCLAVE_IDENTITY,
}import "golang.org/x/sys/windows"
type ENCLAVE_IDENTITY struct {
OwnerId [32]byte
UniqueId [32]byte
AuthorId [32]byte
FamilyId [16]byte
ImageId [16]byte
EnclaveSvn uint32
SecureKernelSvn uint32
PlatformSvn uint32
Flags uint32
SigningLevel uint32
EnclaveType uint32
}
type VBS_ENCLAVE_REPORT struct {
ReportSize uint32
ReportVersion uint32
EnclaveData [64]byte
EnclaveIdentity ENCLAVE_IDENTITY
}type
ENCLAVE_IDENTITY = packed record
OwnerId: array[0..31] of Byte;
UniqueId: array[0..31] of Byte;
AuthorId: array[0..31] of Byte;
FamilyId: array[0..15] of Byte;
ImageId: array[0..15] of Byte;
EnclaveSvn: DWORD;
SecureKernelSvn: DWORD;
PlatformSvn: DWORD;
Flags: DWORD;
SigningLevel: DWORD;
EnclaveType: DWORD;
end;
VBS_ENCLAVE_REPORT = packed record
ReportSize: DWORD;
ReportVersion: DWORD;
EnclaveData: array[0..63] of Byte;
EnclaveIdentity: ENCLAVE_IDENTITY;
end;const ENCLAVE_IDENTITY = extern struct {
OwnerId: [32]u8,
UniqueId: [32]u8,
AuthorId: [32]u8,
FamilyId: [16]u8,
ImageId: [16]u8,
EnclaveSvn: u32,
SecureKernelSvn: u32,
PlatformSvn: u32,
Flags: u32,
SigningLevel: u32,
EnclaveType: u32,
};
const VBS_ENCLAVE_REPORT = extern struct {
ReportSize: u32,
ReportVersion: u32,
EnclaveData: [64]u8,
EnclaveIdentity: ENCLAVE_IDENTITY,
};type
ENCLAVE_IDENTITY {.packed.} = object
OwnerId: array[32, uint8]
UniqueId: array[32, uint8]
AuthorId: array[32, uint8]
FamilyId: array[16, uint8]
ImageId: array[16, uint8]
EnclaveSvn: uint32
SecureKernelSvn: uint32
PlatformSvn: uint32
Flags: uint32
SigningLevel: uint32
EnclaveType: uint32
VBS_ENCLAVE_REPORT {.packed.} = object
ReportSize: uint32
ReportVersion: uint32
EnclaveData: array[64, uint8]
EnclaveIdentity: ENCLAVE_IDENTITYalign(1)
struct ENCLAVE_IDENTITY
{
ubyte[32] OwnerId;
ubyte[32] UniqueId;
ubyte[32] AuthorId;
ubyte[16] FamilyId;
ubyte[16] ImageId;
uint EnclaveSvn;
uint SecureKernelSvn;
uint PlatformSvn;
uint Flags;
uint SigningLevel;
uint EnclaveType;
}
align(1)
struct VBS_ENCLAVE_REPORT
{
uint ReportSize;
uint ReportVersion;
ubyte[64] EnclaveData;
ENCLAVE_IDENTITY EnclaveIdentity;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VBS_ENCLAVE_REPORT サイズ: 224 バイト(x64)
dim st, 56 ; 4byte整数×56(構造体サイズ 224 / 4 切り上げ)
; ReportSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ReportVersion : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; EnclaveData : BYTE (+8, 64byte) varptr(st)+8 を基点に操作(64byte:入れ子/配列)
; EnclaveIdentity : ENCLAVE_IDENTITY (+72, 152byte) varptr(st)+72 を基点に操作(152byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global ENCLAVE_IDENTITY, pack=1
#field byte OwnerId 32
#field byte UniqueId 32
#field byte AuthorId 32
#field byte FamilyId 16
#field byte ImageId 16
#field int EnclaveSvn
#field int SecureKernelSvn
#field int PlatformSvn
#field int Flags
#field int SigningLevel
#field int EnclaveType
#endstruct
#defstruct global VBS_ENCLAVE_REPORT, pack=1
#field int ReportSize
#field int ReportVersion
#field byte EnclaveData 64
#field ENCLAVE_IDENTITY EnclaveIdentity
#endstruct
stdim st, VBS_ENCLAVE_REPORT ; NSTRUCT 変数を確保
st->ReportSize = 100
mes "ReportSize=" + st->ReportSize