From: Hanxiao Li <li.hanxiao@zte.com.cn>
To: dev@dpdk.org
Cc: wang.yong19@zte.com.cn, gakhil@marvell.com,
Hanxiao Li <li.hanxiao@zte.com.cn>
Subject: [PATCH v1 2/2] app/test: add SM4-XTS test cases
Date: Fri, 11 Oct 2024 09:17:05 +0800 [thread overview]
Message-ID: <20241011011705.1428108-3-li.hanxiao@zte.com.cn> (raw)
In-Reply-To: <20241011011705.1428108-1-li.hanxiao@zte.com.cn>
[-- Attachment #1.1.1: Type: text/plain, Size: 3508 bytes --]
add support for 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: 8055 bytes --]
next prev parent reply other threads:[~2024-10-11 1:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 1:17 [PATCH v1 0/2] cryptodev: add SM4-XTS algo and " Hanxiao Li
2024-10-11 1:17 ` [PATCH v1 1/2] cryptodev: add SM4-XTS Hanxiao Li
2024-10-11 12:21 ` [EXTERNAL] " Akhil Goyal
2024-10-11 1:17 ` Hanxiao Li [this message]
2024-10-11 12:22 ` [EXTERNAL] [PATCH v1 0/2] cryptodev: add SM4-XTS algo and test cases 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=20241011011705.1428108-3-li.hanxiao@zte.com.cn \
--to=li.hanxiao@zte.com.cn \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--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).