Edgeless RT  0.2.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ert.h
Go to the documentation of this file.
1 // Copyright (c) Edgeless Systems GmbH.
2 // Licensed under the MIT License.
3 
7 #pragma once
8 
9 #include <openenclave/enclave.h>
10 #include <openenclave/ert_args.h>
11 
12 OE_EXTERNC_BEGIN
13 
22 int emain(void);
23 
37 
48  const char* const* host_array,
49  char*** enclave_array,
50  size_t count);
51 
52 typedef struct _oe_customfs
53 {
54  uint8_t reserved[4248];
55  uintptr_t (*open)(void* context, const char* path, bool must_exist);
56  void (*close)(void* context, uintptr_t handle);
57  uint64_t (*get_size)(void* context, uintptr_t handle);
58  void (*unlink)(void* context, const char* path);
59  void (*read)(
60  void* context,
61  uintptr_t handle,
62  void* buf,
63  uint64_t count,
64  uint64_t offset);
65  bool (*write)(
66  void* context,
67  uintptr_t handle,
68  const void* buf,
69  uint64_t count,
70  uint64_t offset);
72 
91  const char* devname,
92  oe_customfs_t* ops,
93  void* context);
94 
95 OE_EXTERNC_END
96 
97 #ifdef __cplusplus
98 
99 #include <memory>
100 #include <string>
101 
102 namespace ert
103 {
104 namespace memfs
105 {
106 class Filesystem;
107 }
108 
120 class Memfs
121 {
122  public:
123  Memfs(const std::string& devname);
124  ~Memfs();
125  Memfs(const Memfs&) = delete;
126  Memfs& operator=(const Memfs&) = delete;
127 
128  private:
129  const std::unique_ptr<memfs::Filesystem> impl_;
130  oe_customfs_t ops_;
131  uint64_t devid_;
132 
133  static memfs::Filesystem& to_fs(void* context);
134 };
135 
140 namespace payload
141 {
147 const void* get_base() noexcept;
148 
158 void apply_relocations(void start_main(int payload_main(...)));
159 } // namespace payload
160 
161 } // namespace ert
162 
163 #endif // __cplusplus
Definition: ert_args.h:11
const void * get_base() noexcept
Get the base address of the payload image.
This file defines the programming interface for developing enclaves.
enum _oe_result oe_result_t
This enumeration type defines return codes for Open Enclave functions.
oe_result_t ert_get_args_ocall(ert_args_t *retval)
Get pointers to commandline arguments, environment variables, and auxiliary vector from host...
uint64_t oe_load_module_custom_file_system(const char *devname, oe_customfs_t *ops, void *context)
Load a custom file system.
int emain(void)
The enclave entry point used by erthost.
Definition: ert.h:102
void ert_copy_strings_from_host_to_enclave(const char *const *host_array, char ***enclave_array, size_t count)
Securely deep-copy an array of strings from the host to the enclave.
void apply_relocations(void start_main(int payload_main(...)))
Apply relocations to the payload image.
In-enclave-memory filesystem.
Definition: ert.h:120
Definition: ert.h:52