Add a rsa xform capability check in test functions, to check for supported sign and decrypt op_types
Signed-off-by: Ayuj Verma <ayve...@marvell.com> Signed-off-by: Shally Verma <shal...@marvell.com> --- test/test/test_cryptodev_asym.c | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c index 0f6fc5767..ae1c76db7 100644 --- a/test/test/test_cryptodev_asym.c +++ b/test/test/test_cryptodev_asym.c @@ -52,10 +52,33 @@ test_rsa_sign_verify(void) struct rte_crypto_asym_op *asym_op = NULL; struct rte_crypto_op *op = NULL, *result_op = NULL; struct rte_cryptodev_asym_session *sess = NULL; + struct rte_cryptodev_asym_capability_idx cap_idx; + const struct rte_cryptodev_asymmetric_xform_capability *capability; int status = TEST_SUCCESS; uint8_t output_buf[TEST_DATA_SIZE] = {0}; uint8_t input_buf[TEST_DATA_SIZE] = {0}; + /* check for RSA capability */ + cap_idx.type = RTE_CRYPTO_ASYM_XFORM_RSA; + capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx); + + if (!capability) { + RTE_LOG(ERR, USER1, + "RSA xform not supported\n"); + return TEST_SKIPPED; + } + + /* test case supports non-crt sign op only, + * so check for it in capability + */ + if (!rte_cryptodev_asym_xform_capability_check_optype( + capability, RTE_CRYPTO_ASYM_OP_SIGN)) { + RTE_LOG(ERR, USER1, + "non-crt mode RTE_CRYPTO_ASYM_OP_SIGN " + "not supported\n"); + return TEST_SKIPPED; + } + sess = rte_cryptodev_asym_session_create(sess_mpool); if (!sess) { @@ -186,9 +209,33 @@ test_rsa_enc_dec(void) struct rte_crypto_asym_op *asym_op = NULL; struct rte_crypto_op *op = NULL, *result_op = NULL; struct rte_cryptodev_asym_session *sess = NULL; + struct rte_cryptodev_asym_capability_idx cap_idx; + const struct rte_cryptodev_asymmetric_xform_capability *capability; int status = TEST_SUCCESS; uint8_t input_buf[TEST_DATA_SIZE] = {0}; + /* check for RSA capability */ + cap_idx.type = RTE_CRYPTO_ASYM_XFORM_RSA; + capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx); + + if (!capability) { + RTE_LOG(ERR, USER1, + "RSA xform not supported\n"); + return TEST_SKIPPED; + } + + /* test case supports non-crt decrypt op only, + * so check for it in capability + */ + if (!rte_cryptodev_asym_xform_capability_check_optype( + capability, RTE_CRYPTO_ASYM_OP_DECRYPT)) { + RTE_LOG(ERR, USER1, + "non-crt mode RTE_CRYPTO_ASYM_OP_DECRYPT " + "not supported\n"); + return TEST_SKIPPED; + } + + sess = rte_cryptodev_asym_session_create(sess_mpool); if (!sess) { -- 2.20.0