From patchwork Wed Mar 8 17:03:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mrzyglod X-Patchwork-Id: 21627 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 2E093108A; Wed, 8 Mar 2017 18:03:45 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 506113DC for ; Wed, 8 Mar 2017 18:03:43 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2017 09:03:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.36,264,1486454400"; d="scan'208"; a="1120079759" Received: from gklab-246-025.igk.intel.com (HELO Sent) ([10.217.246.25]) by fmsmga001.fm.intel.com with SMTP; 08 Mar 2017 09:03:39 -0800 Received: by Sent (sSMTP sendmail emulation); Wed, 08 Mar 2017 18:03:34 +0100 From: Daniel Mrzyglod To: slawomirx.mrozowicz@intel.com, declan.doherty@intel.com, pablo.de.lara.guarch@intel.com Cc: dev@dpdk.org, Daniel Mrzyglod Date: Wed, 8 Mar 2017 18:03:25 +0100 Message-Id: <1488992605-108262-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487244439-156256-1-git-send-email-danielx.t.mrzyglod@intel.com> References: <1487244439-156256-1-git-send-email-danielx.t.mrzyglod@intel.com> Subject: [dpdk-dev] [PATCH v3] app/crypto-perf: fix avoid wrong optype for AEAD algorithms X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When somebody use bad --optype with aead alghorithms segmentation fault could happen. Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application") Signed-off-by: Daniel Mrzyglod Acked-by: Pablo de Lara --- Changes for v3: - fix headline of this patch - add ccm alghorithm Changes for v2: - fix checkpatch error related with whitespace - fix spelling error How to reproduce: AESNI_GCM: ./build/app/dpdk-test-crypto-perf -c 0xc0 --vdev crypto_aesni_gcm_pmd -w 0000:5e:00.0 -w 0000:3d:01.0 -- --ptest throughput --devtype crypto_aesni_gcm --optype cipher-then-auth --cipher-algo aes-gcm --cipher-op encrypt --cipher-key-sz 16 --cipher-iv-sz 12 --auth-algo aes-gcm --auth-op generate --auth-key-sz 16 --auth-aad-sz 4 --auth-digest-sz 8 --total-ops 10000000 --burst-sz 32 --buffer-sz 1024 --- app/test-crypto-perf/cperf_options_parsing.c | 11 +++++++++++ app/test-crypto-perf/main.c | 6 ++++-- doc/guides/tools/cryptoperf.rst | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index c1d5ffc..c87ba67 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -829,6 +829,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 c1eaaff..fb3f72e 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 1117ebf..478d256 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.