#include "Enclave_t.h" #include "comms.hpp" #include "config.hpp" #include "utils.hpp" #include "route.hpp" #include "ingest.hpp" #define CEILDIV(x,y) (((x)+(y)-1)/(y)) unsigned long ingestion_epoch; unsigned long storage_epoch; Config g_teems_config; int generateMasterKeys(sgx_aes_gcm_128bit_key_t master_secret, sgx_aes_gcm_128bit_key_t &ESK, sgx_aes_gcm_128bit_key_t &TSK) { unsigned char zeroes[SGX_AESGCM_KEY_SIZE]; unsigned char iv[SGX_AESGCM_IV_SIZE]; sgx_aes_gcm_128bit_tag_t mac; memset(zeroes, 0, SGX_AESGCM_KEY_SIZE); memset(iv, 0, SGX_AESGCM_IV_SIZE); memcpy(iv, "Encryption", sizeof("Encryption")); sgx_status_t ret = SGX_SUCCESS; ret = sgx_rijndael128GCM_encrypt((const sgx_aes_gcm_128bit_key_t *) (master_secret), zeroes, SGX_AESGCM_KEY_SIZE, (uint8_t*) ESK, iv, SGX_AESGCM_IV_SIZE, NULL, 0, &mac); if(ret!=SGX_SUCCESS) { return -1; } printf("Encryption Master Key: "); for(int i=0;iuser_count; g_teems_config.msg_size = apiparams->msg_size; g_teems_config.m_priv_out = apiparams->m_priv_out; g_teems_config.m_priv_in = apiparams->m_priv_in; g_teems_config.m_pub_out = apiparams->m_pub_out; g_teems_config.m_pub_in = apiparams->m_pub_in; memcpy(g_teems_config.master_secret, apiparams->master_secret, SGX_AESGCM_KEY_SIZE); g_teems_config.private_routing = apiparams->private_routing; // Temporary vectors to store node numbers for nodes of different // types, where the node numbers are smaller than our own node // number std::vector ing_smaller, rte_smaller, str_smaller; uint16_t cumul_weight = 0; g_teems_config.weights.clear(); g_teems_config.ingestion_nodes.clear(); g_teems_config.routing_nodes.clear(); g_teems_config.storage_nodes.clear(); g_teems_config.storage_map.clear(); for (nodenum_t i=0; i