From: Gagandeep Singh <g.si...@nxp.com>

The descriptors refers to auth data as well, so initializing it
properly for the non-auth cases.

Signed-off-by: Gagandeep Singh <g.si...@nxp.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 16 ++++++++++++----
 drivers/crypto/dpaa_sec/dpaa_sec.c          |  5 +++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c 
b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index c2b836d716..0a0b7f15af 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -3538,12 +3538,20 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev,
                                      session->auth_alg);
                        goto out;
                }
-
                p_authdata = &authdata;
-       } else if (pdcp_xform->domain == RTE_SECURITY_PDCP_MODE_CONTROL) {
-               DPAA2_SEC_ERR("Crypto: Integrity must for c-plane");
-               goto out;
+       } else {
+               if (pdcp_xform->domain == RTE_SECURITY_PDCP_MODE_CONTROL) {
+                       DPAA2_SEC_ERR("Crypto: Integrity must for c-plane");
+                       goto out;
+               }
+               session->auth_key.data = NULL;
+               session->auth_key.length = 0;
+               session->auth_alg = 0;
        }
+       authdata.key = (size_t)session->auth_key.data;
+       authdata.keylen = session->auth_key.length;
+       authdata.key_enc_flags = 0;
+       authdata.key_type = RTA_DATA_IMM;
 
        if (pdcp_xform->sdap_enabled) {
                int nb_keys_to_inline =
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c 
b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 7d47c32693..39babd76f8 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -3188,6 +3188,11 @@ dpaa_sec_set_pdcp_session(struct rte_cryptodev *dev,
                       auth_xform->key.length);
                session->auth_alg = auth_xform->algo;
        } else {
+               if (pdcp_xform->domain == RTE_SECURITY_PDCP_MODE_CONTROL) {
+                       DPAA_SEC_ERR("Crypto: Integrity must for c-plane");
+                       ret = -EINVAL;
+                       goto out;
+               }
                session->auth_key.data = NULL;
                session->auth_key.length = 0;
                session->auth_alg = 0;
-- 
2.17.1

Reply via email to