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

Signed-off-by: Kai Ji <[email protected]>
---
 app/test/test_cryptodev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index fd02107baf..312fb61189 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -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;
-- 
2.34.1

Reply via email to