Win32 API 日本語リファレンス
ホームSystem.Environment › EnclaveVerifyAttestationReport

EnclaveVerifyAttestationReport

関数
エンクレーブのアテステーションレポートを検証する。
DLLvertdll.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

// vertdll.dll
#include <windows.h>

HRESULT EnclaveVerifyAttestationReport(
    DWORD EnclaveType,
    const void* Report,
    DWORD ReportSize
);

パラメーター

名前方向説明
EnclaveTypeDWORDin検証するレポートのエンクレーブ種別。
Reportvoid*in検証対象の証明レポートを指すバッファ。
ReportSizeDWORDinReportのサイズ(バイト)。

戻り値の型: HRESULT

各言語での呼び出し定義

// vertdll.dll
#include <windows.h>

HRESULT EnclaveVerifyAttestationReport(
    DWORD EnclaveType,
    const void* Report,
    DWORD ReportSize
);
[DllImport("vertdll.dll", ExactSpelling = true)]
static extern int EnclaveVerifyAttestationReport(
    uint EnclaveType,   // DWORD
    IntPtr Report,   // void*
    uint ReportSize   // DWORD
);
<DllImport("vertdll.dll", ExactSpelling:=True)>
Public Shared Function EnclaveVerifyAttestationReport(
    EnclaveType As UInteger,   ' DWORD
    Report As IntPtr,   ' void*
    ReportSize As UInteger   ' DWORD
) As Integer
End Function
' EnclaveType : DWORD
' Report : void*
' ReportSize : DWORD
Declare PtrSafe Function EnclaveVerifyAttestationReport Lib "vertdll" ( _
    ByVal EnclaveType As Long, _
    ByVal Report As LongPtr, _
    ByVal ReportSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EnclaveVerifyAttestationReport = ctypes.windll.vertdll.EnclaveVerifyAttestationReport
EnclaveVerifyAttestationReport.restype = ctypes.c_int
EnclaveVerifyAttestationReport.argtypes = [
    wintypes.DWORD,  # EnclaveType : DWORD
    ctypes.POINTER(None),  # Report : void*
    wintypes.DWORD,  # ReportSize : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('vertdll.dll')
EnclaveVerifyAttestationReport = Fiddle::Function.new(
  lib['EnclaveVerifyAttestationReport'],
  [
    -Fiddle::TYPE_INT,  # EnclaveType : DWORD
    Fiddle::TYPE_VOIDP,  # Report : void*
    -Fiddle::TYPE_INT,  # ReportSize : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "vertdll")]
extern "system" {
    fn EnclaveVerifyAttestationReport(
        EnclaveType: u32,  // DWORD
        Report: *const (),  // void*
        ReportSize: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("vertdll.dll")]
public static extern int EnclaveVerifyAttestationReport(uint EnclaveType, IntPtr Report, uint ReportSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'vertdll_EnclaveVerifyAttestationReport' -Namespace Win32 -PassThru
# $api::EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize)
#uselib "vertdll.dll"
#func global EnclaveVerifyAttestationReport "EnclaveVerifyAttestationReport" sptr, sptr, sptr
; EnclaveVerifyAttestationReport EnclaveType, Report, ReportSize   ; 戻り値は stat
; EnclaveType : DWORD -> "sptr"
; Report : void* -> "sptr"
; ReportSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "vertdll.dll"
#cfunc global EnclaveVerifyAttestationReport "EnclaveVerifyAttestationReport" int, sptr, int
; res = EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize)
; EnclaveType : DWORD -> "int"
; Report : void* -> "sptr"
; ReportSize : DWORD -> "int"
; HRESULT EnclaveVerifyAttestationReport(DWORD EnclaveType, void* Report, DWORD ReportSize)
#uselib "vertdll.dll"
#cfunc global EnclaveVerifyAttestationReport "EnclaveVerifyAttestationReport" int, intptr, int
; res = EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize)
; EnclaveType : DWORD -> "int"
; Report : void* -> "intptr"
; ReportSize : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	vertdll = windows.NewLazySystemDLL("vertdll.dll")
	procEnclaveVerifyAttestationReport = vertdll.NewProc("EnclaveVerifyAttestationReport")
)

// EnclaveType (DWORD), Report (void*), ReportSize (DWORD)
r1, _, err := procEnclaveVerifyAttestationReport.Call(
	uintptr(EnclaveType),
	uintptr(Report),
	uintptr(ReportSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function EnclaveVerifyAttestationReport(
  EnclaveType: DWORD;   // DWORD
  Report: Pointer;   // void*
  ReportSize: DWORD   // DWORD
): Integer; stdcall;
  external 'vertdll.dll' name 'EnclaveVerifyAttestationReport';
result := DllCall("vertdll\EnclaveVerifyAttestationReport"
    , "UInt", EnclaveType   ; DWORD
    , "Ptr", Report   ; void*
    , "UInt", ReportSize   ; DWORD
    , "Int")   ; return: HRESULT
●EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize) = DLL("vertdll.dll", "int EnclaveVerifyAttestationReport(dword, void*, dword)")
# 呼び出し: EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize)
# EnclaveType : DWORD -> "dword"
# Report : void* -> "void*"
# ReportSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "vertdll" fn EnclaveVerifyAttestationReport(
    EnclaveType: u32, // DWORD
    Report: ?*anyopaque, // void*
    ReportSize: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;
proc EnclaveVerifyAttestationReport(
    EnclaveType: uint32,  # DWORD
    Report: pointer,  # void*
    ReportSize: uint32  # DWORD
): int32 {.importc: "EnclaveVerifyAttestationReport", stdcall, dynlib: "vertdll.dll".}
pragma(lib, "vertdll");
extern(Windows)
int EnclaveVerifyAttestationReport(
    uint EnclaveType,   // DWORD
    void* Report,   // void*
    uint ReportSize   // DWORD
);
ccall((:EnclaveVerifyAttestationReport, "vertdll.dll"), stdcall, Int32,
      (UInt32, Ptr{Cvoid}, UInt32),
      EnclaveType, Report, ReportSize)
# EnclaveType : DWORD -> UInt32
# Report : void* -> Ptr{Cvoid}
# ReportSize : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t EnclaveVerifyAttestationReport(
    uint32_t EnclaveType,
    void* Report,
    uint32_t ReportSize);
]]
local vertdll = ffi.load("vertdll")
-- vertdll.EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize)
-- EnclaveType : DWORD
-- Report : void*
-- ReportSize : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('vertdll.dll');
const EnclaveVerifyAttestationReport = lib.func('__stdcall', 'EnclaveVerifyAttestationReport', 'int32_t', ['uint32_t', 'void *', 'uint32_t']);
// EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize)
// EnclaveType : DWORD -> 'uint32_t'
// Report : void* -> 'void *'
// ReportSize : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("vertdll.dll", {
  EnclaveVerifyAttestationReport: { parameters: ["u32", "pointer", "u32"], result: "i32" },
});
// lib.symbols.EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize)
// EnclaveType : DWORD -> "u32"
// Report : void* -> "pointer"
// ReportSize : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t EnclaveVerifyAttestationReport(
    uint32_t EnclaveType,
    void* Report,
    uint32_t ReportSize);
C, "vertdll.dll");
// $ffi->EnclaveVerifyAttestationReport(EnclaveType, Report, ReportSize);
// EnclaveType : DWORD
// Report : void*
// ReportSize : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Vertdll extends StdCallLibrary {
    Vertdll INSTANCE = Native.load("vertdll", Vertdll.class);
    int EnclaveVerifyAttestationReport(
        int EnclaveType,   // DWORD
        Pointer Report,   // void*
        int ReportSize   // DWORD
    );
}
@[Link("vertdll")]
lib Libvertdll
  fun EnclaveVerifyAttestationReport = EnclaveVerifyAttestationReport(
    EnclaveType : UInt32,   # DWORD
    Report : Void*,   # void*
    ReportSize : UInt32   # DWORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef EnclaveVerifyAttestationReportNative = Int32 Function(Uint32, Pointer<Void>, Uint32);
typedef EnclaveVerifyAttestationReportDart = int Function(int, Pointer<Void>, int);
final EnclaveVerifyAttestationReport = DynamicLibrary.open('vertdll.dll')
    .lookupFunction<EnclaveVerifyAttestationReportNative, EnclaveVerifyAttestationReportDart>('EnclaveVerifyAttestationReport');
// EnclaveType : DWORD -> Uint32
// Report : void* -> Pointer<Void>
// ReportSize : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function EnclaveVerifyAttestationReport(
  EnclaveType: DWORD;   // DWORD
  Report: Pointer;   // void*
  ReportSize: DWORD   // DWORD
): Integer; stdcall;
  external 'vertdll.dll' name 'EnclaveVerifyAttestationReport';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "EnclaveVerifyAttestationReport"
  c_EnclaveVerifyAttestationReport :: Word32 -> Ptr () -> Word32 -> IO Int32
-- EnclaveType : DWORD -> Word32
-- Report : void* -> Ptr ()
-- ReportSize : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let enclaveverifyattestationreport =
  foreign "EnclaveVerifyAttestationReport"
    (uint32_t @-> (ptr void) @-> uint32_t @-> returning int32_t)
(* EnclaveType : DWORD -> uint32_t *)
(* Report : void* -> (ptr void) *)
(* ReportSize : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library vertdll (t "vertdll.dll"))
(cffi:use-foreign-library vertdll)

(cffi:defcfun ("EnclaveVerifyAttestationReport" enclave-verify-attestation-report :convention :stdcall) :int32
  (enclave-type :uint32)   ; DWORD
  (report :pointer)   ; void*
  (report-size :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $EnclaveVerifyAttestationReport = Win32::API::More->new('vertdll',
    'int EnclaveVerifyAttestationReport(DWORD EnclaveType, LPVOID Report, DWORD ReportSize)');
# my $ret = $EnclaveVerifyAttestationReport->Call($EnclaveType, $Report, $ReportSize);
# EnclaveType : DWORD -> DWORD
# Report : void* -> LPVOID
# ReportSize : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。