From 979b07d8b609d8880585539be913d08750f83f88 Mon Sep 17 00:00:00 2001 From: David Coyle Date: Thu, 16 Jul 2020 16:34:36 +0100 Subject: [PATCH] crypto/qat: fix ambiguous variable names for CRC The variable names crc_length and crc_offset have been changed to crc_data_len and crc_data_ofs respectively, to make it clearer as to their use i.e. the length and offset of the data over which the CRC is calculated. Fixes: 6f0ef237404b ("crypto/qat: support DOCSIS protocol") Signed-off-by: David Coyle Acked-by: Fiona Trahe --- drivers/crypto/qat/qat_sym.c | 8 ++++---- drivers/crypto/qat/qat_sym.h | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index 632313a268..e6bf115232 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -108,18 +108,18 @@ qat_crc_generate(struct qat_sym_session *ctx, struct rte_crypto_op *op) { struct rte_crypto_sym_op *sym_op = op->sym; - uint32_t *crc, crc_length; + uint32_t *crc, crc_data_len; uint8_t *crc_data; if (ctx->qat_dir == ICP_QAT_HW_CIPHER_ENCRYPT && sym_op->auth.data.length != 0) { - crc_length = sym_op->auth.data.length; + crc_data_len = sym_op->auth.data.length; crc_data = rte_pktmbuf_mtod_offset(sym_op->m_src, uint8_t *, sym_op->auth.data.offset); - crc = (uint32_t *)(crc_data + crc_length); + crc = (uint32_t *)(crc_data + crc_data_len); - *crc = rte_net_crc_calc(crc_data, crc_length, + *crc = rte_net_crc_calc(crc_data, crc_data_len, RTE_NET_CRC32_ETH); } } diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h index dbca74efba..7934dd478d 100644 --- a/drivers/crypto/qat/qat_sym.h +++ b/drivers/crypto/qat/qat_sym.h @@ -140,20 +140,21 @@ static inline void qat_crc_verify(struct qat_sym_session *ctx, struct rte_crypto_op *op) { struct rte_crypto_sym_op *sym_op = op->sym; - uint32_t crc_offset, crc_length, crc; + uint32_t crc_data_ofs, crc_data_len, crc; uint8_t *crc_data; if (ctx->qat_dir == ICP_QAT_HW_CIPHER_DECRYPT && sym_op->auth.data.length != 0) { - crc_offset = sym_op->auth.data.offset; - crc_length = sym_op->auth.data.length; + crc_data_ofs = sym_op->auth.data.offset; + crc_data_len = sym_op->auth.data.length; crc_data = rte_pktmbuf_mtod_offset(sym_op->m_src, uint8_t *, - crc_offset); + crc_data_ofs); - crc = rte_net_crc_calc(crc_data, crc_length, RTE_NET_CRC32_ETH); + crc = rte_net_crc_calc(crc_data, crc_data_len, + RTE_NET_CRC32_ETH); - if (crc != *(uint32_t *)(crc_data + crc_length)) + if (crc != *(uint32_t *)(crc_data + crc_data_len)) op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED; } } -- 2.20.1