* [PATCH v1 0/2] cryptodev: add SM4-XTS algo and test cases @ 2024-10-11 1:17 Hanxiao Li 2024-10-11 1:17 ` [PATCH v1 1/2] cryptodev: add SM4-XTS Hanxiao Li ` (2 more replies) 0 siblings, 3 replies; 5+ messages in thread From: Hanxiao Li @ 2024-10-11 1:17 UTC (permalink / raw) To: dev; +Cc: wang.yong19, gakhil, Hanxiao Li [-- Attachment #1.1.1: Type: text/plain, Size: 584 bytes --] v1: - add SM4-XTS algo and test cases. Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn> --- Hanxiao Li (2): cryptodev: add SM4-XTS app/test: add SM4-XTS test cases app/test/test_cryptodev_blockcipher.c | 3 +- app/test/test_cryptodev_sm4_test_vectors.h | 58 ++++++++++++++++++++++ doc/guides/cryptodevs/features/default.ini | 1 + doc/guides/rel_notes/release_24_11.rst | 4 ++ lib/cryptodev/rte_crypto_sym.h | 4 +- lib/cryptodev/rte_cryptodev.c | 3 +- 6 files changed, 70 insertions(+), 3 deletions(-) -- 2.27.0 [-- Attachment #1.1.2: Type: text/html , Size: 1138 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/2] cryptodev: add SM4-XTS 2024-10-11 1:17 [PATCH v1 0/2] cryptodev: add SM4-XTS algo and test cases Hanxiao Li @ 2024-10-11 1:17 ` Hanxiao Li 2024-10-11 12:21 ` [EXTERNAL] " Akhil Goyal 2024-10-11 1:17 ` [PATCH v1 2/2] app/test: add SM4-XTS test cases Hanxiao Li 2024-10-11 12:22 ` [EXTERNAL] [PATCH v1 0/2] cryptodev: add SM4-XTS algo and " Akhil Goyal 2 siblings, 1 reply; 5+ messages in thread From: Hanxiao Li @ 2024-10-11 1:17 UTC (permalink / raw) To: dev; +Cc: wang.yong19, gakhil, Hanxiao Li [-- Attachment #1.1.1: Type: text/plain, Size: 2422 bytes --] add sm4-xts algo for crypto. Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn> --- doc/guides/cryptodevs/features/default.ini | 1 + doc/guides/rel_notes/release_24_11.rst | 4 ++++ lib/cryptodev/rte_crypto_sym.h | 4 +++- lib/cryptodev/rte_cryptodev.c | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index f411d4bab7..0d62bb0d4a 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -67,6 +67,7 @@ SM4 CBC = SM4 CTR = SM4 CFB = SM4 OFB = +SM4 XTS = ; ; Supported authentication algorithms of a default crypto driver. diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index 0ff70d9057..65c5e13136 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -24,6 +24,10 @@ DPDK Release 24.11 New Features ------------ +* **Added new algorithms to cryptodev.** + + * Added symmetric cipher algorithm ShangMi 4 (SM4) in XTS modes. + .. This section should contain new features added in this release. Sample format: diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index 53b18b9412..b34d041fe0 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -176,8 +176,10 @@ enum rte_crypto_cipher_algorithm { /**< ShangMi 4 (SM4) algorithm in CTR mode */ RTE_CRYPTO_CIPHER_SM4_OFB, /**< ShangMi 4 (SM4) algorithm in OFB mode */ - RTE_CRYPTO_CIPHER_SM4_CFB + RTE_CRYPTO_CIPHER_SM4_CFB, /**< ShangMi 4 (SM4) algorithm in CFB mode */ + RTE_CRYPTO_CIPHER_SM4_XTS + /**< ShangMi 4 (SM4) algorithm in XTS mode */ }; /** Symmetric Cipher Direction */ diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 682c9f49d0..83ead956a8 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -97,7 +97,8 @@ crypto_cipher_algorithm_strings[] = { [RTE_CRYPTO_CIPHER_SM4_CBC] = "sm4-cbc", [RTE_CRYPTO_CIPHER_SM4_CTR] = "sm4-ctr", [RTE_CRYPTO_CIPHER_SM4_CFB] = "sm4-cfb", - [RTE_CRYPTO_CIPHER_SM4_OFB] = "sm4-ofb" + [RTE_CRYPTO_CIPHER_SM4_OFB] = "sm4-ofb", + [RTE_CRYPTO_CIPHER_SM4_XTS] = "sm4-xts" }; /** -- 2.27.0 [-- Attachment #1.1.2: Type: text/html , Size: 4559 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [EXTERNAL] [PATCH v1 1/2] cryptodev: add SM4-XTS 2024-10-11 1:17 ` [PATCH v1 1/2] cryptodev: add SM4-XTS Hanxiao Li @ 2024-10-11 12:21 ` Akhil Goyal 0 siblings, 0 replies; 5+ messages in thread From: Akhil Goyal @ 2024-10-11 12:21 UTC (permalink / raw) To: Hanxiao Li, dev; +Cc: wang.yong19 > add sm4-xts algo for crypto. > > Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn> > --- > doc/guides/cryptodevs/features/default.ini | 1 + > doc/guides/rel_notes/release_24_11.rst | 4 ++++ > lib/cryptodev/rte_crypto_sym.h | 4 +++- > lib/cryptodev/rte_cryptodev.c | 3 ++- > 4 files changed, 10 insertions(+), 2 deletions(-) Acked-by: Akhil Goyal <gakhil@marvell.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] app/test: add SM4-XTS test cases 2024-10-11 1:17 [PATCH v1 0/2] cryptodev: add SM4-XTS algo and test cases Hanxiao Li 2024-10-11 1:17 ` [PATCH v1 1/2] cryptodev: add SM4-XTS Hanxiao Li @ 2024-10-11 1:17 ` Hanxiao Li 2024-10-11 12:22 ` [EXTERNAL] [PATCH v1 0/2] cryptodev: add SM4-XTS algo and " Akhil Goyal 2 siblings, 0 replies; 5+ messages in thread From: Hanxiao Li @ 2024-10-11 1:17 UTC (permalink / raw) To: dev; +Cc: wang.yong19, gakhil, Hanxiao Li [-- 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 --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [EXTERNAL] [PATCH v1 0/2] cryptodev: add SM4-XTS algo and test cases 2024-10-11 1:17 [PATCH v1 0/2] cryptodev: add SM4-XTS algo and test cases Hanxiao Li 2024-10-11 1:17 ` [PATCH v1 1/2] cryptodev: add SM4-XTS Hanxiao Li 2024-10-11 1:17 ` [PATCH v1 2/2] app/test: add SM4-XTS test cases Hanxiao Li @ 2024-10-11 12:22 ` Akhil Goyal 2 siblings, 0 replies; 5+ messages in thread From: Akhil Goyal @ 2024-10-11 12:22 UTC (permalink / raw) To: Hanxiao Li, dev; +Cc: wang.yong19 > v1: > - add SM4-XTS algo and test cases. > > Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn> > > --- > Hanxiao Li (2): > cryptodev: add SM4-XTS > app/test: add SM4-XTS test cases > > app/test/test_cryptodev_blockcipher.c | 3 +- > app/test/test_cryptodev_sm4_test_vectors.h | 58 ++++++++++++++++++++++ > doc/guides/cryptodevs/features/default.ini | 1 + > doc/guides/rel_notes/release_24_11.rst | 4 ++ > lib/cryptodev/rte_crypto_sym.h | 4 +- > lib/cryptodev/rte_cryptodev.c | 3 +- > 6 files changed, 70 insertions(+), 3 deletions(-) > Applied to dpdk-next-crypto Thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-11 12:22 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-10-11 1:17 [PATCH v1 0/2] cryptodev: add SM4-XTS algo and test cases 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 ` [PATCH v1 2/2] app/test: add SM4-XTS test cases Hanxiao Li 2024-10-11 12:22 ` [EXTERNAL] [PATCH v1 0/2] cryptodev: add SM4-XTS algo and " Akhil Goyal
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).