[PATCH 3/3] crypto/ipsec_mb: check SGL support for algorithm

Ciara Power ciara.power at intel.com
Thu Apr 7 12:30:41 CEST 2022


This patch adds a check when dequeueing ops and processing, SGL support
only exists for AES-GCM and CHACHA20_POLY1305 algorithms.
If an SGL op for an unsupported algorithm is being processed,
submit a NULL job instead.

Signed-off-by: Ciara Power <ciara.power at intel.com>
---
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index 606c8a0caf..9b21c14f58 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -1202,6 +1202,13 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
 	if (op->sym->m_src->nb_segs > 1)
 		sgl = 1;
 
+	if (sgl && (session->cipher.mode != IMB_CIPHER_GCM
+			&& session->cipher.mode != IMB_CIPHER_CHACHA20_POLY1305)) {
+		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
+		IPSEC_MB_LOG(ERR, "Device only supports SGL for AES-GCM or CHACHA20_POLY1305 algorithms.");
+		return -1;
+	}
+
 	/* Set crypto operation */
 	job->chain_order = session->chain_order;
 
-- 
2.25.1



More information about the dev mailing list