Open Enclave  0.8.0
types.h
Go to the documentation of this file.
1 // Copyright (c) Open Enclave SDK contributors.
2 // Licensed under the MIT License.
3 
10 #ifndef _OE_BITS_TYPES_H
11 #define _OE_BITS_TYPES_H
12 
13 #include "defs.h"
14 
20 #if defined(__GNUC__)
21 typedef long ssize_t;
22 typedef unsigned long size_t;
23 typedef signed char int8_t;
24 typedef unsigned char uint8_t;
25 typedef short int16_t;
26 typedef unsigned short uint16_t;
27 typedef int int32_t;
28 typedef unsigned int uint32_t;
29 typedef long int64_t;
30 typedef unsigned long uint64_t;
31 typedef unsigned long uintptr_t;
32 typedef long ptrdiff_t;
33 typedef long intptr_t;
34 typedef long time_t;
35 typedef long suseconds_t;
36 
37 #elif defined(_MSC_VER)
38 typedef long long ssize_t;
39 typedef unsigned long long size_t;
40 typedef signed char int8_t;
41 typedef unsigned char uint8_t;
42 typedef short int16_t;
43 typedef unsigned short uint16_t;
44 typedef int int32_t;
45 typedef unsigned int uint32_t;
46 typedef long long int64_t;
47 typedef unsigned long long uint64_t;
48 typedef unsigned long long uintptr_t;
49 typedef long long ptrdiff_t;
50 typedef long long intptr_t;
51 typedef long long time_t;
52 typedef long long suseconds_t;
53 #else
54 #error "unknown compiler - please adapt basic types"
55 #endif
56 
57 /* bool type */
58 #ifndef __cplusplus
59 #define true 1
60 #define false 0
61 #define bool _Bool
62 #endif
63 
64 #define OE_SCHAR_MIN (-128)
65 #define OE_SCHAR_MAX 127
66 #define OE_UCHAR_MAX 255
67 #define OE_CHAR_MIN (-128)
68 #define OE_CHAR_MAX 127
69 #define OE_CHAR_BIT 8
70 #define OE_SHRT_MIN (-1 - 0x7fff)
71 #define OE_SHRT_MAX 0x7fff
72 #define OE_USHRT_MAX 0xffff
73 #define OE_INT_MIN (-1 - 0x7fffffff)
74 #define OE_INT_MAX 0x7fffffff
75 #define OE_UINT_MAX 0xffffffffU
76 
77 #ifdef _MSC_VER
78 #define OE_LONG_MAX 0x7fffffffL
79 #elif __linux__
80 #define OE_LONG_MAX 0x7fffffffffffffffL
81 #endif
82 
83 #define OE_LONG_MIN (-OE_LONG_MAX - 1)
84 #define OE_ULONG_MAX (2UL * OE_LONG_MAX + 1)
85 #define OE_LLONG_MAX 0x7fffffffffffffffLL
86 #define OE_LLONG_MIN (-OE_LLONG_MAX - 1)
87 #define OE_ULLONG_MAX (2ULL * OE_LLONG_MAX + 1)
88 
89 #define OE_INT8_MIN (-1 - 0x7f)
90 #define OE_INT8_MAX (0x7f)
91 #define OE_UINT8_MAX (0xff)
92 #define OE_INT16_MIN (-1 - 0x7fff)
93 #define OE_INT16_MAX (0x7fff)
94 #define OE_UINT16_MAX (0xffff)
95 #define OE_INT32_MIN (-1 - 0x7fffffff)
96 #define OE_INT32_MAX (0x7fffffff)
97 #define OE_UINT32_MAX (0xffffffffu)
98 #define OE_INT64_MIN (-1 - 0x7fffffffffffffff)
99 #define OE_INT64_MAX (0x7fffffffffffffff)
100 #define OE_UINT64_MAX (0xffffffffffffffffu)
101 #define OE_SIZE_MAX OE_UINT64_MAX
102 #define OE_SSIZE_MAX OE_INT64_MAX
103 
111 typedef enum _oe_enclave_type
112 {
133  __OE_ENCLAVE_TYPE_MAX = OE_ENUM_MAX,
135 
140 typedef struct _oe_enclave oe_enclave_t;
141 
146 typedef enum _oe_seal_policy
147 {
163  _OE_SEAL_POLICY_MAX = OE_ENUM_MAX,
165 
171 {
176 
182 
188 {
193 
199 
205 {
210 
215 
219  void* user_data;
220 
226 
230 typedef struct _oe_datetime
231 {
232  uint32_t year; /* format: 1970, 2018, 2020 */
233  uint32_t month; /* range: 1-12 */
234  uint32_t day; /* range: 1-31 */
235  uint32_t hours; /* range: 0-23 */
236  uint32_t minutes; /* range: 0-59 */
237  uint32_t seconds; /* range: 0-59 */
238 } oe_datetime_t;
239 
240 #endif /* _OE_BITS_TYPES_H */
enum _oe_seal_policy oe_seal_policy_t
This enumeration type defines the policy used to derive a seal key.
Unused.
Definition: types.h:180
enum _oe_asymmetric_key_format oe_asymmetric_key_format_t
This enumeration defines the format of the asymmetric key.
Unused.
Definition: types.h:163
enum _oe_enclave_type oe_enclave_type_t
This enumeration defines values for the type parameter passed to oe_create_enclave().
_oe_enclave_type
This enumeration defines values for the type parameter passed to oe_create_enclave().
Definition: types.h:111
Unused.
Definition: types.h:133
void * user_data
Optional user data to add to the key derivation.
Definition: types.h:219
struct _oe_asymmetric_key_params oe_asymmetric_key_params_t
This struct contains the parameters for asymmetric key derivation.
_oe_seal_policy
This enumeration type defines the policy used to derive a seal key.
Definition: types.h:146
This struct contains the parameters for asymmetric key derivation.
Definition: types.h:204
_oe_asymmetric_key_type
This enumeration defines the type of a asymmetric key.
Definition: types.h:170
enum _oe_asymmetric_key_type oe_asymmetric_key_type_t
This enumeration defines the type of a asymmetric key.
Key is derived from the signer of the enclave.
Definition: types.h:159
OE_ENCLAVE_TYPE_SGX will force the platform to use SGX, but any platform other than x64 will not supp...
Definition: types.h:123
OE_ENCLAVE_TYPE_OPTEE will force the platform to use OP-TEE, but any platform other than one that imp...
Definition: types.h:129
_oe_asymmetric_key_format
This enumeration defines the format of the asymmetric key.
Definition: types.h:187
OE_ENCLAVE_TYPE_AUTO will pick the type based on the target platform that is being built...
Definition: types.h:118
This struct defines a datetime up to 1 second precision.
Definition: types.h:230
size_t user_data_size
The size of user_data.
Definition: types.h:224
A secp256r1/NIST P-256 elliptic curve key.
Definition: types.h:175
Key is derived from a measurement of the enclave.
Definition: types.h:153
Unused.
Definition: types.h:197
oe_asymmetric_key_format_t format
The exported format of the key.
Definition: types.h:214
The PEM format.
Definition: types.h:192
oe_asymmetric_key_type_t type
The type of asymmetric key.
Definition: types.h:209
struct _oe_datetime oe_datetime_t
This struct defines a datetime up to 1 second precision.
struct _oe_enclave oe_enclave_t
This is an opaque handle to an enclave returned by oe_create_enclave().
Definition: types.h:140