DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: declan.doherty@intel.com
Cc: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3 3/3] app/crypto-perf: fix packet length check
Date: Wed, 20 Sep 2017 02:37:04 +0100	[thread overview]
Message-ID: <20170920013704.85333-4-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <20170920013704.85333-1-pablo.de.lara.guarch@intel.com>

When using DES-CBC, packet size has to be multiple
of 8 bytes, but if a list of packets is provided.
the check was not correct.

Fixes: fc4600fb2520 ("app/crypto-perf: add extra option checks")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by:  Radu Nicolau <radu.nicolau@intel.com>
---
 app/test-crypto-perf/cperf_options_parsing.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 663f53f..3f933bc 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -832,14 +832,26 @@ check_cipher_buffer_length(struct cperf_options *options)
 	if (options->cipher_algo == RTE_CRYPTO_CIPHER_DES_CBC ||
 			options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_CBC ||
 			options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_ECB) {
-		for (buffer_size = options->min_buffer_size;
-				buffer_size < options->max_buffer_size;
-				buffer_size += options->inc_buffer_size) {
+		if (options->inc_buffer_size != 0)
+			buffer_size = options->min_buffer_size;
+		else
+			buffer_size = options->buffer_size_list[0];
+
+		while (buffer_size <= options->max_buffer_size) {
 			if ((buffer_size % DES_BLOCK_SIZE) != 0) {
 				RTE_LOG(ERR, USER1, "Some of the buffer sizes are "
 					"not suitable for the algorithm selected\n");
 				return -EINVAL;
 			}
+
+			if (options->inc_buffer_size != 0)
+				buffer_size += options->inc_buffer_size;
+			else {
+				if (++buffer_size_idx == options->buffer_size_count)
+					break;
+				buffer_size = options->buffer_size_list[buffer_size_idx];
+			}
+
 		}
 	}
 
-- 
2.9.4

  parent reply	other threads:[~2017-09-20  9:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18  6:17 [dpdk-dev] [PATCH] crypto/aesni_mb: add DES support Pablo de Lara
2017-09-04  9:07 ` Zhang, Roy Fan
2017-09-15  2:09 ` [dpdk-dev] [PATCH v2 0/3] Extend " Pablo de Lara
2017-09-15  2:09   ` [dpdk-dev] [PATCH v2 1/3] crypto/aesni_mb: add " Pablo de Lara
2017-09-18 10:56     ` Radu Nicolau
2017-09-18 14:08       ` De Lara Guarch, Pablo
2017-09-15  2:09   ` [dpdk-dev] [PATCH v2 2/3] crypto/openssl: add support for DES-CBC Pablo de Lara
2017-09-18 11:31     ` Radu Nicolau
2017-09-15  2:09   ` [dpdk-dev] [PATCH v2 3/3] app/crypto-perf: fix packet length check Pablo de Lara
2017-09-18 11:32     ` Radu Nicolau
2017-09-20  1:37   ` [dpdk-dev] [PATCH v3 0/3] Extend DES support Pablo de Lara
2017-09-20  1:37     ` [dpdk-dev] [PATCH v3 1/3] crypto/aesni_mb: add " Pablo de Lara
2017-09-20  1:37     ` [dpdk-dev] [PATCH v3 2/3] crypto/openssl: add support for DES-CBC Pablo de Lara
2017-09-20  1:37     ` Pablo de Lara [this message]
2017-10-05  5:27     ` [dpdk-dev] [PATCH v4 0/4] Extend DES support Pablo de Lara
2017-10-05  5:27       ` [dpdk-dev] [PATCH v4 1/4] doc: update IPSec Multi-buffer lib versioning Pablo de Lara
2017-10-05 13:55         ` Mcnamara, John
2017-10-05  5:27       ` [dpdk-dev] [PATCH v4 2/4] crypto/aesni_mb: add DES support Pablo de Lara
2017-10-05  5:27       ` [dpdk-dev] [PATCH v4 3/4] crypto/openssl: add support for DES-CBC Pablo de Lara
2017-10-05  5:28       ` [dpdk-dev] [PATCH v4 4/4] app/crypto-perf: fix packet length check Pablo de Lara
2017-10-05 14:14       ` [dpdk-dev] [PATCH v4 0/4] Extend DES support De Lara Guarch, Pablo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170920013704.85333-4-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).