]> git.droids-corp.org - dpdk.git/commitdiff
crypto/ipsec_mb: check missing operation types
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 23 Feb 2022 16:01:13 +0000 (16:01 +0000)
committerAkhil Goyal <gakhil@marvell.com>
Thu, 24 Feb 2022 10:20:51 +0000 (11:20 +0100)
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 <pablo.de.lara.guarch@intel.com>
drivers/crypto/ipsec_mb/pmd_zuc.c

index 2eae1d1ec77b061830f2d7d7aa79b940c6e2d19f..ec83d96dfc0b4a7dca80768b723f177c6cc84716 100644 (file)
@@ -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++) {