Open Enclave  0.15.0
seal.h
Go to the documentation of this file.
1 // Copyright (c) Open Enclave SDK contributors.
2 // Licensed under the MIT License.
3 
13 #ifndef _OE_SEAL_H
14 #define _OE_SEAL_H
15 
18 #include <openenclave/bits/types.h>
19 
20 OE_EXTERNC_BEGIN
21 
28 typedef struct _oe_seal_setting
29 {
30  int type;
31  uint32_t size;
32  union {
33  uint64_t q;
34  uint32_t d;
35  uint16_t w;
36  uint8_t b;
37  const void*
38  p;
39  } value;
41 
42 /*
43  * TEE agnostic seal settings supported by OE SDK
44  */
46 {
52 
60 
66 
73 
80 };
81 
82 #define __OE_SEAL_SET_POINTER(t, p, s) \
83  { \
84  (t), s, \
85  { \
86  (uint64_t)(p) \
87  } \
88  }
89 #define __OE_SEAL_SET_VALUE(t, v) __OE_SEAL_SET_POINTER(t, v, 0)
90 
97 #define OE_SEAL_SET_POLICY(w) __OE_SEAL_SET_VALUE(OE_SEAL_SETTING_POLICY, w)
98 
110 #define OE_SEAL_SET_CONTEXT(p, s) \
111  __OE_SEAL_SET_POINTER(OE_SEAL_SETTING_ADDITIONAL_CONTEXT, p, s)
112 
125 #define OE_SEAL_SET_IV(p, s) __OE_SEAL_SET_POINTER(OE_SEAL_SETTING_IV, p, s)
126 
157  const oe_uuid_t* plugin_id,
158  const oe_seal_setting_t* settings,
159  size_t settings_count,
160  const uint8_t* plaintext,
161  size_t plaintext_size,
162  const uint8_t* additional_data,
163  size_t additional_data_size,
164  uint8_t** blob,
165  size_t* blob_size);
166 
188  const uint8_t* blob,
189  size_t blob_size,
190  const uint8_t* additional_data,
191  size_t additional_data_size,
192  uint8_t** plaintext,
193  size_t* plaintext_size);
194 
199 {
203  const oe_uuid_t id;
204 
231  const oe_seal_setting_t* settings,
232  size_t settings_count,
233  const uint8_t* plaintext,
234  size_t plaintext_size,
235  const uint8_t* additional_data,
236  size_t additional_data_size,
237  uint8_t** blob,
238  size_t* blob_size);
239 
262  const uint8_t* blob,
263  size_t blob_size,
264  const uint8_t* additional_data,
265  size_t additional_data_size,
266  uint8_t** plaintext,
267  size_t* plaintext_size);
269 
284  const oe_seal_plugin_definition_t* plugin,
285  bool make_default);
286 
296 
297 OE_EXTERNC_END
298 
299 #endif /* _OE_SEAL_H */
_oe_seal_setting::type
int type
Setting type. See oe_seal_setting_type_t for details.
Definition: seal.h:30
oe_seal_setting_type_t
oe_seal_setting_type_t
Definition: seal.h:45
oe_seal_plugin_definition_t
struct _oe_seal_plugin_definition oe_seal_plugin_definition_t
Seal plug-in definition.
OE_SEAL_SETTING_POLICY
@ OE_SEAL_SETTING_POLICY
Desired sealing policy - either OE_SEAL_POLICY_UNIQUE or OE_SEAL_POLICY_PRODUCT.
Definition: seal.h:51
types.h
oe_unseal
oe_result_t oe_unseal(const uint8_t *blob, size_t blob_size, const uint8_t *additional_data, size_t additional_data_size, uint8_t **plaintext, size_t *plaintext_size)
Unseal a blob sealed by oe_seal().
oe_register_seal_plugin
oe_result_t oe_register_seal_plugin(const oe_seal_plugin_definition_t *plugin, bool make_default)
Register a plug-in to be used by oe_seal() and oe_unseal().
OE_SEAL_SETTING_ADDITIONAL_CONTEXT
@ OE_SEAL_SETTING_ADDITIONAL_CONTEXT
Additional context to be included in seal key derivation.
Definition: seal.h:59
_oe_seal_plugin_definition::unseal
oe_result_t(* unseal)(const uint8_t *blob, size_t blob_size, const uint8_t *additional_data, size_t additional_data_size, uint8_t **plaintext, size_t *plaintext_size)
Callback function to be called by oe_unseal() when unsealing a blob.
Definition: seal.h:261
_oe_uuid_t
Struct containing the definition for an UUID.
Definition: evidence.h:43
_oe_seal_plugin_definition::id
const oe_uuid_t id
UUID of the seal plug-in.
Definition: seal.h:203
oe_unregister_seal_plugin
oe_result_t oe_unregister_seal_plugin(const oe_uuid_t *plugin_id)
Unregister a plug-in identified by its UUID.
_oe_seal_plugin_definition
Seal plug-in definition.
Definition: seal.h:198
_oe_seal_setting::d
uint32_t d
double-word value. size should be set to 0.
Definition: seal.h:34
_oe_seal_setting::w
uint16_t w
word value. size should be set to 0.
Definition: seal.h:35
_oe_seal_setting::size
uint32_t size
Size of the buffer pointed to by value.p.
Definition: seal.h:31
result.h
_oe_seal_setting::b
uint8_t b
byte value. size should be set to 0.
Definition: seal.h:36
oe_seal_setting_t
struct _oe_seal_setting oe_seal_setting_t
Seal settings as TLV tuples.
OE_SEAL_SETTING_IV
@ OE_SEAL_SETTING_IV
IV (Initialization Vector) to use should the underlying cipher require one.
Definition: seal.h:65
_oe_seal_setting::q
uint64_t q
quad-word value. size should be set to 0.
Definition: seal.h:33
evidence.h
oe_seal
oe_result_t oe_seal(const oe_uuid_t *plugin_id, const oe_seal_setting_t *settings, size_t settings_count, const uint8_t *plaintext, size_t plaintext_size, const uint8_t *additional_data, size_t additional_data_size, uint8_t **blob, size_t *blob_size)
Seal data to an enclave using AEAD (Authenticated Encryption with Additioonal Data).
OE_SEAL_SETTING_MAX
@ OE_SEAL_SETTING_MAX
Upper bound of seal setting types.
Definition: seal.h:72
_oe_seal_setting::p
const void * p
buffer. size should be set to the buffer size in bytes.
Definition: seal.h:38
_oe_seal_plugin_definition::seal
oe_result_t(* seal)(const oe_seal_setting_t *settings, size_t settings_count, const uint8_t *plaintext, size_t plaintext_size, const uint8_t *additional_data, size_t additional_data_size, uint8_t **blob, size_t *blob_size)
Callback function to be called by oe_seal() when sealing a blob.
Definition: seal.h:230
OE_SEAL_SETTING_PLUGIN_DEFINED
@ OE_SEAL_SETTING_PLUGIN_DEFINED
Lower bound of plug-in defined setting types.
Definition: seal.h:79
oe_result_t
enum _oe_result oe_result_t
This enumeration type defines return codes for Open Enclave functions.
_oe_seal_setting
Seal settings as TLV tuples.
Definition: seal.h:28