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