Skip to content

Commit

Permalink
test/crypto: check for RSA capability
Browse files Browse the repository at this point in the history
In RSA crypto tests, check if it is supported by PMD before
executing it.

Signed-off-by: Gowrishankar Muthukrishnan <[email protected]>
Acked-by: Akhil Goyal <[email protected]>
  • Loading branch information
gmuthukrishn authored and Akhil Goyal committed Jan 8, 2025
1 parent b515f89 commit cdf7f14
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/test/test_cryptodev_asym.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,17 @@ test_rsa_sign_verify(void)
{
struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
struct rte_cryptodev_asym_capability_idx idx;
uint8_t dev_id = ts_params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
int ret, status = TEST_SUCCESS;

/* Check RSA capability */
idx.type = RTE_CRYPTO_ASYM_XFORM_RSA;
if (rte_cryptodev_asym_capability_get(dev_id, &idx) == NULL)
return -ENOTSUP;

/* Test case supports op with exponent key only,
* Check in PMD feature flag for RSA exponent key type support.
*/
Expand Down Expand Up @@ -274,11 +280,17 @@ test_rsa_enc_dec(void)
{
struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
struct rte_cryptodev_asym_capability_idx idx;
uint8_t dev_id = ts_params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
int ret, status = TEST_SUCCESS;

/* Check RSA capability */
idx.type = RTE_CRYPTO_ASYM_XFORM_RSA;
if (rte_cryptodev_asym_capability_get(dev_id, &idx) == NULL)
return -ENOTSUP;

/* Test case supports op with exponent key only,
* Check in PMD feature flag for RSA exponent key type support.
*/
Expand Down Expand Up @@ -314,11 +326,17 @@ test_rsa_sign_verify_crt(void)
{
struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
struct rte_cryptodev_asym_capability_idx idx;
uint8_t dev_id = ts_params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
int ret, status = TEST_SUCCESS;

/* Check RSA capability */
idx.type = RTE_CRYPTO_ASYM_XFORM_RSA;
if (rte_cryptodev_asym_capability_get(dev_id, &idx) == NULL)
return -ENOTSUP;

/* Test case supports op with quintuple format key only,
* Check im PMD feature flag for RSA quintuple key type support.
*/
Expand Down Expand Up @@ -354,11 +372,17 @@ test_rsa_enc_dec_crt(void)
{
struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
struct rte_cryptodev_asym_capability_idx idx;
uint8_t dev_id = ts_params->valid_devs[0];
void *sess = NULL;
struct rte_cryptodev_info dev_info;
int ret, status = TEST_SUCCESS;

/* Check RSA capability */
idx.type = RTE_CRYPTO_ASYM_XFORM_RSA;
if (rte_cryptodev_asym_capability_get(dev_id, &idx) == NULL)
return -ENOTSUP;

/* Test case supports op with quintuple format key only,
* Check in PMD feature flag for RSA quintuple key type support.
*/
Expand Down

0 comments on commit cdf7f14

Please sign in to comment.