DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/aesni_mb: add SHA support
@ 2018-11-15 17:24 Fan Zhang
  2018-12-13 15:18 ` [dpdk-dev] [PATCH v2] crypto/aesni_mb: add plain sha support Fan Zhang
  0 siblings, 1 reply; 11+ messages in thread
From: Fan Zhang @ 2018-11-15 17:24 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal

This patch adds SHA1, SHA224, SHA256, SHA384, SHA512 capability
updates to AESNI-MB PMD.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
This patch does not contain actual functionality implementation.
This patch targets 19.02 release.
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 135 +++++++++++++++++++++++++
 1 file changed, 135 insertions(+)

diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index f3eff2685..2ed83e652 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -39,6 +39,33 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA1 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA1,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
+					.min = 1,
+					.max = 20,
+					.increment = 1
+#else
+					.min = 12,
+					.max = 12,
+					.increment = 0
+#endif
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA1 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -70,6 +97,33 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA224 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA224,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
+					.min = 1,
+					.max = 28,
+					.increment = 1
+#else
+					.min = 14,
+					.max = 14,
+					.increment = 0
+#endif
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA224 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -101,6 +155,33 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA256 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA256,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
+					.min = 1,
+					.max = 32,
+					.increment = 1
+#else
+					.min = 16,
+					.max = 16,
+					.increment = 0
+#endif
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA256 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -132,6 +213,33 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA384 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA384,
+				.block_size = 128,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
+					.min = 1,
+					.max = 48,
+					.increment = 1
+#else
+					.min = 24,
+					.max = 24,
+					.increment = 0
+#endif
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA384 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -163,6 +271,33 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA512  */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA512,
+				.block_size = 128,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
+					.min = 1,
+					.max = 64,
+					.increment = 1
+#else
+					.min = 32,
+					.max = 32,
+					.increment = 0
+#endif
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA512 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
-- 
2.13.6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2] crypto/aesni_mb: add plain sha support
  2018-11-15 17:24 [dpdk-dev] [PATCH] crypto/aesni_mb: add SHA support Fan Zhang
@ 2018-12-13 15:18 ` Fan Zhang
  2018-12-18 10:30   ` Akhil Goyal
  2018-12-19 23:24   ` [dpdk-dev] [PATCH v3 0/3] " Fan Zhang
  0 siblings, 2 replies; 11+ messages in thread
From: Fan Zhang @ 2018-12-13 15:18 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, Damian Nowak, Lukasz Krakowiak

From: Damian Nowak <damianx.nowak@intel.com>

This patch adds the plain SHAx algorithm support to AESNI-MB PMD.

This patch depends on the following patch:
"crypto/aesni_mb: use architure independent marcos"
(http://patchwork.dpdk.org/patch/48633/").

Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 doc/guides/cryptodevs/aesni_mb.rst                 |   5 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c    |  25 +++++
 .../crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c    | 105 +++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   5 +
 test/test/test_cryptodev_blockcipher.c             |  13 ++-
 test/test/test_cryptodev_hash_test_vectors.h       |  10 ++
 6 files changed, 162 insertions(+), 1 deletion(-)

diff --git a/doc/guides/cryptodevs/aesni_mb.rst b/doc/guides/cryptodevs/aesni_mb.rst
index 63e060d75..aa067152a 100644
--- a/doc/guides/cryptodevs/aesni_mb.rst
+++ b/doc/guides/cryptodevs/aesni_mb.rst
@@ -40,6 +40,11 @@ Hash algorithms:
 * RTE_CRYPTO_HASH_SHA512_HMAC
 * RTE_CRYPTO_HASH_AES_XCBC_HMAC
 * RTE_CRYPTO_HASH_AES_CMAC
+* RTE_CRYPTO_HASH_SHA1
+* RTE_CRYPTO_HASH_SHA224
+* RTE_CRYPTO_HASH_SHA256
+* RTE_CRYPTO_HASH_SHA384
+* RTE_CRYPTO_HASH_SHA512
 
 AEAD algorithms:
 
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c
index 2c25b7b32..c794652ce 100755
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c
@@ -107,6 +107,7 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 	hash_one_block_t hash_oneblock_fn;
 	unsigned int key_larger_block_size = 0;
 	uint8_t hashed_key[HMAC_MAX_BLOCK_SIZE] = { 0 };
+	uint32_t auth_precompute = 1;
 
 	if (xform == NULL) {
 		sess->auth.algo = NULL_HASH;
@@ -189,6 +190,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA1:
+		sess->auth.algo = PLAIN_SHA1;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA224_HMAC:
 		sess->auth.algo = SHA_224;
 		hash_oneblock_fn = mb_mgr->sha224_one_block;
@@ -200,6 +205,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA224:
+		sess->auth.algo = PLAIN_SHA_224;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA256_HMAC:
 		sess->auth.algo = SHA_256;
 		hash_oneblock_fn = mb_mgr->sha256_one_block;
@@ -211,6 +220,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA256:
+		sess->auth.algo = PLAIN_SHA_256;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA384_HMAC:
 		sess->auth.algo = SHA_384;
 		hash_oneblock_fn = mb_mgr->sha384_one_block;
@@ -222,6 +235,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA384:
+		sess->auth.algo = PLAIN_SHA_384;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA512_HMAC:
 		sess->auth.algo = SHA_512;
 		hash_oneblock_fn = mb_mgr->sha512_one_block;
@@ -233,6 +250,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA512:
+		sess->auth.algo = PLAIN_SHA_512;
+		auth_precompute = 0;
+		break;
 	default:
 		AESNI_MB_LOG(ERR, "Unsupported authentication algorithm selection");
 		return -ENOTSUP;
@@ -254,6 +275,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 	else
 		sess->auth.gen_digest_len = sess->auth.req_digest_len;
 
+	/* Plain SHA does not require precompute key */
+	if (auth_precompute == 0)
+		return 0;
+
 	/* Calculate Authentication precomputes */
 	if (key_larger_block_size) {
 		calculate_auth_precomputes(hash_oneblock_fn,
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c
index 5788e37d1..c57065d0f 100755
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c
@@ -54,6 +54,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA1 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA1,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 20,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA224 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -75,6 +96,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA224 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA224,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 28,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA256 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -96,6 +138,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA256 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA256,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 32,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA384 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -117,6 +180,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA384 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA384,
+				.block_size = 128,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 48,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA512 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -138,6 +222,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA512  */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA512,
+				.block_size = 128,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 64,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* AES XCBC HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
index 34dd43095..6f4f5eeea 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
@@ -109,6 +109,11 @@ static const unsigned auth_digest_byte_lengths[] = {
 		[AES_CMAC]	= 16,
 		[AES_GMAC]	= 12,
 		[NULL_HASH]	= 0,
+		[PLAIN_SHA1] 	= 20,
+		[PLAIN_SHA_224] = 28,
+		[PLAIN_SHA_256] = 32,
+		[PLAIN_SHA_384] = 48,
+		[PLAIN_SHA_512] = 64
 	/**< Vector mode dependent pointer table of the multi-buffer APIs */
 
 };
diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c
index 1c3f29f6b..467957bab 100644
--- a/test/test/test_cryptodev_blockcipher.c
+++ b/test/test/test_cryptodev_blockcipher.c
@@ -124,7 +124,18 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 		digest_len = tdata->digest.len;
 	} else if (driver_id == aesni_mb_pmd ||
 			driver_id == scheduler_pmd) {
-		digest_len = tdata->digest.truncated_len;
+		switch (tdata->auth_algo) {
+		case RTE_CRYPTO_AUTH_SHA1:
+		case RTE_CRYPTO_AUTH_SHA224:
+		case RTE_CRYPTO_AUTH_SHA256:
+		case RTE_CRYPTO_AUTH_SHA384:
+		case RTE_CRYPTO_AUTH_SHA512:
+			digest_len = tdata->digest.len;
+			break;
+		default:
+			digest_len = tdata->digest.truncated_len;
+			break;
+		}
 	} else {
 		snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
 			"line %u FAILED: %s",
diff --git a/test/test/test_cryptodev_hash_test_vectors.h b/test/test/test_cryptodev_hash_test_vectors.h
index a02dfb3c3..e6e4bd8bb 100644
--- a/test/test/test_cryptodev_hash_test_vectors.h
+++ b/test/test/test_cryptodev_hash_test_vectors.h
@@ -417,6 +417,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha1_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -426,6 +427,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha1_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -485,6 +487,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha224_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -494,6 +497,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha224_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -531,6 +535,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha256_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -540,6 +545,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha256_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -579,6 +585,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha384_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -588,6 +595,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha384_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -627,6 +635,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha512_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
@@ -636,6 +645,7 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &sha512_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
-- 
2.13.6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v2] crypto/aesni_mb: add plain sha support
  2018-12-13 15:18 ` [dpdk-dev] [PATCH v2] crypto/aesni_mb: add plain sha support Fan Zhang
@ 2018-12-18 10:30   ` Akhil Goyal
  2018-12-19 23:24   ` [dpdk-dev] [PATCH v3 0/3] " Fan Zhang
  1 sibling, 0 replies; 11+ messages in thread
From: Akhil Goyal @ 2018-12-18 10:30 UTC (permalink / raw)
  To: Fan Zhang, dev; +Cc: Damian Nowak, Lukasz Krakowiak



On 12/13/2018 8:48 PM, Fan Zhang wrote:
> From: Damian Nowak <damianx.nowak@intel.com>
>
> This patch adds the plain SHAx algorithm support to AESNI-MB PMD.
>
> This patch depends on the following patch:
> "crypto/aesni_mb: use architure independent marcos"
> (http://patchwork.dpdk.org/patch/48633/").
>
> Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
> Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>
Applied to dpdk-next-crypto

Thanks

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 0/3] crypto/aesni_mb: add plain sha support
  2018-12-13 15:18 ` [dpdk-dev] [PATCH v2] crypto/aesni_mb: add plain sha support Fan Zhang
  2018-12-18 10:30   ` Akhil Goyal
@ 2018-12-19 23:24   ` Fan Zhang
  2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 1/3] " Fan Zhang
                       ` (3 more replies)
  1 sibling, 4 replies; 11+ messages in thread
From: Fan Zhang @ 2018-12-19 23:24 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal

This patchset adds the plain SHA1, SHA224, SHA256, SHA384, and SHA512
algorithm support to AESNI-MB PMD. The crypto unit tests and documentation
are updated accordingly.

This patchset depends on the following patchset:
"[PATCH v5 0/3] crypto/aesni_mb: add gmac support"
(https://mails.dpdk.org/archives/dev/2018-December/121709.html").

v3:
rebased on top of latest code.
avoided test for unsupported library versions.

v2:
added implementation.

Fan Zhang (3):
  crypto/aesni_mb: add plain sha support
  test: add aesni-mb sha test
  doc: update release note and PMD information

 doc/guides/cryptodevs/aesni_mb.rst                 |   6 ++
 doc/guides/rel_notes/release_19_02.rst             |   4 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  25 +++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     | 105 +++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   7 ++
 test/test/test_cryptodev_hash_test_vectors.h       |  65 ++++++++++++-
 6 files changed, 205 insertions(+), 7 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 1/3] crypto/aesni_mb: add plain sha support
  2018-12-19 23:24   ` [dpdk-dev] [PATCH v3 0/3] " Fan Zhang
@ 2018-12-19 23:24     ` Fan Zhang
  2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 2/3] test: add aesni-mb sha test Fan Zhang
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Fan Zhang @ 2018-12-19 23:24 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, Damian Nowak, Lukasz Krakowiak

This patch adds the plain SHA1, SHA224, SHA256, SHA384, and SHA512
algorithm support to AESNI-MB PMD.

Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  25 +++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     | 105 +++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   7 ++
 3 files changed, 137 insertions(+)

diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index d34cbc36a..4e31735ca 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -107,6 +107,7 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 	hash_one_block_t hash_oneblock_fn;
 	unsigned int key_larger_block_size = 0;
 	uint8_t hashed_key[HMAC_MAX_BLOCK_SIZE] = { 0 };
+	uint32_t auth_precompute = 1;
 
 	if (xform == NULL) {
 		sess->auth.algo = NULL_HASH;
@@ -237,6 +238,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA1:
+		sess->auth.algo = PLAIN_SHA1;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA224_HMAC:
 		sess->auth.algo = SHA_224;
 		hash_oneblock_fn = mb_mgr->sha224_one_block;
@@ -248,6 +253,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA224:
+		sess->auth.algo = PLAIN_SHA_224;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA256_HMAC:
 		sess->auth.algo = SHA_256;
 		hash_oneblock_fn = mb_mgr->sha256_one_block;
@@ -259,6 +268,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA256:
+		sess->auth.algo = PLAIN_SHA_256;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA384_HMAC:
 		sess->auth.algo = SHA_384;
 		hash_oneblock_fn = mb_mgr->sha384_one_block;
@@ -270,6 +283,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA384:
+		sess->auth.algo = PLAIN_SHA_384;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA512_HMAC:
 		sess->auth.algo = SHA_512;
 		hash_oneblock_fn = mb_mgr->sha512_one_block;
@@ -281,6 +298,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA512:
+		sess->auth.algo = PLAIN_SHA_512;
+		auth_precompute = 0;
+		break;
 	default:
 		AESNI_MB_LOG(ERR, "Unsupported authentication algorithm selection");
 		return -ENOTSUP;
@@ -302,6 +323,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 	else
 		sess->auth.gen_digest_len = sess->auth.req_digest_len;
 
+	/* Plain SHA does not require precompute key */
+	if (auth_precompute == 0)
+		return 0;
+
 	/* Calculate Authentication precomputes */
 	if (key_larger_block_size) {
 		calculate_auth_precomputes(hash_oneblock_fn,
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index 56d409b4b..c90f6baa3 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -54,6 +54,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA1 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA1,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 20,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA224 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -75,6 +96,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA224 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA224,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 28,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA256 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -96,6 +138,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA256 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA256,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 32,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA384 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -117,6 +180,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA384 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA384,
+				.block_size = 128,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 48,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA512 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -138,6 +222,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA512  */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA512,
+				.block_size = 128,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 64,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* AES XCBC HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
index d61abfe4f..cdbe7f520 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
@@ -109,6 +109,13 @@ static const unsigned auth_digest_byte_lengths[] = {
 		[AES_CMAC]	= 16,
 		[AES_GMAC]	= 12,
 		[NULL_HASH]	= 0,
+#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0)
+		[PLAIN_SHA1]	= 20,
+		[PLAIN_SHA_224]	= 28,
+		[PLAIN_SHA_256]	= 32,
+		[PLAIN_SHA_384]	= 48,
+		[PLAIN_SHA_512]	= 64
+#endif
 	/**< Vector mode dependent pointer table of the multi-buffer APIs */
 
 };
-- 
2.13.6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 2/3] test: add aesni-mb sha test
  2018-12-19 23:24   ` [dpdk-dev] [PATCH v3 0/3] " Fan Zhang
  2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 1/3] " Fan Zhang
@ 2018-12-19 23:24     ` Fan Zhang
  2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 3/3] doc: update release note and PMD information Fan Zhang
  2018-12-20 12:22     ` [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA Fan Zhang
  3 siblings, 0 replies; 11+ messages in thread
From: Fan Zhang @ 2018-12-19 23:24 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, Damian Nowak, Lukasz Krakowiak

This patch adds the plain SHA* test cases to AESNI-MB crypto unit test. The
tests are enabled only for intel-ipsec-mb library version 0.52 or older.

Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 test/test/test_cryptodev_hash_test_vectors.h | 65 +++++++++++++++++++++++++---
 1 file changed, 60 insertions(+), 5 deletions(-)

diff --git a/test/test/test_cryptodev_hash_test_vectors.h b/test/test/test_cryptodev_hash_test_vectors.h
index 8964a3bac..21bf347f6 100644
--- a/test/test/test_cryptodev_hash_test_vectors.h
+++ b/test/test/test_cryptodev_hash_test_vectors.h
@@ -96,7 +96,8 @@ sha1_test_vector = {
 			0x35, 0x62, 0xFB, 0xFA, 0x93, 0xFD, 0x7D, 0x70,
 			0xA6, 0x7D, 0x45, 0xCA
 		},
-		.len = 20
+		.len = 20,
+		.truncated_len = 20
 	}
 };
 
@@ -140,7 +141,8 @@ sha224_test_vector = {
 			0x39, 0x26, 0xDF, 0xB5, 0x78, 0x62, 0xB2, 0x6E,
 			0x5E, 0x8F, 0x25, 0x84
 		},
-		.len = 28
+		.len = 28,
+		.truncated_len = 28
 	}
 };
 
@@ -186,7 +188,8 @@ sha256_test_vector = {
 			0x1F, 0xC7, 0x84, 0xEE, 0x76, 0xA6, 0x39, 0x15,
 			0x76, 0x2F, 0x87, 0xF9, 0x01, 0x06, 0xF3, 0xB7
 		},
-		.len = 32
+		.len = 32,
+		.truncated_len = 32
 	}
 };
 
@@ -234,7 +237,8 @@ sha384_test_vector = {
 			0xAD, 0x41, 0xAB, 0x15, 0xB0, 0x03, 0x15, 0xEC,
 			0x9E, 0x3D, 0xED, 0xCB, 0x80, 0x7B, 0xF4, 0xB6
 		},
-		.len = 48
+		.len = 48,
+		.truncated_len = 48
 	}
 };
 
@@ -288,7 +292,8 @@ sha512_test_vector = {
 			0x64, 0x4E, 0x15, 0x68, 0x12, 0x67, 0x26, 0x0F,
 			0x2C, 0x3C, 0x83, 0x25, 0x27, 0x86, 0xF0, 0xDB
 		},
-		.len = 64
+		.len = 64,
+		.truncated_len = 64
 	}
 };
 
@@ -428,7 +433,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA1 Digest Verify",
@@ -437,7 +447,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA1 Digest",
@@ -496,7 +511,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA224 Digest Verify",
@@ -505,7 +525,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA224 Digest",
@@ -542,7 +567,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA256 Digest Verify",
@@ -551,7 +581,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA256 Digest",
@@ -590,7 +625,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA384 Digest Verify",
@@ -599,7 +639,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA384 Digest",
@@ -638,7 +683,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA512 Digest Verify",
@@ -647,7 +697,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA512 Digest",
-- 
2.13.6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3 3/3] doc: update release note and PMD information
  2018-12-19 23:24   ` [dpdk-dev] [PATCH v3 0/3] " Fan Zhang
  2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 1/3] " Fan Zhang
  2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 2/3] test: add aesni-mb sha test Fan Zhang
@ 2018-12-19 23:24     ` Fan Zhang
  2018-12-20 12:22     ` [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA Fan Zhang
  3 siblings, 0 replies; 11+ messages in thread
From: Fan Zhang @ 2018-12-19 23:24 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, Damian Nowak, Lukasz Krakowiak

This patch updates the release note and AESNI-MD PMD documentation.

Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 doc/guides/cryptodevs/aesni_mb.rst     | 6 ++++++
 doc/guides/rel_notes/release_19_02.rst | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/guides/cryptodevs/aesni_mb.rst b/doc/guides/cryptodevs/aesni_mb.rst
index 98082595d..26cb4d5b2 100644
--- a/doc/guides/cryptodevs/aesni_mb.rst
+++ b/doc/guides/cryptodevs/aesni_mb.rst
@@ -41,6 +41,11 @@ Hash algorithms:
 * RTE_CRYPTO_HASH_AES_XCBC_HMAC
 * RTE_CRYPTO_HASH_AES_CMAC
 * RTE_CRYPTO_HASH_AES_GMAC
+* RTE_CRYPTO_HASH_SHA1
+* RTE_CRYPTO_HASH_SHA224
+* RTE_CRYPTO_HASH_SHA256
+* RTE_CRYPTO_HASH_SHA384
+* RTE_CRYPTO_HASH_SHA512
 
 AEAD algorithms:
 
@@ -53,6 +58,7 @@ Limitations
 * Chained mbufs are not supported.
 * Only in-place is currently supported (destination address is the same as source address).
 * RTE_CRYPTO_HASH_AES_GMAC is supported by library version v0.51 or later.
+* RTE_CRYPTO_HASH_SHA* is supported by library version v0.52 or later.
 
 
 Installation
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index 48b183e81..69e3eeff9 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -62,8 +62,8 @@ New Features
 
 * **Updated the AESNI MB PMD.**
 
-  The AESNI MB PMD has been updated with additional support for the AES-GMAC
-  authentication only algorithm.
+  The AESNI MB PMD has been updated with additional support for the AES-GMAC,
+  Plain SHA1, SHA224, SHA256, SHA384, and SHA512 authentication only algorithm.
 
 
 Removed Items
-- 
2.13.6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
  2018-12-19 23:24   ` [dpdk-dev] [PATCH v3 0/3] " Fan Zhang
                       ` (2 preceding siblings ...)
  2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 3/3] doc: update release note and PMD information Fan Zhang
@ 2018-12-20 12:22     ` Fan Zhang
  2018-12-20 17:52       ` Trahe, Fiona
  3 siblings, 1 reply; 11+ messages in thread
From: Fan Zhang @ 2018-12-20 12:22 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, pablo.de.lara.guarch, Damian Nowak, Lukasz Krakowiak

This patch adds the plain SHA1, SHA224, SHA256, SHA384, and SHA512
algorithms support to AESNI-MB PMD. The cryptodev unit test and
documentation are updated accordingly.

This patch depends on "[v6] crypto/aesni_mb: support AES-GMAC"
(http://patchwork.dpdk.org/patch/49180/)

Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
v4:
- combined patches into one.
- changed title.

v3:
- rebased on top of latest code.
- avoided test for unsupported library versions.

v2:
- added implementation.

 doc/guides/cryptodevs/aesni_mb.rst                 |   6 ++
 doc/guides/rel_notes/release_19_02.rst             |   2 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  25 +++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     | 105 +++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   7 ++
 test/test/test_cryptodev_hash_test_vectors.h       |  65 ++++++++++++-
 6 files changed, 205 insertions(+), 5 deletions(-)

diff --git a/doc/guides/cryptodevs/aesni_mb.rst b/doc/guides/cryptodevs/aesni_mb.rst
index 98082595d..26cb4d5b2 100644
--- a/doc/guides/cryptodevs/aesni_mb.rst
+++ b/doc/guides/cryptodevs/aesni_mb.rst
@@ -41,6 +41,11 @@ Hash algorithms:
 * RTE_CRYPTO_HASH_AES_XCBC_HMAC
 * RTE_CRYPTO_HASH_AES_CMAC
 * RTE_CRYPTO_HASH_AES_GMAC
+* RTE_CRYPTO_HASH_SHA1
+* RTE_CRYPTO_HASH_SHA224
+* RTE_CRYPTO_HASH_SHA256
+* RTE_CRYPTO_HASH_SHA384
+* RTE_CRYPTO_HASH_SHA512
 
 AEAD algorithms:
 
@@ -53,6 +58,7 @@ Limitations
 * Chained mbufs are not supported.
 * Only in-place is currently supported (destination address is the same as source address).
 * RTE_CRYPTO_HASH_AES_GMAC is supported by library version v0.51 or later.
+* RTE_CRYPTO_HASH_SHA* is supported by library version v0.52 or later.
 
 
 Installation
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index 3f513a914..104b3a8c7 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -66,8 +66,10 @@ New Features
   compression ratio and compression throughput.
 
 * **updated the AESNI-MB PMD.**
+
   * Added support for intel-ipsec-mb version 0.52.
   * Added AES-GMAC algorithm support.
+  * Added Plain SHA1, SHA224, SHA256, SHA384, and SHA512 algorithms support.
 
 
 Removed Items
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index d34cbc36a..4e31735ca 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -107,6 +107,7 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 	hash_one_block_t hash_oneblock_fn;
 	unsigned int key_larger_block_size = 0;
 	uint8_t hashed_key[HMAC_MAX_BLOCK_SIZE] = { 0 };
+	uint32_t auth_precompute = 1;
 
 	if (xform == NULL) {
 		sess->auth.algo = NULL_HASH;
@@ -237,6 +238,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA1:
+		sess->auth.algo = PLAIN_SHA1;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA224_HMAC:
 		sess->auth.algo = SHA_224;
 		hash_oneblock_fn = mb_mgr->sha224_one_block;
@@ -248,6 +253,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA224:
+		sess->auth.algo = PLAIN_SHA_224;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA256_HMAC:
 		sess->auth.algo = SHA_256;
 		hash_oneblock_fn = mb_mgr->sha256_one_block;
@@ -259,6 +268,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA256:
+		sess->auth.algo = PLAIN_SHA_256;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA384_HMAC:
 		sess->auth.algo = SHA_384;
 		hash_oneblock_fn = mb_mgr->sha384_one_block;
@@ -270,6 +283,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA384:
+		sess->auth.algo = PLAIN_SHA_384;
+		auth_precompute = 0;
+		break;
 	case RTE_CRYPTO_AUTH_SHA512_HMAC:
 		sess->auth.algo = SHA_512;
 		hash_oneblock_fn = mb_mgr->sha512_one_block;
@@ -281,6 +298,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 			key_larger_block_size = 1;
 		}
 		break;
+	case RTE_CRYPTO_AUTH_SHA512:
+		sess->auth.algo = PLAIN_SHA_512;
+		auth_precompute = 0;
+		break;
 	default:
 		AESNI_MB_LOG(ERR, "Unsupported authentication algorithm selection");
 		return -ENOTSUP;
@@ -302,6 +323,10 @@ aesni_mb_set_session_auth_parameters(const MB_MGR *mb_mgr,
 	else
 		sess->auth.gen_digest_len = sess->auth.req_digest_len;
 
+	/* Plain SHA does not require precompute key */
+	if (auth_precompute == 0)
+		return 0;
+
 	/* Calculate Authentication precomputes */
 	if (key_larger_block_size) {
 		calculate_auth_precomputes(hash_oneblock_fn,
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index 56d409b4b..c90f6baa3 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -54,6 +54,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA1 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA1,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 20,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA224 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -75,6 +96,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA224 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA224,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 28,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA256 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -96,6 +138,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA256 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA256,
+				.block_size = 64,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 32,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA384 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -117,6 +180,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA384 */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA384,
+				.block_size = 128,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 48,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* SHA512 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -138,6 +222,27 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
+	{	/* SHA512  */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth = {
+				.algo = RTE_CRYPTO_AUTH_SHA512,
+				.block_size = 128,
+				.key_size = {
+					.min = 0,
+					.max = 0,
+					.increment = 0
+				},
+				.digest_size = {
+					.min = 1,
+					.max = 64,
+					.increment = 1
+				},
+				.iv_size = { 0 }
+			}, }
+		}, }
+	},
 	{	/* AES XCBC HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
index d61abfe4f..cdbe7f520 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
@@ -109,6 +109,13 @@ static const unsigned auth_digest_byte_lengths[] = {
 		[AES_CMAC]	= 16,
 		[AES_GMAC]	= 12,
 		[NULL_HASH]	= 0,
+#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0)
+		[PLAIN_SHA1]	= 20,
+		[PLAIN_SHA_224]	= 28,
+		[PLAIN_SHA_256]	= 32,
+		[PLAIN_SHA_384]	= 48,
+		[PLAIN_SHA_512]	= 64
+#endif
 	/**< Vector mode dependent pointer table of the multi-buffer APIs */
 
 };
diff --git a/test/test/test_cryptodev_hash_test_vectors.h b/test/test/test_cryptodev_hash_test_vectors.h
index 8964a3bac..21bf347f6 100644
--- a/test/test/test_cryptodev_hash_test_vectors.h
+++ b/test/test/test_cryptodev_hash_test_vectors.h
@@ -96,7 +96,8 @@ sha1_test_vector = {
 			0x35, 0x62, 0xFB, 0xFA, 0x93, 0xFD, 0x7D, 0x70,
 			0xA6, 0x7D, 0x45, 0xCA
 		},
-		.len = 20
+		.len = 20,
+		.truncated_len = 20
 	}
 };
 
@@ -140,7 +141,8 @@ sha224_test_vector = {
 			0x39, 0x26, 0xDF, 0xB5, 0x78, 0x62, 0xB2, 0x6E,
 			0x5E, 0x8F, 0x25, 0x84
 		},
-		.len = 28
+		.len = 28,
+		.truncated_len = 28
 	}
 };
 
@@ -186,7 +188,8 @@ sha256_test_vector = {
 			0x1F, 0xC7, 0x84, 0xEE, 0x76, 0xA6, 0x39, 0x15,
 			0x76, 0x2F, 0x87, 0xF9, 0x01, 0x06, 0xF3, 0xB7
 		},
-		.len = 32
+		.len = 32,
+		.truncated_len = 32
 	}
 };
 
@@ -234,7 +237,8 @@ sha384_test_vector = {
 			0xAD, 0x41, 0xAB, 0x15, 0xB0, 0x03, 0x15, 0xEC,
 			0x9E, 0x3D, 0xED, 0xCB, 0x80, 0x7B, 0xF4, 0xB6
 		},
-		.len = 48
+		.len = 48,
+		.truncated_len = 48
 	}
 };
 
@@ -288,7 +292,8 @@ sha512_test_vector = {
 			0x64, 0x4E, 0x15, 0x68, 0x12, 0x67, 0x26, 0x0F,
 			0x2C, 0x3C, 0x83, 0x25, 0x27, 0x86, 0xF0, 0xDB
 		},
-		.len = 64
+		.len = 64,
+		.truncated_len = 64
 	}
 };
 
@@ -428,7 +433,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA1 Digest Verify",
@@ -437,7 +447,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA1 Digest",
@@ -496,7 +511,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA224 Digest Verify",
@@ -505,7 +525,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA224 Digest",
@@ -542,7 +567,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA256 Digest Verify",
@@ -551,7 +581,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA256 Digest",
@@ -590,7 +625,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA384 Digest Verify",
@@ -599,7 +639,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA384 Digest",
@@ -638,7 +683,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "SHA512 Digest Verify",
@@ -647,7 +697,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
 		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
 			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
 			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
+#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
 			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+#else
+			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+			    BLOCKCIPHER_TEST_TARGET_PMD_MB
+#endif
 	},
 	{
 		.test_descr = "HMAC-SHA512 Digest",
-- 
2.13.6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
  2018-12-20 12:22     ` [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA Fan Zhang
@ 2018-12-20 17:52       ` Trahe, Fiona
  2019-01-09 22:32         ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 11+ messages in thread
From: Trahe, Fiona @ 2018-12-20 17:52 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev
  Cc: akhil.goyal, De Lara Guarch, Pablo, Nowak, DamianX, Krakowiak,
	LukaszX, Trahe, Fiona

Hi Fan,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> Sent: Thursday, December 20, 2018 5:22 AM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Nowak, DamianX
> <damianx.nowak@intel.com>; Krakowiak, LukaszX <lukaszx.krakowiak@intel.com>
> Subject: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
> 
> This patch adds the plain SHA1, SHA224, SHA256, SHA384, and SHA512
> algorithms support to AESNI-MB PMD. The cryptodev unit test and
> documentation are updated accordingly.
> 
> This patch depends on "[v6] crypto/aesni_mb: support AES-GMAC"
> (http://patchwork.dpdk.org/patch/49180/)
> 
> Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
> Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---


//snip//

> @@ -428,7 +433,12 @@ static const struct blockcipher_test_case hash_test_cases[] = {
>  		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
>  			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
>  			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
> +#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
>  			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
> +#else
> +			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
> +			    BLOCKCIPHER_TEST_TARGET_PMD_MB
> +#endif
[Fiona] Only a nit, but it's messy to include OCTEONTX in this.
MB doesn't have to be added after the other flags, it would be more readable and
easier for other PMD flags to be added in future if it was put on the previous line, e.g. 
>  			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
> +#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0)
> +			    BLOCKCIPHER_TEST_TARGET_PMD_MB  |
> +#endif
>  			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX

Apart from that 
Acked-by: Fiona Trahe <fiona.trahe@intel.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
  2018-12-20 17:52       ` Trahe, Fiona
@ 2019-01-09 22:32         ` De Lara Guarch, Pablo
  2019-01-10 14:11           ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 11+ messages in thread
From: De Lara Guarch, Pablo @ 2019-01-09 22:32 UTC (permalink / raw)
  To: Trahe, Fiona, Zhang, Roy Fan, dev
  Cc: akhil.goyal, Nowak, DamianX, Krakowiak, LukaszX



> -----Original Message-----
> From: Trahe, Fiona
> Sent: Thursday, December 20, 2018 5:52 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Nowak, DamianX
> <damianx.nowak@intel.com>; Krakowiak, LukaszX
> <lukaszx.krakowiak@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
> 
> Hi Fan,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> > Sent: Thursday, December 20, 2018 5:22 AM
> > To: dev@dpdk.org
> > Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>; Nowak, DamianX
> > <damianx.nowak@intel.com>; Krakowiak, LukaszX
> > <lukaszx.krakowiak@intel.com>
> > Subject: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
> >
> > This patch adds the plain SHA1, SHA224, SHA256, SHA384, and SHA512
> > algorithms support to AESNI-MB PMD. The cryptodev unit test and
> > documentation are updated accordingly.
> >
> > This patch depends on "[v6] crypto/aesni_mb: support AES-GMAC"
> > (http://patchwork.dpdk.org/patch/49180/)
> >
> > Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
> > Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
> > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> > ---
> 
> 
> //snip//
> 
> > @@ -428,7 +433,12 @@ static const struct blockcipher_test_case
> hash_test_cases[] = {
> >  		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
> >  			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
> >  			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
> > +#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
> >  			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
> > +#else
> > +			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
> > +			    BLOCKCIPHER_TEST_TARGET_PMD_MB #endif
> [Fiona] Only a nit, but it's messy to include OCTEONTX in this.
> MB doesn't have to be added after the other flags, it would be more
> readable and easier for other PMD flags to be added in future if it was put
> on the previous line, e.g.
> >  			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
> > +#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0)
> > +			    BLOCKCIPHER_TEST_TARGET_PMD_MB  | #endif
> >  			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
> 
> Apart from that
> Acked-by: Fiona Trahe <fiona.trahe@intel.com>

Agree with Fiona's comment.
Fan, are you ok with it? I can make the change for you and push it to the tree.

Pablo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
  2019-01-09 22:32         ` De Lara Guarch, Pablo
@ 2019-01-10 14:11           ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 11+ messages in thread
From: De Lara Guarch, Pablo @ 2019-01-10 14:11 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Trahe, Fiona, Zhang, Roy Fan, dev
  Cc: akhil.goyal, Nowak, DamianX, Krakowiak, LukaszX



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Wednesday, January 9, 2019 10:32 PM
> To: Trahe, Fiona <fiona.trahe@intel.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Nowak, DamianX <damianx.nowak@intel.com>;
> Krakowiak, LukaszX <lukaszx.krakowiak@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
> 
> 
> 
> > -----Original Message-----
> > From: Trahe, Fiona
> > Sent: Thursday, December 20, 2018 5:52 PM
> > To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> > Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>; Nowak, DamianX
> > <damianx.nowak@intel.com>; Krakowiak, LukaszX
> > <lukaszx.krakowiak@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> > Subject: RE: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
> >
> > Hi Fan,
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang
> > > Sent: Thursday, December 20, 2018 5:22 AM
> > > To: dev@dpdk.org
> > > Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> > > <pablo.de.lara.guarch@intel.com>; Nowak, DamianX
> > > <damianx.nowak@intel.com>; Krakowiak, LukaszX
> > > <lukaszx.krakowiak@intel.com>
> > > Subject: [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA
> > >
> > > This patch adds the plain SHA1, SHA224, SHA256, SHA384, and SHA512
> > > algorithms support to AESNI-MB PMD. The cryptodev unit test and
> > > documentation are updated accordingly.
> > >
> > > This patch depends on "[v6] crypto/aesni_mb: support AES-GMAC"
> > > (http://patchwork.dpdk.org/patch/49180/)
> > >
> > > Signed-off-by: Damian Nowak <damianx.nowak@intel.com>
> > > Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
> > > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> > > ---
> >
> >
> > //snip//
> >
> > > @@ -428,7 +433,12 @@ static const struct blockcipher_test_case
> > hash_test_cases[] = {
> > >  		.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
> > >  			    BLOCKCIPHER_TEST_TARGET_PMD_CCP |
> > >  			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
> > > +#if IMB_VERSION(0, 52, 0) > IMB_VERSION_NUM
> > >  			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
> > > +#else
> > > +			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
> > > +			    BLOCKCIPHER_TEST_TARGET_PMD_MB #endif
> > [Fiona] Only a nit, but it's messy to include OCTEONTX in this.
> > MB doesn't have to be added after the other flags, it would be more
> > readable and easier for other PMD flags to be added in future if it
> > was put on the previous line, e.g.
> > >  			    BLOCKCIPHER_TEST_TARGET_PMD_MVSAM |
> > > +#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0)
> > > +			    BLOCKCIPHER_TEST_TARGET_PMD_MB  | #endif
> > >  			    BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
> >
> > Apart from that
> > Acked-by: Fiona Trahe <fiona.trahe@intel.com>
> 
> Agree with Fiona's comment.
> Fan, are you ok with it? I can make the change for you and push it to the
> tree.

After verbal agreement, I made the change and pushed it to the tree.
Applied to dpdk-next-crypto.

Thanks,
Pablo

> 
> Pablo

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-01-10 14:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-15 17:24 [dpdk-dev] [PATCH] crypto/aesni_mb: add SHA support Fan Zhang
2018-12-13 15:18 ` [dpdk-dev] [PATCH v2] crypto/aesni_mb: add plain sha support Fan Zhang
2018-12-18 10:30   ` Akhil Goyal
2018-12-19 23:24   ` [dpdk-dev] [PATCH v3 0/3] " Fan Zhang
2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 1/3] " Fan Zhang
2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 2/3] test: add aesni-mb sha test Fan Zhang
2018-12-19 23:24     ` [dpdk-dev] [PATCH v3 3/3] doc: update release note and PMD information Fan Zhang
2018-12-20 12:22     ` [dpdk-dev] [PATCH v4] crypto/aesni_mb: support plain SHA Fan Zhang
2018-12-20 17:52       ` Trahe, Fiona
2019-01-09 22:32         ` De Lara Guarch, Pablo
2019-01-10 14:11           ` De Lara Guarch, Pablo

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git