OLD | NEW |
1 /* | 1 /* |
2 * kernel_driver.c | 2 * kernel_driver.c |
3 * | 3 * |
4 * a test driver for the crypto_kernel | 4 * a test driver for the crypto_kernel |
5 * | 5 * |
6 * David A. McGrew | 6 * David A. McGrew |
7 * Cisco Systems, Inc. | 7 * Cisco Systems, Inc. |
8 */ | 8 */ |
9 /* | 9 /* |
10 * | 10 * |
(...skipping 30 matching lines...) Expand all Loading... |
41 * OF THE POSSIBILITY OF SUCH DAMAGE. | 41 * OF THE POSSIBILITY OF SUCH DAMAGE. |
42 * | 42 * |
43 */ | 43 */ |
44 | 44 |
45 | 45 |
46 #ifdef HAVE_CONFIG_H | 46 #ifdef HAVE_CONFIG_H |
47 #include <config.h> | 47 #include <config.h> |
48 #endif | 48 #endif |
49 | 49 |
50 #include <stdio.h> /* for printf() */ | 50 #include <stdio.h> /* for printf() */ |
51 #include <unistd.h> /* for getopt() */ | 51 #include "getopt_s.h" |
52 #include "crypto_kernel.h" | 52 #include "crypto_kernel.h" |
53 | 53 |
54 void | 54 void |
55 usage(char *prog_name) { | 55 usage(char *prog_name) { |
56 printf("usage: %s [ -v ][ -d debug_module ]*\n", prog_name); | 56 printf("usage: %s [ -v ][ -d debug_module ]*\n", prog_name); |
57 exit(255); | 57 exit(255); |
58 } | 58 } |
59 | 59 |
60 int | 60 int |
61 main (int argc, char *argv[]) { | 61 main (int argc, char *argv[]) { |
62 extern char *optarg; | |
63 int q; | 62 int q; |
64 int do_validation = 0; | 63 int do_validation = 0; |
65 err_status_t status; | 64 err_status_t status; |
66 | 65 |
67 if (argc == 1) | 66 if (argc == 1) |
68 usage(argv[0]); | 67 usage(argv[0]); |
69 | 68 |
70 /* initialize kernel - we need to do this before anything else */ | 69 /* initialize kernel - we need to do this before anything else */ |
71 status = crypto_kernel_init(); | 70 status = crypto_kernel_init(); |
72 if (status) { | 71 if (status) { |
73 printf("error: crypto_kernel init failed\n"); | 72 printf("error: crypto_kernel init failed\n"); |
74 exit(1); | 73 exit(1); |
75 } | 74 } |
76 printf("crypto_kernel successfully initalized\n"); | 75 printf("crypto_kernel successfully initalized\n"); |
77 | 76 |
78 /* process input arguments */ | 77 /* process input arguments */ |
79 while (1) { | 78 while (1) { |
80 q = getopt(argc, argv, "vd:"); | 79 q = getopt_s(argc, argv, "vd:"); |
81 if (q == -1) | 80 if (q == -1) |
82 break; | 81 break; |
83 switch (q) { | 82 switch (q) { |
84 case 'v': | 83 case 'v': |
85 do_validation = 1; | 84 do_validation = 1; |
86 break; | 85 break; |
87 case 'd': | 86 case 'd': |
88 status = crypto_kernel_set_debug_module(optarg, 1); | 87 status = crypto_kernel_set_debug_module(optarg_s, 1); |
89 if (status) { | 88 if (status) { |
90 » printf("error: set debug module (%s) failed\n", optarg); | 89 » printf("error: set debug module (%s) failed\n", optarg_s); |
91 exit(1); | 90 exit(1); |
92 } | 91 } |
93 break; | 92 break; |
94 default: | 93 default: |
95 usage(argv[0]); | 94 usage(argv[0]); |
96 } | 95 } |
97 } | 96 } |
98 | 97 |
99 if (do_validation) { | 98 if (do_validation) { |
100 printf("checking crypto_kernel status...\n"); | 99 printf("checking crypto_kernel status...\n"); |
(...skipping 20 matching lines...) Expand all Loading... |
121 * of the crypto_kernel | 120 * of the crypto_kernel |
122 */ | 121 */ |
123 | 122 |
124 err_status_t | 123 err_status_t |
125 crypto_kernel_cipher_test(void) { | 124 crypto_kernel_cipher_test(void) { |
126 | 125 |
127 /* not implemented yet! */ | 126 /* not implemented yet! */ |
128 | 127 |
129 return err_status_ok; | 128 return err_status_ok; |
130 } | 129 } |
OLD | NEW |