Unverified Commit 1fa379be authored by kladko's avatar kladko

SKALE-2345 Cleaning testst

parent 4ccc28e7
...@@ -46,10 +46,10 @@ ...@@ -46,10 +46,10 @@
#include "spdlog/spdlog.h" #include "spdlog/spdlog.h"
#include "common.h" #include "common.h"
int printDebugInfo = 0; int printDebugInfo = -1;
int useHTTPS = 1; int useHTTPS = -1;
int encryptKeys = 0; int encryptKeys = -1;
bool autoconfirm = false; int autoconfirm = -1;
SGXRegistrationServer *registrationServer = nullptr; SGXRegistrationServer *registrationServer = nullptr;
HttpServer *httpServer2 = nullptr; HttpServer *httpServer2 = nullptr;
......
...@@ -86,7 +86,6 @@ void initEnclave() { ...@@ -86,7 +86,6 @@ void initEnclave() {
updated = 0; updated = 0;
#ifndef SGX_HW_SIM #ifndef SGX_HW_SIM
unsigned long support; unsigned long support;
support = get_sgx_support(); support = get_sgx_support();
...@@ -108,13 +107,14 @@ void initEnclave() { ...@@ -108,13 +107,14 @@ void initEnclave() {
fprintf(stderr, "sgx_create_enclave: %s: file not found\n", ENCLAVE_NAME); fprintf(stderr, "sgx_create_enclave: %s: file not found\n", ENCLAVE_NAME);
fprintf(stderr, "Did you forget to set LD_LIBRARY_PATH?\n"); fprintf(stderr, "Did you forget to set LD_LIBRARY_PATH?\n");
} else { } else {
spdlog::error("sgx_create_enclave_search failed");
fprintf(stderr, "%s: 0x%04x\n", ENCLAVE_NAME, status); fprintf(stderr, "%s: 0x%04x\n", ENCLAVE_NAME, status);
} }
exit(1); exit(1);
} }
//fprintf(stderr, "Enclave launched\n"); //fprintf(stderr, "Enclave launched\n");
spdlog::info( "Enclave launched"); spdlog::error( "Enclave created and started successfully");
status = tgmp_init(eid); status = tgmp_init(eid);
if (status != SGX_SUCCESS) { if (status != SGX_SUCCESS) {
...@@ -122,10 +122,8 @@ void initEnclave() { ...@@ -122,10 +122,8 @@ void initEnclave() {
exit(1); exit(1);
} }
if (printDebugInfo) { spdlog::info("Enclave libtgmp library initialized successfully");
spdlog::info("libtgmp initialized");
//fprintf(stderr, "libtgmp initialized\n");
}
} }
......
...@@ -65,18 +65,25 @@ void printUsage() { ...@@ -65,18 +65,25 @@ void printUsage() {
} }
int main(int argc, char *argv[]) { 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)(); void (*SEK_initializer)();
SEK_initializer = init_SEK; SEK_initializer = init_SEK;
bool checkClientCert = true;
bool sign_automatically = false;
int opt; int opt;
if (argc > 1 && strlen(argv[1]) == 1) { if (argc > 1 && strlen(argv[1]) == 1) {
fprintf(stderr, "option is too short %s\n", argv[1]); printUsage();
exit(1); exit(1);
} }
encryptKeys = 0;
while ((opt = getopt(argc, argv, "cshd0aby")) != -1) { while ((opt = getopt(argc, argv, "cshd0aby")) != -1) {
switch (opt) { switch (opt) {
...@@ -90,25 +97,25 @@ int main(int argc, char *argv[]) { ...@@ -90,25 +97,25 @@ int main(int argc, char *argv[]) {
exit(1); exit(1);
} }
case 'c': case 'c':
checkClientCert = false; checkClientCertOption = false;
break; break;
case 's': case 's':
sign_automatically = true; autoSignClientCertOption = true;
break; break;
case 'd': case 'd':
printDebugInfo = 1; printDebugInfoOption = true;
break; break;
case '0': case '0':
useHTTPS = 0; useHTTPSOption = false;
break; break;
case 'a': case 'a':
encryptKeys = 0; encryptKeysOption = false;
break; break;
case 'b': case 'b':
SEK_initializer = enter_SEK; SEK_initializer = enter_SEK;
break; break;
case 'y': case 'y':
autoconfirm = true; autoconfirmOption = true;
break; break;
case '?': case '?':
printUsage(); printUsage();
...@@ -117,7 +124,10 @@ int main(int argc, char *argv[]) { ...@@ -117,7 +124,10 @@ int main(int argc, char *argv[]) {
break; break;
} }
} }
initAll(checkClientCert, sign_automatically, SEK_initializer);
setFullOptions(printDebugInfoOption, useHTTPSOption, autoconfirmOption, encryptKeysOption);
initAll(checkClientCertOption, autoSignClientCertOption, SEK_initializer);
while (true) { while (true) {
sleep(10); sleep(10);
......
...@@ -39,7 +39,23 @@ ...@@ -39,7 +39,23 @@
extern int printDebugInfo; extern int printDebugInfo;
extern int useHTTPS; extern int useHTTPS;
extern int encryptKeys; 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 #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