From: Hanxiao Li <li.hanxiao@zte.com.cn>
To: dev@dpdk.org
Cc: wang.yong19@zte.com.cn, Hanxiao Li <li.hanxiao@zte.com.cn>
Subject: [PATCH v8 7/8] app/test: add sm4-xts test.
Date: Sun, 29 Sep 2024 23:05:04 +0800 [thread overview]
Message-ID: <20240929150512.845745-6-li.hanxiao@zte.com.cn> (raw)
In-Reply-To: <20240929150512.845745-1-li.hanxiao@zte.com.cn>
[-- Attachment #1.1.1: Type: text/plain, Size: 3507 bytes --]
add support of sm4 xts test.
Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn>
---
app/test/test_cryptodev_blockcipher.c | 3 +-
app/test/test_cryptodev_sm4_test_vectors.h | 58 ++++++++++++++++++++++
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index 87a321fac3..8e13cdfc7a 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -1175,7 +1175,8 @@ sm4_cipheronly_setup(void)
RTE_CRYPTO_CIPHER_SM4_ECB,
RTE_CRYPTO_CIPHER_SM4_CTR,
RTE_CRYPTO_CIPHER_SM4_OFB,
- RTE_CRYPTO_CIPHER_SM4_CFB
+ RTE_CRYPTO_CIPHER_SM4_CFB,
+ RTE_CRYPTO_CIPHER_SM4_XTS
};
rte_cryptodev_info_get(dev_id, &dev_info);
diff --git a/app/test/test_cryptodev_sm4_test_vectors.h b/app/test/test_cryptodev_sm4_test_vectors.h
index 582b333296..ad38a31723 100644
--- a/app/test/test_cryptodev_sm4_test_vectors.h
+++ b/app/test/test_cryptodev_sm4_test_vectors.h
@@ -119,6 +119,25 @@ static const uint8_t ciphertext_sm4_ctr[] = {
0x27, 0xF4, 0x99, 0x03, 0xDA, 0x1C, 0x52, 0x04
};
+static const uint8_t ciphertext_sm4_xts[] = {
+ 0xEB, 0x4E, 0x0F, 0x8B, 0x44, 0x75, 0x9A, 0xE4,
+ 0xCD, 0xAF, 0x1F, 0x69, 0xCA, 0x90, 0x62, 0x58,
+ 0x91, 0x7A, 0xA8, 0x14, 0x5D, 0xF3, 0x4E, 0xBC,
+ 0xFC, 0xA6, 0xFE, 0x36, 0x48, 0x8D, 0x4D, 0x55,
+ 0x10, 0x00, 0xF0, 0xA5, 0xB2, 0x6D, 0xAB, 0x61,
+ 0x54, 0x14, 0x8C, 0x9A, 0xFA, 0x8B, 0xDA, 0xA2,
+ 0x00, 0x12, 0xFE, 0xDF, 0x4A, 0x26, 0x61, 0xE8,
+ 0x6E, 0x67, 0x8F, 0xE1, 0xBA, 0xAC, 0x27, 0x72,
+ 0xD8, 0xA1, 0x84, 0xF4, 0xD2, 0x3C, 0xFA, 0xB5,
+ 0x59, 0xE2, 0x0E, 0xC0, 0x7B, 0xCF, 0x25, 0x78,
+ 0x1C, 0x02, 0xDE, 0xB7, 0x17, 0xF8, 0x9E, 0x22,
+ 0x8B, 0x79, 0xF8, 0xA2, 0xFC, 0x12, 0xF9, 0x4A,
+ 0x5E, 0x48, 0x82, 0xBF, 0x87, 0x57, 0x5E, 0xDC,
+ 0xF3, 0xA7, 0x47, 0x96, 0x56, 0x00, 0xDD, 0x04,
+ 0x0E, 0x0E, 0x1B, 0x9E, 0x6B, 0x5C, 0xD0, 0xA6,
+ 0xB5, 0x7B, 0x9E, 0xB5, 0x5A, 0x19, 0xD9, 0x52,
+};
+
static const struct blockcipher_test_data
sm4_test_data_cbc = {
.crypto_algo = RTE_CRYPTO_CIPHER_SM4_CBC,
@@ -247,6 +266,35 @@ sm4_test_data_cfb = {
},
};
+static const struct blockcipher_test_data
+sm4_test_data_xts = {
+ .crypto_algo = RTE_CRYPTO_CIPHER_SM4_XTS,
+ .cipher_key = {
+ .data = {
+ 0x59, 0x32, 0x43, 0x97, 0x5c, 0xce, 0x7c, 0x8a,
+ 0x32, 0xac, 0x6b, 0x3c, 0xaf, 0x8a, 0x19, 0xc5,
+ 0x90, 0xb4, 0x46, 0x18, 0xc8, 0xbf, 0x7a, 0x18,
+ 0x23, 0x26, 0xc3, 0xb2, 0xb0, 0xa9, 0x93, 0x1c
+ },
+ .len = 32
+ },
+ .iv = {
+ .data = {
+ 0xC7, 0x2B, 0x65, 0x91, 0xA0, 0xD7, 0xDE, 0x8F,
+ 0x6B, 0x40, 0x72, 0x33, 0xAD, 0x35, 0x81, 0xD6
+ },
+ .len = 16
+ },
+ .plaintext = {
+ .data = plaintext_sm4,
+ .len = 128
+ },
+ .ciphertext = {
+ .data = ciphertext_sm4_xts,
+ .len = 128
+ },
+};
+
static const struct blockcipher_test_case sm4_cipheronly_test_cases[] = {
{
.test_descr = "SM4-CBC Encryption",
@@ -298,6 +346,16 @@ static const struct blockcipher_test_case sm4_cipheronly_test_cases[] = {
.test_data = &sm4_test_data_cfb,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
},
+ {
+ .test_descr = "SM4-XTS Encryption",
+ .test_data = &sm4_test_data_xts,
+ .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
+ },
+ {
+ .test_descr = "SM4-XTS Decryption",
+ .test_data = &sm4_test_data_xts,
+ .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
+ },
};
static const uint8_t plaintext_sm4_common[] = {
--
2.27.0
[-- Attachment #1.1.2: Type: text/html , Size: 8059 bytes --]
next prev parent reply other threads:[~2024-09-29 15:08 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 8:27 [PATCH] zsda:introduce zsda drivers and examples lhx
2024-07-02 8:52 ` David Marchand
2024-07-02 13:11 ` [EXTERNAL] " Akhil Goyal
2024-09-09 8:08 ` [PATCH v4 1/8] zsda: Introduce zsda device drivers Hanxiao Li
2024-09-10 9:15 ` [PATCH v5 " Hanxiao Li
2024-09-10 9:18 ` [PATCH v5 2/8] zsda: add support for zsdadev operations Hanxiao Li
2024-09-10 9:18 ` [PATCH v5 3/8] zsda: add support for queue operation Hanxiao Li
2024-09-10 9:18 ` [PATCH v5 4/8] zsda: add zsda compressdev driver and interface Hanxiao Li
2024-09-10 9:18 ` [PATCH v5 5/8] zsda: modify files for introducing zsda cryptodev Hanxiao Li
2024-09-10 9:18 ` [PATCH v5 6/8] zsda: add zsda crypto-pmd Hanxiao Li
2024-09-10 9:18 ` [PATCH v5 7/8] zsda: add zsda crypto-sym Hanxiao Li
2024-09-10 9:18 ` [PATCH v5 8/8] zsda: add zsda crypto-session and compile file Hanxiao Li
2024-09-11 7:52 ` [PATCH v6 1/8] zsda: Introduce zsda device drivers Hanxiao Li
2024-09-11 7:54 ` [PATCH v6 2/8] zsda: add support for zsdadev operations Hanxiao Li
2024-09-11 7:54 ` [PATCH v6 3/8] zsda: add support for queue operation Hanxiao Li
2024-09-11 16:01 ` Stephen Hemminger
2024-09-11 7:54 ` [PATCH v6 4/8] zsda: add zsda compressdev driver and interface Hanxiao Li
2024-09-11 7:54 ` [PATCH v6 5/8] zsda: modify files for introducing zsda cryptodev Hanxiao Li
2024-09-17 18:22 ` [EXTERNAL] " Akhil Goyal
2024-09-11 7:54 ` [PATCH v6 6/8] zsda: add zsda crypto-pmd Hanxiao Li
2024-09-17 18:25 ` [EXTERNAL] " Akhil Goyal
2024-09-11 7:54 ` [PATCH v6 7/8] zsda: add zsda crypto-sym Hanxiao Li
2024-09-11 7:54 ` [PATCH v6 8/8] zsda: add zsda crypto-session and compile file Hanxiao Li
2024-09-17 18:33 ` [EXTERNAL] " Akhil Goyal
2024-09-17 18:13 ` [EXTERNAL] [PATCH v6 1/8] zsda: Introduce zsda device drivers Akhil Goyal
2024-09-27 12:44 ` [PATCH v7 0/8] drivers/zsda: introduce zsda drivers Hanxiao Li
2024-09-27 13:01 ` [PATCH v7 1/8] common/zsda: add common function and log macro Hanxiao Li
2024-09-27 13:09 ` [PATCH v7 0/8] drivers/zsda: introduce zsda drivers Hanxiao Li
2024-09-27 13:09 ` [PATCH v7 2/8] common/zsda: configure device Hanxiao Li
2024-09-27 13:09 ` [PATCH v7 3/8] common/zsda: configure queues Hanxiao Li
2024-09-27 13:09 ` [PATCH v7 4/8] compress/zsda: configure drivers of compressdev Hanxiao Li
2024-09-27 13:09 ` [PATCH v7 5/8] crypto/zsda: configure drivers, sessions, capabilities of cryptodev Hanxiao Li
2024-09-27 13:09 ` [PATCH v7 6/8] lib/cryptodev: add sm4 xts for crypto Hanxiao Li
2024-09-27 13:09 ` [PATCH v7 7/8] app/test: add sm4-xts test Hanxiao Li
2024-09-27 13:09 ` [PATCH v7 8/8] doc/guides: add documents and release notes for two drivers Hanxiao Li
2024-09-29 7:35 ` Hanxiao Li
2024-09-29 14:58 ` [PATCH v8 0/8] drivers/zsda: introduce zsda drivers Hanxiao Li
2024-09-29 14:58 ` [PATCH v8 1/8] common/zsda: add common function and log macro Hanxiao Li
2024-09-29 15:04 ` [PATCH v8 2/8] common/zsda: configure device Hanxiao Li
2024-09-29 15:05 ` [PATCH v8 3/8] common/zsda: configure queues Hanxiao Li
2024-09-29 15:05 ` [PATCH v8 4/8] compress/zsda: configure drivers of compressdev Hanxiao Li
2024-09-29 15:05 ` [PATCH v8 5/8] crypto/zsda: configure drivers, sessions, capabilities of cryptodev Hanxiao Li
2024-09-29 15:05 ` [PATCH v8 6/8] lib/cryptodev: add sm4 xts for crypto Hanxiao Li
2024-09-29 15:05 ` Hanxiao Li [this message]
2024-09-29 15:05 ` [PATCH v8 8/8] doc/guides: add documents and release notes for two drivers Hanxiao Li
2024-09-29 19:41 ` Stephen Hemminger
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=20240929150512.845745-6-li.hanxiao@zte.com.cn \
--to=li.hanxiao@zte.com.cn \
--cc=dev@dpdk.org \
--cc=wang.yong19@zte.com.cn \
/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).