1 /* 2 * lws-api-test-gencrypto 3 * 4 * Written in 2010-2018 by Andy Green <andy@warmcat.com> 5 * 6 * This file is made available under the Creative Commons CC0 1.0 7 * Universal Public Domain Dedication. 8 */ 9 10 #include <libwebsockets.h> 11 12 int 13 test_genaes(struct lws_context *context); 14 int 15 test_genec(struct lws_context *context); 16 main(int argc,const char ** argv)17int main(int argc, const char **argv) 18 { 19 struct lws_context_creation_info info; 20 struct lws_context *context; 21 const char *p; 22 int result = 0, logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE; 23 24 if ((p = lws_cmdline_option(argc, argv, "-d"))) 25 logs = atoi(p); 26 27 lws_set_log_level(logs, NULL); 28 lwsl_user("LWS gencrypto apis tests\n"); 29 30 memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */ 31 #if defined(LWS_WITH_NETWORK) 32 info.port = CONTEXT_PORT_NO_LISTEN; 33 #endif 34 info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT; 35 36 context = lws_create_context(&info); 37 if (!context) { 38 lwsl_err("lws init failed\n"); 39 return 1; 40 } 41 42 result |= test_genaes(context); 43 result |= test_genec(context); 44 45 lwsl_user("Completed: %s\n", result ? "FAIL" : "PASS"); 46 47 lws_context_destroy(context); 48 49 return result; 50 } 51