test/crypto: fix output buffer length

Message ID 20211112075348.930617-1-g.singh@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series test/crypto: fix output buffer length |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS

Commit Message

Gagandeep Singh Nov. 12, 2021, 7:53 a.m. UTC
  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")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 app/test/test_cryptodev_blockcipher.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Akhil Goyal Nov. 16, 2021, 7:26 a.m. UTC | #1
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto
Thanks.
  

Patch

diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index 3cdb2c96e8..5688a45377 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -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__,