MCPcopy Create free account
hub / github.com/cisco/libsrtp / main

Function main

crypto/test/kernel_driver.c:59–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59int main(int argc, char *argv[])
60{
61 int q;
62 int do_validation = 0;
63 srtp_err_status_t status;
64
65 if (argc == 1)
66 usage(argv[0]);
67
68 /* initialize kernel - we need to do this before anything else */
69 status = srtp_crypto_kernel_init();
70 if (status) {
71 printf("error: srtp_crypto_kernel init failed\n");
72 exit(1);
73 }
74 printf("srtp_crypto_kernel successfully initalized\n");
75
76 /* process input arguments */
77 while (1) {
78 q = getopt_s(argc, argv, "vd:");
79 if (q == -1)
80 break;
81 switch (q) {
82 case 'v':
83 do_validation = 1;
84 break;
85 case 'd':
86 status = srtp_crypto_kernel_set_debug_module(optarg_s, 1);
87 if (status) {
88 printf("error: set debug module (%s) failed\n", optarg_s);
89 exit(1);
90 }
91 break;
92 default:
93 usage(argv[0]);
94 }
95 }
96
97 if (do_validation) {
98 printf("checking srtp_crypto_kernel status...\n");
99 status = srtp_crypto_kernel_status();
100 if (status) {
101 printf("failed\n");
102 exit(1);
103 }
104 printf("srtp_crypto_kernel passed self-tests\n");
105 }
106
107 status = srtp_crypto_kernel_shutdown();
108 if (status) {
109 printf("error: srtp_crypto_kernel shutdown failed\n");
110 exit(1);
111 }
112 printf("srtp_crypto_kernel successfully shut down\n");
113
114 return 0;
115}

Callers

nothing calls this directly

Calls 6

srtp_crypto_kernel_initFunction · 0.85
getopt_sFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected