Skip to contentSkip to conversation

test/crypto: use standard memory copy for wireless cipher IV

PATCH Applied Kai Ji 2 participants 2 messages Nov 17

lore
Share & tools
lore

Kai Ji

author
#0 lore raw

PATCH 1/1 test/crypto: use standard memory copy for wireless cipher IV

Coverity reports an out-of-bounds read of the ZUC cipher IV when tracing the optimized rte_memcpy() implementation. The ZUC test vectors use 16-byte or 25-byte IVs, which fit in the 64-byte source buffer.

Use memcpy() for IV copies in both the in-place and out-of-place wireless cipher operation helpers. These small test setup copies do not need the optimized packet data copy routine. The copy lengths and operation layout remain unchanged.

Coverity issue: 507468

---
 app/test/test_cryptodev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test/test_cryptodev.c +2 -2
index fd02107baf..312fb61189 100644
@@ -3007,7 +3007,7 @@ create_wireless_algo_cipher_operation(const uint8_t *iv, uint8_t iv_len,
 	sym_op->m_src = ut_params->ibuf;
 
 	/* iv */
-	rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+	memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
 			iv, iv_len);
 	sym_op->cipher.data.length = cipher_len;
 	sym_op->cipher.data.offset = cipher_offset;
@@ -3038,7 +3038,7 @@ create_wireless_algo_cipher_operation_oop(const uint8_t *iv, uint8_t iv_len,
 	sym_op->m_dst = ut_params->obuf;
 
 	/* iv */
-	rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
+	memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
 			iv, iv_len);
 	sym_op->cipher.data.length = cipher_len;
 	sym_op->cipher.data.offset = cipher_offset;
Signature · 1 line
2.34.1
Applied
#1 lore raw
Quoted 9 lines

Coverity reports an out-of-bounds read of the ZUC cipher IV when tracing the optimized rte_memcpy() implementation. The ZUC test vectors use 16-byte or 25-byte IVs, which fit in the 64-byte source buffer.

Use memcpy() for IV copies in both the in-place and out-of-place wireless cipher operation helpers. These small test setup copies do not need the optimized packet data copy routine. The copy lengths and operation layout remain unchanged.

Quoted 4 lines

Coverity issue: 507468

---

Applied to dpdk-next-crypto

    Fixes: 27a1c4714d54 ("app/test: add KASUMI crypto")
    Cc: [email protected]