crypto/qat: fix asym session validation and gen4 EC caps
PATCH 1/2 crypto/qat: fix asym session validation and gen4 EC caps
Fix asym tests to return TEST_SKIPPED when session creation returns -ENOTSUP. Add missing ECDH, ECDSA and ECPM capabilities to GEN4 asym caps table. Reject unsupported RSA padding and EC curves at session configure time with -ENOTSUP.
Bugzilla ID: 1903
--- app/test/test_cryptodev_asym.c | 38 ++++++++++++++++---- drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c | 13 +++++++ drivers/crypto/qat/qat_asym.c | 10 ++++++ 3 files changed, 55 insertions(+), 6 deletions(-)
app/test/test_cryptodev_asym.c +32 -6
@@ -318,6 +318,9 @@ test_rsa_sign_verify(void) error_exit:rte_cryptodev_asym_session_free (dev_id, sess); +if (status ==TEST_SKIPPED ) +return status; +TEST_ASSERT_EQUAL (status,0 ,"Test failed" );return status;
@@ -368,6 +371,9 @@ test_rsa_enc_dec(void)rte_cryptodev_asym_session_free (dev_id, sess); +if (status ==TEST_SKIPPED ) +return status; +TEST_ASSERT_EQUAL (status,0 ,"Test failed" );return status;
@@ -414,6 +420,9 @@ test_rsa_sign_verify_crt(void)rte_cryptodev_asym_session_free (dev_id, sess); +if (status ==TEST_SKIPPED ) +return status; +TEST_ASSERT_EQUAL (status,0 ,"Test failed" );return status;
@@ -460,6 +469,9 @@ test_rsa_enc_dec_crt(void)rte_cryptodev_asym_session_free (dev_id, sess); +if (status ==TEST_SKIPPED ) +return status; +TEST_ASSERT_EQUAL (status,0 ,"Test failed" );return status;
@@ -1712,6 +1724,8 @@ test_ecdsa_sign_verify_all_curve(void) status =test_ecdsa_sign_verify (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -1901,6 +1915,8 @@ test_ecpm_all_curve(void) status =test_ecpm (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -1956,10 +1972,10 @@ test_ecdh_priv_key_generate(enum curve curve_id) idx.type =RTE_CRYPTO_ASYM_XFORM_ECDH ; capa =rte_cryptodev_asym_capability_get (dev_id, &idx);if (capa ==NULL ) -return -ENOTSUP ; +return TEST_SKIPPED ;if (!(capa->op_types & (1 <<RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE ))) -return -ENOTSUP ; +return TEST_SKIPPED ;switch (curve_id) {case SECP192R1 :
@@ -2269,10 +2285,10 @@ test_ecdh_pub_key_verify(enum curve curve_id) idx.type =RTE_CRYPTO_ASYM_XFORM_ECDH ; capa =rte_cryptodev_asym_capability_get (dev_id, &idx);if (capa ==NULL ) -return -ENOTSUP ; +return TEST_SKIPPED ;if (!(capa->op_types & (1 <<RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY ))) -return -ENOTSUP ; +return TEST_SKIPPED ;switch (curve_id) {case SECP192R1 :
@@ -2408,10 +2424,10 @@ test_ecdh_shared_secret(enum curve curve_id) idx.type =RTE_CRYPTO_ASYM_XFORM_ECDH ; capa =rte_cryptodev_asym_capability_get (dev_id, &idx);if (capa ==NULL ) -return -ENOTSUP ; +return TEST_SKIPPED ;if (!(capa->op_types & (1 <<RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE ))) -return -ENOTSUP ; +return TEST_SKIPPED ;switch (curve_id) {case SECP192R1 :
@@ -2668,6 +2684,8 @@ test_ecdh_all_curve(void) status =test_ecdh_priv_key_generate (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -2700,6 +2718,8 @@ test_ecdh_all_curve(void) status =test_ecdh_pub_key_verify (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -2715,6 +2735,8 @@ test_ecdh_all_curve(void) status =test_ecdh_shared_secret (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -2752,6 +2774,8 @@ test_ecdh_qat_curves(void) status =test_ecdh_pub_key_verify (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -2764,6 +2788,8 @@ test_ecdh_qat_curves(void) status =test_ecdh_shared_secret (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c +13 -0
@@ -144,6 +144,19 @@ static struct rte_cryptodev_capabilities qat_asym_crypto_caps_gen4[] = { } } }, +QAT_ASYM_CAP (ECDH , + ((1 <<RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE ) | + (1 <<RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE ) | + (1 <<RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY )), +64 ,512 ,64 ), +QAT_ASYM_CAP (ECDSA , + ((1 <<RTE_CRYPTO_ASYM_OP_SIGN ) | + (1 <<RTE_CRYPTO_ASYM_OP_VERIFY )), +64 ,512 ,64 ), +QAT_ASYM_CAP (ECPM , + ((1 <<RTE_CRYPTO_ASYM_OP_SIGN ) | + (1 <<RTE_CRYPTO_ASYM_OP_VERIFY )), +64 ,512 ,64 ), RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() };
drivers/crypto/qat/qat_asym.c +10 -0
@@ -1483,6 +1483,12 @@ static int session_set_ec(struct qat_asym_session *qat_session, struct rte_crypto_asym_xform *xform) { +/* Validate curve for EC operations using pick_curve (not SM2) */ +if (xform->xform_type !=RTE_CRYPTO_ASYM_XFORM_SM2 ) { +if (pick_curve (xform) <0 ) +return -ENOTSUP ; + } +uint8_t *pkey = xform->ec.pkey.data;uint8_t *q_x = xform->ec.q.x.data;uint8_t *q_y = xform->ec.q.y.data;
@@ -1545,6 +1551,10 @@ qat_asym_session_configure(struct rte_cryptodev *dev __rte_unused, ret =session_set_modinv (qat_session, xform);break ;case RTE_CRYPTO_ASYM_XFORM_RSA : { +if (xform->rsa.padding.type !=RTE_CRYPTO_RSA_PADDING_NONE ) { + ret = -ENOTSUP ; +return ret; + }if (unlikely ((xform->rsa.n.length <RSA_MODULUS_2048_BITS ) && (crypto_qat->qat_dev->options.legacy_alg ==0 ))) { ret = -ENOTSUP ;
Signature · 1 line
2.43.0
PATCH 2/2 crypto/qat: fix modexp and modinv result length and comparison
QAT HW rounds the output buffer size up to the next supported size, but result.length was set to alg_bytesize instead of n.length, causing result comparisons to read past the end of the expected value.
Additionally, when a modulus has a leading zero padding byte, QAT HW strips it from the result but we never strip it from the expected result, so the compare fails. Fix verify_modexp() and verify_modinv() to skip leading zero bytes in the result before comparison.
--- app/test/test_cryptodev_asym.c | 8 ++++++++ app/test/test_cryptodev_asym_util.h | 20 ++++++++++++++++---- drivers/crypto/qat/qat_asym.c | 7 +++---- 3 files changed, 27 insertions(+), 8 deletions(-)
app/test/test_cryptodev_asym.c +8 -0
@@ -3826,6 +3826,14 @@ modular_exponentiation(const void *test_data)uint8_t result[TEST_DATA_SIZE ] = {0 };struct rte_crypto_asym_xform xform = { };const uint8_t dev_id = params->valid_devs[0 ]; +const struct rte_cryptodev_asymmetric_xform_capability *cap; +struct rte_cryptodev_asym_capability_idx cap_idx; + + cap_idx.type =RTE_CRYPTO_ASYM_XFORM_MODEX ; + cap =rte_cryptodev_asym_capability_get (dev_id, &cap_idx); +if (cap ==NULL ||rte_cryptodev_asym_xform_capability_check_modlen ( + cap, vector->modulus.len)) +return TEST_SKIPPED ;memcpy (input, vector->base.data, vector->base.len);memcpy (exponent, vector->exponent.data, vector->exponent.len);
app/test/test_cryptodev_asym_util.h +16 -4
@@ -20,8 +20,14 @@ static inline int rsa_verify(struct rsa_test_data *rsa_param,static inline int verify_modinv (uint8_t *mod_inv,struct rte_crypto_op *result_op) { -if (memcmp (mod_inv, result_op->asym->modinv.result.data, - result_op->asym->modinv.result.length)) +const uint8_t *b = result_op->asym->modinv.result.data; +size_t b_len = result_op->asym->modinv.result.length; + +while (b_len >1 && b[0 ] ==0 ) { + b++; + b_len--; + } +if (memcmp (mod_inv, b, b_len))return -1 ;return 0 ; }
@@ -29,8 +35,14 @@ static inline int verify_modinv(uint8_t *mod_inv,static inline int verify_modexp (uint8_t *mod_exp,struct rte_crypto_op *result_op) { -if (memcmp (mod_exp, result_op->asym->modex.result.data, - result_op->asym->modex.result.length)) +const uint8_t *b = result_op->asym->modex.result.data; +size_t b_len = result_op->asym->modex.result.length; + +while (b_len >1 && b[0 ] ==0 ) { + b++; + b_len--; + } +if (memcmp (mod_exp, b, b_len))return -1 ;return 0 ; }
drivers/crypto/qat/qat_asym.c +3 -4
@@ -274,7 +274,7 @@ modexp_collect(struct rte_crypto_asym_op *asym_op,rte_memcpy (modexp_result, cookie->output_array[0 ] + alg_bytesize - n.length, n.length); - asym_op->modex.result.length = alg_bytesize; + asym_op->modex.result.length = n.length;HEXDUMP ("ModExp result" , cookie->output_array[0 ], alg_bytesize);return RTE_CRYPTO_OP_STATUS_SUCCESS ;
@@ -332,11 +332,10 @@ modinv_collect(struct rte_crypto_asym_op *asym_op,QAT_LOG (ERR ,"Incorrect length of modinv modulus" );return RTE_CRYPTO_OP_STATUS_INVALID_ARGS ; } -rte_memcpy (modinv_result + (asym_op->modinv.result.length - - n.length), +rte_memcpy (modinv_result, cookie->output_array[0 ] + alg_bytesize - n.length, n.length); - asym_op->modinv.result.length = alg_bytesize; + asym_op->modinv.result.length = n.length;HEXDUMP ("ModInv result" , cookie->output_array[0 ], alg_bytesize);return RTE_CRYPTO_OP_STATUS_SUCCESS ;
Signature · 1 line
2.43.0
Re: [EXTERNAL] [PATCH 2/2] crypto/qat: fix modexp and modinv result length and comparison
________________________________
From: Emma Finn <[email protected]>
Sent: Monday, March 23, 2026 20:38
To: Akhil Goyal <[email protected]>; Fan Zhang <[email protected]>; Kai Ji <[email protected]>; Rupesh Chiluka <[email protected]>
Cc: [email protected] <[email protected]>; Emma Finn <[email protected]>
Subject: [EXTERNAL] [PATCH 2/2] crypto/qat: fix modexp and modinv result length and comparison
QAT HW rounds the output buffer size up to the next supported size, but result. length was set to alg_bytesize instead of n. length, causing result comparisons to read past the end of the expected value. Additionally, when a modulus has a leading ZjQcmQRYFpfptBannerStart
Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments
<https://us-phishalarm-ewt.proofpoint.com/EWT/v1/CRVmXkqW!te3Z1f8UYnW6tG-cGdxazuubvGPgl6yTU25nHC1z9RXK4YEidjaGpjsKME98FEQ50hB_lPsKuSS8cG6Y0i77JxgNu0tFoG0$>
Report Suspicious
ZjQcmQRYFpfptBannerEnd
QAT HW rounds the output buffer size up to the next supported size, but result.length was set to alg_bytesize instead of n.length, causing result comparisons to read past the end of the expected value.
Additionally, when a modulus has a leading zero padding byte, QAT HW strips it from the result but we never strip it from the expected result, so the compare fails. Fix verify_modexp() and verify_modinv() to skip leading zero bytes in the result before comparison.
--- app/test/test_cryptodev_asym.c | 8 ++++++++ app/test/test_cryptodev_asym_util.h | 20 ++++++++++++++++---- drivers/crypto/qat/qat_asym.c | 7 +++---- 3 files changed, 27 insertions(+), 8 deletions(-)
app/test/test_cryptodev_asym.c +8 -0
@@ -3826,6 +3826,14 @@ modular_exponentiation(const void *test_data)uint8_t result[TEST_DATA_SIZE ] = {0 };struct rte_crypto_asym_xform xform = { };const uint8_t dev_id = params->valid_devs[0 ]; +const struct rte_cryptodev_asymmetric_xform_capability *cap; +struct rte_cryptodev_asym_capability_idx cap_idx; + + cap_idx.type =RTE_CRYPTO_ASYM_XFORM_MODEX ; + cap =rte_cryptodev_asym_capability_get (dev_id, &cap_idx); +if (cap ==NULL ||rte_cryptodev_asym_xform_capability_check_modlen ( + cap, vector->modulus.len)) +return TEST_SKIPPED ;memcpy (input, vector->base.data, vector->base.len);memcpy (exponent, vector->exponent.data, vector->exponent.len);
app/test/test_cryptodev_asym_util.h +16 -4
@@ -20,8 +20,14 @@ static inline int rsa_verify(struct rsa_test_data *rsa_param,static inline int verify_modinv (uint8_t *mod_inv,struct rte_crypto_op *result_op) { -if (memcmp (mod_inv, result_op->asym->modinv.result.data, - result_op->asym->modinv.result.length)) +const uint8_t *b = result_op->asym->modinv.result.data; +size_t b_len = result_op->asym->modinv.result.length; + +while (b_len >1 && b[0 ] ==0 ) { + b++; + b_len--; + } +if (memcmp (mod_inv, b, b_len))return -1 ;return 0 ; }
@@ -29,8 +35,14 @@ static inline int verify_modinv(uint8_t *mod_inv,static inline int verify_modexp (uint8_t *mod_exp,struct rte_crypto_op *result_op) { -if (memcmp (mod_exp, result_op->asym->modex.result.data, - result_op->asym->modex.result.length)) +const uint8_t *b = result_op->asym->modex.result.data; +size_t b_len = result_op->asym->modex.result.length; + +while (b_len >1 && b[0 ] ==0 ) { + b++; + b_len--; + } +if (memcmp (mod_exp, b, b_len))return -1 ;return 0 ; }
drivers/crypto/qat/qat_asym.c +3 -4
@@ -274,7 +274,7 @@ modexp_collect(struct rte_crypto_asym_op *asym_op,rte_memcpy (modexp_result, cookie->output_array[0 ] + alg_bytesize - n.length, n.length); - asym_op->modex.result.length = alg_bytesize; + asym_op->modex.result.length = n.length;HEXDUMP ("ModExp result" , cookie->output_array[0 ], alg_bytesize);return RTE_CRYPTO_OP_STATUS_SUCCESS ;
@@ -332,11 +332,10 @@ modinv_collect(struct rte_crypto_asym_op *asym_op,QAT_LOG (ERR ,"Incorrect length of modinv modulus" );return RTE_CRYPTO_OP_STATUS_INVALID_ARGS ; } -rte_memcpy (modinv_result + (asym_op->modinv.result.length - - n.length), +rte_memcpy (modinv_result, cookie->output_array[0 ] + alg_bytesize - n.length, n.length); - asym_op->modinv.result.length = alg_bytesize; + asym_op->modinv.result.length = n.length;HEXDUMP ("ModInv result" , cookie->output_array[0 ], alg_bytesize);return RTE_CRYPTO_OP_STATUS_SUCCESS ;
--
2.43.0
Akhil Goyal
AppliedRE: [EXTERNAL] [PATCH 2/2] crypto/qat: fix modexp and modinv result length and comparison
Quoted 4 lines
QAT HW rounds the output buffer size up to the next supported size, but result.length was set to
alg_bytesizeinstead of n.length, causing result comparisons to read past the end of the expected value.
Quoted 8 lines
Additionally, when a modulus has a leading zero padding byte, QAT HW strips it from the result but we never strip it from the expected result, so the compare fails. Fix
verify_modexp()andverify_modinv()to skip leading zero bytes in the result before comparison.Fixes 064ef1b098d1 ("test/crypto: remove PMD-specific asym test suites")Signed-off-by Emma Finn <[email protected]>
Applied to dpdk-next-crypto
Thanks.
________________________________
From: Emma Finn <[email protected]>
Sent: Monday, March 23, 2026 20:38
To: Akhil Goyal <[email protected]>; Fan Zhang <[email protected]>; Kai Ji <[email protected]>; Rupesh Chiluka <[email protected]>
Cc: [email protected] <[email protected]>; Emma Finn <[email protected]>
Subject: [EXTERNAL] [PATCH 1/2] crypto/qat: fix asym session validation and gen4 EC caps
Fix asym tests to return TEST_SKIPPED when session creation returns -ENOTSUP. Add missing ECDH, ECDSA and ECPM capabilities to GEN4 asym caps table. Reject unsupported RSA padding and EC curves at session configure time with -ENOTSUP. Bugzilla ZjQcmQRYFpfptBannerStart
Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments
<https://us-phishalarm-ewt.proofpoint.com/EWT/v1/CRVmXkqW!te3Z1f8UYnW6tG-cGdxazuubvGPgl6yTU24HHC1z9RV5wPQjtl7qP0oEMSmeVZTwYYHqm4_Boxty5bBSBE8DJtAeSS0s7DY$>
Report Suspicious
ZjQcmQRYFpfptBannerEnd
Fix asym tests to return TEST_SKIPPED when session creation returns -ENOTSUP. Add missing ECDH, ECDSA and ECPM capabilities to GEN4 asym caps table. Reject unsupported RSA padding and EC curves at session configure time with -ENOTSUP.
Bugzilla ID: 1903
--- app/test/test_cryptodev_asym.c | 38 ++++++++++++++++---- drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c | 13 +++++++ drivers/crypto/qat/qat_asym.c | 10 ++++++ 3 files changed, 55 insertions(+), 6 deletions(-)
app/test/test_cryptodev_asym.c +32 -6
@@ -318,6 +318,9 @@ test_rsa_sign_verify(void) error_exit:rte_cryptodev_asym_session_free (dev_id, sess); +if (status ==TEST_SKIPPED ) +return status; +TEST_ASSERT_EQUAL (status,0 ,"Test failed" );return status;
@@ -368,6 +371,9 @@ test_rsa_enc_dec(void)rte_cryptodev_asym_session_free (dev_id, sess); +if (status ==TEST_SKIPPED ) +return status; +TEST_ASSERT_EQUAL (status,0 ,"Test failed" );return status;
@@ -414,6 +420,9 @@ test_rsa_sign_verify_crt(void)rte_cryptodev_asym_session_free (dev_id, sess); +if (status ==TEST_SKIPPED ) +return status; +TEST_ASSERT_EQUAL (status,0 ,"Test failed" );return status;
@@ -460,6 +469,9 @@ test_rsa_enc_dec_crt(void)rte_cryptodev_asym_session_free (dev_id, sess); +if (status ==TEST_SKIPPED ) +return status; +TEST_ASSERT_EQUAL (status,0 ,"Test failed" );return status;
@@ -1712,6 +1724,8 @@ test_ecdsa_sign_verify_all_curve(void) status =test_ecdsa_sign_verify (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -1901,6 +1915,8 @@ test_ecpm_all_curve(void) status =test_ecpm (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -1956,10 +1972,10 @@ test_ecdh_priv_key_generate(enum curve curve_id) idx.type =RTE_CRYPTO_ASYM_XFORM_ECDH ; capa =rte_cryptodev_asym_capability_get (dev_id, &idx);if (capa ==NULL ) -return -ENOTSUP ; +return TEST_SKIPPED ;if (!(capa->op_types & (1 <<RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE ))) -return -ENOTSUP ; +return TEST_SKIPPED ;switch (curve_id) {case SECP192R1 :
@@ -2269,10 +2285,10 @@ test_ecdh_pub_key_verify(enum curve curve_id) idx.type =RTE_CRYPTO_ASYM_XFORM_ECDH ; capa =rte_cryptodev_asym_capability_get (dev_id, &idx);if (capa ==NULL ) -return -ENOTSUP ; +return TEST_SKIPPED ;if (!(capa->op_types & (1 <<RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY ))) -return -ENOTSUP ; +return TEST_SKIPPED ;switch (curve_id) {case SECP192R1 :
@@ -2408,10 +2424,10 @@ test_ecdh_shared_secret(enum curve curve_id) idx.type =RTE_CRYPTO_ASYM_XFORM_ECDH ; capa =rte_cryptodev_asym_capability_get (dev_id, &idx);if (capa ==NULL ) -return -ENOTSUP ; +return TEST_SKIPPED ;if (!(capa->op_types & (1 <<RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE ))) -return -ENOTSUP ; +return TEST_SKIPPED ;switch (curve_id) {case SECP192R1 :
@@ -2668,6 +2684,8 @@ test_ecdh_all_curve(void) status =test_ecdh_priv_key_generate (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -2700,6 +2718,8 @@ test_ecdh_all_curve(void) status =test_ecdh_pub_key_verify (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -2715,6 +2735,8 @@ test_ecdh_all_curve(void) status =test_ecdh_shared_secret (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -2752,6 +2774,8 @@ test_ecdh_qat_curves(void) status =test_ecdh_pub_key_verify (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
@@ -2764,6 +2788,8 @@ test_ecdh_qat_curves(void) status =test_ecdh_shared_secret (curve_id);if (status ==TEST_SUCCESS ) { msg ="succeeded" ; + }else if (status ==TEST_SKIPPED ) { + msg ="skipped" ; }else { msg ="failed" ; overall_status = status;
drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c +13 -0
@@ -144,6 +144,19 @@ static struct rte_cryptodev_capabilities qat_asym_crypto_caps_gen4[] = { } } }, +QAT_ASYM_CAP (ECDH , + ((1 <<RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE ) | + (1 <<RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE ) | + (1 <<RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY )), +64 ,512 ,64 ), +QAT_ASYM_CAP (ECDSA , + ((1 <<RTE_CRYPTO_ASYM_OP_SIGN ) | + (1 <<RTE_CRYPTO_ASYM_OP_VERIFY )), +64 ,512 ,64 ), +QAT_ASYM_CAP (ECPM , + ((1 <<RTE_CRYPTO_ASYM_OP_SIGN ) | + (1 <<RTE_CRYPTO_ASYM_OP_VERIFY )), +64 ,512 ,64 ), RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() };
drivers/crypto/qat/qat_asym.c +10 -0
@@ -1483,6 +1483,12 @@ static int session_set_ec(struct qat_asym_session *qat_session, struct rte_crypto_asym_xform *xform) { +/* Validate curve for EC operations using pick_curve (not SM2) */ +if (xform->xform_type !=RTE_CRYPTO_ASYM_XFORM_SM2 ) { +if (pick_curve (xform) <0 ) +return -ENOTSUP ; + } +uint8_t *pkey = xform->ec.pkey.data;uint8_t *q_x = xform->ec.q.x.data;uint8_t *q_y = xform->ec.q.y.data;
@@ -1545,6 +1551,10 @@ qat_asym_session_configure(struct rte_cryptodev *dev __rte_unused, ret =session_set_modinv (qat_session, xform);break ;case RTE_CRYPTO_ASYM_XFORM_RSA : { +if (xform->rsa.padding.type !=RTE_CRYPTO_RSA_PADDING_NONE ) { + ret = -ENOTSUP ; +return ret; + }if (unlikely ((xform->rsa.n.length <RSA_MODULUS_2048_BITS ) && (crypto_qat->qat_dev->options.legacy_alg ==0 ))) { ret = -ENOTSUP ;
--
2.43.0
Akhil Goyal
AppliedQuoted 9 lines
Fix asym tests to return
TEST_SKIPPEDwhen session creation returns-ENOTSUP. Add missing ECDH, ECDSA and ECPM capabilities to GEN4 asym caps table. Reject unsupported RSA padding and EC curves at session configure time with-ENOTSUP.Bugzilla ID: 1903
Fixes 064ef1b098d1 ("test/crypto: remove PMD-specific asym test suites")Signed-off-by Emma Finn <[email protected]>
Applied to dpdk-next-crypto
Thanks.