From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id A427F9E3 for ; Sat, 9 Jul 2016 18:35:11 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 09 Jul 2016 09:35:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,337,1464678000"; d="scan'208";a="136458320" Received: from sie-lab-214-036.ir.intel.com (HELO silpixa00394365.ir.intel.com) ([10.237.214.36]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2016 09:35:09 -0700 From: Pablo de Lara To: dev@dpdk.org Cc: declan.doherty@intel.com, Pablo de Lara Date: Sat, 9 Jul 2016 17:35:58 +0100 Message-Id: <1468082158-94564-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] kasumi: restrict cipher bit-level ops X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jul 2016 16:35:12 -0000 KASUMI PMD only supports bit-level cipher operations when destination buffer is different from the source (out of place operations). This commit adds a check in the code to prevent the user from trying to perform in-place bit-level ciphering. Fixes: 2773c86d061a ("crypto/kasumi: add driver for KASUMI library") Signed-off-by: Pablo de Lara --- doc/guides/cryptodevs/kasumi.rst | 3 +++ drivers/crypto/kasumi/rte_kasumi_pmd.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/guides/cryptodevs/kasumi.rst b/doc/guides/cryptodevs/kasumi.rst index d6b3a97..7346b21 100644 --- a/doc/guides/cryptodevs/kasumi.rst +++ b/doc/guides/cryptodevs/kasumi.rst @@ -52,6 +52,9 @@ Limitations * Chained mbufs are not supported. * KASUMI(F9) supported only if hash offset field is byte-aligned. +* In-place bit-level operations for KASUMI(F8) are not supported + (if length and/or offset of data to be ciphered is not byte-aligned). + Installation ------------ diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 1cdbc06..4e21743 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -243,9 +243,12 @@ process_kasumi_cipher_op_bit(struct rte_crypto_op *op, offset_in_bits = op->sym->cipher.data.offset; src = rte_pktmbuf_mtod(op->sym->m_src, uint8_t *); - dst = op->sym->m_dst ? - rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *) : - rte_pktmbuf_mtod(op->sym->m_src, uint8_t *); + if (op->sym->m_dst == NULL) { + op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; + KASUMI_LOG_ERR("bit-level in-place not supported\n"); + return 0; + } + dst = rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *); IV = *((uint64_t *)(op->sym->cipher.iv.data)); length_in_bits = op->sym->cipher.data.length; -- 2.7.4