> -----Original Message----- > From: Gowrishankar Muthukrishnan <[email protected]> > Sent: Thursday, August 10, 2023 11:35 AM > To: [email protected] > Cc: [email protected]; Akhil Goyal <[email protected]>; Fan Zhang > <[email protected]>; Ji, Kai <[email protected]>; Gowrishankar > Muthukrishnan <[email protected]> > Subject: [v1 4/6] cryptodev: use generic EC xform params for SM2 > > Now, generic EC xform parameters include hash algorithm field. > Hence, SM2 curve can use this generic struct for setting hash algorithm, which > would also require SM2 curve ID enumerated along with other curves, as listed > in: > https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml > > Signed-off-by: Gowrishankar Muthukrishnan <[email protected]> > --- > app/test/test_cryptodev_asym.c | 12 ++++++++---- > app/test/test_cryptodev_sm2_test_vectors.h | 4 +++- > doc/guides/rel_notes/release_23_11.rst | 2 ++ > drivers/crypto/openssl/rte_openssl_pmd_ops.c | 2 +- > lib/cryptodev/rte_crypto_asym.h | 16 ++-------------- > 5 files changed, 16 insertions(+), 20 deletions(-) > > diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c > index 0ef2642fdd..b08772a9bf 100644 > --- a/app/test/test_cryptodev_asym.c > +++ b/app/test/test_cryptodev_asym.c > @@ -1838,7 +1838,8 @@ _test_sm2_sign(bool rnd_secret) > /* Setup asym xform */ > xform.next = NULL; > xform.xform_type = RTE_CRYPTO_ASYM_XFORM_SM2; > - xform.sm2.hash = RTE_CRYPTO_AUTH_SM3; > + xform.ec.curve_id = input_params.curve; > + xform.ec.hash = RTE_CRYPTO_AUTH_SM3; > > ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, > &sess); > if (ret < 0) { > @@ -2019,7 +2020,8 @@ test_sm2_verify(void) > /* Setup asym xform */ > xform.next = NULL; > xform.xform_type = RTE_CRYPTO_ASYM_XFORM_SM2; > - xform.sm2.hash = RTE_CRYPTO_AUTH_SM3; > + xform.ec.curve_id = input_params.curve; > + xform.ec.hash = RTE_CRYPTO_AUTH_SM3; > > ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, > &sess); > if (ret < 0) { > @@ -2120,7 +2122,8 @@ _test_sm2_enc(bool rnd_secret) > /* Setup asym xform */ > +++ b/lib/cryptodev/rte_crypto_asym.h > @@ -69,7 +69,8 @@ enum rte_crypto_curve_id { > RTE_CRYPTO_EC_GROUP_SECP224R1 = 21, > RTE_CRYPTO_EC_GROUP_SECP256R1 = 23, > RTE_CRYPTO_EC_GROUP_SECP384R1 = 24, > - RTE_CRYPTO_EC_GROUP_SECP521R1 = 25 > + RTE_CRYPTO_EC_GROUP_SECP521R1 = 25, > + RTE_CRYPTO_EC_GROUP_SM2 = 41, > }; > > /** > @@ -382,16 +383,6 @@ struct rte_crypto_ec_xform { > /**< Hash algorithm used in EC op. */ > }; > > -/** > - * Asymmetric SM2 transform data. > - * > - * Structure describing SM2 xform params. > - */ > -struct rte_crypto_sm2_xform { > - enum rte_crypto_auth_algorithm hash; > - /**< Hash algorithm used in SM2 op. */ > -}; > - > /** > * Operations params for modular operations: > * exponentiation and multiplicative inverse @@ -649,9 +640,6 @@ struct > rte_crypto_asym_xform { > /**< EC xform parameters, used by elliptic curve based > * operations. > */ > - > - struct rte_crypto_sm2_xform sm2; > - /**< SM2 xform parameters */ > }; > }; > > -- > 2.25.1 Acked-by: Arkadiusz Kusztal <[email protected]>

