From: Akhil Goyal <gakhil@marvell.com>
To: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "ciara.power@intel.com" <ciara.power@intel.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [EXTERNAL] [PATCH] app/test: fix rsa tests in qat suite
Date: Fri, 8 Mar 2024 08:23:49 +0000 [thread overview]
Message-ID: <CO6PR18MB4484D521795D4851F8EC2935D8272@CO6PR18MB4484.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20240308081750.5157-1-arkadiuszx.kusztal@intel.com>
> This commit fixes incorrectly set keys in the
> QAT testsuite for the RSA algorithm.
>
> Fixes: 9b5465867fb8 ("test/crypto: add RSA none padding cases")
> Cc: stable@dpdk.org
>
> Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
> ---
> app/test/test_cryptodev_asym.c | 74 +++++++++++++++++++++-------------------
> --
> 1 file changed, 37 insertions(+), 37 deletions(-)
>
> diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
> index 17daf734e8..241f9c30a0 100644
> --- a/app/test/test_cryptodev_asym.c
> +++ b/app/test/test_cryptodev_asym.c
> @@ -3292,9 +3292,6 @@ modular_multiplicative_inverse(const void *test_data)
> arg.qt.coef.data = coef; \
> arg.qt.coef.length = vector->coef.len
>
> -typedef void (*rsa_key_init_t)(struct rte_crypto_asym_xform *,
> - const struct rsa_test_data_2 *);
> -
> static int
> RSA_Encrypt(const struct rsa_test_data_2 *vector, uint8_t *cipher_buf)
> {
> @@ -3335,41 +3332,14 @@ RSA_Decrypt(const struct rsa_test_data_2 *vector,
> uint8_t *plaintext,
> return 0;
> }
>
> -static void
> -RSA_key_init_Exp(struct rte_crypto_asym_xform *xform,
> - const struct rsa_test_data_2 *vector)
> -{
> - SET_RSA_PARAM(xform->rsa, vector, n);
> - SET_RSA_PARAM(xform->rsa, vector, e);
> - SET_RSA_PARAM(xform->rsa, vector, d);
> - xform->rsa.key_type = RTE_RSA_KEY_TYPE_EXP;
> -}
> -
> -static void
> -RSA_key_init_CRT(struct rte_crypto_asym_xform *xform,
> - const struct rsa_test_data_2 *vector)
> -{
> - SET_RSA_PARAM(xform->rsa, vector, n);
> - SET_RSA_PARAM(xform->rsa, vector, e);
> - SET_RSA_PARAM_QT(xform->rsa, vector, p);
> - SET_RSA_PARAM_QT(xform->rsa, vector, q);
> - SET_RSA_PARAM_QT(xform->rsa, vector, dP);
> - SET_RSA_PARAM_QT(xform->rsa, vector, dQ);
> - SET_RSA_PARAM_QT(xform->rsa, vector, qInv);
> - xform->rsa.key_type = RTE_RSA_KEY_TYPE_QT;
> -}
> -
> static int
> -RSA_Init_Session(const struct rsa_test_data_2 *vector,
> - rsa_key_init_t key_init)
> +RSA_Init_Session(struct rte_crypto_asym_xform *xform)
> {
> const uint8_t dev_id = params->valid_devs[0];
> struct rte_cryptodev_info dev_info;
> - struct rte_crypto_asym_xform xform = { };
> int ret = 0;
>
> - key_init(&xform, vector);
> - xform.xform_type = RTE_CRYPTO_ASYM_XFORM_RSA;
> + xform->xform_type = RTE_CRYPTO_ASYM_XFORM_RSA;
>
> rte_cryptodev_info_get(dev_id, &dev_info);
> if (!(dev_info.feature_flags &
> RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT)) {
> @@ -3377,7 +3347,7 @@ RSA_Init_Session(const struct rsa_test_data_2
> *vector,
> "Device doesn't support decrypt op with quintuple key
> type. Test skipped\n");
> return TEST_SKIPPED;
> }
> - ret = rte_cryptodev_asym_session_create(dev_id, &xform,
> + ret = rte_cryptodev_asym_session_create(dev_id, xform,
> params->session_mpool, &self->sess);
> if (ret < 0) {
> RTE_LOG(ERR, USER1,
> @@ -3392,7 +3362,13 @@ KAT_RSA_Encrypt(const void *data)
> {
> uint8_t cipher_buf[TEST_DATA_SIZE] = {0};
> const struct rsa_test_data_2 *vector = data;
> - int ret = RSA_Init_Session(vector, RSA_key_init_Exp);
> + struct rte_crypto_asym_xform xform = { };
> +
> + SET_RSA_PARAM(xform.rsa, vector, n);
> + SET_RSA_PARAM(xform.rsa, vector, e);
> + SET_RSA_PARAM(xform.rsa, vector, d);
> + xform.rsa.key_type = RTE_RSA_KEY_TYPE_EXP;
> + int ret = RSA_Init_Session(&xform);
Please fix camel casing of functions as well.
This got missed in the original commit.
>
> if (ret) {
> RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
> @@ -3412,8 +3388,17 @@ KAT_RSA_Encrypt_CRT(const void *data)
> {
> uint8_t cipher_buf[TEST_DATA_SIZE] = {0};
> const struct rsa_test_data_2 *vector = data;
> - int ret = RSA_Init_Session(vector, RSA_key_init_CRT);
> + struct rte_crypto_asym_xform xform = { };
>
> + SET_RSA_PARAM(xform.rsa, vector, n);
> + SET_RSA_PARAM(xform.rsa, vector, e);
> + SET_RSA_PARAM_QT(xform.rsa, vector, p);
> + SET_RSA_PARAM_QT(xform.rsa, vector, q);
> + SET_RSA_PARAM_QT(xform.rsa, vector, dP);
> + SET_RSA_PARAM_QT(xform.rsa, vector, dQ);
> + SET_RSA_PARAM_QT(xform.rsa, vector, qInv);
> + xform.rsa.key_type = RTE_RSA_KEY_TYPE_QT;
> + int ret = RSA_Init_Session(&xform);
> if (ret) {
> RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
> return ret;
> @@ -3432,7 +3417,13 @@ KAT_RSA_Decrypt(const void *data)
> {
> uint8_t message[TEST_DATA_SIZE] = {0};
> const struct rsa_test_data_2 *vector = data;
> - int ret = RSA_Init_Session(vector, RSA_key_init_Exp);
> + struct rte_crypto_asym_xform xform = { };
> +
> + SET_RSA_PARAM(xform.rsa, vector, n);
> + SET_RSA_PARAM(xform.rsa, vector, e);
> + SET_RSA_PARAM(xform.rsa, vector, d);
> + xform.rsa.key_type = RTE_RSA_KEY_TYPE_EXP;
> + int ret = RSA_Init_Session(&xform);
>
> if (ret) {
> RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
> @@ -3452,8 +3443,17 @@ KAT_RSA_Decrypt_CRT(const void *data)
> {
> uint8_t message[TEST_DATA_SIZE] = {0};
> const struct rsa_test_data_2 *vector = data;
> - int ret = RSA_Init_Session(vector, RSA_key_init_CRT);
> + struct rte_crypto_asym_xform xform = { };
>
> + SET_RSA_PARAM(xform.rsa, vector, n);
> + SET_RSA_PARAM(xform.rsa, vector, e);
> + SET_RSA_PARAM_QT(xform.rsa, vector, p);
> + SET_RSA_PARAM_QT(xform.rsa, vector, q);
> + SET_RSA_PARAM_QT(xform.rsa, vector, dP);
> + SET_RSA_PARAM_QT(xform.rsa, vector, dQ);
> + SET_RSA_PARAM_QT(xform.rsa, vector, qInv);
> + xform.rsa.key_type = RTE_RSA_KEY_TYPE_QT;
> + int ret = RSA_Init_Session(&xform);
> if (ret) {
> RTE_LOG(ERR, USER1, "Failed to init session for RSA\n");
> return ret;
> --
> 2.13.6
next prev parent reply other threads:[~2024-03-08 8:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 8:17 Arkadiusz Kusztal
2024-03-08 8:23 ` Akhil Goyal [this message]
2024-03-13 9:13 ` [PATCH v2] " Arkadiusz Kusztal
2024-03-13 10:02 ` [EXTERNAL] " Akhil Goyal
2024-03-13 16:02 ` Power, Ciara
2024-03-21 8:35 ` [PATCH v3] " Arkadiusz Kusztal
2024-03-21 8:36 ` Power, Ciara
2024-05-30 9:06 ` [EXTERNAL] " Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CO6PR18MB4484D521795D4851F8EC2935D8272@CO6PR18MB4484.namprd18.prod.outlook.com \
--to=gakhil@marvell.com \
--cc=arkadiuszx.kusztal@intel.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).