From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>, Akhil Goyal <gakhil@marvell.com>,
Fan Zhang <fanzhang.oss@gmail.com>,
Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Cc: <stable@dpdk.org>
Subject: [PATCH 1/2] test/crypto: validate ML crypto keys
Date: Wed, 27 May 2026 14:22:52 +0530 [thread overview]
Message-ID: <20260527085257.1933-1-gmuthukrishn@marvell.com> (raw)
Validate ML-KEM and ML-DSA keys.
Fixes: 76a5877072c ("test/crypto: add ML-KEM and ML-DSA cases")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
app/test/test_cryptodev_asym.c | 48 ++++++++-----------
app/test/test_cryptodev_ml_dsa_test_vectors.h | 8 ++++
app/test/test_cryptodev_ml_kem_test_vectors.h | 8 ++++
3 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index bf1a1fc417..73a8198e53 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -3949,19 +3949,15 @@ mlkem_keygen(const void *test_data)
rte_crypto_ml_kem_pubkey_size[vector->type],
"Incorrect Encapsulation key length\n");
- /* If the seed is all zero, keys are deterministic */
- if (memcmp(vector->d.data, (uint8_t [32]) {0},
- vector->d.length) == 0) {
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->dk.data,
- self->result_op->asym->mlkem.keygen.dk.data,
- self->result_op->asym->mlkem.keygen.dk.length,
- "Incorrect Decapsulation key\n");
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->ek.data,
- self->result_op->asym->mlkem.keygen.ek.data,
- self->result_op->asym->mlkem.keygen.ek.length,
- "Incorrect Encapsulation key\n");
- RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
- }
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->dk.data,
+ self->result_op->asym->mlkem.keygen.dk.data,
+ self->result_op->asym->mlkem.keygen.dk.length,
+ "Incorrect Decapsulation key\n");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->ek.data,
+ self->result_op->asym->mlkem.keygen.ek.data,
+ self->result_op->asym->mlkem.keygen.ek.length,
+ "Incorrect Encapsulation key\n");
+ RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
rte_cryptodev_asym_session_free(dev_id, self->sess);
return TEST_SUCCESS;
@@ -4071,7 +4067,7 @@ mlkem_encap(const void *test_data)
self->op->asym->mlkem.decap.sk.data = sk;
self->op->asym->mlkem.decap.sk.length = 32;
- TEST_ASSERT_SUCCESS(send_one(),
+ TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-KEM Decap)");
debug_hexdump(stdout, "Shared secret from negative test",
@@ -4149,7 +4145,7 @@ mlkem_decap(const void *test_data)
self->op->asym->mlkem.decap.sk.data = sk;
self->op->asym->mlkem.decap.sk.length = 32;
- TEST_ASSERT_SUCCESS(send_one(),
+ TEST_ASSERT_SUCCESS(send_one_no_status_check(),
"Failed to process crypto op (ML-KEM Decap)");
debug_hexdump(stdout, "Shared secret from negative test",
@@ -4214,19 +4210,15 @@ mldsa_keygen(const void *test_data)
rte_crypto_ml_dsa_pubkey_size[vector->type],
"Incorrect Public key length\n");
- /* If the seed is all zero, keys are deterministic */
- if (memcmp(vector->seed.data, (uint8_t [32]) {0},
- vector->seed.length) == 0) {
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->privkey.data,
- self->result_op->asym->mldsa.keygen.privkey.data,
- self->result_op->asym->mldsa.keygen.privkey.length,
- "Incorrect Private key\n");
- TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->pubkey.data,
- self->result_op->asym->mldsa.keygen.pubkey.data,
- self->result_op->asym->mldsa.keygen.pubkey.length,
- "Incorrect Public key\n");
- RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
- }
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->privkey.data,
+ self->result_op->asym->mldsa.keygen.privkey.data,
+ self->result_op->asym->mldsa.keygen.privkey.length,
+ "Incorrect Private key\n");
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(vector->pubkey.data,
+ self->result_op->asym->mldsa.keygen.pubkey.data,
+ self->result_op->asym->mldsa.keygen.pubkey.length,
+ "Incorrect Public key\n");
+ RTE_LOG(DEBUG, USER1, "Deterministic keygen test passed\n");
rte_cryptodev_asym_session_free(dev_id, self->sess);
return TEST_SUCCESS;
diff --git a/app/test/test_cryptodev_ml_dsa_test_vectors.h b/app/test/test_cryptodev_ml_dsa_test_vectors.h
index f2453b9f34..675a6fad04 100644
--- a/app/test/test_cryptodev_ml_dsa_test_vectors.h
+++ b/app/test/test_cryptodev_ml_dsa_test_vectors.h
@@ -1653,6 +1653,14 @@ struct crypto_testsuite_mldsa_params mldsa_keygen_test_vectors[] = {
.data = mldsa_44_seed,
.length = sizeof(mldsa_44_seed),
},
+ .privkey = {
+ .data = mldsa_44_privkey,
+ .length = sizeof(mldsa_44_privkey),
+ },
+ .pubkey = {
+ .data = mldsa_44_pubkey,
+ .length = sizeof(mldsa_44_pubkey),
+ },
},
{
.name = "mldsa_44_keygen (deterministic)",
diff --git a/app/test/test_cryptodev_ml_kem_test_vectors.h b/app/test/test_cryptodev_ml_kem_test_vectors.h
index 8294acc29e..a1d727b969 100644
--- a/app/test/test_cryptodev_ml_kem_test_vectors.h
+++ b/app/test/test_cryptodev_ml_kem_test_vectors.h
@@ -785,6 +785,14 @@ struct crypto_testsuite_mlkem_params mlkem_keygen_test_vectors[] = {
.data = mlkem_512_z,
.length = sizeof(mlkem_512_z),
},
+ .dk = {
+ .data = mlkem_512_dk,
+ .length = sizeof(mlkem_512_dk),
+ },
+ .ek = {
+ .data = mlkem_512_ek,
+ .length = sizeof(mlkem_512_ek),
+ }
},
{
.name = "mlkem_512_keygen (deterministic)",
--
2.37.1
next reply other threads:[~2026-05-27 8:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 8:52 Gowrishankar Muthukrishnan [this message]
2026-05-27 8:52 ` [PATCH 2/2] test/crypto: fix prehash in MLDSA session Gowrishankar Muthukrishnan
2026-05-27 9:13 ` [v2 1/2] test/crypto: validate ML crypto keys Gowrishankar Muthukrishnan
2026-05-27 9:14 ` [v2 2/2] test/crypto: fix prehash in MLDSA session Gowrishankar Muthukrishnan
2026-06-20 18:17 ` [PATCH 1/2] test/crypto: validate ML crypto keys Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260527085257.1933-1-gmuthukrishn@marvell.com \
--to=gmuthukrishn@marvell.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox