]> git.droids-corp.org - dpdk.git/commitdiff
crypto/dpaax_sec: fix auth/cipher xform chain checks
authorHemant Agrawal <hemant.agrawal@nxp.com>
Thu, 10 Feb 2022 10:58:50 +0000 (16:28 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Sat, 12 Feb 2022 11:18:06 +0000 (12:18 +0100)
This patch add more checks on next type for PDCP cases.

Fixes: 45e019608f31 ("crypto/dpaa2_sec: support integrity only PDCP")
Fixes: a1173d55598c ("crypto/dpaa_sec: support PDCP offload")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
drivers/crypto/dpaa_sec/dpaa_sec.c

index 444e1f004388e65cef59924059f93b4f78c2e44b..cb8aaf6446d3f09b9c6d68e7d1e7d4533619c13c 100644 (file)
@@ -3231,13 +3231,15 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev,
        /* find xfrm types */
        if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
                cipher_xform = &xform->cipher;
-               if (xform->next != NULL) {
+               if (xform->next != NULL &&
+                       xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
                        session->ext_params.aead_ctxt.auth_cipher_text = true;
                        auth_xform = &xform->next->auth;
                }
        } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
                auth_xform = &xform->auth;
-               if (xform->next != NULL) {
+               if (xform->next != NULL &&
+                       xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
                        session->ext_params.aead_ctxt.auth_cipher_text = false;
                        cipher_xform = &xform->next->cipher;
                }
index 1137b142e97c30814711674b4c985f57cc056672..75e437f696189ae51388a198f0874000d3ff0690 100644 (file)
@@ -2984,11 +2984,13 @@ dpaa_sec_set_pdcp_session(struct rte_cryptodev *dev,
        /* find xfrm types */
        if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
                cipher_xform = &xform->cipher;
-               if (xform->next != NULL)
+               if (xform->next != NULL &&
+                       xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH)
                        auth_xform = &xform->next->auth;
        } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
                auth_xform = &xform->auth;
-               if (xform->next != NULL)
+               if (xform->next != NULL &&
+                       xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER)
                        cipher_xform = &xform->next->cipher;
        } else {
                DPAA_SEC_ERR("Invalid crypto type");