DPDK patches and discussions
 help / color / mirror / Atom feed
From: Damian Nowak <damianx.nowak@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com,
	arkadiuszx.kusztal@intel.com,
	Damian Nowak <damianx.nowak@intel.com>
Subject: [dpdk-dev] [PATCH] test/crypto: add capability check for ZUC test cases
Date: Mon, 15 Jul 2019 14:14:51 +0200	[thread overview]
Message-ID: <20190715121451.6020-1-damianx.nowak@intel.com> (raw)

This patch adds checking if device support ZUC
algorithms before running ZUC test cases.
It also removes unnecessary checks of digest
appended space and fixes some comments wording.

Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
---
 app/test/test_cryptodev.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 05422da..c822164 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2909,8 +2909,6 @@ create_wireless_algo_auth_cipher_operation(unsigned int auth_tag_len,
 			(op_mode == IN_PLACE ?
 				ut_params->ibuf : ut_params->obuf),
 			data_pad_len);
-		TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
-			"no room to append auth tag");
 		memset(sym_op->auth.digest.data, 0, auth_tag_len);
 	} else {
 		uint16_t remaining_off = (auth_offset >> 3) + (auth_len >> 3);
@@ -2924,8 +2922,6 @@ create_wireless_algo_auth_cipher_operation(unsigned int auth_tag_len,
 				uint8_t *, remaining_off);
 		sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(sgl_buf,
 				remaining_off);
-		TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
-			"no room to append auth tag");
 		memset(sym_op->auth.digest.data, 0, remaining_off);
 		while (sgl_buf->next != NULL) {
 			memset(rte_pktmbuf_mtod(sgl_buf, uint8_t *),
@@ -5002,7 +4998,7 @@ test_kasumi_auth_cipher_sgl(const struct kasumi_test_data *tdata,
 	}
 	memset(buffer, 0, sizeof(buffer));
 
-	/* Create SNOW 3G operation */
+	/* Create KASUMI operation */
 	retval = create_wireless_algo_auth_cipher_operation(
 		tdata->digest.len,
 		tdata->cipher_iv.data, tdata->cipher_iv.len,
@@ -5432,6 +5428,15 @@ test_zuc_auth_cipher(const struct wireless_test_data *tdata,
 	unsigned int ciphertext_len;
 
 	struct rte_cryptodev_info dev_info;
+	struct rte_cryptodev_sym_capability_idx cap_idx;
+
+	/* Check if device supports ZUC EIA3 */
+	cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+	cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;
+
+	if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+			&cap_idx) == NULL)
+		return -ENOTSUP;
 
 	rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
 
@@ -5444,7 +5449,7 @@ test_zuc_auth_cipher(const struct wireless_test_data *tdata,
 		}
 	}
 
-	/* Create KASUMI session */
+	/* Create ZUC session */
 	retval = create_wireless_algo_auth_cipher_session(
 			ts_params->valid_devs[0],
 			(verify ? RTE_CRYPTO_CIPHER_OP_DECRYPT
@@ -5473,8 +5478,6 @@ test_zuc_auth_cipher(const struct wireless_test_data *tdata,
 
 	ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
 	plaintext_len = ceil_byte_length(tdata->plaintext.len);
-	/* Append data which is padded to a multiple of */
-	/* the algorithms block size */
 	ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 16);
 	plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
 
@@ -5600,6 +5603,15 @@ test_zuc_auth_cipher_sgl(const struct wireless_test_data *tdata,
 	uint8_t digest_buffer[10000];
 
 	struct rte_cryptodev_info dev_info;
+	struct rte_cryptodev_sym_capability_idx cap_idx;
+
+	/* Check if device supports ZUC EIA3 */
+	cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+	cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;
+
+	if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+			&cap_idx) == NULL)
+		return -ENOTSUP;
 
 	rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
 
-- 
2.7.4


             reply	other threads:[~2019-07-15 12:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 12:14 Damian Nowak [this message]
2019-07-15 14:16 ` Trahe, Fiona
2019-07-18 15:28   ` Akhil Goyal

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=20190715121451.6020-1-damianx.nowak@intel.com \
    --to=damianx.nowak@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    /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).