1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#![doc(html_logo_url = "https://edp.fortanix.com/img/docs/edp-logo.svg",
html_favicon_url = "https://edp.fortanix.com/favicon.ico",
html_root_url = "https://edp.fortanix.com/docs/api/")]
#[macro_use]
extern crate num_derive;
extern crate sgx_isa;
use sgx_isa::{Report, Targetinfo};
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, FromPrimitive, ToPrimitive)]
pub enum Quote3Error {
Success = 0,
InvalidParameter = 0xe002,
OutOfMemory = 0xe003,
EcdsaIdMismatch = 0xe004,
PathnameBufferOverflow = 0xe005,
FileAccessError = 0xe006,
StoredKeyInvalid = 0xe007,
PubKeyIdMismatch = 0xe008,
InvalidPceSigScheme = 0xe009,
AttKeyBlobInvalid = 0xe00a,
UnsupportedAttKeyId = 0xe00b,
UnsupportedLoadingPolicy = 0xe00c,
InterfaceUnavailable = 0xe00d,
PlatformLibUnavailable = 0xe00e,
AttKeyNotInitialized = 0xe00f,
AttKeyCertDataInvalid = 0xe010,
NoPlatformCertData = 0xe011,
OutOfEpc = 0xe012,
ReportInvalid = 0xe013,
EnclaveLost = 0xe014,
InvalidReport = 0xe015,
EnclaveLoadFailure = 0xe016,
UnableToGenerateQeReport = 0xe017,
KeyCertifcationError = 0xe018,
}
#[cfg(feature = "link")]
#[link(name = "sgx_dcap_ql")]
extern "C" {
#[link_name = "sgx_qe_get_target_info"]
pub fn get_target_info(target_info: &mut Targetinfo) -> u32;
#[link_name = "sgx_qe_get_quote_size"]
pub fn get_quote_size(quote_size: &mut u32) -> u32;
#[link_name = "sgx_qe_get_quote"]
pub fn get_quote(report: &Report, quote_size: u32, quote: *mut u8) -> u32;
}
pub const LIBRARY: &str = "libsgx_dcap_ql.so.1";
pub const SYM_GET_TARGET_INFO: &[u8] = b"sgx_qe_get_target_info\0";
pub type GetTargetInfoFn = unsafe extern "C" fn(target_info: &mut Targetinfo) -> u32;
pub const SYM_GET_QUOTE_SIZE: &[u8] = b"sgx_qe_get_quote_size\0";
pub type GetQuoteSizeFn = unsafe extern "C" fn(quote_size: &mut u32) -> u32;
pub const SYM_GET_QUOTE: &[u8] = b"sgx_qe_get_quote\0";
pub type GetQuoteFn = unsafe extern "C" fn(report: &Report, quote_size: u32, quote: *mut u8) -> u32;