* [PATCH 0/3] Add support for SHAKE @ 2023-01-04 14:38 Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko ` (3 more replies) 0 siblings, 4 replies; 11+ messages in thread From: Volodymyr Fialko @ 2023-01-04 14:38 UTC (permalink / raw) To: dev; +Cc: jerinj, anoobj, gakhil, Volodymyr Fialko This series defines new enums for SHAKE128 and SHAKE256 authentication algorithms and implements support for CNXK crypto PMD. Depends-on: 26375 ("cryptodev: add algo enums to string conversion APIs") Volodymyr Fialko (3): cryptodev: add SHAKE algorithm app/test: add SHAKE test cases crypto/cnxk: add support for SHAKE hash app/test/test_cryptodev_hash_test_vectors.h | 66 +++++++++++++++++++ doc/guides/cryptodevs/cnxk.rst | 2 + doc/guides/cryptodevs/features/cn10k.ini | 2 + doc/guides/cryptodevs/features/cn9k.ini | 2 + doc/guides/cryptodevs/features/default.ini | 2 + drivers/common/cnxk/roc_se.h | 4 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 40 +++++++++++ drivers/crypto/cnxk/cnxk_se.h | 15 +++++ lib/cryptodev/rte_crypto_sym.h | 7 +- lib/cryptodev/rte_cryptodev.c | 5 +- 11 files changed, 142 insertions(+), 5 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] cryptodev: add SHAKE algorithm 2023-01-04 14:38 [PATCH 0/3] Add support for SHAKE Volodymyr Fialko @ 2023-01-04 14:38 ` Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 2/3] app/test: add SHAKE test cases Volodymyr Fialko ` (2 subsequent siblings) 3 siblings, 0 replies; 11+ messages in thread From: Volodymyr Fialko @ 2023-01-04 14:38 UTC (permalink / raw) To: dev, Akhil Goyal, Fan Zhang; +Cc: jerinj, anoobj, Volodymyr Fialko Add SHAKE to enum of auth algorithms. Signed-off-by: Volodymyr Fialko <vfialko@marvell.com> --- doc/guides/cryptodevs/features/default.ini | 2 ++ lib/cryptodev/rte_crypto_sym.h | 7 ++++++- lib/cryptodev/rte_cryptodev.c | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index d51d80ff80..523da0cfa8 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -99,6 +99,8 @@ SHA3_384 HMAC = SHA3_512 = SHA3_512 HMAC = SM3 = +SHAKE_128 = +SHAKE_256 = ; ; Supported AEAD algorithms of a default crypto driver. diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index dc847da7b8..2cfe66530c 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -374,8 +374,13 @@ enum rte_crypto_auth_algorithm { /**< 512 bit SHA3 algorithm. */ RTE_CRYPTO_AUTH_SHA3_512_HMAC, /**< HMAC using 512 bit SHA3 algorithm. */ - RTE_CRYPTO_AUTH_SM3 + RTE_CRYPTO_AUTH_SM3, /**< ShangMi 3 (SM3) algorithm */ + + RTE_CRYPTO_AUTH_SHAKE_128, + /**< 128 bit SHAKE algorithm. */ + RTE_CRYPTO_AUTH_SHAKE_256, + /**< 256 bit SHAKE algorithm. */ }; /** Authentication algorithm name strings */ diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 742a4c512e..17c70023ef 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -226,7 +226,10 @@ crypto_auth_algorithm_strings[] = { [RTE_CRYPTO_AUTH_KASUMI_F9] = "kasumi-f9", [RTE_CRYPTO_AUTH_SNOW3G_UIA2] = "snow3g-uia2", [RTE_CRYPTO_AUTH_ZUC_EIA3] = "zuc-eia3", - [RTE_CRYPTO_AUTH_SM3] = "sm3" + [RTE_CRYPTO_AUTH_SM3] = "sm3", + + [RTE_CRYPTO_AUTH_SHAKE_128] = "shake-128", + [RTE_CRYPTO_AUTH_SHAKE_256] = "shake-256", }; /** -- 2.34.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] app/test: add SHAKE test cases 2023-01-04 14:38 [PATCH 0/3] Add support for SHAKE Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko @ 2023-01-04 14:38 ` Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 3/3] crypto/cnxk: add support for SHAKE hash Volodymyr Fialko 2023-01-12 10:47 ` [PATCH v2 0/3] Add support for SHAKE Volodymyr Fialko 3 siblings, 0 replies; 11+ messages in thread From: Volodymyr Fialko @ 2023-01-04 14:38 UTC (permalink / raw) To: dev, Akhil Goyal, Fan Zhang, Yipeng Wang, Sameh Gobriel, Bruce Richardson, Vladimir Medvedkin Cc: jerinj, anoobj, Volodymyr Fialko Add test cases for SHAKE hash algorithm for Digest and Digest-Verify. Signed-off-by: Volodymyr Fialko <vfialko@marvell.com> --- app/test/test_cryptodev_hash_test_vectors.h | 66 +++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index 4b57286fa5..fa9986a4da 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -538,6 +538,52 @@ hmac_sha3_512_test_vector = { } }; +static const struct blockcipher_test_data +shake_128_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_SHAKE_128, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .digest = { + .data = { + 0x69, 0xBD, 0xD5, 0x14, 0x85, 0xE0, 0x44, 0xA4, + 0x25, 0xE6, 0x9F, 0x81, 0xC8, 0x18, 0x58, 0x3E, + 0xFE, 0xC9, 0x0B, 0xAD, 0x27, 0x98, 0x14, 0x3F, + 0xB9, 0x7D, 0x68, 0x4D, 0x60, 0x77, 0x82, 0x64, + 0x6D, 0x64, 0x66, 0x67, 0xFA, 0xBC, 0x4F, 0xAC, + 0x9C, 0x75, 0x8D, 0x63, 0xBA, 0xBD, 0x2B, 0x03, + 0x0F, 0x2F, 0x46, 0x15, 0x88, 0xF0, 0x8C, 0x09, + 0xAC, 0x87, 0x84, 0x5B, 0xCA, 0x65, 0xA1, 0x14 + }, + .len = 64, + .truncated_len = 64 + } +}; + +static const struct blockcipher_test_data +shake_256_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_SHAKE_256, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .digest = { + .data = { + 0x9E, 0xA2, 0x1B, 0x84, 0x15, 0x0E, 0xF0, 0x46, + 0xD9, 0xA9, 0x11, 0x02, 0x11, 0x67, 0x9A, 0xDC, + 0x62, 0x95, 0x8C, 0xD6, 0xEF, 0x89, 0x35, 0x8C, + 0xBF, 0x41, 0x5F, 0x23, 0x16, 0xBD, 0x0C, 0xDE, + 0xEC, 0x1D, 0x47, 0x90, 0xA4, 0xD9, 0x18, 0x63, + 0xE1, 0x60, 0xF8, 0xAF, 0x0F, 0x57, 0xBA, 0xCA, + 0x5D, 0x97, 0x58, 0xF5, 0xFF, 0xE4, 0x85, 0x40, + 0xCA, 0x7D, 0xB8, 0x35, 0x3B, 0x89, 0xCA, 0x34 + }, + .len = 64, + .truncated_len = 64 + } +}; + static const struct blockcipher_test_data cmac_test_vector = { .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, @@ -853,6 +899,26 @@ static const struct blockcipher_test_case hash_test_cases[] = { .test_data = &hmac_sha3_512_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, }, + { + .test_descr = "SHAKE_128 Digest", + .test_data = &shake_128_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "SHAKE_128 Digest Verify", + .test_data = &shake_128_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, + { + .test_descr = "SHAKE_256 Digest", + .test_data = &shake_256_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "SHAKE_256 Digest Verify", + .test_data = &shake_256_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, { .test_descr = "CMAC Digest 12B", .test_data = &cmac_test_vector_12, -- 2.34.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] crypto/cnxk: add support for SHAKE hash 2023-01-04 14:38 [PATCH 0/3] Add support for SHAKE Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 2/3] app/test: add SHAKE test cases Volodymyr Fialko @ 2023-01-04 14:38 ` Volodymyr Fialko 2023-01-12 10:47 ` [PATCH v2 0/3] Add support for SHAKE Volodymyr Fialko 3 siblings, 0 replies; 11+ messages in thread From: Volodymyr Fialko @ 2023-01-04 14:38 UTC (permalink / raw) To: dev, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao Cc: jerinj, gakhil, Volodymyr Fialko Add support for SHAKE hash and hmac operations Signed-off-by: Volodymyr Fialko <vfialko@marvell.com> --- doc/guides/cryptodevs/cnxk.rst | 2 + doc/guides/cryptodevs/features/cn10k.ini | 2 + doc/guides/cryptodevs/features/cn9k.ini | 2 + drivers/common/cnxk/roc_se.h | 4 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 40 +++++++++++++++++++ drivers/crypto/cnxk/cnxk_se.h | 15 +++++++ 7 files changed, 64 insertions(+), 3 deletions(-) diff --git a/doc/guides/cryptodevs/cnxk.rst b/doc/guides/cryptodevs/cnxk.rst index 9b01e04e5f..3c2e38fefd 100644 --- a/doc/guides/cryptodevs/cnxk.rst +++ b/doc/guides/cryptodevs/cnxk.rst @@ -67,6 +67,8 @@ Hash algorithms: * ``RTE_CRYPTO_AUTH_SHA3_384_HMAC`` * ``RTE_CRYPTO_AUTH_SHA3_512`` * ``RTE_CRYPTO_AUTH_SHA3_512_HMAC`` +* ``RTE_CRYPTO_AUTH_SHAKE_128`` +* ``RTE_CRYPTO_AUTH_SHAKE_256`` * ``RTE_CRYPTO_AUTH_SNOW3G_UIA2`` * ``RTE_CRYPTO_AUTH_ZUC_EIA3`` * ``RTE_CRYPTO_AUTH_AES_CMAC`` diff --git a/doc/guides/cryptodevs/features/cn10k.ini b/doc/guides/cryptodevs/features/cn10k.ini index 44b61663fc..162d1a25ca 100644 --- a/doc/guides/cryptodevs/features/cn10k.ini +++ b/doc/guides/cryptodevs/features/cn10k.ini @@ -71,6 +71,8 @@ SHA3_384 = Y SHA3_384 HMAC = Y SHA3_512 = Y SHA3_512 HMAC = Y +SHAKE_128 = Y +SHAKE_256 = Y ; ; Supported AEAD algorithms of 'cn10k' crypto driver. diff --git a/doc/guides/cryptodevs/features/cn9k.ini b/doc/guides/cryptodevs/features/cn9k.ini index e7b287db26..bbed4b2e23 100644 --- a/doc/guides/cryptodevs/features/cn9k.ini +++ b/doc/guides/cryptodevs/features/cn9k.ini @@ -72,6 +72,8 @@ SHA3_384 = Y SHA3_384 HMAC = Y SHA3_512 = Y SHA3_512 HMAC = Y +SHAKE_128 = Y +SHAKE_256 = Y ; ; Supported AEAD algorithms of 'cn9k' crypto driver. diff --git a/drivers/common/cnxk/roc_se.h b/drivers/common/cnxk/roc_se.h index c357c19c0b..f4a5a32522 100644 --- a/drivers/common/cnxk/roc_se.h +++ b/drivers/common/cnxk/roc_se.h @@ -92,8 +92,8 @@ typedef enum { ROC_SE_SHA3_SHA256 = 11, ROC_SE_SHA3_SHA384 = 12, ROC_SE_SHA3_SHA512 = 13, - ROC_SE_SHA3_SHAKE256 = 14, - ROC_SE_SHA3_SHAKE512 = 15, + ROC_SE_SHA3_SHAKE128 = 14, + ROC_SE_SHA3_SHAKE256 = 15, /* These are only for software use */ ROC_SE_ZUC_EIA3 = 0x90, diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h index 8241ee67d0..dd7dd3bc3a 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev.h +++ b/drivers/crypto/cnxk/cnxk_cryptodev.h @@ -10,7 +10,7 @@ #include "roc_cpt.h" -#define CNXK_CPT_MAX_CAPS 45 +#define CNXK_CPT_MAX_CAPS 47 #define CNXK_SEC_CRYPTO_MAX_CAPS 16 #define CNXK_SEC_MAX_CAPS 9 #define CNXK_AE_EC_ID_MAX 8 diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c index 60514a32aa..78789c3e28 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -498,6 +498,46 @@ static const struct rte_cryptodev_capabilities caps_sha3[] = { }, } }, } }, + { /* SHAKE_128 */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHAKE_128, + .block_size = 168, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 1, + .max = 255, + .increment = 1 + }, + }, } + }, } + }, + { /* SHAKE_256 */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHAKE_256, + .block_size = 136, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 1, + .max = 255, + .increment = 1 + }, + }, } + }, } + }, }; static const struct rte_cryptodev_capabilities caps_chacha20[] = { diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 4b0cc4df19..6a651119b3 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -183,6 +183,13 @@ cpt_mac_len_verify(struct rte_crypto_auth_xform *auth) case RTE_CRYPTO_AUTH_SHA3_512_HMAC: ret = (mac_len <= 64) ? 0 : -1; break; + /* SHAKE itself doesn't have limitation of digest length, + * but in microcode size of length field is limited to 8 bits + */ + case RTE_CRYPTO_AUTH_SHAKE_128: + case RTE_CRYPTO_AUTH_SHAKE_256: + ret = (mac_len <= UINT8_MAX) ? 0 : -1; + break; case RTE_CRYPTO_AUTH_NULL: ret = 0; break; @@ -2204,6 +2211,14 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) is_sha3 = 1; auth_type = ROC_SE_SHA3_SHA512; break; + case RTE_CRYPTO_AUTH_SHAKE_128: + is_sha3 = 1; + auth_type = ROC_SE_SHA3_SHAKE128; + break; + case RTE_CRYPTO_AUTH_SHAKE_256: + is_sha3 = 1; + auth_type = ROC_SE_SHA3_SHAKE256; + break; case RTE_CRYPTO_AUTH_MD5_HMAC: case RTE_CRYPTO_AUTH_MD5: auth_type = ROC_SE_MD5_TYPE; -- 2.34.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 0/3] Add support for SHAKE 2023-01-04 14:38 [PATCH 0/3] Add support for SHAKE Volodymyr Fialko ` (2 preceding siblings ...) 2023-01-04 14:38 ` [PATCH 3/3] crypto/cnxk: add support for SHAKE hash Volodymyr Fialko @ 2023-01-12 10:47 ` Volodymyr Fialko 2023-01-12 10:47 ` [PATCH v2 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko ` (3 more replies) 3 siblings, 4 replies; 11+ messages in thread From: Volodymyr Fialko @ 2023-01-12 10:47 UTC (permalink / raw) To: dev; +Cc: jerinj, anoobj, Volodymyr Fialko This series defines new enums for SHAKE128 and SHAKE256 authentication algorithms and implements support for CNXK crypto PMD. v2: - rebased for dpdk-next-crypto Volodymyr Fialko (3): cryptodev: add SHAKE algorithm app/test: add SHAKE test cases crypto/cnxk: add support for SHAKE hash app/test/test_cryptodev_hash_test_vectors.h | 66 +++++++++++++++++++ doc/guides/cryptodevs/cnxk.rst | 2 + doc/guides/cryptodevs/features/cn10k.ini | 2 + doc/guides/cryptodevs/features/cn9k.ini | 2 + doc/guides/cryptodevs/features/default.ini | 2 + drivers/common/cnxk/roc_se.h | 4 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 40 +++++++++++ drivers/crypto/cnxk/cnxk_se.h | 15 +++++ lib/cryptodev/rte_crypto_sym.h | 7 +- lib/cryptodev/rte_cryptodev.c | 5 +- 11 files changed, 142 insertions(+), 5 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/3] cryptodev: add SHAKE algorithm 2023-01-12 10:47 ` [PATCH v2 0/3] Add support for SHAKE Volodymyr Fialko @ 2023-01-12 10:47 ` Volodymyr Fialko 2023-01-30 19:24 ` Akhil Goyal 2023-01-12 10:47 ` [PATCH v2 2/3] app/test: add SHAKE test cases Volodymyr Fialko ` (2 subsequent siblings) 3 siblings, 1 reply; 11+ messages in thread From: Volodymyr Fialko @ 2023-01-12 10:47 UTC (permalink / raw) To: dev, Akhil Goyal, Fan Zhang; +Cc: jerinj, anoobj, Volodymyr Fialko Add SHAKE to enum of auth algorithms. Signed-off-by: Volodymyr Fialko <vfialko@marvell.com> --- doc/guides/cryptodevs/features/default.ini | 2 ++ lib/cryptodev/rte_crypto_sym.h | 7 ++++++- lib/cryptodev/rte_cryptodev.c | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index d51d80ff80..523da0cfa8 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -99,6 +99,8 @@ SHA3_384 HMAC = SHA3_512 = SHA3_512 HMAC = SM3 = +SHAKE_128 = +SHAKE_256 = ; ; Supported AEAD algorithms of a default crypto driver. diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index dc847da7b8..2cfe66530c 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -374,8 +374,13 @@ enum rte_crypto_auth_algorithm { /**< 512 bit SHA3 algorithm. */ RTE_CRYPTO_AUTH_SHA3_512_HMAC, /**< HMAC using 512 bit SHA3 algorithm. */ - RTE_CRYPTO_AUTH_SM3 + RTE_CRYPTO_AUTH_SM3, /**< ShangMi 3 (SM3) algorithm */ + + RTE_CRYPTO_AUTH_SHAKE_128, + /**< 128 bit SHAKE algorithm. */ + RTE_CRYPTO_AUTH_SHAKE_256, + /**< 256 bit SHAKE algorithm. */ }; /** Authentication algorithm name strings */ diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 742a4c512e..17c70023ef 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -226,7 +226,10 @@ crypto_auth_algorithm_strings[] = { [RTE_CRYPTO_AUTH_KASUMI_F9] = "kasumi-f9", [RTE_CRYPTO_AUTH_SNOW3G_UIA2] = "snow3g-uia2", [RTE_CRYPTO_AUTH_ZUC_EIA3] = "zuc-eia3", - [RTE_CRYPTO_AUTH_SM3] = "sm3" + [RTE_CRYPTO_AUTH_SM3] = "sm3", + + [RTE_CRYPTO_AUTH_SHAKE_128] = "shake-128", + [RTE_CRYPTO_AUTH_SHAKE_256] = "shake-256", }; /** -- 2.34.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH v2 1/3] cryptodev: add SHAKE algorithm 2023-01-12 10:47 ` [PATCH v2 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko @ 2023-01-30 19:24 ` Akhil Goyal 0 siblings, 0 replies; 11+ messages in thread From: Akhil Goyal @ 2023-01-30 19:24 UTC (permalink / raw) To: Volodymyr Fialko, dev, Fan Zhang Cc: Jerin Jacob Kollanukkaran, Anoob Joseph, Volodymyr Fialko, Kai Ji > -----Original Message----- > From: Volodymyr Fialko <vfialko@marvell.com> > Sent: Thursday, January 12, 2023 4:18 PM > To: dev@dpdk.org; Akhil Goyal <gakhil@marvell.com>; Fan Zhang > <fanzhang.oss@gmail.com> > Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Anoob Joseph > <anoobj@marvell.com>; Volodymyr Fialko <vfialko@marvell.com> > Subject: [PATCH v2 1/3] cryptodev: add SHAKE algorithm > > Add SHAKE to enum of auth algorithms. > > Signed-off-by: Volodymyr Fialko <vfialko@marvell.com> Acked-by: Akhil Goyal <gakhil@marvell.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/3] app/test: add SHAKE test cases 2023-01-12 10:47 ` [PATCH v2 0/3] Add support for SHAKE Volodymyr Fialko 2023-01-12 10:47 ` [PATCH v2 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko @ 2023-01-12 10:47 ` Volodymyr Fialko 2023-01-30 19:25 ` Akhil Goyal 2023-01-12 10:47 ` [PATCH v2 3/3] crypto/cnxk: add support for SHAKE hash Volodymyr Fialko 2023-01-31 8:10 ` [EXT] [PATCH v2 0/3] Add support for SHAKE Akhil Goyal 3 siblings, 1 reply; 11+ messages in thread From: Volodymyr Fialko @ 2023-01-12 10:47 UTC (permalink / raw) To: dev, Yipeng Wang, Sameh Gobriel, Bruce Richardson, Vladimir Medvedkin, Akhil Goyal, Fan Zhang Cc: jerinj, anoobj, Volodymyr Fialko Add test cases for SHAKE hash algorithm for Digest and Digest-Verify. Signed-off-by: Volodymyr Fialko <vfialko@marvell.com> --- app/test/test_cryptodev_hash_test_vectors.h | 66 +++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index 4b57286fa5..fa9986a4da 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -538,6 +538,52 @@ hmac_sha3_512_test_vector = { } }; +static const struct blockcipher_test_data +shake_128_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_SHAKE_128, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .digest = { + .data = { + 0x69, 0xBD, 0xD5, 0x14, 0x85, 0xE0, 0x44, 0xA4, + 0x25, 0xE6, 0x9F, 0x81, 0xC8, 0x18, 0x58, 0x3E, + 0xFE, 0xC9, 0x0B, 0xAD, 0x27, 0x98, 0x14, 0x3F, + 0xB9, 0x7D, 0x68, 0x4D, 0x60, 0x77, 0x82, 0x64, + 0x6D, 0x64, 0x66, 0x67, 0xFA, 0xBC, 0x4F, 0xAC, + 0x9C, 0x75, 0x8D, 0x63, 0xBA, 0xBD, 0x2B, 0x03, + 0x0F, 0x2F, 0x46, 0x15, 0x88, 0xF0, 0x8C, 0x09, + 0xAC, 0x87, 0x84, 0x5B, 0xCA, 0x65, 0xA1, 0x14 + }, + .len = 64, + .truncated_len = 64 + } +}; + +static const struct blockcipher_test_data +shake_256_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_SHAKE_256, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .digest = { + .data = { + 0x9E, 0xA2, 0x1B, 0x84, 0x15, 0x0E, 0xF0, 0x46, + 0xD9, 0xA9, 0x11, 0x02, 0x11, 0x67, 0x9A, 0xDC, + 0x62, 0x95, 0x8C, 0xD6, 0xEF, 0x89, 0x35, 0x8C, + 0xBF, 0x41, 0x5F, 0x23, 0x16, 0xBD, 0x0C, 0xDE, + 0xEC, 0x1D, 0x47, 0x90, 0xA4, 0xD9, 0x18, 0x63, + 0xE1, 0x60, 0xF8, 0xAF, 0x0F, 0x57, 0xBA, 0xCA, + 0x5D, 0x97, 0x58, 0xF5, 0xFF, 0xE4, 0x85, 0x40, + 0xCA, 0x7D, 0xB8, 0x35, 0x3B, 0x89, 0xCA, 0x34 + }, + .len = 64, + .truncated_len = 64 + } +}; + static const struct blockcipher_test_data cmac_test_vector = { .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, @@ -853,6 +899,26 @@ static const struct blockcipher_test_case hash_test_cases[] = { .test_data = &hmac_sha3_512_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, }, + { + .test_descr = "SHAKE_128 Digest", + .test_data = &shake_128_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "SHAKE_128 Digest Verify", + .test_data = &shake_128_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, + { + .test_descr = "SHAKE_256 Digest", + .test_data = &shake_256_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "SHAKE_256 Digest Verify", + .test_data = &shake_256_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, { .test_descr = "CMAC Digest 12B", .test_data = &cmac_test_vector_12, -- 2.34.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH v2 2/3] app/test: add SHAKE test cases 2023-01-12 10:47 ` [PATCH v2 2/3] app/test: add SHAKE test cases Volodymyr Fialko @ 2023-01-30 19:25 ` Akhil Goyal 0 siblings, 0 replies; 11+ messages in thread From: Akhil Goyal @ 2023-01-30 19:25 UTC (permalink / raw) To: Volodymyr Fialko, dev, Yipeng Wang, Sameh Gobriel, Bruce Richardson, Vladimir Medvedkin, Fan Zhang Cc: Jerin Jacob Kollanukkaran, Anoob Joseph, Volodymyr Fialko > Subject: [PATCH v2 2/3] app/test: add SHAKE test cases > > Add test cases for SHAKE hash algorithm for Digest and Digest-Verify. > > Signed-off-by: Volodymyr Fialko <vfialko@marvell.com> > --- Acked-by: Akhil Goyal <gakhil@marvell.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 3/3] crypto/cnxk: add support for SHAKE hash 2023-01-12 10:47 ` [PATCH v2 0/3] Add support for SHAKE Volodymyr Fialko 2023-01-12 10:47 ` [PATCH v2 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko 2023-01-12 10:47 ` [PATCH v2 2/3] app/test: add SHAKE test cases Volodymyr Fialko @ 2023-01-12 10:47 ` Volodymyr Fialko 2023-01-31 8:10 ` [EXT] [PATCH v2 0/3] Add support for SHAKE Akhil Goyal 3 siblings, 0 replies; 11+ messages in thread From: Volodymyr Fialko @ 2023-01-12 10:47 UTC (permalink / raw) To: dev, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao Cc: jerinj, Volodymyr Fialko Add support for SHAKE hash and hmac operations Signed-off-by: Volodymyr Fialko <vfialko@marvell.com> --- doc/guides/cryptodevs/cnxk.rst | 2 + doc/guides/cryptodevs/features/cn10k.ini | 2 + doc/guides/cryptodevs/features/cn9k.ini | 2 + drivers/common/cnxk/roc_se.h | 4 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 40 +++++++++++++++++++ drivers/crypto/cnxk/cnxk_se.h | 15 +++++++ 7 files changed, 64 insertions(+), 3 deletions(-) diff --git a/doc/guides/cryptodevs/cnxk.rst b/doc/guides/cryptodevs/cnxk.rst index 9b01e04e5f..3c2e38fefd 100644 --- a/doc/guides/cryptodevs/cnxk.rst +++ b/doc/guides/cryptodevs/cnxk.rst @@ -67,6 +67,8 @@ Hash algorithms: * ``RTE_CRYPTO_AUTH_SHA3_384_HMAC`` * ``RTE_CRYPTO_AUTH_SHA3_512`` * ``RTE_CRYPTO_AUTH_SHA3_512_HMAC`` +* ``RTE_CRYPTO_AUTH_SHAKE_128`` +* ``RTE_CRYPTO_AUTH_SHAKE_256`` * ``RTE_CRYPTO_AUTH_SNOW3G_UIA2`` * ``RTE_CRYPTO_AUTH_ZUC_EIA3`` * ``RTE_CRYPTO_AUTH_AES_CMAC`` diff --git a/doc/guides/cryptodevs/features/cn10k.ini b/doc/guides/cryptodevs/features/cn10k.ini index 44b61663fc..162d1a25ca 100644 --- a/doc/guides/cryptodevs/features/cn10k.ini +++ b/doc/guides/cryptodevs/features/cn10k.ini @@ -71,6 +71,8 @@ SHA3_384 = Y SHA3_384 HMAC = Y SHA3_512 = Y SHA3_512 HMAC = Y +SHAKE_128 = Y +SHAKE_256 = Y ; ; Supported AEAD algorithms of 'cn10k' crypto driver. diff --git a/doc/guides/cryptodevs/features/cn9k.ini b/doc/guides/cryptodevs/features/cn9k.ini index e7b287db26..bbed4b2e23 100644 --- a/doc/guides/cryptodevs/features/cn9k.ini +++ b/doc/guides/cryptodevs/features/cn9k.ini @@ -72,6 +72,8 @@ SHA3_384 = Y SHA3_384 HMAC = Y SHA3_512 = Y SHA3_512 HMAC = Y +SHAKE_128 = Y +SHAKE_256 = Y ; ; Supported AEAD algorithms of 'cn9k' crypto driver. diff --git a/drivers/common/cnxk/roc_se.h b/drivers/common/cnxk/roc_se.h index e9415f21a5..6758142214 100644 --- a/drivers/common/cnxk/roc_se.h +++ b/drivers/common/cnxk/roc_se.h @@ -85,8 +85,8 @@ typedef enum { ROC_SE_SHA3_SHA256 = 11, ROC_SE_SHA3_SHA384 = 12, ROC_SE_SHA3_SHA512 = 13, - ROC_SE_SHA3_SHAKE256 = 14, - ROC_SE_SHA3_SHAKE512 = 15, + ROC_SE_SHA3_SHAKE128 = 14, + ROC_SE_SHA3_SHAKE256 = 15, /* These are only for software use */ ROC_SE_ZUC_EIA3 = 0x90, diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h index 8241ee67d0..dd7dd3bc3a 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev.h +++ b/drivers/crypto/cnxk/cnxk_cryptodev.h @@ -10,7 +10,7 @@ #include "roc_cpt.h" -#define CNXK_CPT_MAX_CAPS 45 +#define CNXK_CPT_MAX_CAPS 47 #define CNXK_SEC_CRYPTO_MAX_CAPS 16 #define CNXK_SEC_MAX_CAPS 9 #define CNXK_AE_EC_ID_MAX 8 diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c index b2197a12be..d2ae4b5bff 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -498,6 +498,46 @@ static const struct rte_cryptodev_capabilities caps_sha3[] = { }, } }, } }, + { /* SHAKE_128 */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHAKE_128, + .block_size = 168, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 1, + .max = 255, + .increment = 1 + }, + }, } + }, } + }, + { /* SHAKE_256 */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHAKE_256, + .block_size = 136, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 1, + .max = 255, + .increment = 1 + }, + }, } + }, } + }, }; static const struct rte_cryptodev_capabilities caps_chacha20[] = { diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 0e5d2dde39..c16027ec75 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -192,6 +192,13 @@ cpt_mac_len_verify(struct rte_crypto_auth_xform *auth) case RTE_CRYPTO_AUTH_SHA3_512_HMAC: ret = (mac_len <= 64) ? 0 : -1; break; + /* SHAKE itself doesn't have limitation of digest length, + * but in microcode size of length field is limited to 8 bits + */ + case RTE_CRYPTO_AUTH_SHAKE_128: + case RTE_CRYPTO_AUTH_SHAKE_256: + ret = (mac_len <= UINT8_MAX) ? 0 : -1; + break; case RTE_CRYPTO_AUTH_NULL: ret = 0; break; @@ -1949,6 +1956,14 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) is_sha3 = 1; auth_type = ROC_SE_SHA3_SHA512; break; + case RTE_CRYPTO_AUTH_SHAKE_128: + is_sha3 = 1; + auth_type = ROC_SE_SHA3_SHAKE128; + break; + case RTE_CRYPTO_AUTH_SHAKE_256: + is_sha3 = 1; + auth_type = ROC_SE_SHA3_SHAKE256; + break; case RTE_CRYPTO_AUTH_MD5_HMAC: case RTE_CRYPTO_AUTH_MD5: auth_type = ROC_SE_MD5_TYPE; -- 2.34.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [EXT] [PATCH v2 0/3] Add support for SHAKE 2023-01-12 10:47 ` [PATCH v2 0/3] Add support for SHAKE Volodymyr Fialko ` (2 preceding siblings ...) 2023-01-12 10:47 ` [PATCH v2 3/3] crypto/cnxk: add support for SHAKE hash Volodymyr Fialko @ 2023-01-31 8:10 ` Akhil Goyal 3 siblings, 0 replies; 11+ messages in thread From: Akhil Goyal @ 2023-01-31 8:10 UTC (permalink / raw) To: Volodymyr Fialko, dev Cc: Jerin Jacob Kollanukkaran, Anoob Joseph, Volodymyr Fialko > This series defines new enums for SHAKE128 and SHAKE256 authentication > algorithms and implements support for CNXK crypto PMD. > > v2: > - rebased for dpdk-next-crypto > > Volodymyr Fialko (3): > cryptodev: add SHAKE algorithm > app/test: add SHAKE test cases > crypto/cnxk: add support for SHAKE hash > > app/test/test_cryptodev_hash_test_vectors.h | 66 +++++++++++++++++++ > doc/guides/cryptodevs/cnxk.rst | 2 + > doc/guides/cryptodevs/features/cn10k.ini | 2 + > doc/guides/cryptodevs/features/cn9k.ini | 2 + > doc/guides/cryptodevs/features/default.ini | 2 + > drivers/common/cnxk/roc_se.h | 4 +- > drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- > .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 40 +++++++++++ > drivers/crypto/cnxk/cnxk_se.h | 15 +++++ > lib/cryptodev/rte_crypto_sym.h | 7 +- > lib/cryptodev/rte_cryptodev.c | 5 +- > 11 files changed, 142 insertions(+), 5 deletions(-) > Series Acked-by: Akhil Goyal <gakhil@marvell.com> Applied to dpdk-next-crypto Added release notes. Please make sure to add it in future. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-01-31 8:11 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-01-04 14:38 [PATCH 0/3] Add support for SHAKE Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 2/3] app/test: add SHAKE test cases Volodymyr Fialko 2023-01-04 14:38 ` [PATCH 3/3] crypto/cnxk: add support for SHAKE hash Volodymyr Fialko 2023-01-12 10:47 ` [PATCH v2 0/3] Add support for SHAKE Volodymyr Fialko 2023-01-12 10:47 ` [PATCH v2 1/3] cryptodev: add SHAKE algorithm Volodymyr Fialko 2023-01-30 19:24 ` Akhil Goyal 2023-01-12 10:47 ` [PATCH v2 2/3] app/test: add SHAKE test cases Volodymyr Fialko 2023-01-30 19:25 ` Akhil Goyal 2023-01-12 10:47 ` [PATCH v2 3/3] crypto/cnxk: add support for SHAKE hash Volodymyr Fialko 2023-01-31 8:10 ` [EXT] [PATCH v2 0/3] Add support for SHAKE 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).