1/*
2 * lws-api-test-cose
3 *
4 * Written in 2010-2021 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
12int
13test_cose_keys(struct lws_context *context);
14int
15test_cose_sign(struct lws_context *context);
16
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 COSE api 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 = 0;
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_cose_keys(context);
43	result |= test_cose_sign(context);
44
45	lwsl_user("Completed: %s\n", result ? "FAIL" : "PASS");
46
47	lws_context_destroy(context);
48
49	return result;
50}
51