DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ruifeng Wang <ruifeng.wang@arm.com>
To: Ruifeng Wang <ruifeng.wang@arm.com>
Cc: dev@dpdk.org, arkadiuszx.kusztal@intel.com, akhil.goyal@nxp.com,
	honnappa.nagarahalli@arm.com, nd@arm.com
Subject: [dpdk-dev] [PATCH] crypto/armv8: remove crypto enum list end references
Date: Fri, 18 Sep 2020 13:45:17 +0800	[thread overview]
Message-ID: <20200918054518.208990-1-ruifeng.wang@arm.com> (raw)

Removed references to RTE_CRYPTO_CIPHER_LIST_END and
RTE_CRYPTO_AUTH_LIST_END.

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
---
This is follow up of cryptodev change:
http://patches.dpdk.org/patch/76330/
 drivers/crypto/armv8/armv8_pmd_private.h | 6 ++----
 drivers/crypto/armv8/rte_armv8_pmd.c     | 9 ++++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/armv8/armv8_pmd_private.h b/drivers/crypto/armv8/armv8_pmd_private.h
index 66b03fb92..75ddba79c 100644
--- a/drivers/crypto/armv8/armv8_pmd_private.h
+++ b/drivers/crypto/armv8/armv8_pmd_private.h
@@ -70,11 +70,9 @@ enum armv8_crypto_auth_mode {
 	ARMV8_CRYPTO_AUTH_LIST_END = ARMV8_CRYPTO_AUTH_NOT_SUPPORTED
 };
 
-#define CRYPTO_ORDER_MAX		ARMV8_CRYPTO_CHAIN_LIST_END
-#define CRYPTO_CIPHER_OP_MAX		ARMV8_CRYPTO_CIPHER_OP_LIST_END
 #define CRYPTO_CIPHER_KEYLEN_MAX	ARMV8_CRYPTO_CIPHER_KEYLEN_LIST_END
-#define CRYPTO_CIPHER_MAX		RTE_CRYPTO_CIPHER_LIST_END
-#define CRYPTO_AUTH_MAX			RTE_CRYPTO_AUTH_LIST_END
+#define CRYPTO_CIPHER_MAX		(RTE_CRYPTO_CIPHER_AES_ECB + 1)
+#define CRYPTO_AUTH_MAX			(RTE_CRYPTO_AUTH_SHA512_HMAC + 1)
 
 #define HMAC_IPAD_VALUE			(0x36)
 #define HMAC_OPAD_VALUE			(0x5C)
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index c95729db5..c3db711b7 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -143,7 +143,8 @@ crypto_chain_order[] = {
 	crypto_func_tbl_t *func_tbl =					\
 				(crypto_chain_order[(order)])[(cop)];	\
 									\
-	((*func_tbl)[(calg)][(aalg)][KEYL(keyl)]);		\
+	((calg >= CRYPTO_CIPHER_MAX) || (aalg >= CRYPTO_AUTH_MAX)) ?	\
+		NULL : ((*func_tbl)[(calg)][(aalg)][KEYL(keyl)]);	\
 })
 
 /*----------------------------------------------------------------------------*/
@@ -188,7 +189,8 @@ crypto_key_sched_dir[] = {
 ({									\
 	crypto_key_sched_tbl_t *ks_tbl = crypto_key_sched_dir[(cop)];	\
 									\
-	((*ks_tbl)[(calg)][KEYL(keyl)]);				\
+	(calg >= CRYPTO_CIPHER_MAX) ?					\
+		NULL : ((*ks_tbl)[(calg)][KEYL(keyl)]);			\
 })
 
 /*----------------------------------------------------------------------------*/
@@ -436,7 +438,8 @@ armv8_crypto_set_session_chained_parameters(struct armv8_crypto_session *sess,
 		return -ENOTSUP;
 	}
 
-	if (unlikely(sess->crypto_func == NULL)) {
+	if (unlikely(sess->crypto_func == NULL ||
+		sess->cipher.key_sched == NULL)) {
 		/*
 		 * If we got here that means that there must be a bug
 		 * in the algorithms selection above. Nevertheless keep
-- 
2.17.1


             reply	other threads:[~2020-09-18  5:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18  5:45 Ruifeng Wang [this message]
2020-10-09 19:52 ` 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=20200918054518.208990-1-ruifeng.wang@arm.com \
    --to=ruifeng.wang@arm.com \
    --cc=akhil.goyal@nxp.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=nd@arm.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).