TA-REF
types.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (C) 2019 National Institute of Advanced Industrial Science
5 * and Technology (AIST)
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#pragma once
32#include <stddef.h>
33#include "sgx_error.h" /* sgx_status_t */
34#include "sgx_eid.h" /* sgx_enclave_id_t */
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/* Global EID shared by multiple threads */
41sgx_enclave_id_t global_eid = 0;
42
43typedef struct _sgx_errlist_t {
44 sgx_status_t err;
45 const char *msg;
46 const char *sug; /* Suggestion */
48
49/* Error code returned by sgx_create_enclave */
51 {
52 SGX_ERROR_UNEXPECTED,
53 "Unexpected error occurred.",
54 NULL
55 },
56 {
57 SGX_ERROR_INVALID_PARAMETER,
58 "Invalid parameter.",
59 NULL
60 },
61 {
62 SGX_ERROR_OUT_OF_MEMORY,
63 "Out of memory.",
64 NULL
65 },
66 {
67 SGX_ERROR_ENCLAVE_LOST,
68 "Power transition occurred.",
69 "Please refer to the sample \"PowerTransition\" for details."
70 },
71 {
72 SGX_ERROR_INVALID_ENCLAVE,
73 "Invalid enclave image.",
74 NULL
75 },
76 {
77 SGX_ERROR_INVALID_ENCLAVE_ID,
78 "Invalid enclave identification.",
79 NULL
80 },
81 {
82 SGX_ERROR_INVALID_SIGNATURE,
83 "Invalid enclave signature.",
84 NULL
85 },
86 {
87 SGX_ERROR_OUT_OF_EPC,
88 "Out of EPC memory.",
89 NULL
90 },
91 {
92 SGX_ERROR_NO_DEVICE,
93 "Invalid SGX device.",
94 "Please make sure SGX module is enabled in the BIOS, and install SGX driver afterwards."
95 },
96 {
97 SGX_ERROR_MEMORY_MAP_CONFLICT,
98 "Memory map conflicted.",
99 NULL
100 },
101 {
102 SGX_ERROR_INVALID_METADATA,
103 "Invalid enclave metadata.",
104 NULL
105 },
106 {
107 SGX_ERROR_DEVICE_BUSY,
108 "SGX device was busy.",
109 NULL
110 },
111 {
112 SGX_ERROR_INVALID_VERSION,
113 "Enclave version was invalid.",
114 NULL
115 },
116 {
117 SGX_ERROR_INVALID_ATTRIBUTE,
118 "Enclave was not authorized.",
119 NULL
120 },
121 {
122 SGX_ERROR_ENCLAVE_FILE_ACCESS,
123 "Can't open enclave file.",
124 NULL
125 },
126};
127
128#ifdef __cplusplus
129}
130#endif
static sgx_errlist_t sgx_errlist[]
Definition: types.h:50
struct _sgx_errlist_t sgx_errlist_t
sgx_enclave_id_t global_eid
Definition: types.h:41
Definition: types.h:43
sgx_status_t err
Definition: types.h:44
const char * sug
Definition: types.h:46
const char * msg
Definition: types.h:45