From: Daniel Mrzyglod Date: Wed, 8 Mar 2017 17:03:25 +0000 (+0100) Subject: app/crypto-perf: avoid wrong operation type for AEAD algos X-Git-Tag: spdx-start~3745 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5e669376316651d6b6ed2d67cc0cb9a7d4c63b3a;p=dpdk.git app/crypto-perf: avoid wrong operation type for AEAD algos When somebody use bad --optype with aead algorithms segmentation fault could happen. Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application") Signed-off-by: Daniel Mrzyglod Acked-by: Pablo de Lara --- diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index da82ce9cd4..d6afc8548f 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -643,6 +643,17 @@ cperf_options_check(struct cperf_options *options) } } + if (options->cipher_algo == RTE_CRYPTO_CIPHER_AES_GCM || + options->cipher_algo == RTE_CRYPTO_CIPHER_AES_CCM || + options->auth_algo == RTE_CRYPTO_AUTH_AES_GCM || + options->auth_algo == RTE_CRYPTO_AUTH_AES_CCM || + options->auth_algo == RTE_CRYPTO_AUTH_AES_GMAC) { + if (options->op_type != CPERF_AEAD) { + RTE_LOG(ERR, USER1, "Use --optype aead\n"); + return -EINVAL; + } + } + return 0; } diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index c1eaaff9f7..fb3f72e10f 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -118,7 +118,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, if (opts->op_type == CPERF_AUTH_ONLY || opts->op_type == CPERF_CIPHER_THEN_AUTH || - opts->op_type == CPERF_AUTH_THEN_CIPHER) { + opts->op_type == CPERF_AUTH_THEN_CIPHER || + opts->op_type == CPERF_AEAD) { cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; cap_idx.algo.auth = opts->auth_algo; @@ -139,7 +140,8 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, if (opts->op_type == CPERF_CIPHER_ONLY || opts->op_type == CPERF_CIPHER_THEN_AUTH || - opts->op_type == CPERF_AUTH_THEN_CIPHER) { + opts->op_type == CPERF_AUTH_THEN_CIPHER || + opts->op_type == CPERF_AEAD) { cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; cap_idx.algo.cipher = opts->cipher_algo; diff --git a/doc/guides/tools/cryptoperf.rst b/doc/guides/tools/cryptoperf.rst index 1117ebf6d3..478d256e94 100644 --- a/doc/guides/tools/cryptoperf.rst +++ b/doc/guides/tools/cryptoperf.rst @@ -181,6 +181,8 @@ The following are the appication command-line options: auth-then-cipher aead + For GCM/CCM algorithms you should use aead flag. + * ``--sessionless`` Enable session-less crypto operations mode.