-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.c
76 lines (61 loc) · 1.78 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Copyright (C) 2020 Dyne.org foundation
*
* This file is subject to the terms and conditions of the Affero GNU
* General Public License (AGPL) version 3. See the file LICENSE for
* more details.
*
*/
#include <wolfssl/ssl.h>
#include <wolfssl/wolfcrypt/sha256.h>
#include "shell.h"
#include "msg.h"
#include "dp3t-config.h"
#include "dp3t.h"
#include "keystore.h"
#include "ble_scan.h"
#define MAIN_QUEUE_SIZE (8)
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
extern int dtls_client(int argc, char **argv);
extern int dtls_server(int argc, char **argv);
#ifdef MODULE_WOLFCRYPT_TEST
extern int wolfcrypt_test(void* args);
static int wolftest(int argc, char **argv)
{
(void)argc;
(void)argv;
wolfcrypt_test(NULL);
return 0;
}
#endif
extern int gatt_server(void);
static const shell_command_t shell_commands[] = {
{ "testvec", "print test vectors", dp3t_shellcmd_testvec },
{ "rekey", "regenerate DP3T secure key", dp3t_shellcmd_rekey },
#ifdef MODULE_WOLFCRYPT_TEST
{ "wolftest", "Perform wolfcrypt porting test", wolftest },
#endif
{ NULL, NULL, NULL }
};
char line_buf[SHELL_DEFAULT_BUFSIZE];
int main(void)
{
uint8_t *ephid, *sk_t0;
/* we need a message queue for the thread running the shell in order to
* receive potentially fast incoming networking packets */
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
/* Global wolfSSL initialization */
wolfSSL_Init();
wolfSSL_Debugging_ON();
/* dp3t */
dp3t_start();
/* Start dp3t gatt advertisements */
gatt_server();
/* Start dp3t scan service */
dp3t_blescan_init();
/* start shell */
printf( "All up, running the shell now\r\n");
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
/* should be never reached */
return 0;
}