From: Anoob Joseph <anoobj@marvell.com>
To: <gakhil@marvell.com>, <dev@dpdk.org>
Cc: Archana Muniganti <marchana@marvell.com>,
<radu.nicolau@intel.com>, <roy.fan.zhang@intel.com>,
<hemant.agrawal@nxp.com>, <konstantin.ananyev@intel.com>,
<anoobj@marvell.com>
Subject: [PATCH] test/crypto: add AES-CCM test vectors
Date: Tue, 26 Jul 2022 15:46:19 +0530 [thread overview]
Message-ID: <20220726101619.1992-1-anoobj@marvell.com> (raw)
From: Archana Muniganti <marchana@marvell.com>
Added ESP tunnel mode known vectors for AES-CCM along with
combined mode support.
Signed-off-by: Archana Muniganti <marchana@marvell.com>
---
app/test/test_cryptodev.c | 8 ++
app/test/test_cryptodev_security_ipsec.c | 3 +
app/test/test_cryptodev_security_ipsec.h | 5 +
...st_cryptodev_security_ipsec_test_vectors.h | 101 ++++++++++++++++++
4 files changed, 117 insertions(+)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 69a0301de0..ee566a4ee3 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -15292,6 +15292,10 @@ static struct unit_test_suite ipsec_proto_testsuite = {
"Outbound known vector (ESP tunnel mode IPv4 AES-GCM 256)",
ut_setup_security, ut_teardown,
test_ipsec_proto_known_vec, &pkt_aes_256_gcm),
+ TEST_CASE_NAMED_WITH_DATA(
+ "Outbound known vector (ESP tunnel mode IPv4 AES-CCM 256)",
+ ut_setup_security, ut_teardown,
+ test_ipsec_proto_known_vec, &pkt_aes_256_ccm),
TEST_CASE_NAMED_WITH_DATA(
"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])",
ut_setup_security, ut_teardown,
@@ -15353,6 +15357,10 @@ static struct unit_test_suite ipsec_proto_testsuite = {
"Inbound known vector (ESP tunnel mode IPv4 AES-GCM 256)",
ut_setup_security, ut_teardown,
test_ipsec_proto_known_vec_inb, &pkt_aes_256_gcm),
+ TEST_CASE_NAMED_WITH_DATA(
+ "Inbound known vector (ESP tunnel mode IPv4 AES-CCM 256)",
+ ut_setup_security, ut_teardown,
+ test_ipsec_proto_known_vec_inb, &pkt_aes_256_ccm),
TEST_CASE_NAMED_WITH_DATA(
"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)",
ut_setup_security, ut_teardown,
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 6086055af1..3f691f0f56 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -392,6 +392,9 @@ test_ipsec_td_prepare(const struct crypto_param *param1,
else
memcpy(td, &pkt_aes_256_gcm, sizeof(*td));
+ if (param1->alg.aead == RTE_CRYPTO_AEAD_AES_CCM)
+ td->salt.len = 3;
+
td->aead = true;
td->xform.aead.aead.algo = param1->alg.aead;
td->xform.aead.aead.key.length = param1->key_length;
diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h
index 744dd64a9e..02b08f9f95 100644
--- a/app/test/test_cryptodev_security_ipsec.h
+++ b/app/test/test_cryptodev_security_ipsec.h
@@ -132,6 +132,11 @@ static const struct crypto_param aead_list[] = {
{
.type = RTE_CRYPTO_SYM_XFORM_AEAD,
.alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
+ .key_length = 32,
+ },
+ {
+ .type = RTE_CRYPTO_SYM_XFORM_AEAD,
+ .alg.aead = RTE_CRYPTO_AEAD_AES_CCM,
.key_length = 32
},
};
diff --git a/app/test/test_cryptodev_security_ipsec_test_vectors.h b/app/test/test_cryptodev_security_ipsec_test_vectors.h
index 5c5b0445ee..5f775a241a 100644
--- a/app/test/test_cryptodev_security_ipsec_test_vectors.h
+++ b/app/test/test_cryptodev_security_ipsec_test_vectors.h
@@ -325,6 +325,107 @@ struct ipsec_test_data pkt_aes_256_gcm = {
},
};
+struct ipsec_test_data pkt_aes_256_ccm = {
+ .key = {
+ .data = {
+ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
+ 0x61, 0x62, 0x63, 0x64, 0x61, 0x62, 0x63, 0x64,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
+ },
+ },
+ .input_text = {
+ .data = {
+ /* IP */
+ 0x45, 0x00, 0x00, 0x2E, 0x00, 0x01, 0x00, 0x00,
+ 0x40, 0x11, 0x5F, 0xBC, 0x0D, 0x00, 0x00, 0x02,
+ 0x0E, 0x00, 0x00, 0x01,
+
+ /* UDP */
+ 0x04, 0x01, 0x04, 0x01, 0x00, 0x1A, 0xA0, 0x79,
+ 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
+ 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
+ 0x78, 0x78,
+ },
+ .len = 46,
+ },
+ .output_text = {
+ .data = {
+ /* IP - outer header */
+ 0x45, 0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0x00,
+ 0x40, 0x32, 0x76, 0x65, 0x02, 0x00, 0x00, 0x01,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* ESP */
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
+
+ /* IV */
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0xBB, 0x81,
+
+ /* Data */
+ 0xB4, 0x12, 0x67, 0x79, 0x79, 0x9A, 0xCB, 0xC5,
+ 0x94, 0xF9, 0xA3, 0x95, 0xAC, 0x06, 0x8B, 0xEE,
+ 0x20, 0x69, 0xE8, 0xD9, 0x4A, 0xC2, 0xAA, 0xA0,
+ 0xD4, 0xEE, 0xF6, 0xAE, 0x08, 0xF8, 0x3F, 0xE6,
+ 0x88, 0x1F, 0x5C, 0xD7, 0x8D, 0x9D, 0x30, 0x02,
+ 0x36, 0xEA, 0x10, 0x5B, 0xB0, 0x30, 0x97, 0xBF,
+ 0xFA, 0x89, 0x36, 0x53, 0x96, 0xD7, 0x43, 0x8C,
+ 0x4D, 0x87, 0xFD, 0x8E, 0x45, 0x49, 0x34, 0x80,
+ },
+ .len = 100,
+ },
+ .salt = {
+ .data = {
+ 0x6d, 0x6e, 0x6f
+ },
+ .len = 3,
+ },
+
+ .iv = {
+ .data = {
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0xBB, 0x81,
+ },
+ },
+
+ .ipsec_xform = {
+ .spi = 0x00000100,
+ .options.esn = 0,
+ .options.udp_encap = 0,
+ .options.copy_dscp = 0,
+ .options.copy_flabel = 0,
+ .options.copy_df = 0,
+ .options.dec_ttl = 0,
+ .options.ecn = 0,
+ .options.stats = 0,
+ .options.tunnel_hdr_verify = 0,
+ .options.ip_csum_enable = 0,
+ .options.l4_csum_enable = 0,
+ .direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
+ .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
+ .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
+ .tunnel.type = RTE_SECURITY_IPSEC_TUNNEL_IPV4,
+ .replay_win_sz = 0,
+ },
+
+ .aead = true,
+
+ .xform = {
+ .aead = {
+ .next = NULL,
+ .type = RTE_CRYPTO_SYM_XFORM_AEAD,
+ .aead = {
+ .op = RTE_CRYPTO_AEAD_OP_ENCRYPT,
+ .algo = RTE_CRYPTO_AEAD_AES_CCM,
+ .key.length = 32,
+ .iv.length = 12,
+ .iv.offset = IV_OFFSET,
+ .digest_length = 16,
+ .aad_length = 12,
+ },
+ },
+ },
+};
+
/* Known vectors for AES-CBC
* https://datatracker.ietf.org/doc/html/rfc3602#section-4
*/
--
2.25.1
next reply other threads:[~2022-07-26 10:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 10:16 Anoob Joseph [this message]
2022-08-25 8:18 ` Akhil Goyal
2022-08-28 9:30 ` 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=20220726101619.1992-1-anoobj@marvell.com \
--to=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=hemant.agrawal@nxp.com \
--cc=konstantin.ananyev@intel.com \
--cc=marchana@marvell.com \
--cc=radu.nicolau@intel.com \
--cc=roy.fan.zhang@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).