[dpdk-dev] kasumi: restrict cipher bit-level ops
Commit Message
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 <pablo.de.lara.guarch@intel.com>
---
doc/guides/cryptodevs/kasumi.rst | 3 +++
drivers/crypto/kasumi/rte_kasumi_pmd.c | 9 ++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
Comments
2016-07-09 17:35, Pablo de Lara:
> 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 <pablo.de.lara.guarch@intel.com>
Applied, thanks
@@ -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
------------
@@ -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;