app/crypto-perf: fix incorrect input data for AEAD decrypt

Message ID 1574334867-32619-1-git-send-email-marchana@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series app/crypto-perf: fix incorrect input data for AEAD decrypt |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance fail Performance Testing issues
ci/Intel-compilation fail Compilation issues
ci/travis-robot success Travis build: passed

Commit Message

Archana Muniganti Nov. 21, 2019, 11:14 a.m. UTC
  In AEAD decrypt(verify mode), test data should point to
cipher text instead of plain text

Fixes: 5b2b0a740fba ("app/crypto-perf: overwrite mbuf when verifying")

Signed-off-by: Archana Muniganti <marchana@marvell.com>
---
 app/test-crypto-perf/cperf_test_verify.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
  

Comments

Akhil Goyal Nov. 25, 2019, 10:18 a.m. UTC | #1
> >
> > In AEAD decrypt(verify mode), test data should point to cipher text instead of
> > plain text
> >
> > Fixes: 5b2b0a740fba ("app/crypto-perf: overwrite mbuf when verifying")
> >
> > Signed-off-by: Archana Muniganti <marchana@marvell.com>
> 
> Acked-by: Anoob Joseph <anoobj@marvell.com>

Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index bbdf37d..833bc9a 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -203,11 +203,19 @@  struct cperf_op_result {
 {
 	uint32_t segment_sz = options->segment_sz;
 	uint8_t *mbuf_data;
-	uint8_t *test_data =
-			(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
+	uint8_t *test_data;
+	uint32_t remaining_bytes = options->max_buffer_size;
+
+	if (options->op_type == CPERF_AEAD) {
+		test_data = (options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ?
 					test_vector->plaintext.data :
 					test_vector->ciphertext.data;
-	uint32_t remaining_bytes = options->max_buffer_size;
+	} else {
+		test_data =
+			(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
+				test_vector->plaintext.data :
+				test_vector->ciphertext.data;
+	}
 
 	while (remaining_bytes) {
 		mbuf_data = rte_pktmbuf_mtod(mbuf, uint8_t *);