Skip to contentSkip to conversation

test/crypto: fix output buffer length

PATCH Applied Gagandeep Singh 2 participants 2 messages Nov 12, 2021 – Nov 16, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/crypto: fix output buffer length

Input buffer length is getting appended with padding length when the test case is encrypted digest, but output buffer length is appended with padding length for all the cases.

This patch fixes the output buffer length by appending the padding length only when the test case is of encrypted digest type.

Fixes 6356c28642a6 ("test/crypto: add cases for block cipher encrypted digest")
---
 app/test/test_cryptodev_blockcipher.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
app/test/test_cryptodev_blockcipher.c +4 -1
index 3cdb2c96e8..5688a45377 100644
@@ -266,7 +266,10 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 		}
 		memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
 
-		buf_p = rte_pktmbuf_append(obuf, buf_len + pad_len);
+		if (t->op_mask & BLOCKCIPHER_TEST_OP_DIGEST_ENCRYPTED)
+			buf_p = rte_pktmbuf_append(obuf, buf_len + pad_len);
+		else
+			buf_p = rte_pktmbuf_append(obuf, buf_len);
 		if (!buf_p) {
 			snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
 				"FAILED: %s", __LINE__,
Signature · 1 line
2.25.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 9 lines

Input buffer length is getting appended with padding length when the test case is encrypted digest, but output buffer length is appended with padding length for all the cases.

This patch fixes the output buffer length by appending the padding length only when the test case is of encrypted digest type.

Quoted 5 lines
Fixes 6356c28642a6 ("test/crypto: add cases for block cipher encrypted

digest")
Cc: [email protected]

Applied to dpdk-next-crypto
Thanks.