Skip to content

Commit

Permalink
test/crypto: fix debug messages
Browse files Browse the repository at this point in the history
[ upstream commit 1c6b77de0aa97072372fa80891c93063ec132c1a ]

When the queue_ops_rsa_enc_dec function is called, the plaintext will
be printed twice instead of both plaintext and ciphertext. When the
create_aead_operation function is called, the contents of iv and aad
will be printed incorrectly. This patch fixes the issues above.

Fixes: 77a217a ("test/crypto: add AES-CCM tests")
Fixes: 5ae3699 ("test/crypto: move RSA enqueue/dequeue into functions")

Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
Reviewed-by: Joey Xing <joey.xing@jaguarmicro.com>
Reviewed-by: Qingmin Liu <qingmin.liu@jaguarmicro.com>
Reviewed-by: Lei Cai <lei.cai@jaguarmicro.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  • Loading branch information
Sunyang Wu authored and cpaelzer committed Nov 11, 2022
1 parent d6e07e9 commit 32b1e65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/test/test_cryptodev.c
Original file line number Diff line number Diff line change
Expand Up @@ -7708,7 +7708,7 @@ create_aead_operation(enum rte_crypto_aead_operation op,
rte_pktmbuf_iova(ut_params->ibuf);
/* Copy AAD 18 bytes after the AAD pointer, according to the API */
memcpy(sym_op->aead.aad.data + 18, tdata->aad.data, tdata->aad.len);
debug_hexdump(stdout, "aad:", sym_op->aead.aad.data,
debug_hexdump(stdout, "aad:", sym_op->aead.aad.data + 18,
tdata->aad.len);

/* Append IV at the end of the crypto operation*/
Expand All @@ -7717,7 +7717,7 @@ create_aead_operation(enum rte_crypto_aead_operation op,

/* Copy IV 1 byte after the IV pointer, according to the API */
rte_memcpy(iv_ptr + 1, tdata->iv.data, tdata->iv.len);
debug_hexdump(stdout, "iv:", iv_ptr,
debug_hexdump(stdout, "iv:", iv_ptr + 1,
tdata->iv.len);
} else {
aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16);
Expand Down
4 changes: 2 additions & 2 deletions app/test/test_cryptodev_asym.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ queue_ops_rsa_enc_dec(struct rte_cryptodev_asym_session *sess)
status = TEST_FAILED;
goto error_exit;
}
debug_hexdump(stdout, "encrypted message", asym_op->rsa.message.data,
asym_op->rsa.message.length);
debug_hexdump(stdout, "encrypted message", asym_op->rsa.cipher.data,
asym_op->rsa.cipher.length);

/* Use the resulted output as decryption Input vector*/
asym_op = result_op->asym;
Expand Down

0 comments on commit 32b1e65

Please sign in to comment.