[1/6] crypto/octeontx2: add RSA and modexp asym capabilities

Message ID 1568042799-25982-2-git-send-email-anoobj@marvell.com (mailing list archive)
State Changes Requested, archived
Delegated to: akhil goyal
Headers
Series add asymmetric support in crypto_octeontx2 PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Anoob Joseph Sept. 9, 2019, 3:26 p.m. UTC
  From: Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>

Adding RSA and modexp capabilities supported by octeontx2 crypto PMD

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>
Signed-off-by: Sunila Sahu <ssahu@marvell.com>
---
 drivers/crypto/octeontx2/otx2_cryptodev.c          |  3 +-
 .../crypto/octeontx2/otx2_cryptodev_capabilities.c | 39 ++++++++++++++++++++--
 2 files changed, 39 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev.c b/drivers/crypto/octeontx2/otx2_cryptodev.c
index 814b9ed..490e7a1 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev.c
@@ -102,7 +102,8 @@  otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			     RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
 			     RTE_CRYPTODEV_FF_IN_PLACE_SGL |
 			     RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
-			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT;
+			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
+			     RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO;
 
 	return 0;
 
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c b/drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
index 3a70470..b9e3fe3 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_capabilities.c
@@ -6,7 +6,8 @@ 
 
 #include "otx2_cryptodev_capabilities.h"
 
-static const struct rte_cryptodev_capabilities otx2_cpt_sym_capabilities[] = {
+static const struct
+rte_cryptodev_capabilities otx2_cpt_capabilities[] = {
 	/* Symmetric capabilities */
 	{	/* NULL (AUTH) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -594,11 +595,45 @@  static const struct rte_cryptodev_capabilities otx2_cpt_sym_capabilities[] = {
 		}, }
 	},
 	/* End of symmetric capabilities */
+
+	/* Asymmetric capabilities */
+	{	/* RSA */
+		.op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+		{.asym = {
+			.xform_capa = {
+				.xform_type = RTE_CRYPTO_ASYM_XFORM_RSA,
+				.op_types = ((1 << RTE_CRYPTO_ASYM_OP_SIGN) |
+					(1 << RTE_CRYPTO_ASYM_OP_VERIFY) |
+					(1 << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
+					(1 << RTE_CRYPTO_ASYM_OP_DECRYPT)),
+				{.modlen = {
+					.min = 17,
+					.max = 1024,
+					.increment = 1
+				}, }
+			}
+		}, }
+	},
+	{	/* MOD_EXP */
+		.op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
+		{.asym = {
+			.xform_capa = {
+				.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
+				.op_types = 0,
+				{.modlen = {
+					.min = 17,
+					.max = 1024,
+					.increment = 1
+				}, }
+			}
+		}, }
+	},
+	/* End of asymmetric capabilities */
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
 const struct rte_cryptodev_capabilities *
 otx2_cpt_capabilities_get(void)
 {
-	return otx2_cpt_sym_capabilities;
+	return otx2_cpt_capabilities;
 }