|
@@ -73,7 +73,8 @@ void Ingestion::initialize(uint32_t num, uint32_t start, sgx_aes_gcm_128bit_key_
|
|
|
|
|
|
bool Ingestion::authenticate(clientid_t cid, unsigned char *auth_message)
|
|
|
{
|
|
|
- uint32_t lcid = cid-cstart;
|
|
|
+ uint32_t num_ing_nodes = g_teems_config.num_ingestion_nodes;
|
|
|
+ uint32_t lcid = cid / num_ing_nodes;
|
|
|
const sgx_aes_gcm_128bit_key_t *ckey = &(clients[lcid].key);
|
|
|
return(authenticateClient(auth_message, ckey));
|
|
|
}
|
|
@@ -82,7 +83,8 @@ bool Ingestion::processMsgBundle(clientid_t cid, unsigned char *msgbundle,
|
|
|
uint32_t num_msgs) {
|
|
|
|
|
|
// Fetch corresponding client key
|
|
|
- clientid_t lcid = cid - g_ing.cstart;
|
|
|
+ uint32_t num_ing_nodes = g_teems_config.num_ingestion_nodes;
|
|
|
+ clientid_t lcid = cid / num_ing_nodes;
|
|
|
sgx_aes_gcm_128bit_key_t *ckey = &(clients[lcid].key);
|
|
|
unsigned char *iv = msgbundle;
|
|
|
msgbundle += SGX_AESGCM_IV_SIZE;
|
|
@@ -120,13 +122,6 @@ bool Ingestion::processMsgBundle(clientid_t cid, unsigned char *msgbundle,
|
|
|
msg_queue.reserved += num_msgs;
|
|
|
pthread_mutex_unlock(&msg_queue.mutex);
|
|
|
|
|
|
- /*
|
|
|
- if(lcid==0) {
|
|
|
- printf("\n\nIngestion: Message for lcid 0, S, R = %ld, %ld\n\n\n", *((uint32_t*) dec_msgbundle),
|
|
|
- *((uint32_t*) (dec_msgbundle + 4)));
|
|
|
- }
|
|
|
- */
|
|
|
-
|
|
|
memmove(msg_queue.buf + head * msg_size,
|
|
|
dec_msgbundle, num_msgs * msg_size);
|
|
|
|
|
@@ -143,8 +138,10 @@ bool Ingestion::processMsgBundle(clientid_t cid, unsigned char *msgbundle,
|
|
|
|
|
|
void Ingestion::generateClientKeys(sgx_aes_gcm_128bit_key_t &ESK)
|
|
|
{
|
|
|
- printf("In Ingestion::genCK, num_clients = %d, client_start = %d, client_end = %d\n",
|
|
|
- cnum, cstart, cnum + cstart);
|
|
|
+ //printf("In Ingestion::genCK, num_clients = %d, client_start = %d, client_end = %d\n",
|
|
|
+ // cnum, cstart, cnum + cstart);
|
|
|
+ uint32_t num_ing_nodes = g_teems_config.num_ingestion_nodes;
|
|
|
+
|
|
|
for(uint32_t i=0; i<cnum; i++)
|
|
|
{
|
|
|
unsigned char zeroes[SGX_AESGCM_KEY_SIZE];
|
|
@@ -153,7 +150,7 @@ void Ingestion::generateClientKeys(sgx_aes_gcm_128bit_key_t &ESK)
|
|
|
memset(zeroes, 0, SGX_AESGCM_KEY_SIZE);
|
|
|
memset(iv, 0, SGX_AESGCM_IV_SIZE);
|
|
|
|
|
|
- uint32_t client_num = cstart + i;
|
|
|
+ uint32_t client_num = cstart + (i * num_ing_nodes);
|
|
|
memcpy(iv, (uint8_t*) (&client_num), sizeof(client_num));
|
|
|
|
|
|
sgx_status_t ret = SGX_SUCCESS;
|
|
@@ -164,6 +161,14 @@ void Ingestion::generateClientKeys(sgx_aes_gcm_128bit_key_t &ESK)
|
|
|
printf("Ingestion::GCK FAIL\n");
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ printf("Client %d Ingestion: (after Gen) ", client_num);
|
|
|
+ for(int j=0;j<SGX_AESGCM_KEY_SIZE;j++) {
|
|
|
+ printf("%x", (clients[i].key)[j]);
|
|
|
+ }
|
|
|
+ printf("\n");
|
|
|
+ */
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|