From: Ruifeng Wang Date: Fri, 18 Sep 2020 05:45:17 +0000 (+0800) Subject: crypto/armv8: remove algo lists end X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=087ed975925aae7b55461651329b822e06391649;p=dpdk.git crypto/armv8: remove algo lists end Removed references to RTE_CRYPTO_CIPHER_LIST_END and RTE_CRYPTO_AUTH_LIST_END to prevent ABI breakages that may arise when adding new crypto algorithms. Signed-off-by: Ruifeng Wang Reviewed-by: Phil Yang --- diff --git a/drivers/crypto/armv8/armv8_pmd_private.h b/drivers/crypto/armv8/armv8_pmd_private.h index 66b03fb92b..75ddba79c1 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 72d29ae0cb..3f6cb66ba2 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