Unverified Commit 1fa379be authored by kladko's avatar kladko

SKALE-2345 Cleaning testst

parent 4ccc28e7
......@@ -46,10 +46,10 @@
#include "spdlog/spdlog.h"
#include "common.h"
int printDebugInfo = 0;
int useHTTPS = 1;
int encryptKeys = 0;
bool autoconfirm = false;
int printDebugInfo = -1;
int useHTTPS = -1;
int encryptKeys = -1;
int autoconfirm = -1;
SGXRegistrationServer *registrationServer = nullptr;
HttpServer *httpServer2 = nullptr;
......
......@@ -86,7 +86,6 @@ void initEnclave() {
updated = 0;
#ifndef SGX_HW_SIM
unsigned long support;
support = get_sgx_support();
......@@ -108,13 +107,14 @@ void initEnclave() {
fprintf(stderr, "sgx_create_enclave: %s: file not found\n", ENCLAVE_NAME);
fprintf(stderr, "Did you forget to set LD_LIBRARY_PATH?\n");
} else {
spdlog::error("sgx_create_enclave_search failed");
fprintf(stderr, "%s: 0x%04x\n", ENCLAVE_NAME, status);
}
exit(1);
}
//fprintf(stderr, "Enclave launched\n");
spdlog::info( "Enclave launched");
spdlog::error( "Enclave created and started successfully");
status = tgmp_init(eid);
if (status != SGX_SUCCESS) {
......@@ -122,10 +122,8 @@ void initEnclave() {
exit(1);
}
if (printDebugInfo) {
spdlog::info("libtgmp initialized");
//fprintf(stderr, "libtgmp initialized\n");
}
spdlog::info("Enclave libtgmp library initialized successfully");
}
......
......@@ -65,18 +65,25 @@ void printUsage() {
}
int main(int argc, char *argv[]) {
bool encryptKeysOption = false;
bool useHTTPSOption = true;
bool printDebugInfoOption = false;
bool autoconfirmOption = false;
bool checkClientCertOption = true;
bool autoSignClientCertOption = false;
void (*SEK_initializer)();
SEK_initializer = init_SEK;
bool checkClientCert = true;
bool sign_automatically = false;
int opt;
if (argc > 1 && strlen(argv[1]) == 1) {
fprintf(stderr, "option is too short %s\n", argv[1]);
printUsage();
exit(1);
}
encryptKeys = 0;
while ((opt = getopt(argc, argv, "cshd0aby")) != -1) {
switch (opt) {
......@@ -90,25 +97,25 @@ int main(int argc, char *argv[]) {
exit(1);
}
case 'c':
checkClientCert = false;
checkClientCertOption = false;
break;
case 's':
sign_automatically = true;
autoSignClientCertOption = true;
break;
case 'd':
printDebugInfo = 1;
printDebugInfoOption = true;
break;
case '0':
useHTTPS = 0;
useHTTPSOption = false;
break;
case 'a':
encryptKeys = 0;
encryptKeysOption = false;
break;
case 'b':
SEK_initializer = enter_SEK;
break;
case 'y':
autoconfirm = true;
autoconfirmOption = true;
break;
case '?':
printUsage();
......@@ -117,7 +124,10 @@ int main(int argc, char *argv[]) {
break;
}
}
initAll(checkClientCert, sign_automatically, SEK_initializer);
setFullOptions(printDebugInfoOption, useHTTPSOption, autoconfirmOption, encryptKeysOption);
initAll(checkClientCertOption, autoSignClientCertOption, SEK_initializer);
while (true) {
sleep(10);
......
......@@ -39,7 +39,23 @@
extern int printDebugInfo;
extern int useHTTPS;
extern int encryptKeys;
extern bool autoconfirm;
extern int autoconfirm;
inline void setFullOptions(int _printDebugInfo, int _useHTTPS, int _autoconfirm, int _encryptKeys) {
printDebugInfo = _printDebugInfo;
useHTTPS = _useHTTPS;
autoconfirm = _autoconfirm;
encryptKeys = _encryptKeys;
}
inline void setOptions(int _printDebugInfo, int _useHTTPS, int _autoconfirm) {
setFullOptions(_printDebugInfo, _useHTTPS, _autoconfirm, false);
}
#define BUF_LEN 1024
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment