From: Pablo de Lara Date: Wed, 23 Feb 2022 16:01:13 +0000 (+0000) Subject: crypto/ipsec_mb: check missing operation types X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cfb566048ee729969d982a0c6020148d69f585fc;p=dpdk.git crypto/ipsec_mb: check missing operation types When processing crypto operations in ZUC PMD, there were two operation types that were set at session level, but not checked when the operations are enqueued and processed, leaving the buffers untouched silently. Fixes: cde8df1bda9d ("crypto/ipsec_mb: move zuc PMD") Cc: stable@dpdk.org Signed-off-by: Pablo de Lara --- diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c b/drivers/crypto/ipsec_mb/pmd_zuc.c index 2eae1d1ec7..ec83d96dfc 100644 --- a/drivers/crypto/ipsec_mb/pmd_zuc.c +++ b/drivers/crypto/ipsec_mb/pmd_zuc.c @@ -198,7 +198,7 @@ process_ops(struct rte_crypto_op **ops, enum ipsec_mb_operation op_type, struct ipsec_mb_qp *qp, uint8_t num_ops) { unsigned int i; - unsigned int processed_ops; + unsigned int processed_ops = 0; switch (op_type) { case IPSEC_MB_OP_ENCRYPT_ONLY: @@ -212,18 +212,21 @@ process_ops(struct rte_crypto_op **ops, enum ipsec_mb_operation op_type, num_ops); break; case IPSEC_MB_OP_ENCRYPT_THEN_HASH_GEN: + case IPSEC_MB_OP_DECRYPT_THEN_HASH_VERIFY: processed_ops = process_zuc_cipher_op(qp, ops, sessions, num_ops); process_zuc_hash_op(qp, ops, sessions, processed_ops); break; case IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT: + case IPSEC_MB_OP_HASH_GEN_THEN_ENCRYPT: processed_ops = process_zuc_hash_op(qp, ops, sessions, num_ops); process_zuc_cipher_op(qp, ops, sessions, processed_ops); break; default: /* Operation not supported. */ - processed_ops = 0; + for (i = 0; i < num_ops; i++) + ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION; } for (i = 0; i < num_ops; i++) {