Skip to contentSkip to conversation

app/test-crypto-perf: add test vectors for more ML-KEM and ML-DSA variants

PATCH In review Radu Nicolau 2 participants 2 messages Sep 17

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/test-crypto-perf: add test vectors for more ML-KEM and ML-DSA variants

Add support and test vectors for ML-KEM-768, ML-KEM-1024, ML-DSA-65 and ML-DSA-87 algorithms.
Increase ML test buffer sizes to accommodate larger buffers. Removed unused test data from test vectors file

---
 app/test-crypto-perf/cperf_ops.c             |   58 +-
 app/test-crypto-perf/cperf_options.h         |    4 +
 app/test-crypto-perf/cperf_options_parsing.c |   66 +-
 app/test-crypto-perf/cperf_test_common.c     |    6 +-
 app/test-crypto-perf/cperf_test_vectors.c    | 5097 +++++++++++++++---
 app/test-crypto-perf/cperf_test_vectors.h    |    2 +-
 app/test-crypto-perf/main.c                  |   70 +-
 doc/guides/tools/cryptoperf.rst              |    4 +
 8 files changed, 4488 insertions(+), 819 deletions(-)
app/test-crypto-perf/cperf_ops.c +56 -2
index 873fa3b59f..da6922704d 100644
@@ -1336,12 +1336,41 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		return asym_sess;
 	}
+	if (options->op_type == CPERF_ASYM_MLDSA65) {
+		xform.next = NULL;
+		xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_DSA;
+		xform.mldsa.type = RTE_CRYPTO_ML_DSA_65;
+		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);
+		if (ret < 0 || asym_sess == NULL) {
+			RTE_LOG(ERR, USER1, "ML-DSA Asym session create failed\n");
+			return NULL;
+		}
+		return asym_sess;
+	}
+	if (options->op_type == CPERF_ASYM_MLDSA87) {
+		xform.next = NULL;
+		xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_DSA;
+		xform.mldsa.type = RTE_CRYPTO_ML_DSA_87;
+		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);
+		if (ret < 0 || asym_sess == NULL) {
+			RTE_LOG(ERR, USER1, "ML-DSA Asym session create failed\n");
+			return NULL;
+		}
+		return asym_sess;
+	}
 
 	if (options->op_type == CPERF_ASYM_MLKEM512) {
 		xform.next = NULL;
 		xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_KEM;
 		xform.mlkem.type = RTE_CRYPTO_ML_KEM_512;
-
 		ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mp, &asym_sess);
 		if (ret < 0 || asym_sess == NULL) {
 			RTE_LOG(ERR, USER1, "ML-KEM Asym session create failed\n");
@@ -1349,7 +1378,28 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		}
 		return asym_sess;
 	}
-
+	if (options->op_type == CPERF_ASYM_MLKEM768) {
+		xform.next = NULL;
+		xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_KEM;
+		xform.mlkem.type = RTE_CRYPTO_ML_KEM_768;
+		ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mp, &asym_sess);
+		if (ret < 0 || asym_sess == NULL) {
+			RTE_LOG(ERR, USER1, "ML-KEM Asym session create failed\n");
+			return NULL;
+		}
+		return asym_sess;
+	}
+	if (options->op_type == CPERF_ASYM_MLKEM1024) {
+		xform.next = NULL;
+		xform.xform_type = RTE_CRYPTO_ASYM_XFORM_ML_KEM;
+		xform.mlkem.type = RTE_CRYPTO_ML_KEM_1024;
+		ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mp, &asym_sess);
+		if (ret < 0 || asym_sess == NULL) {
+			RTE_LOG(ERR, USER1, "ML-KEM Asym session create failed\n");
+			return NULL;
+		}
+		return asym_sess;
+	}
 
 #ifdef RTE_LIB_SECURITY
 	/*
@@ -1668,9 +1718,13 @@ 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:
+	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 +4 -0
index d8ceca2424..81616f5e57 100644
@@ -102,7 +102,11 @@ 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,
 	CPERF_TLS,
 };
 
app/test-crypto-perf/cperf_options_parsing.c +64 -2

95 lines not on this page · raw message

app/test-crypto-perf/cperf_test_common.c +5 -1
index 0bcaa6dfd8..2f637a1e2d 100644
@@ -315,7 +315,11 @@ 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_MLDSA44)
+		options->op_type == CPERF_ASYM_MLKEM768 ||
+		options->op_type == CPERF_ASYM_MLKEM1024 ||
+		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 +4287 -810

2,798 lines not on this page · raw message

app/test-crypto-perf/cperf_test_vectors.h +1 -1
index 6b4b4f22b4..8424d67828 100644

Lines of this file are not shown. View the raw message.

app/test-crypto-perf/main.c +67 -3

70 lines not on this page · raw message

doc/guides/tools/cryptoperf.rst +4 -0
index 759c304b48..3f193f79ac 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.52.0

Part of the diff is not shown here. View the raw message.