Asylo
|
A manager object responsible for creating and managing enclave instances. More...
#include <enclave_manager.h>
Public Member Functions | |
Status | LoadEnclave (const EnclaveLoadConfig &load_config) |
Loads an enclave. More... | |
Status | LoadEnclave (absl::string_view name, const EnclaveLoader &loader, void *base_address=nullptr, const size_t enclave_size=0) |
Loads an enclave. More... | |
Status | LoadEnclave (absl::string_view name, const EnclaveLoader &loader, EnclaveConfig config, void *base_address=nullptr, const size_t enclave_size=0) |
Loads an enclave. More... | |
EnclaveClient * | GetClient (absl::string_view name) const ABSL_LOCKS_EXCLUDED(client_table_lock_) |
Fetches a client to a loaded enclave. More... | |
const absl::string_view | GetName (const EnclaveClient *client) const ABSL_LOCKS_EXCLUDED(client_table_lock_) |
Returns the name of an enclave client. More... | |
Status | DestroyEnclave (EnclaveClient *client, const EnclaveFinal &final_input, bool skip_finalize=false) ABSL_LOCKS_EXCLUDED(client_table_lock_) |
Destroys an enclave. More... | |
SharedResourceManager * | shared_resources () |
Fetches the shared resource manager object. More... | |
const SharedResourceManager * | shared_resources () const |
Fetches the shared resource manager object. More... | |
EnclaveLoadConfig | GetLoadConfigFromClient (EnclaveClient *client) ABSL_LOCKS_EXCLUDED(client_table_lock_) |
Get the load config of an enclave. More... | |
Static Public Member Functions | |
static StatusOr< EnclaveManager * > | Instance () |
Fetches the EnclaveManager singleton instance. More... | |
static Status | Configure (const EnclaveManagerOptions &options) |
A manager object responsible for creating and managing enclave instances.
EnclaveManager is a singleton class that tracks the status of enclaves within a process. Users can get a pointer to the singleton instance by calling the static Instance() method.
NOTE: Configuring the EnclaveManager with Configure() is no longer required before obtaining a pointer to the singleton instance.
|
static |
Configures the enclave manager.
options | Configuration options as described in EnclaveManagerOptions. |
Status asylo::EnclaveManager::DestroyEnclave | ( | EnclaveClient * | client, |
const EnclaveFinal & | final_input, | ||
bool | skip_finalize = false |
||
) |
Destroys an enclave.
Destroys an enclave. This method calls client's
EnterAndFinalize entry point with final_input unless skip_finalize
is true, then calls client's
DestroyEnclave method, and then removes client's name from the EnclaveManager client registry. The manager owns the client, so removing it calls client's destructor and frees its memory. The client is destroyed regardless of whether client's
EnterAndFinalize method succeeds or fails. This method must not be invoked more than once.
client | A client attached to the enclave to destroy. |
final_input | Input to pass the enclave's finalizer. |
skip_finalize | If true, the enclave is destroyed without invoking its Finalize method. |
EnclaveClient* asylo::EnclaveManager::GetClient | ( | absl::string_view | name | ) | const |
Fetches a client to a loaded enclave.
name | The name of an EnclaveClient that may be registered in the EnclaveManager. |
EnclaveLoadConfig asylo::EnclaveManager::GetLoadConfigFromClient | ( | EnclaveClient * | client | ) |
Get the load config of an enclave.
This should only be used during fork in order to load an enclave with the same load config as the parent.
const absl::string_view asylo::EnclaveManager::GetName | ( | const EnclaveClient * | client | ) | const |
Returns the name of an enclave client.
client | A pointer to a client that may be registered in the EnclaveManager. |
client
the empty string will be returned.
|
static |
Fetches the EnclaveManager singleton instance.
Status asylo::EnclaveManager::LoadEnclave | ( | const EnclaveLoadConfig & | load_config | ) |
Loads an enclave.
Loads a new enclave utilizing the passed enclave backend loader configuration settings. The loaded enclave is bound to the value of field name
set in |load_config|. The enclave is initialized with custom enclave config settings if the config
field is set in |load_config|. Else, the enclave is initialized with default Asylo enclave config settings.
It is an error to specify a name which is already bound to an enclave.
Example: 1) Load an enclave with custom enclave config settings
2) Load an enclave with default enclave config settings
load_config | Backend configuration options to load an enclave |
Status asylo::EnclaveManager::LoadEnclave | ( | absl::string_view | name, |
const EnclaveLoader & | loader, | ||
void * | base_address = nullptr , |
||
const size_t | enclave_size = 0 |
||
) |
Loads an enclave.
Loads a new enclave with default enclave config settings and binds it to a name. The actual work of opening the enclave is delegated to the passed loader object.
It is an error to specify a name which is already bound to an enclave.
Example:
name | Name to bind the loaded enclave under. |
loader | Configured enclave loader to load from. |
base_address | Start address to load enclave(optional). |
enclave_size | The size of the enclave in memory(only needed if |base_address| is specified). |
Status asylo::EnclaveManager::LoadEnclave | ( | absl::string_view | name, |
const EnclaveLoader & | loader, | ||
EnclaveConfig | config, | ||
void * | base_address = nullptr , |
||
const size_t | enclave_size = 0 |
||
) |
Loads an enclave.
Loads a new enclave with custom enclave config settings and binds it to a name. The actual work of opening the enclave is delegated to the passed loader object.
It is an error to specify a name which is already bound to an enclave.
Example:
name | Name to bind the loaded enclave under. |
loader | Configured enclave loader to load from. |
config | Enclave configuration to launch the enclave with. |
base_address | Start address to load enclave(optional). |
enclave_size | The size of the enclave in memory(only needed if |base_address| is specified). |
|
inline |
Fetches the shared resource manager object.
|
inline |
Fetches the shared resource manager object.