app/crypto-perf: fix AES CBC 128 test vectors
[dpdk.git] / app / test-crypto-perf / cperf_options_parsing.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Intel Corporation nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #include <getopt.h>
34 #include <unistd.h>
35
36 #include <rte_cryptodev.h>
37 #include <rte_malloc.h>
38
39 #include "cperf_options.h"
40
41 struct name_id_map {
42         const char *name;
43         uint32_t id;
44 };
45
46 static int
47 get_str_key_id_mapping(struct name_id_map *map, unsigned int map_len,
48                 const char *str_key)
49 {
50         unsigned int i;
51
52         for (i = 0; i < map_len; i++) {
53
54                 if (strcmp(str_key, map[i].name) == 0)
55                         return map[i].id;
56         }
57
58         return -1;
59 }
60
61 static int
62 parse_cperf_test_type(struct cperf_options *opts, const char *arg)
63 {
64         struct name_id_map cperftest_namemap[] = {
65                 {
66                         cperf_test_type_strs[CPERF_TEST_TYPE_THROUGHPUT],
67                         CPERF_TEST_TYPE_THROUGHPUT
68                 },
69                 {
70                         cperf_test_type_strs[CPERF_TEST_TYPE_LATENCY],
71                         CPERF_TEST_TYPE_LATENCY
72                 }
73         };
74
75         int id = get_str_key_id_mapping(
76                         (struct name_id_map *)cperftest_namemap,
77                         RTE_DIM(cperftest_namemap), arg);
78         if (id < 0) {
79                 RTE_LOG(ERR, USER1, "failed to parse test type");
80                 return -1;
81         }
82
83         opts->test = (enum cperf_perf_test_type)id;
84
85         return 0;
86 }
87
88 static int
89 parse_uint32_t(uint32_t *value, const char *arg)
90 {
91         char *end = NULL;
92         unsigned long n = strtoul(arg, &end, 10);
93
94         if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0'))
95                 return -1;
96
97         if (n > UINT32_MAX)
98                 return -ERANGE;
99
100         *value = (uint32_t) n;
101
102         return 0;
103 }
104
105 static int
106 parse_uint16_t(uint16_t *value, const char *arg)
107 {
108         uint32_t val = 0;
109         int ret = parse_uint32_t(&val, arg);
110
111         if (ret < 0)
112                 return ret;
113
114         if (val > UINT16_MAX)
115                 return -ERANGE;
116
117         *value = (uint16_t) val;
118
119         return 0;
120 }
121
122 static int
123 parse_total_ops(struct cperf_options *opts, const char *arg)
124 {
125         int ret = parse_uint32_t(&opts->total_ops, arg);
126
127         if (ret)
128                 RTE_LOG(ERR, USER1, "failed to parse total operations count\n");
129
130         if (opts->total_ops == 0) {
131                 RTE_LOG(ERR, USER1,
132                                 "invalid total operations count number specified\n");
133                 return -1;
134         }
135
136         return ret;
137 }
138
139 static int
140 parse_pool_sz(struct cperf_options *opts, const char *arg)
141 {
142         int ret =  parse_uint32_t(&opts->pool_sz, arg);
143
144         if (ret)
145                 RTE_LOG(ERR, USER1, "failed to parse pool size");
146         return ret;
147 }
148
149 static int
150 parse_burst_sz(struct cperf_options *opts, const char *arg)
151 {
152         int ret = parse_uint32_t(&opts->burst_sz, arg);
153
154         if (ret)
155                 RTE_LOG(ERR, USER1, "failed to parse burst size");
156         return ret;
157 }
158
159 static int
160 parse_buffer_sz(struct cperf_options *opts, const char *arg)
161 {
162         uint32_t i, valid_buf_sz[] = {
163                         32, 64, 128, 256, 384, 512, 768, 1024, 1280, 1536, 1792,
164                         2048
165         };
166
167         if (parse_uint32_t(&opts->buffer_sz, arg)) {
168                 RTE_LOG(ERR, USER1, "failed to parse buffer size");
169                 return -1;
170         }
171
172         for (i = 0; i < RTE_DIM(valid_buf_sz); i++)
173                 if (valid_buf_sz[i] == opts->buffer_sz)
174                         return 0;
175
176         RTE_LOG(ERR, USER1, "invalid buffer size specified");
177         return -1;
178 }
179
180 static int
181 parse_segments_nb(struct cperf_options *opts, const char *arg)
182 {
183         int ret = parse_uint32_t(&opts->segments_nb, arg);
184
185         if (ret) {
186                 RTE_LOG(ERR, USER1, "failed to parse segments number\n");
187                 return -1;
188         }
189
190         if ((opts->segments_nb == 0) || (opts->segments_nb > 255)) {
191                 RTE_LOG(ERR, USER1, "invalid segments number specified\n");
192                 return -1;
193         }
194
195         return 0;
196 }
197
198 static int
199 parse_device_type(struct cperf_options *opts, const char *arg)
200 {
201         if (strlen(arg) > (sizeof(opts->device_type) - 1))
202                 return -1;
203
204         strncpy(opts->device_type, arg, sizeof(opts->device_type) - 1);
205         *(opts->device_type + sizeof(opts->device_type) - 1) = '\0';
206
207         return 0;
208 }
209
210 static int
211 parse_op_type(struct cperf_options *opts, const char *arg)
212 {
213         struct name_id_map optype_namemap[] = {
214                 {
215                         cperf_op_type_strs[CPERF_CIPHER_ONLY],
216                         CPERF_CIPHER_ONLY
217                 },
218                 {
219                         cperf_op_type_strs[CPERF_AUTH_ONLY],
220                         CPERF_AUTH_ONLY
221                 },
222                 {
223                         cperf_op_type_strs[CPERF_CIPHER_THEN_AUTH],
224                         CPERF_CIPHER_THEN_AUTH
225                 },
226                 {
227                         cperf_op_type_strs[CPERF_AUTH_THEN_CIPHER],
228                         CPERF_AUTH_THEN_CIPHER
229                 },
230                 {
231                         cperf_op_type_strs[CPERF_AEAD],
232                         CPERF_AEAD
233                 }
234         };
235
236         int id = get_str_key_id_mapping(optype_namemap,
237                         RTE_DIM(optype_namemap), arg);
238         if (id < 0) {
239                 RTE_LOG(ERR, USER1, "invalid opt type specified\n");
240                 return -1;
241         }
242
243         opts->op_type = (enum cperf_op_type)id;
244
245         return 0;
246 }
247
248 static int
249 parse_sessionless(struct cperf_options *opts,
250                 const char *arg __rte_unused)
251 {
252         opts->sessionless = 1;
253         return 0;
254 }
255
256 static int
257 parse_out_of_place(struct cperf_options *opts,
258                 const char *arg __rte_unused)
259 {
260         opts->out_of_place = 1;
261         return 0;
262 }
263
264 static int
265 parse_verify(struct cperf_options *opts,
266                 const char *arg __rte_unused)
267 {
268         opts->verify = 1;
269
270         return 0;
271 }
272
273 static int
274 parse_test_file(struct cperf_options *opts,
275                 const char *arg)
276 {
277         opts->test_file = strdup(arg);
278         if (access(opts->test_file, F_OK) != -1)
279                 return 0;
280         RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n");
281
282         return -1;
283 }
284
285 static int
286 parse_test_name(struct cperf_options *opts,
287                 const char *arg)
288 {
289         char *test_name = (char *) rte_zmalloc(NULL,
290                 sizeof(char) * (strlen(arg) + 3), 0);
291         snprintf(test_name, strlen(arg) + 3, "[%s]", arg);
292         opts->test_name = test_name;
293
294         return 0;
295 }
296
297 static int
298 parse_silent(struct cperf_options *opts,
299                 const char *arg __rte_unused)
300 {
301         opts->silent = 1;
302
303         return 0;
304 }
305
306 static int
307 parse_cipher_algo(struct cperf_options *opts, const char *arg)
308 {
309
310         enum rte_crypto_cipher_algorithm cipher_algo;
311
312         if (rte_cryptodev_get_cipher_algo_enum(&cipher_algo, arg) < 0) {
313                 RTE_LOG(ERR, USER1, "Invalid cipher algorithm specified\n");
314                 return -1;
315         }
316
317         opts->cipher_algo = cipher_algo;
318
319         return 0;
320 }
321
322 static int
323 parse_cipher_op(struct cperf_options *opts, const char *arg)
324 {
325         struct name_id_map cipher_op_namemap[] = {
326                 {
327                         rte_crypto_cipher_operation_strings
328                         [RTE_CRYPTO_CIPHER_OP_ENCRYPT],
329                         RTE_CRYPTO_CIPHER_OP_ENCRYPT },
330                 {
331                         rte_crypto_cipher_operation_strings
332                         [RTE_CRYPTO_CIPHER_OP_DECRYPT],
333                         RTE_CRYPTO_CIPHER_OP_DECRYPT
334                 }
335         };
336
337         int id = get_str_key_id_mapping(cipher_op_namemap,
338                         RTE_DIM(cipher_op_namemap), arg);
339         if (id < 0) {
340                 RTE_LOG(ERR, USER1, "Invalid cipher operation specified\n");
341                 return -1;
342         }
343
344         opts->cipher_op = (enum rte_crypto_cipher_operation)id;
345
346         return 0;
347 }
348
349 static int
350 parse_cipher_key_sz(struct cperf_options *opts, const char *arg)
351 {
352         return parse_uint16_t(&opts->cipher_key_sz, arg);
353 }
354
355 static int
356 parse_cipher_iv_sz(struct cperf_options *opts, const char *arg)
357 {
358         return parse_uint16_t(&opts->cipher_iv_sz, arg);
359 }
360
361 static int
362 parse_auth_algo(struct cperf_options *opts, const char *arg)
363 {
364         enum rte_crypto_auth_algorithm auth_algo;
365
366         if (rte_cryptodev_get_auth_algo_enum(&auth_algo, arg) < 0) {
367                 RTE_LOG(ERR, USER1, "Invalid authentication algorithm specified\n");
368                 return -1;
369         }
370
371         opts->auth_algo = auth_algo;
372
373         return 0;
374 }
375
376 static int
377 parse_auth_op(struct cperf_options *opts, const char *arg)
378 {
379         struct name_id_map auth_op_namemap[] = {
380                 {
381                         rte_crypto_auth_operation_strings
382                         [RTE_CRYPTO_AUTH_OP_GENERATE],
383                         RTE_CRYPTO_AUTH_OP_GENERATE },
384                 {
385                         rte_crypto_auth_operation_strings
386                         [RTE_CRYPTO_AUTH_OP_VERIFY],
387                         RTE_CRYPTO_AUTH_OP_VERIFY
388                 }
389         };
390
391         int id = get_str_key_id_mapping(auth_op_namemap,
392                         RTE_DIM(auth_op_namemap), arg);
393         if (id < 0) {
394                 RTE_LOG(ERR, USER1, "invalid authentication operation specified"
395                                 "\n");
396                 return -1;
397         }
398
399         opts->auth_op = (enum rte_crypto_auth_operation)id;
400
401         return 0;
402 }
403
404 static int
405 parse_auth_key_sz(struct cperf_options *opts, const char *arg)
406 {
407         return parse_uint16_t(&opts->auth_key_sz, arg);
408 }
409
410 static int
411 parse_auth_digest_sz(struct cperf_options *opts, const char *arg)
412 {
413         return parse_uint16_t(&opts->auth_digest_sz, arg);
414 }
415
416 static int
417 parse_auth_aad_sz(struct cperf_options *opts, const char *arg)
418 {
419         return parse_uint16_t(&opts->auth_aad_sz, arg);
420 }
421
422 static int
423 parse_csv_friendly(struct cperf_options *opts, const char *arg __rte_unused)
424 {
425         opts->csv = 1;
426         opts->silent = 1;
427         return 0;
428 }
429
430 typedef int (*option_parser_t)(struct cperf_options *opts,
431                 const char *arg);
432
433 struct long_opt_parser {
434         const char *lgopt_name;
435         option_parser_t parser_fn;
436
437 };
438
439 static struct option lgopts[] = {
440
441         { CPERF_PTEST_TYPE, required_argument, 0, 0 },
442
443         { CPERF_POOL_SIZE, required_argument, 0, 0 },
444         { CPERF_TOTAL_OPS, required_argument, 0, 0 },
445         { CPERF_BURST_SIZE, required_argument, 0, 0 },
446         { CPERF_BUFFER_SIZE, required_argument, 0, 0 },
447         { CPERF_SEGMENTS_NB, required_argument, 0, 0 },
448
449         { CPERF_DEVTYPE, required_argument, 0, 0 },
450         { CPERF_OPTYPE, required_argument, 0, 0 },
451
452         { CPERF_SILENT, no_argument, 0, 0 },
453         { CPERF_SESSIONLESS, no_argument, 0, 0 },
454         { CPERF_OUT_OF_PLACE, no_argument, 0, 0 },
455         { CPERF_VERIFY, no_argument, 0, 0 },
456         { CPERF_TEST_FILE, required_argument, 0, 0 },
457         { CPERF_TEST_NAME, required_argument, 0, 0 },
458
459         { CPERF_CIPHER_ALGO, required_argument, 0, 0 },
460         { CPERF_CIPHER_OP, required_argument, 0, 0 },
461
462         { CPERF_CIPHER_KEY_SZ, required_argument, 0, 0 },
463         { CPERF_CIPHER_IV_SZ, required_argument, 0, 0 },
464
465         { CPERF_AUTH_ALGO, required_argument, 0, 0 },
466         { CPERF_AUTH_OP, required_argument, 0, 0 },
467
468         { CPERF_AUTH_KEY_SZ, required_argument, 0, 0 },
469         { CPERF_AUTH_DIGEST_SZ, required_argument, 0, 0 },
470         { CPERF_AUTH_AAD_SZ, required_argument, 0, 0 },
471         { CPERF_CSV, no_argument, 0, 0},
472
473         { NULL, 0, 0, 0 }
474 };
475
476 void
477 cperf_options_default(struct cperf_options *opts)
478 {
479         opts->test = CPERF_TEST_TYPE_THROUGHPUT;
480
481         opts->pool_sz = 8192;
482         opts->total_ops = 10000000;
483         opts->burst_sz = 32;
484         opts->buffer_sz = 64;
485         opts->segments_nb = 1;
486
487         strncpy(opts->device_type, "crypto_aesni_mb",
488                         sizeof(opts->device_type));
489
490         opts->op_type = CPERF_CIPHER_THEN_AUTH;
491
492         opts->silent = 0;
493         opts->verify = 0;
494         opts->test_file = NULL;
495         opts->test_name = NULL;
496         opts->sessionless = 0;
497         opts->out_of_place = 0;
498         opts->csv = 0;
499
500         opts->cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC;
501         opts->cipher_op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
502         opts->cipher_key_sz = 16;
503         opts->cipher_iv_sz = 16;
504
505         opts->auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
506         opts->auth_op = RTE_CRYPTO_AUTH_OP_GENERATE;
507
508         opts->auth_key_sz = 64;
509         opts->auth_digest_sz = 12;
510         opts->auth_aad_sz = 0;
511 }
512
513 static int
514 cperf_opts_parse_long(int opt_idx, struct cperf_options *opts)
515 {
516         struct long_opt_parser parsermap[] = {
517                 { CPERF_PTEST_TYPE,     parse_cperf_test_type },
518                 { CPERF_SILENT,         parse_silent },
519                 { CPERF_POOL_SIZE,      parse_pool_sz },
520                 { CPERF_TOTAL_OPS,      parse_total_ops },
521                 { CPERF_BURST_SIZE,     parse_burst_sz },
522                 { CPERF_BUFFER_SIZE,    parse_buffer_sz },
523                 { CPERF_SEGMENTS_NB,    parse_segments_nb },
524                 { CPERF_DEVTYPE,        parse_device_type },
525                 { CPERF_OPTYPE,         parse_op_type },
526                 { CPERF_SESSIONLESS,    parse_sessionless },
527                 { CPERF_OUT_OF_PLACE,   parse_out_of_place },
528                 { CPERF_VERIFY,         parse_verify },
529                 { CPERF_TEST_FILE,      parse_test_file },
530                 { CPERF_TEST_NAME,      parse_test_name },
531                 { CPERF_CIPHER_ALGO,    parse_cipher_algo },
532                 { CPERF_CIPHER_OP,      parse_cipher_op },
533                 { CPERF_CIPHER_KEY_SZ,  parse_cipher_key_sz },
534                 { CPERF_CIPHER_IV_SZ,   parse_cipher_iv_sz },
535                 { CPERF_AUTH_ALGO,      parse_auth_algo },
536                 { CPERF_AUTH_OP,        parse_auth_op },
537                 { CPERF_AUTH_KEY_SZ,    parse_auth_key_sz },
538                 { CPERF_AUTH_DIGEST_SZ, parse_auth_digest_sz },
539                 { CPERF_AUTH_AAD_SZ,    parse_auth_aad_sz },
540                 { CPERF_CSV,    parse_csv_friendly},
541         };
542         unsigned int i;
543
544         for (i = 0; i < RTE_DIM(parsermap); i++) {
545                 if (strncmp(lgopts[opt_idx].name, parsermap[i].lgopt_name,
546                                 strlen(lgopts[opt_idx].name)) == 0)
547                         return parsermap[i].parser_fn(opts, optarg);
548         }
549
550         return -EINVAL;
551 }
552
553 int
554 cperf_options_parse(struct cperf_options *options, int argc, char **argv)
555 {
556         int opt, retval, opt_idx;
557
558         while ((opt = getopt_long(argc, argv, "", lgopts, &opt_idx)) != EOF) {
559                 switch (opt) {
560                 /* long options */
561                 case 0:
562
563                         retval = cperf_opts_parse_long(opt_idx, options);
564                         if (retval != 0)
565                                 return retval;
566
567                         break;
568
569                 default:
570                         return -EINVAL;
571                 }
572         }
573
574         return 0;
575 }
576
577 int
578 cperf_options_check(struct cperf_options *options)
579 {
580         if (options->segments_nb > options->buffer_sz) {
581                 RTE_LOG(ERR, USER1,
582                                 "Segments number greater than buffer size.\n");
583                 return -EINVAL;
584         }
585
586         if (options->verify && options->test_file == NULL) {
587                 RTE_LOG(ERR, USER1, "Define path to the file with test"
588                                 " vectors.\n");
589                 return -EINVAL;
590         }
591
592         if (options->test_name != NULL && options->test_file == NULL) {
593                 RTE_LOG(ERR, USER1, "Define path to the file with test"
594                                 " vectors.\n");
595                 return -EINVAL;
596         }
597
598         if (options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY &&
599                         options->test_file == NULL) {
600                 RTE_LOG(ERR, USER1, "Define path to the file with test"
601                                 " vectors.\n");
602                 return -EINVAL;
603         }
604
605         if (options->verify &&
606                         options->total_ops > options->pool_sz) {
607                 RTE_LOG(ERR, USER1, "Total number of ops must be less than or"
608                                 " equal to the pool size.\n");
609                 return -EINVAL;
610         }
611
612         if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
613                 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_ENCRYPT &&
614                                 options->auth_op !=
615                                 RTE_CRYPTO_AUTH_OP_GENERATE) {
616                         RTE_LOG(ERR, USER1, "Option cipher then auth must use"
617                                         " options: encrypt and generate.\n");
618                         return -EINVAL;
619                 }
620         } else if (options->op_type == CPERF_AUTH_THEN_CIPHER) {
621                 if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_DECRYPT &&
622                                 options->auth_op !=
623                                 RTE_CRYPTO_AUTH_OP_VERIFY) {
624                         RTE_LOG(ERR, USER1, "Option auth then cipher must use"
625                                         " options: decrypt and verify.\n");
626                         return -EINVAL;
627                 }
628         } else if (options->op_type == CPERF_AEAD) {
629                 if (!(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT &&
630                                 options->auth_op ==
631                                 RTE_CRYPTO_AUTH_OP_GENERATE) &&
632                                 !(options->cipher_op ==
633                                 RTE_CRYPTO_CIPHER_OP_DECRYPT &&
634                                 options->auth_op ==
635                                 RTE_CRYPTO_AUTH_OP_VERIFY)) {
636                         RTE_LOG(ERR, USER1, "Use together options: encrypt and"
637                                         " generate or decrypt and verify.\n");
638                         return -EINVAL;
639                 }
640         }
641
642         if (options->cipher_algo == RTE_CRYPTO_CIPHER_AES_GCM ||
643                         options->cipher_algo == RTE_CRYPTO_CIPHER_AES_CCM ||
644                         options->auth_algo == RTE_CRYPTO_AUTH_AES_GCM ||
645                         options->auth_algo == RTE_CRYPTO_AUTH_AES_CCM ||
646                         options->auth_algo == RTE_CRYPTO_AUTH_AES_GMAC) {
647                 if (options->op_type != CPERF_AEAD) {
648                         RTE_LOG(ERR, USER1, "Use --optype aead\n");
649                         return -EINVAL;
650                 }
651         }
652
653         return 0;
654 }
655
656 void
657 cperf_options_dump(struct cperf_options *opts)
658 {
659         printf("# Crypto Performance Application Options:\n");
660         printf("#\n");
661         printf("# cperf test: %s\n", cperf_test_type_strs[opts->test]);
662         printf("#\n");
663         printf("# size of crypto op / mbuf pool: %u\n", opts->pool_sz);
664         printf("# total number of ops: %u\n", opts->total_ops);
665         printf("# burst size: %u\n", opts->burst_sz);
666         printf("# buffer size: %u\n", opts->buffer_sz);
667         printf("# segments per buffer: %u\n", opts->segments_nb);
668         printf("#\n");
669         printf("# cryptodev type: %s\n", opts->device_type);
670         printf("#\n");
671         printf("# crypto operation: %s\n", cperf_op_type_strs[opts->op_type]);
672         printf("# verify operation: %s\n", opts->verify ? "yes" : "no");
673         printf("# sessionless: %s\n", opts->sessionless ? "yes" : "no");
674         printf("# out of place: %s\n", opts->out_of_place ? "yes" : "no");
675
676         printf("#\n");
677
678         if (opts->op_type == CPERF_AUTH_ONLY ||
679                         opts->op_type == CPERF_CIPHER_THEN_AUTH ||
680                         opts->op_type == CPERF_AUTH_THEN_CIPHER ||
681                         opts->op_type == CPERF_AEAD) {
682                 printf("# auth algorithm: %s\n",
683                         rte_crypto_auth_algorithm_strings[opts->auth_algo]);
684                 printf("# auth operation: %s\n",
685                         rte_crypto_auth_operation_strings[opts->auth_op]);
686                 printf("# auth key size: %u\n", opts->auth_key_sz);
687                 printf("# auth digest size: %u\n", opts->auth_digest_sz);
688                 printf("# auth aad size: %u\n", opts->auth_aad_sz);
689                 printf("#\n");
690         }
691
692         if (opts->op_type == CPERF_CIPHER_ONLY ||
693                         opts->op_type == CPERF_CIPHER_THEN_AUTH ||
694                         opts->op_type == CPERF_AUTH_THEN_CIPHER ||
695                         opts->op_type == CPERF_AEAD) {
696                 printf("# cipher algorithm: %s\n",
697                         rte_crypto_cipher_algorithm_strings[opts->cipher_algo]);
698                 printf("# cipher operation: %s\n",
699                         rte_crypto_cipher_operation_strings[opts->cipher_op]);
700                 printf("# cipher key size: %u\n", opts->cipher_key_sz);
701                 printf("# cipher iv size: %u\n", opts->cipher_iv_sz);
702                 printf("#\n");
703         }
704 }