mirror of
https://github.com/corda/corda.git
synced 2025-06-19 23:53:52 +00:00
ENT-1263 - Use MRENCLAVE instead of enclave ID in create_thread (#487)
* 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
This commit is contained in:
21
sgx-jvm/jvm-enclave/common/enclave_map.cpp
Normal file
21
sgx-jvm/jvm-enclave/common/enclave_map.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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;
|
||||
}
|
Reference in New Issue
Block a user