Browse Source

Touch up App/appconfig.{cpp,hpp}

Ian Goldberg 11 months ago
parent
commit
5d5f9d9071
2 changed files with 8 additions and 6 deletions
  1. 6 4
      App/appconfig.cpp
  2. 2 2
      App/appconfig.hpp

+ 6 - 4
App/appconfig.cpp

@@ -7,8 +7,6 @@
 #include "boost/property_tree/ptree.hpp"
 #include "boost/property_tree/json_parser.hpp"
 
-EnclaveAPIParams apiparams;
-
 // Split a hostport string like "127.0.0.1:12000" at the rightmost colon
 // into a host part "127.0.0.1" and a port part "12000".
 static bool split_host_port(std::string &host, std::string &port,
@@ -86,8 +84,10 @@ bool config_parse(Config &config, const std::string configstr,
                     config.m_pub_out = pentry.second.get_value<uint8_t>();
                 } else if (!pentry.first.compare("pub_in")) {
                     config.m_pub_in = pentry.second.get_value<uint8_t>();
-                // Currently hardcoding an AES key for client -> server communication
                 } else if (!pentry.first.compare("master_secret")) {
+                    // Currently hardcoding an AES key for client <->
+                    // server communication, but in reality, a key
+                    // exchange would be done
                     std::string hex_key = pentry.second.data();
                     memcpy(config.master_secret, hex_key.c_str(), SGX_AESGCM_KEY_SIZE);
                 } else if (!pentry.first.compare("private_routing")) {
@@ -158,6 +158,7 @@ bool config_parse(Config &config, const std::string configstr,
     if (!ret) return ret;
 
     // Now load the config into the enclave
+    EnclaveAPIParams apiparams;
     apiparams.user_count = config.user_count;
     apiparams.msg_size = config.msg_size;
     apiparams.m_priv_out = config.m_priv_out;
@@ -175,7 +176,8 @@ bool config_parse(Config &config, const std::string configstr,
         apinodeconfigs[i].weight = config.nodes[i].weight;
         apinodeconfigs[i].roles = config.nodes[i].roles;
     }
-    ret &= ecall_config_load(nthreads, &apiparams, apinodeconfigs.data(), num_nodes, config.my_node_num);
+    ret &= ecall_config_load(nthreads, &apiparams, apinodeconfigs.data(),
+        num_nodes, config.my_node_num);
     if (!ret) {
         std::cerr << "Loading config into enclave failed\n";
     }

+ 2 - 2
App/appconfig.hpp

@@ -36,12 +36,12 @@ struct Config {
     std::vector<NodeConfig> nodes;
     // Which node is this one?
     nodenum_t my_node_num;
-    // Hardcoded master secret to generate keys for client -> server communication
+    // Stub hardcoded master secret to generate keys for client <->
+    // server communication (in reality, a key exchange would be done)
     sgx_aes_gcm_128bit_key_t master_secret;
 };
 
 bool config_parse(Config &config, const std::string configstr,
     const std::string &myname, threadid_t nthreads);
 
-extern EnclaveAPIParams apiparams;
 #endif