Commit f98e115c authored by Johan Pascal's avatar Johan Pascal

Add test/bench on large groups

parent a29998e0
......@@ -39,6 +39,7 @@ set(SOURCE_FILES_CXX
lime_lime-tester.cpp
lime_helloworld-tester.cpp
lime_crypto-tester.cpp
lime_massive_group-tester.cpp
)
bc_apply_compile_flags(SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
......
......@@ -35,6 +35,11 @@ using namespace::soci;
namespace lime_tester {
// default url and ports of X3DH servers
std::string test_x3dh_server_url{"localhost"};
std::string test_x3dh_c25519_server_port{"25519"};
std::string test_x3dh_c448_server_port{"25520"};
/* for testing purpose RNG, no need to be good one */
std::random_device rd;
std::uniform_int_distribution<uint8_t> uniform_dist(0,255);
......
......@@ -32,7 +32,12 @@
using namespace::lime;
namespace lime_tester {
// default url and ports of X3DH servers
extern std::string test_x3dh_server_url;
extern std::string test_x3dh_c25519_server_port;
extern std::string test_x3dh_c448_server_port;
// messages pattern
extern std::string shortMessage;
extern std::string longMessage;
extern std::string veryLongMessage;
......
......@@ -27,11 +27,6 @@ static const char *log_domain = "lime";
bool cleanDatabase = true;
bool bench = false;
// settings used in lime suite
extern std::string test_x3dh_server_url;
extern std::string test_x3dh_c25519_server_port;
extern std::string test_x3dh_c448_server_port;
static void log_handler(int lev, const char *fmt, va_list args) {
#ifdef _WIN32
/* We must use stdio to avoid log formatting (for autocompletion etc.) */
......@@ -56,6 +51,7 @@ void lime_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list
bc_tester_add_suite(&lime_crypto_test_suite);
bc_tester_add_suite(&lime_double_ratchet_test_suite);
bc_tester_add_suite(&lime_lime_test_suite);
bc_tester_add_suite(&lime_massive_group_test_suite);
bc_tester_add_suite(&lime_helloworld_test_suite);
}
......@@ -134,13 +130,13 @@ int main(int argc, char *argv[]) {
if (lime_tester_set_log_file(argv[i]) < 0) return -2;
} else if (strcmp(argv[i],"--x3dh-server-name")==0){
CHECK_ARG("--x3dh-server-name", ++i, argc);
test_x3dh_server_url=std::string(argv[i]);
lime_tester::test_x3dh_server_url=std::string(argv[i]);
} else if (strcmp(argv[i],"--c255-x3dh-server-port")==0){
CHECK_ARG("--c255-x3dh-server-port", ++i, argc);
test_x3dh_c25519_server_port=std::string(argv[i]);
lime_tester::test_x3dh_c25519_server_port=std::string(argv[i]);
} else if (strcmp(argv[i],"--c448-x3dh-server-port")==0){
CHECK_ARG("--c448-x3dh-server-port", ++i, argc);
test_x3dh_c448_server_port=std::string(argv[i]);
lime_tester::test_x3dh_c448_server_port=std::string(argv[i]);
} else if (strcmp(argv[i],"--operation-timeout")==0){
CHECK_ARG("--operation-timeout", ++i, argc);
lime_tester::wait_for_timeout=std::atoi(argv[i]);
......
......@@ -34,6 +34,7 @@ extern test_suite_t lime_double_ratchet_test_suite;
extern test_suite_t lime_lime_test_suite;
extern test_suite_t lime_helloworld_test_suite;
extern test_suite_t lime_crypto_test_suite;
extern test_suite_t lime_massive_group_test_suite;
void lime_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args));
void lime_tester_uninit(void);
......
......@@ -29,10 +29,6 @@
using namespace::std;
using namespace::lime;
extern std::string test_x3dh_server_url;
extern std::string test_x3dh_c25519_server_port;
extern std::string test_x3dh_c448_server_port;
static belle_sip_stack_t *stack=NULL;
static belle_http_provider_t *prov=NULL;
......@@ -609,20 +605,20 @@ static void helloworld_verifyIdentity_test(const lime::CurveId curve, const std:
static void helloworld_basic(void) {
// run the test on Curve25519 and Curve448 based encryption if available
#ifdef EC25519_ENABLED
helloworld_basic_test(lime::CurveId::c25519, "helloworld_basic", std::string("https://").append(test_x3dh_server_url).append(":").append(test_x3dh_c25519_server_port).data());
helloworld_basic_test(lime::CurveId::c25519, "helloworld_basic", std::string("https://").append(lime_tester::test_x3dh_server_url).append(":").append(lime_tester::test_x3dh_c25519_server_port).data());
#endif
#ifdef EC448_ENABLED
helloworld_basic_test(lime::CurveId::c448, "helloworld_basic", std::string("https://").append(test_x3dh_server_url).append(":").append(test_x3dh_c448_server_port).data());
helloworld_basic_test(lime::CurveId::c448, "helloworld_basic", std::string("https://").append(lime_tester::test_x3dh_server_url).append(":").append(lime_tester::test_x3dh_c448_server_port).data());
#endif
}
static void helloworld_verifyIdentity(void) {
// run the test on Curve25519 and Curve448 based encryption if available
#ifdef EC25519_ENABLED
helloworld_verifyIdentity_test(lime::CurveId::c25519, "helloworld_basic", std::string("https://").append(test_x3dh_server_url).append(":").append(test_x3dh_c25519_server_port).data());
helloworld_verifyIdentity_test(lime::CurveId::c25519, "helloworld_basic", std::string("https://").append(lime_tester::test_x3dh_server_url).append(":").append(lime_tester::test_x3dh_c25519_server_port).data());
#endif
#ifdef EC448_ENABLED
helloworld_verifyIdentity_test(lime::CurveId::c448, "helloworld_basic", std::string("https://").append(test_x3dh_server_url).append(":").append(test_x3dh_c448_server_port).data());
helloworld_verifyIdentity_test(lime::CurveId::c448, "helloworld_basic", std::string("https://").append(lime_tester::test_x3dh_server_url).append(":").append(lime_tester::test_x3dh_c448_server_port).data());
#endif
}
......
This diff is collapsed.
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