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