patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: declan.doherty@intel.com, akhil.goyal@nxp.com
Cc: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH v4 3/8] app/crypto-perf: parse AEAD data from vectors
Date: Wed,  4 Oct 2017 04:46:08 +0100	[thread overview]
Message-ID: <20171004034613.44541-4-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <20171004034613.44541-1-pablo.de.lara.guarch@intel.com>

Since DPDK 17.08, there is specific parameters
for AEAD algorithm, like AES-GCM. When verifying
crypto operations with test vectors, the parser
was not reading AEAD data (such as IV or key).

Fixes: 8a5b494a7f99 ("app/test-crypto-perf: add AEAD parameters")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test-crypto-perf/cperf_test_vector_parsing.c | 55 ++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index 148a604..3952632 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -116,6 +116,20 @@ show_test_vector(struct cperf_test_vector *test_vector)
 		printf("\n");
 	}
 
+	if (test_vector->aead_key.data) {
+		printf("\naead_key =\n");
+		for (i = 0; i < test_vector->aead_key.length; ++i) {
+			if ((i % wrap == 0) && (i != 0))
+				printf("\n");
+			if (i == (uint32_t)(test_vector->aead_key.length - 1))
+				printf("0x%02x", test_vector->aead_key.data[i]);
+			else
+				printf("0x%02x, ",
+					test_vector->aead_key.data[i]);
+		}
+		printf("\n");
+	}
+
 	if (test_vector->cipher_iv.data) {
 		printf("\ncipher_iv =\n");
 		for (i = 0; i < test_vector->cipher_iv.length; ++i) {
@@ -142,6 +156,19 @@ show_test_vector(struct cperf_test_vector *test_vector)
 		printf("\n");
 	}
 
+	if (test_vector->aead_iv.data) {
+		printf("\naead_iv =\n");
+		for (i = 0; i < test_vector->aead_iv.length; ++i) {
+			if ((i % wrap == 0) && (i != 0))
+				printf("\n");
+			if (i == (uint32_t)(test_vector->aead_iv.length - 1))
+				printf("0x%02x", test_vector->aead_iv.data[i]);
+			else
+				printf("0x%02x, ", test_vector->aead_iv.data[i]);
+		}
+		printf("\n");
+	}
+
 	if (test_vector->ciphertext.data) {
 		printf("\nciphertext =\n");
 		for (i = 0; i < test_vector->ciphertext.length; ++i) {
@@ -345,6 +372,20 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
 			vector->auth_key.length = opts->auth_key_sz;
 		}
 
+	} else if (strstr(key_token, "aead_key")) {
+		rte_free(vector->aead_key.data);
+		vector->aead_key.data = data;
+		if (tc_found)
+			vector->aead_key.length = data_length;
+		else {
+			if (opts->aead_key_sz > data_length) {
+				printf("Global aead_key shorter than "
+					"aead_key_sz\n");
+				return -1;
+			}
+			vector->aead_key.length = opts->aead_key_sz;
+		}
+
 	} else if (strstr(key_token, "cipher_iv")) {
 		rte_free(vector->cipher_iv.data);
 		vector->cipher_iv.data = data;
@@ -373,6 +414,20 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
 			vector->auth_iv.length = opts->auth_iv_sz;
 		}
 
+	} else if (strstr(key_token, "aead_iv")) {
+		rte_free(vector->aead_iv.data);
+		vector->aead_iv.data = data;
+		if (tc_found)
+			vector->aead_iv.length = data_length;
+		else {
+			if (opts->aead_iv_sz > data_length) {
+				printf("Global aead iv shorter than "
+					"aead_iv_sz\n");
+				return -1;
+			}
+			vector->aead_iv.length = opts->aead_iv_sz;
+		}
+
 	} else if (strstr(key_token, "ciphertext")) {
 		rte_free(vector->ciphertext.data);
 		vector->ciphertext.data = data;
-- 
2.9.4

  parent reply	other threads:[~2017-10-04 11:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170818080520.43088-1-pablo.de.lara.guarch@intel.com>
2017-08-18  8:05 ` [dpdk-stable] [PATCH 2/6] " Pablo de Lara
     [not found] ` <20170913072026.29734-1-pablo.de.lara.guarch@intel.com>
2017-09-13  7:20   ` [dpdk-stable] [PATCH v2 2/7] " Pablo de Lara
     [not found]   ` <20170922075519.28342-1-pablo.de.lara.guarch@intel.com>
2017-09-22  7:55     ` [dpdk-stable] [PATCH v3 " Pablo de Lara
     [not found]     ` <20171004034613.44541-1-pablo.de.lara.guarch@intel.com>
2017-10-04  3:46       ` Pablo de Lara [this message]
     [not found] ` <20170913072249.29797-1-pablo.de.lara.guarch@intel.com>
2017-09-13  7:22   ` [dpdk-stable] [PATCH v2 " Pablo de Lara

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=20171004034613.44541-4-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=akhil.goyal@nxp.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).