mirror of
https://github.com/corda/corda.git
synced 2025-02-09 20:31:18 +00:00
25bee1903a
* ENT-1263 - Use MRENCLAVE instead of enclave_id for create_thread * ENT-1263 - Dedup dependencies in JAR * ENT-1263 - Ensure C++ 11 is used for enclave inspection tool * ENT-1263 - Throw exception if enclave ID mapping does not exist
22 lines
803 B
C++
22 lines
803 B
C++
#include <cstring>
|
|
#include <stdexcept>
|
|
#include "enclave_map.h"
|
|
|
|
static enclave_map_t map;
|
|
|
|
void add_enclave_mapping(sgx_measurement_t *mr_enclave, sgx_enclave_id_t enclave_id) {
|
|
// Note: The size of the enclave map is proportional to the number of unique
|
|
// enclaves a system is dealing with. For the time being we don't envision this
|
|
// number to be very big. Longer term, we might want to implement some form of
|
|
// pruning to avoid old entries taking up unnecessary memory space.
|
|
map[mr_enclave] = enclave_id;
|
|
}
|
|
|
|
sgx_enclave_id_t get_enclave_id(sgx_measurement_t *mr_enclave) {
|
|
auto result = map.find(mr_enclave);
|
|
if (result == map.end()) {
|
|
throw std::invalid_argument("no enclave ID associated with enclave measurement");
|
|
}
|
|
return result->second;
|
|
}
|