app/crypto-perf: support mldsa Sign-Iteration
PATCH v2 1/4 app/crypto-perf: support mldsa Sign-Iteration
Add ML-DSA44 Sign-Iteration based test support for 1, 5 and 10 iterations to test-crypto-perf.
--- app/test-crypto-perf/cperf_options.h | 3 + app/test-crypto-perf/cperf_options_parsing.c | 47 +- app/test-crypto-perf/cperf_test_vectors.c | 1024 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 3 + app/test-crypto-perf/main.c | 17 +- doc/guides/tools/cryptoperf.rst | 7 + 6 files changed, 1096 insertions(+), 5 deletions(-)
app/test-crypto-perf/cperf_options.h +3 -0
@@ -56,6 +56,8 @@#define CPERF_ASYM_OP ("asym-op") +#define CPERF_MLDSA_SIGN_ITER ("mldsa-sign-iter") +#ifdef RTE_LIB_SECURITY #define CPERF_PDCP_SN_SZ ("pdcp-sn-sz")#define CPERF_PDCP_DOMAIN ("pdcp-domain")
@@ -196,6 +198,7 @@ struct cperf_options {struct cperf_rsa_test_data *rsa_data;uint16_t rsa_modlen;uint8_t rsa_keytype; +uint8_t mldsa_sign_iter; };void
app/test-crypto-perf/cperf_options_parsing.c +44 -3
90 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.c +1024 -0
1,036 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +3 -0
@@ -252,5 +252,8 @@ extern struct cperf_mlkem_test_data mlkem_encap_perf_data[];extern struct cperf_mlkem_test_data mlkem_decap_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];#endif
app/test-crypto-perf/main.c +15 -2
@@ -524,8 +524,21 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,if (asym_capability ==NULL )return -1 ; -if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; +break ; +default : + opts->mldsa_data = &mldsa_sign_perf_data[0 ]; + } + }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) opts->mldsa_data = &mldsa_verify_perf_data[0 ];else {
doc/guides/tools/cryptoperf.rst +7 -0
@@ -364,6 +364,13 @@ The following are the application command-line options: Not applicable for modex op type. Default is ``encrypt``. +* ``--mldsa-sign-iter <1/5/10>`` + + Set ML-DSA sign iteration count for mldsa_44 sign operation. + Default is ``1``. + Only applicable when: + ``--optype mldsa_44`` and ``--asym-op sign``. + * ``--rsa-priv-keytype <exp/qt>`` Set RSA private key type.
Signature · 1 line
2.43.0
PATCH v2 2/4 app/crypto-perf: add ML-KEM support
Extend ML-KEM Support in crypto-perf to include ML-KEM768 and ML-KEM1024 test vectors.
--- app/test-crypto-perf/cperf_ops.c | 12 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 32 +- app/test-crypto-perf/cperf_test_common.c | 2 + app/test-crypto-perf/cperf_test_vectors.c | 1500 +++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 22 +- 7 files changed, 1555 insertions(+), 19 deletions(-)
app/test-crypto-perf/cperf_ops.c +9 -3
@@ -1337,10 +1337,13 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { +switch (options->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; - xform.mlkem.type =RTE_CRYPTO_ML_KEM_512 ; + xform.mlkem.type = options->mlkem_data->type; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);if (ret <0 || asym_sess ==NULL ) {
@@ -1348,9 +1351,10 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; } -#ifdef RTE_LIB_SECURITY /* * security only
@@ -1671,6 +1675,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : op_fns->populate_ops = cperf_set_ops_asym_mlkem;break ;#ifdef RTE_LIB_SECURITY
app/test-crypto-perf/cperf_options.h +2 -0
@@ -105,6 +105,8 @@ enum cperf_op_type {CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 ,CPERF_ASYM_MLKEM512 , +CPERF_ASYM_MLKEM768 , +CPERF_ASYM_MLKEM1024 , CPERF_TLS, };
app/test-crypto-perf/cperf_options_parsing.c +23 -9
@@ -41,7 +41,7 @@ usage(char *progname)" --optype cipher-only / auth-only / cipher-then-auth / auth-then-cipher /\n" " aead / pdcp / docsis / ipsec / modex / rsa / secp192r1 /\n" " secp224r1 / secp256r1 / secp384r1 / secp521r1 / eddsa / sm2 /\n" -" mlkem_512 / mldsa_44 /\n" +" mlkem_512 / mlkem_768 / mlkem_1024 / mldsa_44 /\n" " tls-record : set operation type\n" " --sessionless: enable session-less crypto operations\n" " --shared-session: share 1 session across all queue pairs on crypto device\n"
@@ -568,6 +568,14 @@ parse_op_type(struct cperf_options *opts, const char *arg) cperf_op_type_strs[CPERF_ASYM_MLKEM512 ],CPERF_ASYM_MLKEM512 }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM768 ], +CPERF_ASYM_MLKEM768 + }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM1024 ], +CPERF_ASYM_MLKEM1024 + }, { cperf_op_type_strs[CPERF_TLS ],CPERF_TLS
@@ -1704,12 +1712,11 @@ cperf_options_check(struct cperf_options *options) } } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { -if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - options->mlkem_data = &mlkem_encap_perf_data[0 ]; -else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - options->mlkem_data = &mlkem_decap_perf_data[0 ]; -else { +if (options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 ) { +if (options->asym_op_type !=RTE_CRYPTO_ASYM_OP_ENCRYPT && + options->asym_op_type !=RTE_CRYPTO_ASYM_OP_DECRYPT ) {RTE_LOG (ERR ,USER1 ,"ML-KEM operations only support encrypt (encapsulate) and decrypt (decapsulate)\n" );return -EINVAL ;
@@ -1817,8 +1824,15 @@ cperf_options_dump(struct cperf_options *opts)if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter); } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) -printf ("# mlkem test name: %s\n" , opts->mlkem_data->name); +switch (opts->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : +printf ("# mlkem algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); +break ; +default : +break ; + } }printf ("# sessionless: %s\n" , opts->sessionless ?"yes" :"no" );printf ("# shared session: %s\n" , opts->shared_session ?"yes" :"no" );
app/test-crypto-perf/cperf_test_common.c +2 -0
@@ -315,6 +315,8 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_ED25519 || options->op_type ==CPERF_ASYM_SM2 || options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 || options->op_type == CPERF_ASYM_MLDSA44) return true;
app/test-crypto-perf/cperf_test_vectors.c +1499 -1
1,518 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -248,8 +248,8 @@ extern struct cperf_rsa_test_data rsa_pub_perf_data[4];extern struct cperf_rsa_test_data rsa_exp_perf_data[4 ];extern struct cperf_rsa_test_data rsa_qt_perf_data[4 ];extern struct cperf_rsa_plaintext rsa_plaintext; -extern struct cperf_mlkem_test_data mlkem_encap_perf_data[]; -extern struct cperf_mlkem_test_data mlkem_decap_perf_data[]; +extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3 ]; +extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3 ];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[];
app/test-crypto-perf/main.c +18 -4
@@ -55,6 +55,8 @@ const char *cperf_op_type_strs[] = { [CPERF_ASYM_SM2] = "sm2", [CPERF_TLS] = "tls-record", [CPERF_ASYM_MLKEM512] = "mlkem_512", + [CPERF_ASYM_MLKEM768] = "mlkem_768", + [CPERF_ASYM_MLKEM1024] = "mlkem_1024", [CPERF_ASYM_MLDSA44] = "mldsa_44", };
@@ -248,6 +250,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)case CPERF_ASYM_SM2 :case CPERF_ASYM_RSA :case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 :case CPERF_ASYM_MLDSA44 :case CPERF_ASYM_MODEX : conf.ff_disable |= (RTE_CRYPTODEV_FF_SECURITY |
@@ -547,21 +551,31 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, } } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) { +if (opts->op_type ==CPERF_ASYM_MLKEM512 || + opts->op_type ==CPERF_ASYM_MLKEM768 || + opts->op_type ==CPERF_ASYM_MLKEM1024 ) { +uint8_t index =0 ; + asym_cap_idx.type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; asym_capability =rte_cryptodev_asym_capability_get (cdev_id, &asym_cap_idx);if (asym_capability ==NULL )return -1 ; +if (opts->op_type ==CPERF_ASYM_MLKEM512 ) + index =0 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM768 ) + index =1 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM1024 ) + index =2 ; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - opts->mlkem_data = &mlkem_encap_perf_data[0 ]; + opts->mlkem_data = &mlkem_encap_perf_data[index];else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - opts->mlkem_data = &mlkem_decap_perf_data[0 ]; + opts->mlkem_data = &mlkem_decap_perf_data[index];else {RTE_LOG (ERR ,USER1 ,"Unsupported MLKEM operation type\n" );return -ENOTSUP ; } - } if (opts->op_type == CPERF_AUTH_ONLY ||
Signature · 1 line
2.43.0
PATCH v2 3/4 app/crypto-perf: add ML-DSA support
In reply to Pratik SenapatiExtend ML-DSA test-cases to include deterministic
sign and verify for ML-DSA65 and ML-DSA87.
--- app/test-crypto-perf/cperf_ops.c | 14 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 53 +- app/test-crypto-perf/cperf_test_common.c | 4 +- app/test-crypto-perf/cperf_test_vectors.c | 2797 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 53 +- 7 files changed, 2876 insertions(+), 51 deletions(-)
app/test-crypto-perf/cperf_ops.c +10 -4
@@ -1321,12 +1321,14 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLDSA44 ) { +switch (options->op_type) { +case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_DSA ; - xform.mldsa.type =RTE_CRYPTO_ML_DSA_44 ; - xform.mldsa.sign_deterministic = - options->mldsa_data->sign_deterministic; + xform.mldsa.type = options->mldsa_data->type; + xform.mldsa.sign_deterministic = options->mldsa_data->sign_deterministic; xform.mldsa.sign_prehash = false; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);
@@ -1335,6 +1337,8 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; }switch (options->op_type) {
@@ -1672,6 +1676,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_sm2;break ;case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_options.h +2 -0
@@ -104,6 +104,8 @@ enum cperf_op_type {CPERF_ASYM_ED25519 ,CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 , +CPERF_ASYM_MLDSA65 , +CPERF_ASYM_MLDSA87 ,CPERF_ASYM_MLKEM512 ,CPERF_ASYM_MLKEM768 , CPERF_ASYM_MLKEM1024,
app/test-crypto-perf/cperf_options_parsing.c +26 -27
79 lines not on this page · raw message
app/test-crypto-perf/cperf_test_common.c +3 -1
@@ -317,7 +317,9 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_MLKEM512 || options->op_type ==CPERF_ASYM_MLKEM768 || options->op_type ==CPERF_ASYM_MLKEM1024 || - options->op_type == CPERF_ASYM_MLDSA44) + options->op_type ==CPERF_ASYM_MLDSA44 || + options->op_type ==CPERF_ASYM_MLDSA65 || + options->op_type == CPERF_ASYM_MLDSA87) return true;return false;
app/test-crypto-perf/cperf_test_vectors.c +2797 -0
2,815 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -250,8 +250,8 @@ extern struct cperf_rsa_test_data rsa_qt_perf_data[4]; extern struct cperf_rsa_plaintext rsa_plaintext; extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3]; extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3]; -extern struct cperf_mldsa_test_data mldsa_sign_perf_data[]; -extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data[3]; +extern struct cperf_mldsa_test_data mldsa_verify_perf_data[3]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];
app/test-crypto-perf/main.c +36 -17
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
PATCH v2 4/4 app/crypto-perf: add ML-DSA sign support
In reply to Pratik SenapatiExtend ML-DSA sign iteration support to include ML-DSA65 and ML-DSA87 for 1, 5 and 10 sign iterations.
--- app/test-crypto-perf/cperf_options_parsing.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 220 ++++++++++++++++--- app/test-crypto-perf/main.c | 28 +-- doc/guides/tools/cryptoperf.rst | 5 +- 4 files changed, 210 insertions(+), 46 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +1 -2
@@ -1820,8 +1820,7 @@ cperf_options_dump(struct cperf_options *opts)case CPERF_ASYM_MLDSA65 :case CPERF_ASYM_MLDSA87 :printf ("# mldsa algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); -if (opts->op_type ==CPERF_ASYM_MLDSA44 && - opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter);break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_test_vectors.c +194 -26
393 lines not on this page · raw message
app/test-crypto-perf/main.c +12 -16
@@ -544,23 +544,19 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, mldsa_idx =2 ;if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { -if (opts->op_type ==CPERF_ASYM_MLDSA44 ) { -switch (opts->mldsa_sign_iter) { -case 1 : - opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; -break ; -case 5 : - opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; -break ; -case 10 : - opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; -break ; -default : - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; -break ; - } - }else { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[mldsa_idx]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[mldsa_idx]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[mldsa_idx]; +break ; +default : opts->mldsa_data = &mldsa_sign_perf_data[mldsa_idx]; +break ; } }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { opts->mldsa_data = &mldsa_verify_perf_data[mldsa_idx];
doc/guides/tools/cryptoperf.rst +3 -2
@@ -366,10 +366,11 @@ The following are the application command-line options: * ``--mldsa-sign-iter <1/5/10>`` - Set ML-DSA sign iteration count for mldsa_44 sign operation. + Set ML-DSA sign iteration count for mldsa sign operation. Default is ``1``. Only applicable when: - ``--optype mldsa_44`` and ``--asym-op sign``. + ``--optype mldsa_44``, ``--optype mldsa_65``, ``--optype mldsa_87`` + and ``--asym-op sign``. * ``--rsa-priv-keytype <exp/qt>``
Signature · 1 line
2.43.0
PATCH v3 1/4 app/crypto-perf: support mldsa Sign-Iteration
In reply to Pratik SenapatiAdd ML-DSA44 Sign-Iteration based test support for 1, 5 and 10 iterations to test-crypto-perf.
--- app/test-crypto-perf/cperf_options.h | 3 + app/test-crypto-perf/cperf_options_parsing.c | 47 +- app/test-crypto-perf/cperf_test_vectors.c | 1024 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 3 + app/test-crypto-perf/main.c | 17 +- doc/guides/tools/cryptoperf.rst | 7 + 6 files changed, 1096 insertions(+), 5 deletions(-)
app/test-crypto-perf/cperf_options.h +3 -0
@@ -56,6 +56,8 @@#define CPERF_ASYM_OP ("asym-op") +#define CPERF_MLDSA_SIGN_ITER ("mldsa-sign-iter") +#ifdef RTE_LIB_SECURITY #define CPERF_PDCP_SN_SZ ("pdcp-sn-sz")#define CPERF_PDCP_DOMAIN ("pdcp-domain")
@@ -196,6 +198,7 @@ struct cperf_options {struct cperf_rsa_test_data *rsa_data;uint16_t rsa_modlen;uint8_t rsa_keytype; +uint8_t mldsa_sign_iter; };void
app/test-crypto-perf/cperf_options_parsing.c +44 -3
90 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.c +1024 -0
1,036 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +3 -0
@@ -252,5 +252,8 @@ extern struct cperf_mlkem_test_data mlkem_encap_perf_data[];extern struct cperf_mlkem_test_data mlkem_decap_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];#endif
app/test-crypto-perf/main.c +15 -2
@@ -524,8 +524,21 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,if (asym_capability ==NULL )return -1 ; -if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; +break ; +default : + opts->mldsa_data = &mldsa_sign_perf_data[0 ]; + } + }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) opts->mldsa_data = &mldsa_verify_perf_data[0 ];else {
doc/guides/tools/cryptoperf.rst +7 -0
@@ -364,6 +364,13 @@ The following are the application command-line options: Not applicable for modex op type. Default is ``encrypt``. +* ``--mldsa-sign-iter <1/5/10>`` + + Set ML-DSA sign iteration count for mldsa_44 sign operation. + Default is ``1``. + Only applicable when: + ``--optype mldsa_44`` and ``--asym-op sign``. + * ``--rsa-priv-keytype <exp/qt>`` Set RSA private key type.
Signature · 1 line
2.43.0
PATCH v3 2/4 app/crypto-perf: add ML-KEM support
Extend ML-KEM Support in crypto-perf to include ML-KEM768 and ML-KEM1024 test vectors.
--- app/test-crypto-perf/cperf_ops.c | 12 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 32 +- app/test-crypto-perf/cperf_test_common.c | 2 + app/test-crypto-perf/cperf_test_vectors.c | 1500 +++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 22 +- 7 files changed, 1555 insertions(+), 19 deletions(-)
app/test-crypto-perf/cperf_ops.c +9 -3
@@ -1337,10 +1337,13 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { +switch (options->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; - xform.mlkem.type =RTE_CRYPTO_ML_KEM_512 ; + xform.mlkem.type = options->mlkem_data->type; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);if (ret <0 || asym_sess ==NULL ) {
@@ -1348,9 +1351,10 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; } -#ifdef RTE_LIB_SECURITY /* * security only
@@ -1671,6 +1675,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : op_fns->populate_ops = cperf_set_ops_asym_mlkem;break ;#ifdef RTE_LIB_SECURITY
app/test-crypto-perf/cperf_options.h +2 -0
@@ -105,6 +105,8 @@ enum cperf_op_type {CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 ,CPERF_ASYM_MLKEM512 , +CPERF_ASYM_MLKEM768 , +CPERF_ASYM_MLKEM1024 , CPERF_TLS, };
app/test-crypto-perf/cperf_options_parsing.c +23 -9
@@ -41,7 +41,7 @@ usage(char *progname)" --optype cipher-only / auth-only / cipher-then-auth / auth-then-cipher /\n" " aead / pdcp / docsis / ipsec / modex / rsa / secp192r1 /\n" " secp224r1 / secp256r1 / secp384r1 / secp521r1 / eddsa / sm2 /\n" -" mlkem_512 / mldsa_44 /\n" +" mlkem_512 / mlkem_768 / mlkem_1024 / mldsa_44 /\n" " tls-record : set operation type\n" " --sessionless: enable session-less crypto operations\n" " --shared-session: share 1 session across all queue pairs on crypto device\n"
@@ -568,6 +568,14 @@ parse_op_type(struct cperf_options *opts, const char *arg) cperf_op_type_strs[CPERF_ASYM_MLKEM512 ],CPERF_ASYM_MLKEM512 }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM768 ], +CPERF_ASYM_MLKEM768 + }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM1024 ], +CPERF_ASYM_MLKEM1024 + }, { cperf_op_type_strs[CPERF_TLS ],CPERF_TLS
@@ -1704,12 +1712,11 @@ cperf_options_check(struct cperf_options *options) } } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { -if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - options->mlkem_data = &mlkem_encap_perf_data[0 ]; -else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - options->mlkem_data = &mlkem_decap_perf_data[0 ]; -else { +if (options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 ) { +if (options->asym_op_type !=RTE_CRYPTO_ASYM_OP_ENCRYPT && + options->asym_op_type !=RTE_CRYPTO_ASYM_OP_DECRYPT ) {RTE_LOG (ERR ,USER1 ,"ML-KEM operations only support encrypt (encapsulate) and decrypt (decapsulate)\n" );return -EINVAL ;
@@ -1817,8 +1824,15 @@ cperf_options_dump(struct cperf_options *opts)if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter); } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) -printf ("# mlkem test name: %s\n" , opts->mlkem_data->name); +switch (opts->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : +printf ("# mlkem algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); +break ; +default : +break ; + } }printf ("# sessionless: %s\n" , opts->sessionless ?"yes" :"no" );printf ("# shared session: %s\n" , opts->shared_session ?"yes" :"no" );
app/test-crypto-perf/cperf_test_common.c +2 -0
@@ -315,6 +315,8 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_ED25519 || options->op_type ==CPERF_ASYM_SM2 || options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 || options->op_type == CPERF_ASYM_MLDSA44) return true;
app/test-crypto-perf/cperf_test_vectors.c +1499 -1
1,518 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -248,8 +248,8 @@ extern struct cperf_rsa_test_data rsa_pub_perf_data[4];extern struct cperf_rsa_test_data rsa_exp_perf_data[4 ];extern struct cperf_rsa_test_data rsa_qt_perf_data[4 ];extern struct cperf_rsa_plaintext rsa_plaintext; -extern struct cperf_mlkem_test_data mlkem_encap_perf_data[]; -extern struct cperf_mlkem_test_data mlkem_decap_perf_data[]; +extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3 ]; +extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3 ];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[];
app/test-crypto-perf/main.c +18 -4
@@ -55,6 +55,8 @@ const char *cperf_op_type_strs[] = { [CPERF_ASYM_SM2] = "sm2", [CPERF_TLS] = "tls-record", [CPERF_ASYM_MLKEM512] = "mlkem_512", + [CPERF_ASYM_MLKEM768] = "mlkem_768", + [CPERF_ASYM_MLKEM1024] = "mlkem_1024", [CPERF_ASYM_MLDSA44] = "mldsa_44", };
@@ -248,6 +250,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)case CPERF_ASYM_SM2 :case CPERF_ASYM_RSA :case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 :case CPERF_ASYM_MLDSA44 :case CPERF_ASYM_MODEX : conf.ff_disable |= (RTE_CRYPTODEV_FF_SECURITY |
@@ -547,21 +551,31 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, } } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) { +if (opts->op_type ==CPERF_ASYM_MLKEM512 || + opts->op_type ==CPERF_ASYM_MLKEM768 || + opts->op_type ==CPERF_ASYM_MLKEM1024 ) { +uint8_t index =0 ; + asym_cap_idx.type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; asym_capability =rte_cryptodev_asym_capability_get (cdev_id, &asym_cap_idx);if (asym_capability ==NULL )return -1 ; +if (opts->op_type ==CPERF_ASYM_MLKEM512 ) + index =0 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM768 ) + index =1 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM1024 ) + index =2 ; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - opts->mlkem_data = &mlkem_encap_perf_data[0 ]; + opts->mlkem_data = &mlkem_encap_perf_data[index];else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - opts->mlkem_data = &mlkem_decap_perf_data[0 ]; + opts->mlkem_data = &mlkem_decap_perf_data[index];else {RTE_LOG (ERR ,USER1 ,"Unsupported MLKEM operation type\n" );return -ENOTSUP ; } - } if (opts->op_type == CPERF_AUTH_ONLY ||
Signature · 1 line
2.43.0
PATCH v3 3/4 app/crypto-perf: add ML-DSA support
In reply to Pratik SenapatiExtend ML-DSA test-cases to include deterministic
sign and verify for ML-DSA65 and ML-DSA87.
--- app/test-crypto-perf/cperf_ops.c | 14 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 53 +- app/test-crypto-perf/cperf_test_common.c | 4 +- app/test-crypto-perf/cperf_test_vectors.c | 2797 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 53 +- 7 files changed, 2876 insertions(+), 51 deletions(-)
app/test-crypto-perf/cperf_ops.c +10 -4
@@ -1321,12 +1321,14 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLDSA44 ) { +switch (options->op_type) { +case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_DSA ; - xform.mldsa.type =RTE_CRYPTO_ML_DSA_44 ; - xform.mldsa.sign_deterministic = - options->mldsa_data->sign_deterministic; + xform.mldsa.type = options->mldsa_data->type; + xform.mldsa.sign_deterministic = options->mldsa_data->sign_deterministic; xform.mldsa.sign_prehash = false; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);
@@ -1335,6 +1337,8 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; }switch (options->op_type) {
@@ -1672,6 +1676,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_sm2;break ;case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_options.h +2 -0
@@ -104,6 +104,8 @@ enum cperf_op_type {CPERF_ASYM_ED25519 ,CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 , +CPERF_ASYM_MLDSA65 , +CPERF_ASYM_MLDSA87 ,CPERF_ASYM_MLKEM512 ,CPERF_ASYM_MLKEM768 , CPERF_ASYM_MLKEM1024,
app/test-crypto-perf/cperf_options_parsing.c +26 -27
79 lines not on this page · raw message
app/test-crypto-perf/cperf_test_common.c +3 -1
@@ -317,7 +317,9 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_MLKEM512 || options->op_type ==CPERF_ASYM_MLKEM768 || options->op_type ==CPERF_ASYM_MLKEM1024 || - options->op_type == CPERF_ASYM_MLDSA44) + options->op_type ==CPERF_ASYM_MLDSA44 || + options->op_type ==CPERF_ASYM_MLDSA65 || + options->op_type == CPERF_ASYM_MLDSA87) return true;return false;
app/test-crypto-perf/cperf_test_vectors.c +2797 -0
2,815 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -250,8 +250,8 @@ extern struct cperf_rsa_test_data rsa_qt_perf_data[4]; extern struct cperf_rsa_plaintext rsa_plaintext; extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3]; extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3]; -extern struct cperf_mldsa_test_data mldsa_sign_perf_data[]; -extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data[3]; +extern struct cperf_mldsa_test_data mldsa_verify_perf_data[3]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];
app/test-crypto-perf/main.c +36 -17
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
PATCH v3 4/4 app/crypto-perf: add ML-DSA sign support
In reply to Pratik SenapatiExtend ML-DSA sign iteration support to include ML-DSA65 and ML-DSA87 for 1, 5 and 10 sign iterations.
--- app/test-crypto-perf/cperf_ops.c | 101 ++++++++--- app/test-crypto-perf/cperf_options_parsing.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 174 ++++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 24 +-- app/test-crypto-perf/main.c | 28 ++- doc/guides/tools/cryptoperf.rst | 5 +- 6 files changed, 280 insertions(+), 55 deletions(-)
app/test-crypto-perf/cperf_ops.c +81 -20
@@ -219,8 +219,27 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { +/* Intermediate writable buffers for static const test vectors */ +static uint8_t ek_buf[1568 ];/* ML-KEM-1024 ek max */ +static uint8_t dk_buf[3168 ];/* ML-KEM-1024 dk max */ +static uint8_t msg_buf[32 ];/* ML-KEM message (32 bytes) */ +static uint8_t cipher_buf[1568 ];/* ML-KEM-1024 cipher max */ +static uint8_t sk_buf[32 ];/* shared key (32 bytes) */ uint16_t i; +if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { +memcpy (ek_buf, options->mlkem_data->ek.data, + options->mlkem_data->ek.length); +if (options->mlkem_data->message.length) +memcpy (msg_buf, options->mlkem_data->message.data, + options->mlkem_data->message.length); + }else { +memcpy (dk_buf, options->mlkem_data->dk.data, + options->mlkem_data->dk.length); +memcpy (cipher_buf, options->mlkem_data->cipher.data, + options->mlkem_data->cipher.length); + } +for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -229,24 +248,25 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_ENCAP ; - asym_op->mlkem.encap.ek.data = options->mlkem_data->ek.data; + asym_op->mlkem.encap.ek.data = ek_buf; asym_op->mlkem.encap.ek.length = options->mlkem_data->ek.length; - asym_op->mlkem.encap.cipher.data = options->mlkem_data->cipher.data; + asym_op->mlkem.encap.cipher.data = cipher_buf; asym_op->mlkem.encap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.encap.sk.data = options->mlkem_data->sk.data; + asym_op->mlkem.encap.sk.data = sk_buf; asym_op->mlkem.encap.sk.length = options->mlkem_data->sk.length; - asym_op->mlkem.encap.message.data = options->mlkem_data->message.data; + asym_op->mlkem.encap.message.data = msg_buf; asym_op->mlkem.encap.message.length = options->mlkem_data->message.length; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_DECAP ; - asym_op->mlkem.decap.dk.data = options->mlkem_data->dk.data; + asym_op->mlkem.decap.dk.data = dk_buf; asym_op->mlkem.decap.dk.length = options->mlkem_data->dk.length; - asym_op->mlkem.decap.cipher.data = options->mlkem_data->cipher.data; + asym_op->mlkem.decap.cipher.data = cipher_buf; asym_op->mlkem.decap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.decap.sk.data = options->mlkem_data->sk.data; + asym_op->mlkem.decap.sk.data = sk_buf; asym_op->mlkem.decap.sk.length = options->mlkem_data->sk.length; }else { -rte_panic ("Unsupported ML-KEM operation type %d\n" , options->asym_op_type); +rte_panic ("Unsupported ML-KEM operation type %d\n" , + options->asym_op_type); } } }
@@ -262,8 +282,48 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { +/* Intermediate writable buffers for static const test vectors */ +static uint8_t privkey_buf[4896 ];/* ML-DSA-87 privkey max */ +static uint8_t pubkey_buf[2592 ];/* ML-DSA-87 pubkey max */ +static uint8_t msg_buf[256 ];/* message */ +static uint8_t sign_buf[4627 ];/* ML-DSA-87 sign max */ +static uint8_t ctx_buf[256 ];/* context */ +static uint8_t seed_buf[32 ];/* seed */ +static uint8_t mu_buf[64 ];/* mu */ uint16_t i; +if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +memcpy (privkey_buf, options->mldsa_data->privkey.data, + options->mldsa_data->privkey.length); +if (options->mldsa_data->message.length) +memcpy (msg_buf, options->mldsa_data->message.data, + options->mldsa_data->message.length); +if (options->mldsa_data->ctx.length) +memcpy (ctx_buf, options->mldsa_data->ctx.data, + options->mldsa_data->ctx.length); +if (options->mldsa_data->seed.length) +memcpy (seed_buf, options->mldsa_data->seed.data, + options->mldsa_data->seed.length); +if (options->mldsa_data->mu.length) +memcpy (mu_buf, options->mldsa_data->mu.data, + options->mldsa_data->mu.length); + }else { +memcpy (pubkey_buf, options->mldsa_data->pubkey.data, + options->mldsa_data->pubkey.length); +if (options->mldsa_data->message.length) +memcpy (msg_buf, options->mldsa_data->message.data, + options->mldsa_data->message.length); +if (options->mldsa_data->sign.length) +memcpy (sign_buf, options->mldsa_data->sign.data, + options->mldsa_data->sign.length); +if (options->mldsa_data->ctx.length) +memcpy (ctx_buf, options->mldsa_data->ctx.data, + options->mldsa_data->ctx.length); +if (options->mldsa_data->mu.length) +memcpy (mu_buf, options->mldsa_data->mu.data, + options->mldsa_data->mu.length); + } +for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -272,34 +332,35 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_SIGN ; - asym_op->mldsa.siggen.privkey.data = options->mldsa_data->privkey.data; + asym_op->mldsa.siggen.privkey.data = privkey_buf; asym_op->mldsa.siggen.privkey.length = options->mldsa_data->privkey.length; - asym_op->mldsa.siggen.message.data = options->mldsa_data->message.data; + asym_op->mldsa.siggen.message.data = msg_buf; asym_op->mldsa.siggen.message.length = options->mldsa_data->message.length; - asym_op->mldsa.siggen.sign.data = options->mldsa_data->sign.data; + asym_op->mldsa.siggen.sign.data = sign_buf; asym_op->mldsa.siggen.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.siggen.ctx.data = options->mldsa_data->ctx.data; + asym_op->mldsa.siggen.ctx.data = ctx_buf; asym_op->mldsa.siggen.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.siggen.seed.data = options->mldsa_data->seed.data; + asym_op->mldsa.siggen.seed.data = seed_buf; asym_op->mldsa.siggen.seed.length = options->mldsa_data->seed.length; - asym_op->mldsa.siggen.mu.data = options->mldsa_data->mu.data; + asym_op->mldsa.siggen.mu.data = mu_buf; asym_op->mldsa.siggen.mu.length = options->mldsa_data->mu.length; asym_op->mldsa.siggen.hash = options->mldsa_data->hash; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_VERIFY ; - asym_op->mldsa.sigver.pubkey.data = options->mldsa_data->pubkey.data; + asym_op->mldsa.sigver.pubkey.data = pubkey_buf; asym_op->mldsa.sigver.pubkey.length = options->mldsa_data->pubkey.length; - asym_op->mldsa.sigver.message.data = options->mldsa_data->message.data; + asym_op->mldsa.sigver.message.data = msg_buf; asym_op->mldsa.sigver.message.length = options->mldsa_data->message.length; - asym_op->mldsa.sigver.sign.data = options->mldsa_data->sign.data; + asym_op->mldsa.sigver.sign.data = sign_buf; asym_op->mldsa.sigver.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.sigver.ctx.data = options->mldsa_data->ctx.data; + asym_op->mldsa.sigver.ctx.data = ctx_buf; asym_op->mldsa.sigver.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.sigver.mu.data = options->mldsa_data->mu.data; + asym_op->mldsa.sigver.mu.data = mu_buf; asym_op->mldsa.sigver.mu.length = options->mldsa_data->mu.length; asym_op->mldsa.sigver.hash = options->mldsa_data->hash; }else { -rte_panic ("Unsupported ML-DSA operation type %d\n" , options->asym_op_type); +rte_panic ("Unsupported ML-DSA operation type %d\n" , + options->asym_op_type); } } }
app/test-crypto-perf/cperf_options_parsing.c +1 -2
@@ -1820,8 +1820,7 @@ cperf_options_dump(struct cperf_options *opts)case CPERF_ASYM_MLDSA65 :case CPERF_ASYM_MLDSA87 :printf ("# mldsa algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); -if (opts->op_type ==CPERF_ASYM_MLDSA44 && - opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter);break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_test_vectors.c +171 -3
216 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +12 -12
@@ -111,23 +111,23 @@ struct cperf_mlkem_test_data {const char *name;enum rte_crypto_ml_kem_type type;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } dk;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } ek;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } message;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } cipher;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } sk; };
@@ -192,31 +192,31 @@ struct cperf_mldsa_test_data {const char *name;enum rte_crypto_ml_dsa_type type;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } privkey;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } pubkey;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } message;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } sign;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } ctx;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } seed;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } mu;enum rte_crypto_auth_algorithm hash;
app/test-crypto-perf/main.c +12 -16
@@ -544,23 +544,19 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, mldsa_idx =2 ;if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { -if (opts->op_type ==CPERF_ASYM_MLDSA44 ) { -switch (opts->mldsa_sign_iter) { -case 1 : - opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; -break ; -case 5 : - opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; -break ; -case 10 : - opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; -break ; -default : - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; -break ; - } - }else { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[mldsa_idx]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[mldsa_idx]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[mldsa_idx]; +break ; +default : opts->mldsa_data = &mldsa_sign_perf_data[mldsa_idx]; +break ; } }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { opts->mldsa_data = &mldsa_verify_perf_data[mldsa_idx];
doc/guides/tools/cryptoperf.rst +3 -2
@@ -366,10 +366,11 @@ The following are the application command-line options: * ``--mldsa-sign-iter <1/5/10>`` - Set ML-DSA sign iteration count for mldsa_44 sign operation. + Set ML-DSA sign iteration count for mldsa sign operation. Default is ``1``. Only applicable when: - ``--optype mldsa_44`` and ``--asym-op sign``. + ``--optype mldsa_44``, ``--optype mldsa_65``, ``--optype mldsa_87`` + and ``--asym-op sign``. * ``--rsa-priv-keytype <exp/qt>``
Signature · 1 line
2.43.0
PATCH v4 1/4 app/crypto-perf: support mldsa Sign-Iteration
In reply to Pratik SenapatiAdd ML-DSA44 Sign-Iteration based test support for 1, 5 and 10 iterations to test-crypto-perf.
--- app/test-crypto-perf/cperf_options.h | 3 + app/test-crypto-perf/cperf_options_parsing.c | 47 +- app/test-crypto-perf/cperf_test_vectors.c | 1024 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 3 + app/test-crypto-perf/main.c | 17 +- doc/guides/tools/cryptoperf.rst | 7 + 6 files changed, 1096 insertions(+), 5 deletions(-)
app/test-crypto-perf/cperf_options.h +3 -0
@@ -56,6 +56,8 @@#define CPERF_ASYM_OP ("asym-op") +#define CPERF_MLDSA_SIGN_ITER ("mldsa-sign-iter") +#ifdef RTE_LIB_SECURITY #define CPERF_PDCP_SN_SZ ("pdcp-sn-sz")#define CPERF_PDCP_DOMAIN ("pdcp-domain")
@@ -196,6 +198,7 @@ struct cperf_options {struct cperf_rsa_test_data *rsa_data;uint16_t rsa_modlen;uint8_t rsa_keytype; +uint8_t mldsa_sign_iter; };void
app/test-crypto-perf/cperf_options_parsing.c +44 -3
90 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.c +1024 -0
1,036 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +3 -0
@@ -252,5 +252,8 @@ extern struct cperf_mlkem_test_data mlkem_encap_perf_data[];extern struct cperf_mlkem_test_data mlkem_decap_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];#endif
app/test-crypto-perf/main.c +15 -2
@@ -524,8 +524,21 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,if (asym_capability ==NULL )return -1 ; -if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; +break ; +default : + opts->mldsa_data = &mldsa_sign_perf_data[0 ]; + } + }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) opts->mldsa_data = &mldsa_verify_perf_data[0 ];else {
doc/guides/tools/cryptoperf.rst +7 -0
@@ -364,6 +364,13 @@ The following are the application command-line options: Not applicable for modex op type. Default is ``encrypt``. +* ``--mldsa-sign-iter <1/5/10>`` + + Set ML-DSA sign iteration count for mldsa_44 sign operation. + Default is ``1``. + Only applicable when: + ``--optype mldsa_44`` and ``--asym-op sign``. + * ``--rsa-priv-keytype <exp/qt>`` Set RSA private key type.
Signature · 1 line
2.43.0
PATCH v4 2/4 app/crypto-perf: add ML-KEM support
Extend ML-KEM Support in crypto-perf to include ML-KEM768 and ML-KEM1024 test vectors.
--- app/test-crypto-perf/cperf_ops.c | 12 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 32 +- app/test-crypto-perf/cperf_test_common.c | 2 + app/test-crypto-perf/cperf_test_vectors.c | 1500 +++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 22 +- 7 files changed, 1555 insertions(+), 19 deletions(-)
app/test-crypto-perf/cperf_ops.c +9 -3
@@ -1337,10 +1337,13 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { +switch (options->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; - xform.mlkem.type =RTE_CRYPTO_ML_KEM_512 ; + xform.mlkem.type = options->mlkem_data->type; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);if (ret <0 || asym_sess ==NULL ) {
@@ -1348,9 +1351,10 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; } -#ifdef RTE_LIB_SECURITY /* * security only
@@ -1671,6 +1675,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : op_fns->populate_ops = cperf_set_ops_asym_mlkem;break ;#ifdef RTE_LIB_SECURITY
app/test-crypto-perf/cperf_options.h +2 -0
@@ -105,6 +105,8 @@ enum cperf_op_type {CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 ,CPERF_ASYM_MLKEM512 , +CPERF_ASYM_MLKEM768 , +CPERF_ASYM_MLKEM1024 , CPERF_TLS, };
app/test-crypto-perf/cperf_options_parsing.c +23 -9
@@ -41,7 +41,7 @@ usage(char *progname)" --optype cipher-only / auth-only / cipher-then-auth / auth-then-cipher /\n" " aead / pdcp / docsis / ipsec / modex / rsa / secp192r1 /\n" " secp224r1 / secp256r1 / secp384r1 / secp521r1 / eddsa / sm2 /\n" -" mlkem_512 / mldsa_44 /\n" +" mlkem_512 / mlkem_768 / mlkem_1024 / mldsa_44 /\n" " tls-record : set operation type\n" " --sessionless: enable session-less crypto operations\n" " --shared-session: share 1 session across all queue pairs on crypto device\n"
@@ -568,6 +568,14 @@ parse_op_type(struct cperf_options *opts, const char *arg) cperf_op_type_strs[CPERF_ASYM_MLKEM512 ],CPERF_ASYM_MLKEM512 }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM768 ], +CPERF_ASYM_MLKEM768 + }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM1024 ], +CPERF_ASYM_MLKEM1024 + }, { cperf_op_type_strs[CPERF_TLS ],CPERF_TLS
@@ -1704,12 +1712,11 @@ cperf_options_check(struct cperf_options *options) } } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { -if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - options->mlkem_data = &mlkem_encap_perf_data[0 ]; -else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - options->mlkem_data = &mlkem_decap_perf_data[0 ]; -else { +if (options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 ) { +if (options->asym_op_type !=RTE_CRYPTO_ASYM_OP_ENCRYPT && + options->asym_op_type !=RTE_CRYPTO_ASYM_OP_DECRYPT ) {RTE_LOG (ERR ,USER1 ,"ML-KEM operations only support encrypt (encapsulate) and decrypt (decapsulate)\n" );return -EINVAL ;
@@ -1817,8 +1824,15 @@ cperf_options_dump(struct cperf_options *opts)if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter); } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) -printf ("# mlkem test name: %s\n" , opts->mlkem_data->name); +switch (opts->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : +printf ("# mlkem algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); +break ; +default : +break ; + } }printf ("# sessionless: %s\n" , opts->sessionless ?"yes" :"no" );printf ("# shared session: %s\n" , opts->shared_session ?"yes" :"no" );
app/test-crypto-perf/cperf_test_common.c +2 -0
@@ -315,6 +315,8 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_ED25519 || options->op_type ==CPERF_ASYM_SM2 || options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 || options->op_type == CPERF_ASYM_MLDSA44) return true;
app/test-crypto-perf/cperf_test_vectors.c +1499 -1
1,518 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -248,8 +248,8 @@ extern struct cperf_rsa_test_data rsa_pub_perf_data[4];extern struct cperf_rsa_test_data rsa_exp_perf_data[4 ];extern struct cperf_rsa_test_data rsa_qt_perf_data[4 ];extern struct cperf_rsa_plaintext rsa_plaintext; -extern struct cperf_mlkem_test_data mlkem_encap_perf_data[]; -extern struct cperf_mlkem_test_data mlkem_decap_perf_data[]; +extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3 ]; +extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3 ];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[];
app/test-crypto-perf/main.c +18 -4
@@ -55,6 +55,8 @@ const char *cperf_op_type_strs[] = { [CPERF_ASYM_SM2] = "sm2", [CPERF_TLS] = "tls-record", [CPERF_ASYM_MLKEM512] = "mlkem_512", + [CPERF_ASYM_MLKEM768] = "mlkem_768", + [CPERF_ASYM_MLKEM1024] = "mlkem_1024", [CPERF_ASYM_MLDSA44] = "mldsa_44", };
@@ -248,6 +250,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)case CPERF_ASYM_SM2 :case CPERF_ASYM_RSA :case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 :case CPERF_ASYM_MLDSA44 :case CPERF_ASYM_MODEX : conf.ff_disable |= (RTE_CRYPTODEV_FF_SECURITY |
@@ -547,21 +551,31 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, } } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) { +if (opts->op_type ==CPERF_ASYM_MLKEM512 || + opts->op_type ==CPERF_ASYM_MLKEM768 || + opts->op_type ==CPERF_ASYM_MLKEM1024 ) { +uint8_t index =0 ; + asym_cap_idx.type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; asym_capability =rte_cryptodev_asym_capability_get (cdev_id, &asym_cap_idx);if (asym_capability ==NULL )return -1 ; +if (opts->op_type ==CPERF_ASYM_MLKEM512 ) + index =0 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM768 ) + index =1 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM1024 ) + index =2 ; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - opts->mlkem_data = &mlkem_encap_perf_data[0 ]; + opts->mlkem_data = &mlkem_encap_perf_data[index];else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - opts->mlkem_data = &mlkem_decap_perf_data[0 ]; + opts->mlkem_data = &mlkem_decap_perf_data[index];else {RTE_LOG (ERR ,USER1 ,"Unsupported MLKEM operation type\n" );return -ENOTSUP ; } - } if (opts->op_type == CPERF_AUTH_ONLY ||
Signature · 1 line
2.43.0
PATCH v4 3/4 app/crypto-perf: add ML-DSA support
In reply to Pratik SenapatiExtend ML-DSA test-cases to include deterministic
sign and verify for ML-DSA65 and ML-DSA87.
--- app/test-crypto-perf/cperf_ops.c | 14 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 53 +- app/test-crypto-perf/cperf_test_common.c | 4 +- app/test-crypto-perf/cperf_test_vectors.c | 2797 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 53 +- 7 files changed, 2876 insertions(+), 51 deletions(-)
app/test-crypto-perf/cperf_ops.c +10 -4
@@ -1321,12 +1321,14 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLDSA44 ) { +switch (options->op_type) { +case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_DSA ; - xform.mldsa.type =RTE_CRYPTO_ML_DSA_44 ; - xform.mldsa.sign_deterministic = - options->mldsa_data->sign_deterministic; + xform.mldsa.type = options->mldsa_data->type; + xform.mldsa.sign_deterministic = options->mldsa_data->sign_deterministic; xform.mldsa.sign_prehash = false; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);
@@ -1335,6 +1337,8 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; }switch (options->op_type) {
@@ -1672,6 +1676,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_sm2;break ;case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_options.h +2 -0
@@ -104,6 +104,8 @@ enum cperf_op_type {CPERF_ASYM_ED25519 ,CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 , +CPERF_ASYM_MLDSA65 , +CPERF_ASYM_MLDSA87 ,CPERF_ASYM_MLKEM512 ,CPERF_ASYM_MLKEM768 , CPERF_ASYM_MLKEM1024,
app/test-crypto-perf/cperf_options_parsing.c +26 -27
79 lines not on this page · raw message
app/test-crypto-perf/cperf_test_common.c +3 -1
@@ -317,7 +317,9 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_MLKEM512 || options->op_type ==CPERF_ASYM_MLKEM768 || options->op_type ==CPERF_ASYM_MLKEM1024 || - options->op_type == CPERF_ASYM_MLDSA44) + options->op_type ==CPERF_ASYM_MLDSA44 || + options->op_type ==CPERF_ASYM_MLDSA65 || + options->op_type == CPERF_ASYM_MLDSA87) return true;return false;
app/test-crypto-perf/cperf_test_vectors.c +2797 -0
2,815 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -250,8 +250,8 @@ extern struct cperf_rsa_test_data rsa_qt_perf_data[4]; extern struct cperf_rsa_plaintext rsa_plaintext; extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3]; extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3]; -extern struct cperf_mldsa_test_data mldsa_sign_perf_data[]; -extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data[3]; +extern struct cperf_mldsa_test_data mldsa_verify_perf_data[3]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];
app/test-crypto-perf/main.c +36 -17
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
PATCH v4 4/4 app/crypto-perf: add ML-DSA sign support
In reply to Pratik SenapatiExtend ML-DSA sign iteration support to include ML-DSA65 and ML-DSA87 for 1, 5 and 10 sign iterations.
--- app/test-crypto-perf/cperf_ops.c | 101 ++++++++--- app/test-crypto-perf/cperf_options_parsing.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 174 ++++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 24 +-- app/test-crypto-perf/main.c | 28 ++- doc/guides/tools/cryptoperf.rst | 5 +- 6 files changed, 280 insertions(+), 55 deletions(-)
app/test-crypto-perf/cperf_ops.c +81 -20
@@ -219,8 +219,27 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { +/* Intermediate writable buffers for static const test vectors */ +static uint8_t ek_buf[1568 ];/* ML-KEM-1024 ek max */ +static uint8_t dk_buf[3168 ];/* ML-KEM-1024 dk max */ +static uint8_t msg_buf[32 ];/* ML-KEM message (32 bytes) */ +static uint8_t cipher_buf[1568 ];/* ML-KEM-1024 cipher max */ +static uint8_t sk_buf[32 ];/* shared key (32 bytes) */ uint16_t i; +if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { +memcpy (ek_buf, options->mlkem_data->ek.data, + options->mlkem_data->ek.length); +if (options->mlkem_data->message.length) +memcpy (msg_buf, options->mlkem_data->message.data, + options->mlkem_data->message.length); + }else { +memcpy (dk_buf, options->mlkem_data->dk.data, + options->mlkem_data->dk.length); +memcpy (cipher_buf, options->mlkem_data->cipher.data, + options->mlkem_data->cipher.length); + } +for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -229,24 +248,25 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_ENCAP ; - asym_op->mlkem.encap.ek.data = options->mlkem_data->ek.data; + asym_op->mlkem.encap.ek.data = ek_buf; asym_op->mlkem.encap.ek.length = options->mlkem_data->ek.length; - asym_op->mlkem.encap.cipher.data = options->mlkem_data->cipher.data; + asym_op->mlkem.encap.cipher.data = cipher_buf; asym_op->mlkem.encap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.encap.sk.data = options->mlkem_data->sk.data; + asym_op->mlkem.encap.sk.data = sk_buf; asym_op->mlkem.encap.sk.length = options->mlkem_data->sk.length; - asym_op->mlkem.encap.message.data = options->mlkem_data->message.data; + asym_op->mlkem.encap.message.data = msg_buf; asym_op->mlkem.encap.message.length = options->mlkem_data->message.length; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_DECAP ; - asym_op->mlkem.decap.dk.data = options->mlkem_data->dk.data; + asym_op->mlkem.decap.dk.data = dk_buf; asym_op->mlkem.decap.dk.length = options->mlkem_data->dk.length; - asym_op->mlkem.decap.cipher.data = options->mlkem_data->cipher.data; + asym_op->mlkem.decap.cipher.data = cipher_buf; asym_op->mlkem.decap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.decap.sk.data = options->mlkem_data->sk.data; + asym_op->mlkem.decap.sk.data = sk_buf; asym_op->mlkem.decap.sk.length = options->mlkem_data->sk.length; }else { -rte_panic ("Unsupported ML-KEM operation type %d\n" , options->asym_op_type); +rte_panic ("Unsupported ML-KEM operation type %d\n" , + options->asym_op_type); } } }
@@ -262,8 +282,48 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { +/* Intermediate writable buffers for static const test vectors */ +static uint8_t privkey_buf[4896 ];/* ML-DSA-87 privkey max */ +static uint8_t pubkey_buf[2592 ];/* ML-DSA-87 pubkey max */ +static uint8_t msg_buf[256 ];/* message */ +static uint8_t sign_buf[4627 ];/* ML-DSA-87 sign max */ +static uint8_t ctx_buf[256 ];/* context */ +static uint8_t seed_buf[32 ];/* seed */ +static uint8_t mu_buf[64 ];/* mu */ uint16_t i; +if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +memcpy (privkey_buf, options->mldsa_data->privkey.data, + options->mldsa_data->privkey.length); +if (options->mldsa_data->message.length) +memcpy (msg_buf, options->mldsa_data->message.data, + options->mldsa_data->message.length); +if (options->mldsa_data->ctx.length) +memcpy (ctx_buf, options->mldsa_data->ctx.data, + options->mldsa_data->ctx.length); +if (options->mldsa_data->seed.length) +memcpy (seed_buf, options->mldsa_data->seed.data, + options->mldsa_data->seed.length); +if (options->mldsa_data->mu.length) +memcpy (mu_buf, options->mldsa_data->mu.data, + options->mldsa_data->mu.length); + }else { +memcpy (pubkey_buf, options->mldsa_data->pubkey.data, + options->mldsa_data->pubkey.length); +if (options->mldsa_data->message.length) +memcpy (msg_buf, options->mldsa_data->message.data, + options->mldsa_data->message.length); +if (options->mldsa_data->sign.length) +memcpy (sign_buf, options->mldsa_data->sign.data, + options->mldsa_data->sign.length); +if (options->mldsa_data->ctx.length) +memcpy (ctx_buf, options->mldsa_data->ctx.data, + options->mldsa_data->ctx.length); +if (options->mldsa_data->mu.length) +memcpy (mu_buf, options->mldsa_data->mu.data, + options->mldsa_data->mu.length); + } +for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -272,34 +332,35 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_SIGN ; - asym_op->mldsa.siggen.privkey.data = options->mldsa_data->privkey.data; + asym_op->mldsa.siggen.privkey.data = privkey_buf; asym_op->mldsa.siggen.privkey.length = options->mldsa_data->privkey.length; - asym_op->mldsa.siggen.message.data = options->mldsa_data->message.data; + asym_op->mldsa.siggen.message.data = msg_buf; asym_op->mldsa.siggen.message.length = options->mldsa_data->message.length; - asym_op->mldsa.siggen.sign.data = options->mldsa_data->sign.data; + asym_op->mldsa.siggen.sign.data = sign_buf; asym_op->mldsa.siggen.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.siggen.ctx.data = options->mldsa_data->ctx.data; + asym_op->mldsa.siggen.ctx.data = ctx_buf; asym_op->mldsa.siggen.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.siggen.seed.data = options->mldsa_data->seed.data; + asym_op->mldsa.siggen.seed.data = seed_buf; asym_op->mldsa.siggen.seed.length = options->mldsa_data->seed.length; - asym_op->mldsa.siggen.mu.data = options->mldsa_data->mu.data; + asym_op->mldsa.siggen.mu.data = mu_buf; asym_op->mldsa.siggen.mu.length = options->mldsa_data->mu.length; asym_op->mldsa.siggen.hash = options->mldsa_data->hash; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_VERIFY ; - asym_op->mldsa.sigver.pubkey.data = options->mldsa_data->pubkey.data; + asym_op->mldsa.sigver.pubkey.data = pubkey_buf; asym_op->mldsa.sigver.pubkey.length = options->mldsa_data->pubkey.length; - asym_op->mldsa.sigver.message.data = options->mldsa_data->message.data; + asym_op->mldsa.sigver.message.data = msg_buf; asym_op->mldsa.sigver.message.length = options->mldsa_data->message.length; - asym_op->mldsa.sigver.sign.data = options->mldsa_data->sign.data; + asym_op->mldsa.sigver.sign.data = sign_buf; asym_op->mldsa.sigver.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.sigver.ctx.data = options->mldsa_data->ctx.data; + asym_op->mldsa.sigver.ctx.data = ctx_buf; asym_op->mldsa.sigver.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.sigver.mu.data = options->mldsa_data->mu.data; + asym_op->mldsa.sigver.mu.data = mu_buf; asym_op->mldsa.sigver.mu.length = options->mldsa_data->mu.length; asym_op->mldsa.sigver.hash = options->mldsa_data->hash; }else { -rte_panic ("Unsupported ML-DSA operation type %d\n" , options->asym_op_type); +rte_panic ("Unsupported ML-DSA operation type %d\n" , + options->asym_op_type); } } }
app/test-crypto-perf/cperf_options_parsing.c +1 -2
@@ -1820,8 +1820,7 @@ cperf_options_dump(struct cperf_options *opts)case CPERF_ASYM_MLDSA65 :case CPERF_ASYM_MLDSA87 :printf ("# mldsa algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); -if (opts->op_type ==CPERF_ASYM_MLDSA44 && - opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter);break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_test_vectors.c +171 -3
216 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +12 -12
@@ -111,23 +111,23 @@ struct cperf_mlkem_test_data {const char *name;enum rte_crypto_ml_kem_type type;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } dk;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } ek;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } message;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } cipher;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } sk; };
@@ -192,31 +192,31 @@ struct cperf_mldsa_test_data {const char *name;enum rte_crypto_ml_dsa_type type;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } privkey;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } pubkey;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } message;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } sign;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } ctx;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } seed;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } mu;enum rte_crypto_auth_algorithm hash;
app/test-crypto-perf/main.c +12 -16
@@ -544,23 +544,19 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, mldsa_idx =2 ;if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { -if (opts->op_type ==CPERF_ASYM_MLDSA44 ) { -switch (opts->mldsa_sign_iter) { -case 1 : - opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; -break ; -case 5 : - opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; -break ; -case 10 : - opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; -break ; -default : - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; -break ; - } - }else { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[mldsa_idx]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[mldsa_idx]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[mldsa_idx]; +break ; +default : opts->mldsa_data = &mldsa_sign_perf_data[mldsa_idx]; +break ; } }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { opts->mldsa_data = &mldsa_verify_perf_data[mldsa_idx];
doc/guides/tools/cryptoperf.rst +3 -2
@@ -366,10 +366,11 @@ The following are the application command-line options: * ``--mldsa-sign-iter <1/5/10>`` - Set ML-DSA sign iteration count for mldsa_44 sign operation. + Set ML-DSA sign iteration count for mldsa sign operation. Default is ``1``. Only applicable when: - ``--optype mldsa_44`` and ``--asym-op sign``. + ``--optype mldsa_44``, ``--optype mldsa_65``, ``--optype mldsa_87`` + and ``--asym-op sign``. * ``--rsa-priv-keytype <exp/qt>``
Signature · 1 line
2.43.0
Quoted 5 lines · Pratik Senapati
Add ML-DSA44 Sign-Iteration based test support for 1, 5 and 10 iterations to test-crypto-perf.
Signed-off-by Pratik Senapati <[email protected]>---
Quoted 1 line
Series-tested-by Radu Nicolau <[email protected]>
Hi,
I checked your patch-set, and my patch-set DOES NOT have the following patches:
- ML-DSA sign: non-deterministic, sha3_256, and ext-mu variants for 65 and 87 (6 cases)
- ML-KEM encap: non-deterministic (random message) variants for 768 and 1024 (2 cases)
My patchset doesn't have the above patches since it was out of scope for our requirements.
To conclude:
We can do the following:
- I can include your test-cases and add your sign-off.
- We can accept your patch-set and reject mine.
Please let me know what you'd like to do.
Thanks,
Pratik
Quoted 12 lines · Pratik Senapati
Quoted 1 line
Series-tested-by Radu Nicolau <[email protected]>Hi,
I checked your patch-set, and my patch-set DOES NOT have the following patches:
- ML-DSA sign: non-deterministic,
sha3_256, and ext-mu variants for 65 and 87 (6 cases)
- ML-KEM encap: non-deterministic (random message) variants for 768 and 1024 (2 cases)My patchset doesn't have the above patches since it was out of scope for our requirements.
To conclude:
Quoted 8 lines
We can do the following:
- I can include your test-cases and add your sign-off.
- We can accept your patch-set and reject mine.Please let me know what you'd like to do.
Thanks,
Pratik
Hi,
The best approach, which includes most of our work, will be:
1. retain my patch for the test app, which covers more test cases.
2. retain your patchset for the crypto-perf app, which has all the variants that mine has, and in addition the sign iterations argument.
Regards,
Radu
Pratik Senapati
Tested-byQuoted 7 lines
The best approach, which includes most of our work, will be:
1. retain my patch for the test app, which covers more test cases.
2. retain your patchset for the crypto-perf app, which has all the variants that mine has, and in addition the sign iterations argument.Regards,
Radu
Hello Radu,
Agreed on the approach. Let's proceed with that, I've tested your patches and all test-cases pass.
Thanks,
Pratik Senapati
Quoted 6 lines
Subject: [PATCH v4 1/4] app/crypto-perf: support mldsa Sign-Iteration
Add ML-DSA44 Sign-Iteration based test support for 1, 5 and 10 iterations to test-crypto-perf.
Signed-off-by Pratik Senapati <[email protected]>
Please fix individual patches compilation
../app/test-crypto-perf/cperf_test_vectors.c:6925:33: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
6925 | .data = mldsa_44_sign_1_iter,
| ^~~~~~~~~~~~~~~~~~~~
../app/test-crypto-perf/cperf_test_vectors.c:6945:33: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
6945 | .data = mldsa_44_message_5_iter,
| ^~~~~~~~~~~~~~~~~~~~~~~
../app/test-crypto-perf/cperf_test_vectors.c:6949:33: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
6949 | .data = mldsa_44_sign_5_iter,
| ^~~~~~~~~~~~~~~~~~~~
../app/test-crypto-perf/cperf_test_vectors.c:6969:33: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
6969 | .data = mldsa_44_message_10_iter,
| ^~~~~~~~~~~~~~~~~~~~~~~~
../app/test-crypto-perf/cperf_test_vectors.c:6973:33: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
6973 | .data = mldsa_44_sign_10_iter,
| ^~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
v5 cover app/crypto-perf: extend PQC support
In reply to Pratik SenapatiThis series extends the ML-KEM and ML-DSA support in test-crypto-perf that was introduced in v24.11 (ML-KEM-512 and ML-DSA-44).
Patches 1-4 add the remaining key sizes and sign functionality:
- ML-KEM-768 and ML-KEM-1024 encapsulation/decapsulation
- ML-DSA-65 and ML-DSA-87 sign/verify
- ML-DSA Sign-Iteration test mode (1, 5, 10 iterations) for all ML-DSA variants, measuring per-signing-iteration latency
Patch 5 fixes a correctness issue in the PQC test vector output buffer handling. ML-KEM and ML-DSA output fields (sign, cipher, shared key) were pointing directly into shared global data, causing all ops in a burst to write to the same buffer and clobber each other's results. This patch routes PQC ops through the cperf_test_vector mechanism, allocating per-op writable output buffer pools (length * nb_descriptors) and using rte_free_sensitive() for private key material.
v5 changes:
- Added patch 5: fix PQC test vector output buffer handling
- Added rte_free_sensitive() for ML-KEM dk/sk and ML-DSA privkey
- Used rte_zmalloc for the test vector struct (NULL-initializes optional fields; rte_free(NULL) is a defined no-op in DPDK)
- Pre-allocate output buffer pool (length x nb_descriptors) so each op in a burst has its own writable output slot
Testing:
- ML-DSA and ML-KEM operations tested across all supported key sizes by Pratik Senapati <[email protected]>
Pratik Senapati (5):
app/crypto-perf: support mldsa Sign-Iteration app/crypto-perf: add ML-KEM support app/crypto-perf: add ML-DSA support app/crypto-perf: add ML-DSA sign support app/crypto-perf: fix PQC test vector output buffer handling
app/test-crypto-perf/cperf_ops.c | 121 +- app/test-crypto-perf/cperf_options.h | 7 + app/test-crypto-perf/cperf_options_parsing.c | 91 +- app/test-crypto-perf/cperf_test_common.c | 6 +- app/test-crypto-perf/cperf_test_vector_parsing.c | 12 + app/test-crypto-perf/cperf_test_vectors.c | 5586 ++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 65 +- app/test-crypto-perf/main.c | 62 +- doc/guides/tools/cryptoperf.rst | 8 + 9 files changed, 5873 insertions(+), 85 deletions(-)
Signature · 1 line
2.43.0
PATCH v5 1/5 app/crypto-perf: support mldsa Sign-Iteration
Add ML-DSA44 Sign-Iteration based test support for 1, 5 and 10 iterations to test-crypto-perf.
--- app/test-crypto-perf/cperf_options.h | 3 + app/test-crypto-perf/cperf_options_parsing.c | 47 +- app/test-crypto-perf/cperf_test_vectors.c | 1024 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 3 + app/test-crypto-perf/main.c | 17 +- doc/guides/tools/cryptoperf.rst | 7 + 6 files changed, 1096 insertions(+), 5 deletions(-)
app/test-crypto-perf/cperf_options.h +3 -0
@@ -56,6 +56,8 @@#define CPERF_ASYM_OP ("asym-op") +#define CPERF_MLDSA_SIGN_ITER ("mldsa-sign-iter") +#ifdef RTE_LIB_SECURITY #define CPERF_PDCP_SN_SZ ("pdcp-sn-sz")#define CPERF_PDCP_DOMAIN ("pdcp-domain")
@@ -196,6 +198,7 @@ struct cperf_options {struct cperf_rsa_test_data *rsa_data;uint16_t rsa_modlen;uint8_t rsa_keytype; +uint8_t mldsa_sign_iter; };void
app/test-crypto-perf/cperf_options_parsing.c +44 -3
90 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.c +1024 -0
1,036 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +3 -0
@@ -252,5 +252,8 @@ extern struct cperf_mlkem_test_data mlkem_encap_perf_data[];extern struct cperf_mlkem_test_data mlkem_decap_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];#endif
app/test-crypto-perf/main.c +15 -2
@@ -524,8 +524,21 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,if (asym_capability ==NULL )return -1 ; -if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; +break ; +default : + opts->mldsa_data = &mldsa_sign_perf_data[0 ]; + } + }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) opts->mldsa_data = &mldsa_verify_perf_data[0 ];else {
doc/guides/tools/cryptoperf.rst +7 -0
@@ -364,6 +364,13 @@ The following are the application command-line options: Not applicable for modex op type. Default is ``encrypt``. +* ``--mldsa-sign-iter <1/5/10>`` + + Set ML-DSA sign iteration count for mldsa_44 sign operation. + Default is ``1``. + Only applicable when: + ``--optype mldsa_44`` and ``--asym-op sign``. + * ``--rsa-priv-keytype <exp/qt>`` Set RSA private key type.
Signature · 1 line
2.43.0
PATCH v5 2/5 app/crypto-perf: add ML-KEM support
In reply to Pratik SenapatiExtend ML-KEM Support in crypto-perf to include ML-KEM768 and ML-KEM1024 test vectors.
--- app/test-crypto-perf/cperf_ops.c | 12 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 32 +- app/test-crypto-perf/cperf_test_common.c | 2 + app/test-crypto-perf/cperf_test_vectors.c | 1500 +++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 22 +- 7 files changed, 1555 insertions(+), 19 deletions(-)
app/test-crypto-perf/cperf_ops.c +9 -3
@@ -1339,10 +1339,13 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { +switch (options->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; - xform.mlkem.type =RTE_CRYPTO_ML_KEM_512 ; + xform.mlkem.type = options->mlkem_data->type; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);if (ret <0 || asym_sess ==NULL ) {
@@ -1350,9 +1353,10 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; } -#ifdef RTE_LIB_SECURITY /* * security only
@@ -1673,6 +1677,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : op_fns->populate_ops = cperf_set_ops_asym_mlkem;break ;#ifdef RTE_LIB_SECURITY
app/test-crypto-perf/cperf_options.h +2 -0
@@ -105,6 +105,8 @@ enum cperf_op_type {CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 ,CPERF_ASYM_MLKEM512 , +CPERF_ASYM_MLKEM768 , +CPERF_ASYM_MLKEM1024 , CPERF_TLS, };
app/test-crypto-perf/cperf_options_parsing.c +23 -9
@@ -41,7 +41,7 @@ usage(char *progname)" --optype cipher-only / auth-only / cipher-then-auth / auth-then-cipher /\n" " aead / pdcp / docsis / ipsec / modex / rsa / secp192r1 /\n" " secp224r1 / secp256r1 / secp384r1 / secp521r1 / eddsa / sm2 /\n" -" mlkem_512 / mldsa_44 /\n" +" mlkem_512 / mlkem_768 / mlkem_1024 / mldsa_44 /\n" " tls-record : set operation type\n" " --sessionless: enable session-less crypto operations\n" " --shared-session: share 1 session across all queue pairs on crypto device\n"
@@ -568,6 +568,14 @@ parse_op_type(struct cperf_options *opts, const char *arg) cperf_op_type_strs[CPERF_ASYM_MLKEM512 ],CPERF_ASYM_MLKEM512 }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM768 ], +CPERF_ASYM_MLKEM768 + }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM1024 ], +CPERF_ASYM_MLKEM1024 + }, { cperf_op_type_strs[CPERF_TLS ],CPERF_TLS
@@ -1704,12 +1712,11 @@ cperf_options_check(struct cperf_options *options) } } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { -if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - options->mlkem_data = &mlkem_encap_perf_data[0 ]; -else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - options->mlkem_data = &mlkem_decap_perf_data[0 ]; -else { +if (options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 ) { +if (options->asym_op_type !=RTE_CRYPTO_ASYM_OP_ENCRYPT && + options->asym_op_type !=RTE_CRYPTO_ASYM_OP_DECRYPT ) {RTE_LOG (ERR ,USER1 ,"ML-KEM operations only support encrypt (encapsulate) and decrypt (decapsulate)\n" );return -EINVAL ;
@@ -1817,8 +1824,15 @@ cperf_options_dump(struct cperf_options *opts)if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter); } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) -printf ("# mlkem test name: %s\n" , opts->mlkem_data->name); +switch (opts->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : +printf ("# mlkem algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); +break ; +default : +break ; + } }printf ("# sessionless: %s\n" , opts->sessionless ?"yes" :"no" );printf ("# shared session: %s\n" , opts->shared_session ?"yes" :"no" );
app/test-crypto-perf/cperf_test_common.c +2 -0
@@ -315,6 +315,8 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_ED25519 || options->op_type ==CPERF_ASYM_SM2 || options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 || options->op_type == CPERF_ASYM_MLDSA44) return true;
app/test-crypto-perf/cperf_test_vectors.c +1499 -1
1,518 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -248,8 +248,8 @@ extern struct cperf_rsa_test_data rsa_pub_perf_data[4];extern struct cperf_rsa_test_data rsa_exp_perf_data[4 ];extern struct cperf_rsa_test_data rsa_qt_perf_data[4 ];extern struct cperf_rsa_plaintext rsa_plaintext; -extern struct cperf_mlkem_test_data mlkem_encap_perf_data[]; -extern struct cperf_mlkem_test_data mlkem_decap_perf_data[]; +extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3 ]; +extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3 ];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[];
app/test-crypto-perf/main.c +18 -4
@@ -55,6 +55,8 @@ const char *cperf_op_type_strs[] = { [CPERF_ASYM_SM2] = "sm2", [CPERF_TLS] = "tls-record", [CPERF_ASYM_MLKEM512] = "mlkem_512", + [CPERF_ASYM_MLKEM768] = "mlkem_768", + [CPERF_ASYM_MLKEM1024] = "mlkem_1024", [CPERF_ASYM_MLDSA44] = "mldsa_44", };
@@ -248,6 +250,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)case CPERF_ASYM_SM2 :case CPERF_ASYM_RSA :case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 :case CPERF_ASYM_MLDSA44 :case CPERF_ASYM_MODEX : conf.ff_disable |= (RTE_CRYPTODEV_FF_SECURITY |
@@ -547,21 +551,31 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, } } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) { +if (opts->op_type ==CPERF_ASYM_MLKEM512 || + opts->op_type ==CPERF_ASYM_MLKEM768 || + opts->op_type ==CPERF_ASYM_MLKEM1024 ) { +uint8_t index =0 ; + asym_cap_idx.type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; asym_capability =rte_cryptodev_asym_capability_get (cdev_id, &asym_cap_idx);if (asym_capability ==NULL )return -1 ; +if (opts->op_type ==CPERF_ASYM_MLKEM512 ) + index =0 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM768 ) + index =1 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM1024 ) + index =2 ; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - opts->mlkem_data = &mlkem_encap_perf_data[0 ]; + opts->mlkem_data = &mlkem_encap_perf_data[index];else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - opts->mlkem_data = &mlkem_decap_perf_data[0 ]; + opts->mlkem_data = &mlkem_decap_perf_data[index];else {RTE_LOG (ERR ,USER1 ,"Unsupported MLKEM operation type\n" );return -ENOTSUP ; } - } if (opts->op_type == CPERF_AUTH_ONLY ||
Signature · 1 line
2.43.0
PATCH v5 3/5 app/crypto-perf: add ML-DSA support
In reply to Pratik SenapatiExtend ML-DSA test-cases to include deterministic
sign and verify for ML-DSA65 and ML-DSA87.
--- app/test-crypto-perf/cperf_ops.c | 14 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 53 +- app/test-crypto-perf/cperf_test_common.c | 4 +- app/test-crypto-perf/cperf_test_vectors.c | 2797 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 53 +- 7 files changed, 2876 insertions(+), 51 deletions(-)
app/test-crypto-perf/cperf_ops.c +10 -4
@@ -1323,12 +1323,14 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLDSA44 ) { +switch (options->op_type) { +case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_DSA ; - xform.mldsa.type =RTE_CRYPTO_ML_DSA_44 ; - xform.mldsa.sign_deterministic = - options->mldsa_data->sign_deterministic; + xform.mldsa.type = options->mldsa_data->type; + xform.mldsa.sign_deterministic = options->mldsa_data->sign_deterministic; xform.mldsa.sign_prehash = false; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);
@@ -1337,6 +1339,8 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; }switch (options->op_type) {
@@ -1674,6 +1678,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_sm2;break ;case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_options.h +2 -0
@@ -104,6 +104,8 @@ enum cperf_op_type {CPERF_ASYM_ED25519 ,CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 , +CPERF_ASYM_MLDSA65 , +CPERF_ASYM_MLDSA87 ,CPERF_ASYM_MLKEM512 ,CPERF_ASYM_MLKEM768 , CPERF_ASYM_MLKEM1024,
app/test-crypto-perf/cperf_options_parsing.c +26 -27
79 lines not on this page · raw message
app/test-crypto-perf/cperf_test_common.c +3 -1
@@ -317,7 +317,9 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_MLKEM512 || options->op_type ==CPERF_ASYM_MLKEM768 || options->op_type ==CPERF_ASYM_MLKEM1024 || - options->op_type == CPERF_ASYM_MLDSA44) + options->op_type ==CPERF_ASYM_MLDSA44 || + options->op_type ==CPERF_ASYM_MLDSA65 || + options->op_type == CPERF_ASYM_MLDSA87) return true;return false;
app/test-crypto-perf/cperf_test_vectors.c +2797 -0
2,815 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -250,8 +250,8 @@ extern struct cperf_rsa_test_data rsa_qt_perf_data[4]; extern struct cperf_rsa_plaintext rsa_plaintext; extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3]; extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3]; -extern struct cperf_mldsa_test_data mldsa_sign_perf_data[]; -extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data[3]; +extern struct cperf_mldsa_test_data mldsa_verify_perf_data[3]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];
app/test-crypto-perf/main.c +36 -17
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
PATCH v5 4/5 app/crypto-perf: add ML-DSA sign support
In reply to Pratik SenapatiExtend ML-DSA sign iteration support to include ML-DSA65 and ML-DSA87 for 1, 5 and 10 sign iterations.
--- app/test-crypto-perf/cperf_ops.c | 101 ++++++++--- app/test-crypto-perf/cperf_options_parsing.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 174 ++++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 24 +-- app/test-crypto-perf/main.c | 28 ++- doc/guides/tools/cryptoperf.rst | 5 +- 6 files changed, 280 insertions(+), 55 deletions(-)
app/test-crypto-perf/cperf_ops.c +81 -20
@@ -219,8 +219,27 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { +/* Intermediate writable buffers for static const test vectors */ +static uint8_t ek_buf[1568 ];/* ML-KEM-1024 ek max */ +static uint8_t dk_buf[3168 ];/* ML-KEM-1024 dk max */ +static uint8_t msg_buf[32 ];/* ML-KEM message (32 bytes) */ +static uint8_t cipher_buf[1568 ];/* ML-KEM-1024 cipher max */ +static uint8_t sk_buf[32 ];/* shared key (32 bytes) */ uint16_t i; +if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { +memcpy (ek_buf, options->mlkem_data->ek.data, + options->mlkem_data->ek.length); +if (options->mlkem_data->message.length) +memcpy (msg_buf, options->mlkem_data->message.data, + options->mlkem_data->message.length); + }else { +memcpy (dk_buf, options->mlkem_data->dk.data, + options->mlkem_data->dk.length); +memcpy (cipher_buf, options->mlkem_data->cipher.data, + options->mlkem_data->cipher.length); + } +for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -229,24 +248,25 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_ENCAP ; - asym_op->mlkem.encap.ek.data = options->mlkem_data->ek.data; + asym_op->mlkem.encap.ek.data = ek_buf; asym_op->mlkem.encap.ek.length = options->mlkem_data->ek.length; - asym_op->mlkem.encap.cipher.data = options->mlkem_data->cipher.data; + asym_op->mlkem.encap.cipher.data = cipher_buf; asym_op->mlkem.encap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.encap.sk.data = options->mlkem_data->sk.data; + asym_op->mlkem.encap.sk.data = sk_buf; asym_op->mlkem.encap.sk.length = options->mlkem_data->sk.length; - asym_op->mlkem.encap.message.data = options->mlkem_data->message.data; + asym_op->mlkem.encap.message.data = msg_buf; asym_op->mlkem.encap.message.length = options->mlkem_data->message.length; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_DECAP ; - asym_op->mlkem.decap.dk.data = options->mlkem_data->dk.data; + asym_op->mlkem.decap.dk.data = dk_buf; asym_op->mlkem.decap.dk.length = options->mlkem_data->dk.length; - asym_op->mlkem.decap.cipher.data = options->mlkem_data->cipher.data; + asym_op->mlkem.decap.cipher.data = cipher_buf; asym_op->mlkem.decap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.decap.sk.data = options->mlkem_data->sk.data; + asym_op->mlkem.decap.sk.data = sk_buf; asym_op->mlkem.decap.sk.length = options->mlkem_data->sk.length; }else { -rte_panic ("Unsupported ML-KEM operation type %d\n" , options->asym_op_type); +rte_panic ("Unsupported ML-KEM operation type %d\n" , + options->asym_op_type); } } }
@@ -262,8 +282,48 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { +/* Intermediate writable buffers for static const test vectors */ +static uint8_t privkey_buf[4896 ];/* ML-DSA-87 privkey max */ +static uint8_t pubkey_buf[2592 ];/* ML-DSA-87 pubkey max */ +static uint8_t msg_buf[256 ];/* message */ +static uint8_t sign_buf[4627 ];/* ML-DSA-87 sign max */ +static uint8_t ctx_buf[256 ];/* context */ +static uint8_t seed_buf[32 ];/* seed */ +static uint8_t mu_buf[64 ];/* mu */ uint16_t i; +if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +memcpy (privkey_buf, options->mldsa_data->privkey.data, + options->mldsa_data->privkey.length); +if (options->mldsa_data->message.length) +memcpy (msg_buf, options->mldsa_data->message.data, + options->mldsa_data->message.length); +if (options->mldsa_data->ctx.length) +memcpy (ctx_buf, options->mldsa_data->ctx.data, + options->mldsa_data->ctx.length); +if (options->mldsa_data->seed.length) +memcpy (seed_buf, options->mldsa_data->seed.data, + options->mldsa_data->seed.length); +if (options->mldsa_data->mu.length) +memcpy (mu_buf, options->mldsa_data->mu.data, + options->mldsa_data->mu.length); + }else { +memcpy (pubkey_buf, options->mldsa_data->pubkey.data, + options->mldsa_data->pubkey.length); +if (options->mldsa_data->message.length) +memcpy (msg_buf, options->mldsa_data->message.data, + options->mldsa_data->message.length); +if (options->mldsa_data->sign.length) +memcpy (sign_buf, options->mldsa_data->sign.data, + options->mldsa_data->sign.length); +if (options->mldsa_data->ctx.length) +memcpy (ctx_buf, options->mldsa_data->ctx.data, + options->mldsa_data->ctx.length); +if (options->mldsa_data->mu.length) +memcpy (mu_buf, options->mldsa_data->mu.data, + options->mldsa_data->mu.length); + } +for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -272,34 +332,35 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_SIGN ; - asym_op->mldsa.siggen.privkey.data = options->mldsa_data->privkey.data; + asym_op->mldsa.siggen.privkey.data = privkey_buf; asym_op->mldsa.siggen.privkey.length = options->mldsa_data->privkey.length; - asym_op->mldsa.siggen.message.data = options->mldsa_data->message.data; + asym_op->mldsa.siggen.message.data = msg_buf; asym_op->mldsa.siggen.message.length = options->mldsa_data->message.length; - asym_op->mldsa.siggen.sign.data = options->mldsa_data->sign.data; + asym_op->mldsa.siggen.sign.data = sign_buf; asym_op->mldsa.siggen.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.siggen.ctx.data = options->mldsa_data->ctx.data; + asym_op->mldsa.siggen.ctx.data = ctx_buf; asym_op->mldsa.siggen.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.siggen.seed.data = options->mldsa_data->seed.data; + asym_op->mldsa.siggen.seed.data = seed_buf; asym_op->mldsa.siggen.seed.length = options->mldsa_data->seed.length; - asym_op->mldsa.siggen.mu.data = options->mldsa_data->mu.data; + asym_op->mldsa.siggen.mu.data = mu_buf; asym_op->mldsa.siggen.mu.length = options->mldsa_data->mu.length; asym_op->mldsa.siggen.hash = options->mldsa_data->hash; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_VERIFY ; - asym_op->mldsa.sigver.pubkey.data = options->mldsa_data->pubkey.data; + asym_op->mldsa.sigver.pubkey.data = pubkey_buf; asym_op->mldsa.sigver.pubkey.length = options->mldsa_data->pubkey.length; - asym_op->mldsa.sigver.message.data = options->mldsa_data->message.data; + asym_op->mldsa.sigver.message.data = msg_buf; asym_op->mldsa.sigver.message.length = options->mldsa_data->message.length; - asym_op->mldsa.sigver.sign.data = options->mldsa_data->sign.data; + asym_op->mldsa.sigver.sign.data = sign_buf; asym_op->mldsa.sigver.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.sigver.ctx.data = options->mldsa_data->ctx.data; + asym_op->mldsa.sigver.ctx.data = ctx_buf; asym_op->mldsa.sigver.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.sigver.mu.data = options->mldsa_data->mu.data; + asym_op->mldsa.sigver.mu.data = mu_buf; asym_op->mldsa.sigver.mu.length = options->mldsa_data->mu.length; asym_op->mldsa.sigver.hash = options->mldsa_data->hash; }else { -rte_panic ("Unsupported ML-DSA operation type %d\n" , options->asym_op_type); +rte_panic ("Unsupported ML-DSA operation type %d\n" , + options->asym_op_type); } } }
app/test-crypto-perf/cperf_options_parsing.c +1 -2
@@ -1820,8 +1820,7 @@ cperf_options_dump(struct cperf_options *opts)case CPERF_ASYM_MLDSA65 :case CPERF_ASYM_MLDSA87 :printf ("# mldsa algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); -if (opts->op_type ==CPERF_ASYM_MLDSA44 && - opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter);break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_test_vectors.c +171 -3
216 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +12 -12
@@ -111,23 +111,23 @@ struct cperf_mlkem_test_data {const char *name;enum rte_crypto_ml_kem_type type;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } dk;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } ek;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } message;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } cipher;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } sk; };
@@ -192,31 +192,31 @@ struct cperf_mldsa_test_data {const char *name;enum rte_crypto_ml_dsa_type type;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } privkey;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } pubkey;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } message;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } sign;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } ctx;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } seed;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } mu;enum rte_crypto_auth_algorithm hash;
app/test-crypto-perf/main.c +12 -16
@@ -544,23 +544,19 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, mldsa_idx =2 ;if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { -if (opts->op_type ==CPERF_ASYM_MLDSA44 ) { -switch (opts->mldsa_sign_iter) { -case 1 : - opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; -break ; -case 5 : - opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; -break ; -case 10 : - opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; -break ; -default : - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; -break ; - } - }else { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[mldsa_idx]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[mldsa_idx]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[mldsa_idx]; +break ; +default : opts->mldsa_data = &mldsa_sign_perf_data[mldsa_idx]; +break ; } }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { opts->mldsa_data = &mldsa_verify_perf_data[mldsa_idx];
doc/guides/tools/cryptoperf.rst +3 -2
@@ -366,10 +366,11 @@ The following are the application command-line options: * ``--mldsa-sign-iter <1/5/10>`` - Set ML-DSA sign iteration count for mldsa_44 sign operation. + Set ML-DSA sign iteration count for mldsa sign operation. Default is ``1``. Only applicable when: - ``--optype mldsa_44`` and ``--asym-op sign``. + ``--optype mldsa_44``, ``--optype mldsa_65``, ``--optype mldsa_87`` + and ``--asym-op sign``. * ``--rsa-priv-keytype <exp/qt>``
Signature · 1 line
2.43.0
PATCH v5 5/5 app/crypto-perf: fix PQC test vector output buffer handling
In reply to Pratik SenapatiRoute ML-KEM and ML-DSA ops through the cperf_test_vector mechanism instead of accessing options->mlkem_data/mldsa_data directly in the per-op setup functions.
Allocate writable rte_malloc'd buffers in cperf_test_vectors.c to hold copies of the input data for each field.
Use rte_zmalloc for the test vector struct so unset pointer fields are NULL-initialized; rte_free(NULL) is a defined no-op in DPDK.
Skip allocation for optional zero-length fields (ML-DSA privkey, pubkey; ML-KEM ek, dk, message, sk) which are absent depending on operation type.
Use a single err_free label with free_test_vector() to clean up on any allocation failure.
Pre-allocate output buffers (ML-DSA sign, ML-KEM cipher and sk) as a pool of nb_descriptors slots so each in-flight op gets its own writable slice, preventing cross-op clobbering in burst mode.
Use rte_free_sensitive() for ML-KEM dk/sk and ML-DSA privkey to zero private key material before freeing.
Validate op type before the per-op loop with an explicit panic on unsupported types.
--- app/test-crypto-perf/cperf_ops.c | 154 ++++++----------- .../cperf_test_vector_parsing.c | 12 ++ app/test-crypto-perf/cperf_test_vectors.c | 159 ++++++++++++++---- app/test-crypto-perf/cperf_test_vectors.h | 78 +++++++-- 4 files changed, 256 insertions(+), 147 deletions(-)
app/test-crypto-perf/cperf_ops.c +51 -103
@@ -214,31 +214,17 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops, uint32_t dst_buf_offset __rte_unused, uint16_t nb_ops, void *sess, const struct cperf_options *options, - const struct cperf_test_vector *test_vector __rte_unused, + const struct cperf_test_vector *test_vector, uint16_t iv_offset __rte_unused, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { -/* Intermediate writable buffers for static const test vectors */ -static uint8_t ek_buf[1568 ];/* ML-KEM-1024 ek max */ -static uint8_t dk_buf[3168 ];/* ML-KEM-1024 dk max */ -static uint8_t msg_buf[32 ];/* ML-KEM message (32 bytes) */ -static uint8_t cipher_buf[1568 ];/* ML-KEM-1024 cipher max */ -static uint8_t sk_buf[32 ];/* shared key (32 bytes) */ uint16_t i; -if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { -memcpy (ek_buf, options->mlkem_data->ek.data, - options->mlkem_data->ek.length); -if (options->mlkem_data->message.length) -memcpy (msg_buf, options->mlkem_data->message.data, - options->mlkem_data->message.length); - }else { -memcpy (dk_buf, options->mlkem_data->dk.data, - options->mlkem_data->dk.length); -memcpy (cipher_buf, options->mlkem_data->cipher.data, - options->mlkem_data->cipher.length); - } +if (options->asym_op_type !=RTE_CRYPTO_ASYM_OP_ENCRYPT && + options->asym_op_type !=RTE_CRYPTO_ASYM_OP_DECRYPT ) +rte_panic ("Unsupported ML-KEM operation type %d\n" , + options->asym_op_type);for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -248,25 +234,25 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_ENCAP ; - asym_op->mlkem.encap.ek.data = ek_buf; - asym_op->mlkem.encap.ek.length = options->mlkem_data->ek.length; - asym_op->mlkem.encap.cipher.data = cipher_buf; - asym_op->mlkem.encap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.encap.sk.data = sk_buf; - asym_op->mlkem.encap.sk.length = options->mlkem_data->sk.length; - asym_op->mlkem.encap.message.data = msg_buf; - asym_op->mlkem.encap.message.length = options->mlkem_data->message.length; + asym_op->mlkem.encap.ek.data = test_vector->mlkem.ek.data; + asym_op->mlkem.encap.ek.length = test_vector->mlkem.ek.length; + asym_op->mlkem.encap.cipher.data = test_vector->mlkem.cipher.data + + (i * test_vector->mlkem.cipher.length); + asym_op->mlkem.encap.cipher.length = test_vector->mlkem.cipher.length; + asym_op->mlkem.encap.sk.data = test_vector->mlkem.sk.data + + (i * test_vector->mlkem.sk.length); + asym_op->mlkem.encap.sk.length = test_vector->mlkem.sk.length; + asym_op->mlkem.encap.message.data = test_vector->mlkem.message.data; + asym_op->mlkem.encap.message.length = test_vector->mlkem.message.length; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_DECAP ; - asym_op->mlkem.decap.dk.data = dk_buf; - asym_op->mlkem.decap.dk.length = options->mlkem_data->dk.length; - asym_op->mlkem.decap.cipher.data = cipher_buf; - asym_op->mlkem.decap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.decap.sk.data = sk_buf; - asym_op->mlkem.decap.sk.length = options->mlkem_data->sk.length; - }else { -rte_panic ("Unsupported ML-KEM operation type %d\n" , - options->asym_op_type); + asym_op->mlkem.decap.dk.data = test_vector->mlkem.dk.data; + asym_op->mlkem.decap.dk.length = test_vector->mlkem.dk.length; + asym_op->mlkem.decap.cipher.data = test_vector->mlkem.cipher.data; + asym_op->mlkem.decap.cipher.length = test_vector->mlkem.cipher.length; + asym_op->mlkem.decap.sk.data = test_vector->mlkem.sk.data + + (i * test_vector->mlkem.sk.length); + asym_op->mlkem.decap.sk.length = test_vector->mlkem.sk.length; } } }
@@ -277,52 +263,17 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops, uint32_t dst_buf_offset __rte_unused, uint16_t nb_ops, void *sess, const struct cperf_options *options, - const struct cperf_test_vector *test_vector __rte_unused, + const struct cperf_test_vector *test_vector, uint16_t iv_offset __rte_unused, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { -/* Intermediate writable buffers for static const test vectors */ -static uint8_t privkey_buf[4896 ];/* ML-DSA-87 privkey max */ -static uint8_t pubkey_buf[2592 ];/* ML-DSA-87 pubkey max */ -static uint8_t msg_buf[256 ];/* message */ -static uint8_t sign_buf[4627 ];/* ML-DSA-87 sign max */ -static uint8_t ctx_buf[256 ];/* context */ -static uint8_t seed_buf[32 ];/* seed */ -static uint8_t mu_buf[64 ];/* mu */ uint16_t i; -if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { -memcpy (privkey_buf, options->mldsa_data->privkey.data, - options->mldsa_data->privkey.length); -if (options->mldsa_data->message.length) -memcpy (msg_buf, options->mldsa_data->message.data, - options->mldsa_data->message.length); -if (options->mldsa_data->ctx.length) -memcpy (ctx_buf, options->mldsa_data->ctx.data, - options->mldsa_data->ctx.length); -if (options->mldsa_data->seed.length) -memcpy (seed_buf, options->mldsa_data->seed.data, - options->mldsa_data->seed.length); -if (options->mldsa_data->mu.length) -memcpy (mu_buf, options->mldsa_data->mu.data, - options->mldsa_data->mu.length); - }else { -memcpy (pubkey_buf, options->mldsa_data->pubkey.data, - options->mldsa_data->pubkey.length); -if (options->mldsa_data->message.length) -memcpy (msg_buf, options->mldsa_data->message.data, - options->mldsa_data->message.length); -if (options->mldsa_data->sign.length) -memcpy (sign_buf, options->mldsa_data->sign.data, - options->mldsa_data->sign.length); -if (options->mldsa_data->ctx.length) -memcpy (ctx_buf, options->mldsa_data->ctx.data, - options->mldsa_data->ctx.length); -if (options->mldsa_data->mu.length) -memcpy (mu_buf, options->mldsa_data->mu.data, - options->mldsa_data->mu.length); - } +if (options->asym_op_type !=RTE_CRYPTO_ASYM_OP_SIGN && + options->asym_op_type !=RTE_CRYPTO_ASYM_OP_VERIFY ) +rte_panic ("Unsupported ML-DSA operation type %d\n" , + options->asym_op_type);for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -332,35 +283,33 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_SIGN ; - asym_op->mldsa.siggen.privkey.data = privkey_buf; - asym_op->mldsa.siggen.privkey.length = options->mldsa_data->privkey.length; - asym_op->mldsa.siggen.message.data = msg_buf; - asym_op->mldsa.siggen.message.length = options->mldsa_data->message.length; - asym_op->mldsa.siggen.sign.data = sign_buf; - asym_op->mldsa.siggen.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.siggen.ctx.data = ctx_buf; - asym_op->mldsa.siggen.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.siggen.seed.data = seed_buf; - asym_op->mldsa.siggen.seed.length = options->mldsa_data->seed.length; - asym_op->mldsa.siggen.mu.data = mu_buf; - asym_op->mldsa.siggen.mu.length = options->mldsa_data->mu.length; + asym_op->mldsa.siggen.privkey.data = test_vector->mldsa.privkey.data; + asym_op->mldsa.siggen.privkey.length = test_vector->mldsa.privkey.length; + asym_op->mldsa.siggen.message.data = test_vector->mldsa.message.data; + asym_op->mldsa.siggen.message.length = test_vector->mldsa.message.length; + asym_op->mldsa.siggen.sign.data = test_vector->mldsa.sign.data + + (i * test_vector->mldsa.sign.length); + asym_op->mldsa.siggen.sign.length = test_vector->mldsa.sign.length; + asym_op->mldsa.siggen.ctx.data = test_vector->mldsa.ctx.data; + asym_op->mldsa.siggen.ctx.length = test_vector->mldsa.ctx.length; + asym_op->mldsa.siggen.seed.data = test_vector->mldsa.seed.data; + asym_op->mldsa.siggen.seed.length = test_vector->mldsa.seed.length; + asym_op->mldsa.siggen.mu.data = test_vector->mldsa.mu.data; + asym_op->mldsa.siggen.mu.length = test_vector->mldsa.mu.length; asym_op->mldsa.siggen.hash = options->mldsa_data->hash; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_VERIFY ; - asym_op->mldsa.sigver.pubkey.data = pubkey_buf; - asym_op->mldsa.sigver.pubkey.length = options->mldsa_data->pubkey.length; - asym_op->mldsa.sigver.message.data = msg_buf; - asym_op->mldsa.sigver.message.length = options->mldsa_data->message.length; - asym_op->mldsa.sigver.sign.data = sign_buf; - asym_op->mldsa.sigver.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.sigver.ctx.data = ctx_buf; - asym_op->mldsa.sigver.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.sigver.mu.data = mu_buf; - asym_op->mldsa.sigver.mu.length = options->mldsa_data->mu.length; + asym_op->mldsa.sigver.pubkey.data = test_vector->mldsa.pubkey.data; + asym_op->mldsa.sigver.pubkey.length = test_vector->mldsa.pubkey.length; + asym_op->mldsa.sigver.message.data = test_vector->mldsa.message.data; + asym_op->mldsa.sigver.message.length = test_vector->mldsa.message.length; + asym_op->mldsa.sigver.sign.data = test_vector->mldsa.sign.data; + asym_op->mldsa.sigver.sign.length = test_vector->mldsa.sign.length; + asym_op->mldsa.sigver.ctx.data = test_vector->mldsa.ctx.data; + asym_op->mldsa.sigver.ctx.length = test_vector->mldsa.ctx.length; + asym_op->mldsa.sigver.mu.data = test_vector->mldsa.mu.data; + asym_op->mldsa.sigver.mu.length = test_vector->mldsa.mu.length; asym_op->mldsa.sigver.hash = options->mldsa_data->hash; - }else { -rte_panic ("Unsupported ML-DSA operation type %d\n" , - options->asym_op_type); } } }
@@ -470,8 +419,6 @@ cperf_set_ops_security_ipsec(struct rte_crypto_op **ops, ops[i]->status =RTE_CRYPTO_OP_STATUS_NOT_PROCESSED ;rte_security_attach_session (ops[i], sess); sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] + src_buf_offset); -if (options->is_outbound) -rte_pktmbuf_reset (sym_op->m_src); sym_op->m_src->pkt_len = test_buffer_size;while ((m->next !=NULL ) && (offset >= m->data_len)) {
@@ -1384,6 +1331,7 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } +switch (options->op_type) {case CPERF_ASYM_MLDSA44 :case CPERF_ASYM_MLDSA65 :
app/test-crypto-perf/cperf_test_vector_parsing.c +12 -0
@@ -24,6 +24,18 @@ free_test_vector(struct cperf_test_vector *vector, struct cperf_options *opts)rte_free (vector->auth_iv.data);rte_free (vector->aad.data);rte_free (vector->digest.data); +rte_free (vector->mlkem.ek.data); +rte_free_sensitive (vector->mlkem.dk.data); +rte_free (vector->mlkem.message.data); +rte_free (vector->mlkem.cipher.data); +rte_free_sensitive (vector->mlkem.sk.data); +rte_free_sensitive (vector->mldsa.privkey.data); +rte_free (vector->mldsa.pubkey.data); +rte_free (vector->mldsa.message.data); +rte_free (vector->mldsa.sign.data); +rte_free (vector->mldsa.ctx.data); +rte_free (vector->mldsa.seed.data); +rte_free (vector->mldsa.mu.data);if (opts->test_file !=NULL ) {rte_free (vector->plaintext.data);
app/test-crypto-perf/cperf_test_vectors.c +127 -32
367 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +66 -12
126 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 1/4 app/crypto-perf: support mldsa Sign-Iteration
In reply to Pratik SenapatiAdd ML-DSA44 Sign-Iteration based test support for 1, 5 and 10 iterations to test-crypto-perf.
--- app/test-crypto-perf/cperf_ops.c | 101 +- app/test-crypto-perf/cperf_options.h | 3 + app/test-crypto-perf/cperf_options_parsing.c | 47 +- app/test-crypto-perf/cperf_test_vectors.c | 1024 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 27 +- app/test-crypto-perf/main.c | 17 +- doc/guides/tools/cryptoperf.rst | 7 + 7 files changed, 1189 insertions(+), 37 deletions(-)
app/test-crypto-perf/cperf_ops.c +81 -20
@@ -219,8 +219,27 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { +/* Intermediate writable buffers for static const test vectors */ +static uint8_t ek_buf[1568 ];/* ML-KEM-1024 ek max */ +static uint8_t dk_buf[3168 ];/* ML-KEM-1024 dk max */ +static uint8_t msg_buf[32 ];/* ML-KEM message (32 bytes) */ +static uint8_t cipher_buf[1568 ];/* ML-KEM-1024 cipher max */ +static uint8_t sk_buf[32 ];/* shared key (32 bytes) */ uint16_t i; +if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { +memcpy (ek_buf, options->mlkem_data->ek.data, + options->mlkem_data->ek.length); +if (options->mlkem_data->message.length) +memcpy (msg_buf, options->mlkem_data->message.data, + options->mlkem_data->message.length); + }else { +memcpy (dk_buf, options->mlkem_data->dk.data, + options->mlkem_data->dk.length); +memcpy (cipher_buf, options->mlkem_data->cipher.data, + options->mlkem_data->cipher.length); + } +for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -229,24 +248,25 @@ cperf_set_ops_asym_mlkem(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_ENCAP ; - asym_op->mlkem.encap.ek.data = options->mlkem_data->ek.data; + asym_op->mlkem.encap.ek.data = ek_buf; asym_op->mlkem.encap.ek.length = options->mlkem_data->ek.length; - asym_op->mlkem.encap.cipher.data = options->mlkem_data->cipher.data; + asym_op->mlkem.encap.cipher.data = cipher_buf; asym_op->mlkem.encap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.encap.sk.data = options->mlkem_data->sk.data; + asym_op->mlkem.encap.sk.data = sk_buf; asym_op->mlkem.encap.sk.length = options->mlkem_data->sk.length; - asym_op->mlkem.encap.message.data = options->mlkem_data->message.data; + asym_op->mlkem.encap.message.data = msg_buf; asym_op->mlkem.encap.message.length = options->mlkem_data->message.length; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) { asym_op->mlkem.op =RTE_CRYPTO_ML_KEM_OP_DECAP ; - asym_op->mlkem.decap.dk.data = options->mlkem_data->dk.data; + asym_op->mlkem.decap.dk.data = dk_buf; asym_op->mlkem.decap.dk.length = options->mlkem_data->dk.length; - asym_op->mlkem.decap.cipher.data = options->mlkem_data->cipher.data; + asym_op->mlkem.decap.cipher.data = cipher_buf; asym_op->mlkem.decap.cipher.length = options->mlkem_data->cipher.length; - asym_op->mlkem.decap.sk.data = options->mlkem_data->sk.data; + asym_op->mlkem.decap.sk.data = sk_buf; asym_op->mlkem.decap.sk.length = options->mlkem_data->sk.length; }else { -rte_panic ("Unsupported ML-KEM operation type %d\n" , options->asym_op_type); +rte_panic ("Unsupported ML-KEM operation type %d\n" , + options->asym_op_type); } } }
@@ -262,8 +282,48 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops, uint32_t *imix_idx __rte_unused, uint64_t *tsc_start __rte_unused) { +/* Intermediate writable buffers for static const test vectors */ +static uint8_t privkey_buf[4896 ];/* ML-DSA-87 privkey max */ +static uint8_t pubkey_buf[2592 ];/* ML-DSA-87 pubkey max */ +static uint8_t msg_buf[256 ];/* message */ +static uint8_t sign_buf[4627 ];/* ML-DSA-87 sign max */ +static uint8_t ctx_buf[256 ];/* context */ +static uint8_t seed_buf[32 ];/* seed */ +static uint8_t mu_buf[64 ];/* mu */ uint16_t i; +if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +memcpy (privkey_buf, options->mldsa_data->privkey.data, + options->mldsa_data->privkey.length); +if (options->mldsa_data->message.length) +memcpy (msg_buf, options->mldsa_data->message.data, + options->mldsa_data->message.length); +if (options->mldsa_data->ctx.length) +memcpy (ctx_buf, options->mldsa_data->ctx.data, + options->mldsa_data->ctx.length); +if (options->mldsa_data->seed.length) +memcpy (seed_buf, options->mldsa_data->seed.data, + options->mldsa_data->seed.length); +if (options->mldsa_data->mu.length) +memcpy (mu_buf, options->mldsa_data->mu.data, + options->mldsa_data->mu.length); + }else { +memcpy (pubkey_buf, options->mldsa_data->pubkey.data, + options->mldsa_data->pubkey.length); +if (options->mldsa_data->message.length) +memcpy (msg_buf, options->mldsa_data->message.data, + options->mldsa_data->message.length); +if (options->mldsa_data->sign.length) +memcpy (sign_buf, options->mldsa_data->sign.data, + options->mldsa_data->sign.length); +if (options->mldsa_data->ctx.length) +memcpy (ctx_buf, options->mldsa_data->ctx.data, + options->mldsa_data->ctx.length); +if (options->mldsa_data->mu.length) +memcpy (mu_buf, options->mldsa_data->mu.data, + options->mldsa_data->mu.length); + } +for (i =0 ; i < nb_ops; i++) {struct rte_crypto_asym_op *asym_op = ops[i]->asym;
@@ -272,34 +332,35 @@ cperf_set_ops_asym_mldsa(struct rte_crypto_op **ops,if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_SIGN ; - asym_op->mldsa.siggen.privkey.data = options->mldsa_data->privkey.data; + asym_op->mldsa.siggen.privkey.data = privkey_buf; asym_op->mldsa.siggen.privkey.length = options->mldsa_data->privkey.length; - asym_op->mldsa.siggen.message.data = options->mldsa_data->message.data; + asym_op->mldsa.siggen.message.data = msg_buf; asym_op->mldsa.siggen.message.length = options->mldsa_data->message.length; - asym_op->mldsa.siggen.sign.data = options->mldsa_data->sign.data; + asym_op->mldsa.siggen.sign.data = sign_buf; asym_op->mldsa.siggen.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.siggen.ctx.data = options->mldsa_data->ctx.data; + asym_op->mldsa.siggen.ctx.data = ctx_buf; asym_op->mldsa.siggen.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.siggen.seed.data = options->mldsa_data->seed.data; + asym_op->mldsa.siggen.seed.data = seed_buf; asym_op->mldsa.siggen.seed.length = options->mldsa_data->seed.length; - asym_op->mldsa.siggen.mu.data = options->mldsa_data->mu.data; + asym_op->mldsa.siggen.mu.data = mu_buf; asym_op->mldsa.siggen.mu.length = options->mldsa_data->mu.length; asym_op->mldsa.siggen.hash = options->mldsa_data->hash; }else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { asym_op->mldsa.op =RTE_CRYPTO_ML_DSA_OP_VERIFY ; - asym_op->mldsa.sigver.pubkey.data = options->mldsa_data->pubkey.data; + asym_op->mldsa.sigver.pubkey.data = pubkey_buf; asym_op->mldsa.sigver.pubkey.length = options->mldsa_data->pubkey.length; - asym_op->mldsa.sigver.message.data = options->mldsa_data->message.data; + asym_op->mldsa.sigver.message.data = msg_buf; asym_op->mldsa.sigver.message.length = options->mldsa_data->message.length; - asym_op->mldsa.sigver.sign.data = options->mldsa_data->sign.data; + asym_op->mldsa.sigver.sign.data = sign_buf; asym_op->mldsa.sigver.sign.length = options->mldsa_data->sign.length; - asym_op->mldsa.sigver.ctx.data = options->mldsa_data->ctx.data; + asym_op->mldsa.sigver.ctx.data = ctx_buf; asym_op->mldsa.sigver.ctx.length = options->mldsa_data->ctx.length; - asym_op->mldsa.sigver.mu.data = options->mldsa_data->mu.data; + asym_op->mldsa.sigver.mu.data = mu_buf; asym_op->mldsa.sigver.mu.length = options->mldsa_data->mu.length; asym_op->mldsa.sigver.hash = options->mldsa_data->hash; }else { -rte_panic ("Unsupported ML-DSA operation type %d\n" , options->asym_op_type); +rte_panic ("Unsupported ML-DSA operation type %d\n" , + options->asym_op_type); } } }
app/test-crypto-perf/cperf_options.h +3 -0
@@ -56,6 +56,8 @@#define CPERF_ASYM_OP ("asym-op") +#define CPERF_MLDSA_SIGN_ITER ("mldsa-sign-iter") +#ifdef RTE_LIB_SECURITY #define CPERF_PDCP_SN_SZ ("pdcp-sn-sz")#define CPERF_PDCP_DOMAIN ("pdcp-domain")
@@ -196,6 +198,7 @@ struct cperf_options {struct cperf_rsa_test_data *rsa_data;uint16_t rsa_modlen;uint8_t rsa_keytype; +uint8_t mldsa_sign_iter; };void
app/test-crypto-perf/cperf_options_parsing.c +44 -3
90 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.c +1024 -0
1,036 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +15 -12
@@ -111,23 +111,23 @@ struct cperf_mlkem_test_data {const char *name;enum rte_crypto_ml_kem_type type;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } dk;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } ek;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } message;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } cipher;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } sk; };
@@ -192,31 +192,31 @@ struct cperf_mldsa_test_data {const char *name;enum rte_crypto_ml_dsa_type type;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } privkey;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } pubkey;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } message;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } sign;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } ctx;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } seed;struct { -uint8_t *data; +const uint8_t *data;uint32_t length; } mu;enum rte_crypto_auth_algorithm hash;
@@ -252,5 +252,8 @@ extern struct cperf_mlkem_test_data mlkem_encap_perf_data[];extern struct cperf_mlkem_test_data mlkem_decap_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];#endif
app/test-crypto-perf/main.c +15 -2
@@ -524,8 +524,21 @@ cperf_verify_devices_capabilities(struct cperf_options *opts,if (asym_capability ==NULL )return -1 ; -if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; +break ; +default : + opts->mldsa_data = &mldsa_sign_perf_data[0 ]; + } + }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) opts->mldsa_data = &mldsa_verify_perf_data[0 ];else {
doc/guides/tools/cryptoperf.rst +7 -0
@@ -364,6 +364,13 @@ The following are the application command-line options: Not applicable for modex op type. Default is ``encrypt``. +* ``--mldsa-sign-iter <1/5/10>`` + + Set ML-DSA sign iteration count for mldsa_44 sign operation. + Default is ``1``. + Only applicable when: + ``--optype mldsa_44`` and ``--asym-op sign``. + * ``--rsa-priv-keytype <exp/qt>`` Set RSA private key type.
Signature · 1 line
2.43.0
PATCH 2/4 app/crypto-perf: add ML-KEM support
Extend ML-KEM Support in crypto-perf to include ML-KEM768 and ML-KEM1024 test vectors.
--- app/test-crypto-perf/cperf_ops.c | 12 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 32 +- app/test-crypto-perf/cperf_test_common.c | 2 + app/test-crypto-perf/cperf_test_vectors.c | 1500 +++++++++++++++++- app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 22 +- 7 files changed, 1555 insertions(+), 19 deletions(-)
app/test-crypto-perf/cperf_ops.c +9 -3
@@ -1398,10 +1398,13 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { +switch (options->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; - xform.mlkem.type =RTE_CRYPTO_ML_KEM_512 ; + xform.mlkem.type = options->mlkem_data->type; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);if (ret <0 || asym_sess ==NULL ) {
@@ -1409,9 +1412,10 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; } -#ifdef RTE_LIB_SECURITY /* * security only
@@ -1732,6 +1736,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : op_fns->populate_ops = cperf_set_ops_asym_mlkem;break ;#ifdef RTE_LIB_SECURITY
app/test-crypto-perf/cperf_options.h +2 -0
@@ -105,6 +105,8 @@ enum cperf_op_type {CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 ,CPERF_ASYM_MLKEM512 , +CPERF_ASYM_MLKEM768 , +CPERF_ASYM_MLKEM1024 , CPERF_TLS, };
app/test-crypto-perf/cperf_options_parsing.c +23 -9
@@ -41,7 +41,7 @@ usage(char *progname)" --optype cipher-only / auth-only / cipher-then-auth / auth-then-cipher /\n" " aead / pdcp / docsis / ipsec / modex / rsa / secp192r1 /\n" " secp224r1 / secp256r1 / secp384r1 / secp521r1 / eddsa / sm2 /\n" -" mlkem_512 / mldsa_44 /\n" +" mlkem_512 / mlkem_768 / mlkem_1024 / mldsa_44 /\n" " tls-record : set operation type\n" " --sessionless: enable session-less crypto operations\n" " --shared-session: share 1 session across all queue pairs on crypto device\n"
@@ -568,6 +568,14 @@ parse_op_type(struct cperf_options *opts, const char *arg) cperf_op_type_strs[CPERF_ASYM_MLKEM512 ],CPERF_ASYM_MLKEM512 }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM768 ], +CPERF_ASYM_MLKEM768 + }, + { + cperf_op_type_strs[CPERF_ASYM_MLKEM1024 ], +CPERF_ASYM_MLKEM1024 + }, { cperf_op_type_strs[CPERF_TLS ],CPERF_TLS
@@ -1704,12 +1712,11 @@ cperf_options_check(struct cperf_options *options) } } -if (options->op_type ==CPERF_ASYM_MLKEM512 ) { -if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - options->mlkem_data = &mlkem_encap_perf_data[0 ]; -else if (options->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - options->mlkem_data = &mlkem_decap_perf_data[0 ]; -else { +if (options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 ) { +if (options->asym_op_type !=RTE_CRYPTO_ASYM_OP_ENCRYPT && + options->asym_op_type !=RTE_CRYPTO_ASYM_OP_DECRYPT ) {RTE_LOG (ERR ,USER1 ,"ML-KEM operations only support encrypt (encapsulate) and decrypt (decapsulate)\n" );return -EINVAL ;
@@ -1817,8 +1824,15 @@ cperf_options_dump(struct cperf_options *opts)if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter); } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) -printf ("# mlkem test name: %s\n" , opts->mlkem_data->name); +switch (opts->op_type) { +case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 : +printf ("# mlkem algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); +break ; +default : +break ; + } }printf ("# sessionless: %s\n" , opts->sessionless ?"yes" :"no" );printf ("# shared session: %s\n" , opts->shared_session ?"yes" :"no" );
app/test-crypto-perf/cperf_test_common.c +2 -0
@@ -315,6 +315,8 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_ED25519 || options->op_type ==CPERF_ASYM_SM2 || options->op_type ==CPERF_ASYM_MLKEM512 || + options->op_type ==CPERF_ASYM_MLKEM768 || + options->op_type ==CPERF_ASYM_MLKEM1024 || options->op_type == CPERF_ASYM_MLDSA44) return true;
app/test-crypto-perf/cperf_test_vectors.c +1499 -1
1,518 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -248,8 +248,8 @@ extern struct cperf_rsa_test_data rsa_pub_perf_data[4];extern struct cperf_rsa_test_data rsa_exp_perf_data[4 ];extern struct cperf_rsa_test_data rsa_qt_perf_data[4 ];extern struct cperf_rsa_plaintext rsa_plaintext; -extern struct cperf_mlkem_test_data mlkem_encap_perf_data[]; -extern struct cperf_mlkem_test_data mlkem_decap_perf_data[]; +extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3 ]; +extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3 ];extern struct cperf_mldsa_test_data mldsa_sign_perf_data[];extern struct cperf_mldsa_test_data mldsa_verify_perf_data[];extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[];
app/test-crypto-perf/main.c +18 -4
@@ -55,6 +55,8 @@ const char *cperf_op_type_strs[] = { [CPERF_ASYM_SM2] = "sm2", [CPERF_TLS] = "tls-record", [CPERF_ASYM_MLKEM512] = "mlkem_512", + [CPERF_ASYM_MLKEM768] = "mlkem_768", + [CPERF_ASYM_MLKEM1024] = "mlkem_1024", [CPERF_ASYM_MLDSA44] = "mldsa_44", };
@@ -248,6 +250,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)case CPERF_ASYM_SM2 :case CPERF_ASYM_RSA :case CPERF_ASYM_MLKEM512 : +case CPERF_ASYM_MLKEM768 : +case CPERF_ASYM_MLKEM1024 :case CPERF_ASYM_MLDSA44 :case CPERF_ASYM_MODEX : conf.ff_disable |= (RTE_CRYPTODEV_FF_SECURITY |
@@ -547,21 +551,31 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, } } -if (opts->op_type ==CPERF_ASYM_MLKEM512 ) { +if (opts->op_type ==CPERF_ASYM_MLKEM512 || + opts->op_type ==CPERF_ASYM_MLKEM768 || + opts->op_type ==CPERF_ASYM_MLKEM1024 ) { +uint8_t index =0 ; + asym_cap_idx.type =RTE_CRYPTO_ASYM_XFORM_ML_KEM ; asym_capability =rte_cryptodev_asym_capability_get (cdev_id, &asym_cap_idx);if (asym_capability ==NULL )return -1 ; +if (opts->op_type ==CPERF_ASYM_MLKEM512 ) + index =0 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM768 ) + index =1 ; +else if (opts->op_type ==CPERF_ASYM_MLKEM1024 ) + index =2 ; +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_ENCRYPT ) - opts->mlkem_data = &mlkem_encap_perf_data[0 ]; + opts->mlkem_data = &mlkem_encap_perf_data[index];else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_DECRYPT ) - opts->mlkem_data = &mlkem_decap_perf_data[0 ]; + opts->mlkem_data = &mlkem_decap_perf_data[index];else {RTE_LOG (ERR ,USER1 ,"Unsupported MLKEM operation type\n" );return -ENOTSUP ; } - } if (opts->op_type == CPERF_AUTH_ONLY ||
Signature · 1 line
2.43.0
PATCH 3/4 app/crypto-perf: add ML-DSA support
In reply to Pratik SenapatiExtend ML-DSA test-cases to include deterministic
sign and verify for ML-DSA65 and ML-DSA87.
--- app/test-crypto-perf/cperf_ops.c | 14 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 53 +- app/test-crypto-perf/cperf_test_common.c | 4 +- app/test-crypto-perf/cperf_test_vectors.c | 2797 ++++++++++++++++++ app/test-crypto-perf/cperf_test_vectors.h | 4 +- app/test-crypto-perf/main.c | 53 +- 7 files changed, 2876 insertions(+), 51 deletions(-)
app/test-crypto-perf/cperf_ops.c +10 -4
@@ -1382,12 +1382,14 @@ cperf_create_session(struct rte_mempool *sess_mp,return asym_sess; } -if (options->op_type ==CPERF_ASYM_MLDSA44 ) { +switch (options->op_type) { +case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : xform.next =NULL ; xform.xform_type =RTE_CRYPTO_ASYM_XFORM_ML_DSA ; - xform.mldsa.type =RTE_CRYPTO_ML_DSA_44 ; - xform.mldsa.sign_deterministic = - options->mldsa_data->sign_deterministic; + xform.mldsa.type = options->mldsa_data->type; + xform.mldsa.sign_deterministic = options->mldsa_data->sign_deterministic; xform.mldsa.sign_prehash = false; ret =rte_cryptodev_asym_session_create (dev_id, &xform, sess_mp, &asym_sess);
@@ -1396,6 +1398,8 @@ cperf_create_session(struct rte_mempool *sess_mp,return NULL ; }return asym_sess; +default : +break ; }switch (options->op_type) {
@@ -1733,6 +1737,8 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_asym_sm2;break ;case CPERF_ASYM_MLDSA44 : +case CPERF_ASYM_MLDSA65 : +case CPERF_ASYM_MLDSA87 : op_fns->populate_ops = cperf_set_ops_asym_mldsa;break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_options.h +2 -0
@@ -104,6 +104,8 @@ enum cperf_op_type {CPERF_ASYM_ED25519 ,CPERF_ASYM_SM2 ,CPERF_ASYM_MLDSA44 , +CPERF_ASYM_MLDSA65 , +CPERF_ASYM_MLDSA87 ,CPERF_ASYM_MLKEM512 ,CPERF_ASYM_MLKEM768 , CPERF_ASYM_MLKEM1024,
app/test-crypto-perf/cperf_options_parsing.c +26 -27
79 lines not on this page · raw message
app/test-crypto-perf/cperf_test_common.c +3 -1
@@ -317,7 +317,9 @@ cperf_is_asym_test(const struct cperf_options *options) options->op_type ==CPERF_ASYM_MLKEM512 || options->op_type ==CPERF_ASYM_MLKEM768 || options->op_type ==CPERF_ASYM_MLKEM1024 || - options->op_type == CPERF_ASYM_MLDSA44) + options->op_type ==CPERF_ASYM_MLDSA44 || + options->op_type ==CPERF_ASYM_MLDSA65 || + options->op_type == CPERF_ASYM_MLDSA87) return true;return false;
app/test-crypto-perf/cperf_test_vectors.c +2797 -0
2,815 lines not on this page · raw message
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -250,8 +250,8 @@ extern struct cperf_rsa_test_data rsa_qt_perf_data[4]; extern struct cperf_rsa_plaintext rsa_plaintext; extern struct cperf_mlkem_test_data mlkem_encap_perf_data[3]; extern struct cperf_mlkem_test_data mlkem_decap_perf_data[3]; -extern struct cperf_mldsa_test_data mldsa_sign_perf_data[]; -extern struct cperf_mldsa_test_data mldsa_verify_perf_data[]; +extern struct cperf_mldsa_test_data mldsa_sign_perf_data[3]; +extern struct cperf_mldsa_test_data mldsa_verify_perf_data[3]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_1_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_5_iter[]; extern struct cperf_mldsa_test_data mldsa_sign_perf_data_10_iter[];
app/test-crypto-perf/main.c +36 -17
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
PATCH 4/4 app/crypto-perf: add ML-DSA sign support
In reply to Pratik SenapatiExtend ML-DSA sign iteration support to include ML-DSA65 and ML-DSA87 for 1, 5 and 10 sign iterations.
--- app/test-crypto-perf/cperf_options_parsing.c | 3 +- app/test-crypto-perf/cperf_test_vectors.c | 170 ++++++++++++++++++- app/test-crypto-perf/main.c | 28 ++- doc/guides/tools/cryptoperf.rst | 5 +- 4 files changed, 185 insertions(+), 21 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +1 -2
@@ -1820,8 +1820,7 @@ cperf_options_dump(struct cperf_options *opts)case CPERF_ASYM_MLDSA65 :case CPERF_ASYM_MLDSA87 :printf ("# mldsa algorithm: %s\n" , cperf_op_type_strs[opts->op_type]); -if (opts->op_type ==CPERF_ASYM_MLDSA44 && - opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) +if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN )printf ("# mldsa sign iterations: %u\n" , opts->mldsa_sign_iter);break ;case CPERF_ASYM_MLKEM512 :
app/test-crypto-perf/cperf_test_vectors.c +169 -1
200 lines not on this page · raw message
app/test-crypto-perf/main.c +12 -16
@@ -544,23 +544,19 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, mldsa_idx =2 ;if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_SIGN ) { -if (opts->op_type ==CPERF_ASYM_MLDSA44 ) { -switch (opts->mldsa_sign_iter) { -case 1 : - opts->mldsa_data = &mldsa_sign_perf_data_1_iter[0 ]; -break ; -case 5 : - opts->mldsa_data = &mldsa_sign_perf_data_5_iter[0 ]; -break ; -case 10 : - opts->mldsa_data = &mldsa_sign_perf_data_10_iter[0 ]; -break ; -default : - opts->mldsa_data = &mldsa_sign_perf_data[0 ]; -break ; - } - }else { +switch (opts->mldsa_sign_iter) { +case 1 : + opts->mldsa_data = &mldsa_sign_perf_data_1_iter[mldsa_idx]; +break ; +case 5 : + opts->mldsa_data = &mldsa_sign_perf_data_5_iter[mldsa_idx]; +break ; +case 10 : + opts->mldsa_data = &mldsa_sign_perf_data_10_iter[mldsa_idx]; +break ; +default : opts->mldsa_data = &mldsa_sign_perf_data[mldsa_idx]; +break ; } }else if (opts->asym_op_type ==RTE_CRYPTO_ASYM_OP_VERIFY ) { opts->mldsa_data = &mldsa_verify_perf_data[mldsa_idx];
doc/guides/tools/cryptoperf.rst +3 -2
@@ -366,10 +366,11 @@ The following are the application command-line options: * ``--mldsa-sign-iter <1/5/10>`` - Set ML-DSA sign iteration count for mldsa_44 sign operation. + Set ML-DSA sign iteration count for mldsa sign operation. Default is ``1``. Only applicable when: - ``--optype mldsa_44`` and ``--asym-op sign``. + ``--optype mldsa_44``, ``--optype mldsa_65``, ``--optype mldsa_87`` + and ``--asym-op sign``. * ``--rsa-priv-keytype <exp/qt>``
Signature · 1 line
2.43.0