From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0077.outbound.protection.outlook.com [104.47.40.77]) by dpdk.org (Postfix) with ESMTP id F01AB1B699 for ; Wed, 16 May 2018 08:06:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qd/cTyNcGwSHG/d4Dcn4kAT/Uy327qxsR5WDjOX5l8g=; b=h5t0LX6/ptUF0g++1KwrAnN7DlEwsPVHfjHVMH13thUxsYalp5vvnSVKk685TbJ2Kmqa/qQSjuzkPf/svh/RZbmMNOAFrmTsUZobo4tN4M6SnuYCiwAwuRxE4FoTccOTnHWw9VGvvrV3SOIvKnLeNAQKpi0CfzqLlTVLtg943Og= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by DM5PR0701MB3637.namprd07.prod.outlook.com (2603:10b6:4:7d::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Wed, 16 May 2018 06:06:01 +0000 From: Shally Verma To: pablo.de.lara.guarch@intel.com Cc: fiona.trahe@intel.com, akhil.goyal@nxp.com, dev@dpdk.org, pathreya@caviumnetworks.com, Sunila Sahu , Ashish Gupta Date: Wed, 16 May 2018 11:35:10 +0530 Message-Id: <1526450713-17299-4-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526450713-17299-1-git-send-email-shally.verma@caviumnetworks.com> References: <1526450713-17299-1-git-send-email-shally.verma@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: PN1PR0101CA0047.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::33) To DM5PR0701MB3637.namprd07.prod.outlook.com (2603:10b6:4:7d::38) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR0701MB3637; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3637; 3:F/CHKhi7LycGnwB/Tj5CBMiB1D0VG87QAcANvQc8znoff1JPIhefc7pZPFDmGMrYrzweSZf1FNqM2LYORCRThJj/+x/ZSnTjROmKuYwCxWjRfqum9+cP8I1Zy8ka6sbhcBSLBmpLp3J0PWicxIbxdGlP6in+wExqZqCoqiImZ+WwzF2YnfgpNSWgxMz9o0XM306YiGE1rpe6p53lo8O2+TwC/XThr0qFAEa4ZDaXlq6Y655pGX8mDfFaywA5/Ol5; 25:tKjZNEmCMzq1DNyzD13KS9np/iCKvC4cFy6p653EnSb89PEIxyLqHZ1VXTO5V3gGuK7bl7no+UzSCSOPqblT8Q+yoKmgsNQehyoA2Mn8yj98SOuUJSHtX2bpQElTSepPWhWsos7w3FyEBwYkLwFaY+d2H5MX8/risfLszBSkAGW+ihhEZjiIaCORyCA8Z14SGioAxMRpclO9o8BI79uabzpcmkKvUXfHlc6xgGpKE1b/+SSxRGTDlGtg+CL1FPKbiMxccNTNPc5xgA04eC7an3R3PVvQCFj6vAFuh/qfhhpwyvRlqUUplyPxaT9s8hhPGl7phZvaWNJRX5TCqeRdCQ==; 31:E7WJO9MyebgQKABbCRMJNwQlQ1e8P0ME94/jvmwvTxdQxzlrv6T/cqwHrwBV80UUsGJkfN9UehfNibyELqsBkOaY0Xrsxj21Ck0s/Ua7vI7HpfVVv2nPges0y4rGyn4ybgYdpEDN5MJgfJdVCUMW1SHM/fEft4v0ofg4dE45629EFvrSylk9eN48ZrbHrwoEg89mbiw3WfS8TeU+FDmwX2GJRxo23/fjk8qhR7fqKKc= X-MS-TrafficTypeDiagnostic: DM5PR0701MB3637: X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3637; 20:eyAHgZ6v0uXy1pPCgMUjZkdDAeMP183s5i3V1H3SxgWZRixe7ESm2iwGBukxCzNaVPBENcBtQUXSrXK5yEsMrFQshxhwuSxfw5Vkvns9k3pMQZ/RJtG8aH01D6qCTZGOJpCv6TrgyA2639QgOchg18v6cdIX1+2Ursz4UVz2AZ/7DQmDJya35wmvPSk9IoL7H/eMTkgzaLVqHoTa4Y32cLfxw9fiqeRW7VB2o/LV03c9iJPowk39YyyR4ktfAkXM+PLuVkvAIV4RPj/4wir2O40aHyMoVdH9SQhQ4OJFfPVCsaBFmTTZfYrghH5I2J7+kqJQDiG3crVlGHZV+Xp7xTRBhS+9SEVOWbvM2GFgnwSoGN7Cy0xB+RdvwAfwzz0m5QluAMcrgcvEMD0WdLZwb0/uh1/Gq6jd2p/iaDFgnS8LCjVNeF6FQIETTN0nQG6qkjz+CZ7qPSUHVVoxU4rgjL9J5dRPTWmX73EAHmZcYmgbjV0DiOEmjUD7ydiQHF9Wg4iA8U1VAdnnODExPfYcen/Rq6JqE/PY2UI+s4gSNqhkrlNtaC60mAND6tctcGrTKJ4gNxlqynLn1yi0OelHbAnkuD6QHL88CSHxQfT9+sM=; 4:Nape0+hPeZ++n9G0M8lQraEs5O7XwSrMbjrNCK7zsZq8/fXsa71lRKaWJdvTTWmdl/J0kpzRlnaXew+sbi4Qg6Rc7zTeRKAdz6hAlKxa+j2MD30eB8bwXo6qoHCR5MVIagG4D6H9ESjB3udZFVWkBXuwq84894QV4K2v1M4srn1IuLkwkDq9HxqQV7KTyKtqCy8+SKRmy8k7stOid6TXB3sWMBMRgmJYejtCd1j9ME9HA+Guzck02mAXfxlfUOyq64hyp0VVBCbkaNvoqw7f6Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DM5PR0701MB3637; BCL:0; PCL:0; RULEID:; SRVR:DM5PR0701MB3637; X-Forefront-PRVS: 0674DC6DD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(39380400002)(366004)(39860400002)(189003)(199004)(76176011)(6486002)(7736002)(305945005)(42882007)(106356001)(105586002)(3846002)(6116002)(8656006)(53416004)(6666003)(47776003)(2351001)(2361001)(59450400001)(66066001)(6506007)(386003)(6512007)(55236004)(16526019)(8676002)(54906003)(51416003)(52116002)(50226002)(186003)(69596002)(81166006)(16586007)(316002)(26005)(6916009)(81156014)(107886003)(5660300001)(8936002)(53936002)(36756003)(48376002)(50466002)(25786009)(478600001)(956004)(72206003)(97736004)(476003)(11346002)(446003)(486006)(4326008)(2906002)(44832011)(68736007)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR0701MB3637; H:hyd1sverma-dt.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR0701MB3637; 23:vNB6PVZytJpep1xIuIv5/8QETlygVG7s60Qr1Zd?= =?us-ascii?Q?7zKmAne+DmAn/JiEy4q9yLYpHLATf1wJkoo1jaIdBXOO766WKQTOflUEJupE?= =?us-ascii?Q?8SjcEzUbZtTgfuvNd9MqWV6/2t7iUBElNeQuTiFu1JQW1iXk3fYAw3ID867l?= =?us-ascii?Q?1FV5usOPlErQqjU+4T7SimAz7bzDkX5fxRsOrsVhhKoVEuvW7dqES02M60TU?= =?us-ascii?Q?tKThkr3RMOolIzSHYf+QUPFSa+yBmcbu12+ynyzMWNgFj3qwmqevTiXAnLy2?= =?us-ascii?Q?8KWgNc0vLi+z5TUGZnR35mBLOSvaxCckxMZWuIvU3Xdosl5bh0StTvJ9n809?= =?us-ascii?Q?+rt3hGSaALvzDYPXTzo+9nnFB1PrMycnFrDkC3Ui4sRzMHhxJwjhTQeOxg+w?= =?us-ascii?Q?ySghz0rqbj1iEWO1kqF2nOG3moHslWVZdaTgv4oXtSAtkHQJaMH6xcuXrnQ9?= =?us-ascii?Q?VrimtcI2+LEdBObrJhgGf4kW35H7h+refySFImYKCuuicnZkYCExxQndbBaK?= =?us-ascii?Q?PMiN9h/XNIcLxTXtYjOaBuXYWJsis9C0BiHN8QtmtUM9BKl8pkTHdV9/p5NR?= =?us-ascii?Q?lZnezzh0UQCAD/oo/VnQCb/W+ImscNSQfJhiyJ37lzJQYCJPDAwucShBfcBL?= =?us-ascii?Q?Wv+Up9BV/94IPVD37q2dybs7rvpa0zZXigHn8ZlxL+isnwdyurxLAEFOEWnJ?= =?us-ascii?Q?ilo1jbUA+q6P90TpQfFKnfkg2+TpGFdCVLnyRElSMPJX91ysOqKl69ar02As?= =?us-ascii?Q?V1oCQkZgsnRkVwnd/lH0y98MiGcWxchMG4Zx0ROcB65DJOF1aW9AdUPOnw4C?= =?us-ascii?Q?P0O9iBUM1hGh9SgkIHSx8gkrVGgXvFDkmgabQ3pTHn2QWcErG9RKExtbdNJ1?= =?us-ascii?Q?6cJu61goiM/qiQzyJ6ttppJWqAa3hTQA2OSrfdwo2a854T/0DwwRUqp759wj?= =?us-ascii?Q?Lu/nIldScWyMJg9TEi3li9v8j7MgE0QAOEtOokuh946JuswgcEjl8jFhZrDD?= =?us-ascii?Q?HQazvHi4JH1O+5Ndw2PBE2H3P+vWbTOX2DFTp+gr9HOPvTteLT2w+CvDvkLo?= =?us-ascii?Q?RhScaXR8/WgeSvSAHHnhVwlD9yLlQUxmE/cf8eytjqfzicDe2FWwd19tU7Ge?= =?us-ascii?Q?KjtOh6pCvWJS9Vos7dr2IAgj+tV1aS66gqzzT8L9rQtlhrSj81kF5yg97875?= =?us-ascii?Q?e8oBJSa9syKinGu5D1qVxKCOE1U/urg30CGLrxmxaWaBOAsRZUC1TH4MliKC?= =?us-ascii?Q?GgNQu4Z10Xxqphn0XS+OIbWI3Zp8THB+OYR1H1oAt4vBeh9ohiDVMGzT77lH?= =?us-ascii?Q?LdYxaT0wzP//TZVrZcJw8en3Y0hcnniD4hQX22gTFmNgFJKgicld3Ch0hxRM?= =?us-ascii?Q?sljTkFsCExr2i3XEH6UeYOYp98w464e88tg4+1MC/KodxFf/cje7vZ3sKE4Z?= =?us-ascii?Q?Kb2k4+bpCTQ=3D=3D?= X-Microsoft-Antispam-Message-Info: FgzGW+LHYNqwdQkTUv0B1cc8JMQ2gGddIPlpiLgkF0+6/cvgbf1K3zM6zAKfdKEW6C8ZAue645LRDA0TQVsmiznwANRU4SpkGZgkUEURxldr/cZpu51V2zM2BNMVvGuOGCGwg0tg9g4W94Aze20h8UaZ67lX9HjWtn/kXWhEzjKnbk9lfCtVGIdJPcmfD8GV X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3637; 6:vsA9Lnd0+NBnFX4F/mFd/ERmAwvUGbKptm/iZoU4zZp9um83FibA19X31rtBpX0YEFQJU9LNOKVcRDE4V5oYewYg6ZDT/s+mf6mc5zMEKqJr2bED3WkDvomCa70Sn/6jA0pwSQnYcejyCU101SVC1MqNnBL+W3hN9tiQiTtcxVZ3POBZFvCbroPl73h3WihIND/QKUEDcZnpbwmDN2Zyu9WijKUip1XzZjKNZjJt7ByCewAmb5pJ0xC3MzZFwNiZdjLCiQwH5S/O8PvX+Wowe5TI3AHJRSaGpzc2nHjfq6UKq4P/fYsZ5Dqipmd1xPcu+osLD4oa+QmOtGbcbCUKp/fywG9YcnHN2jY1AQ4old4lku67+Diru2BfZVTkyNeAwbo/SoT7OlbrwAb89oka17sLrHYehwrqesDbThy6ZXGbGwm4xMjUSA+I4JoV0M3vrkmykGgZyZJxQI/dg/DHqw==; 5:b/PLIvf/oNdv3Pp2CIPnUnZM84ddHOLaVGMD7TtGO16f3QGoZuEtrix592o7sC127rLTXptaRH8KbgdwqBpcvCItQMk0YC0dPO9oxlDFblpUldTuLQnp+d4xQH/qcR8PrWR6J/7ZVPtbiUCAgO+ouYoDiUxz0bwXmhYT/WVfilI=; 24:C92nKUiGO3P38MayV+RIlE0OP4PEur+g0neDxH/11cYHVCtdbp8DNgKSHaUb0OT7SDdOp5vCBwWJ1Nn7m5E3drk5QHWvjEqHkoqQCRO2BZ0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3637; 7:ihfNbEHSmYCHZXz6DBOIqDn549sU0A+Of+umtesyrXRRvCkWax6/I54rrpFkcOMFfEV4w5102lGAwZG16wS8KnX9Gt3gxJdnhO5hNhrhbOZfPWSOMw6I90PxRYFo38CWO4JYrykPLPQNUfCBanoj0C2fGPRjHavJESOcaX5KnSmZ+yqviGdRtoLmYmeMF7WnyUlXJrGiWr62aqsAYUlJTLZCZXQxKZ1eltfopFheGKQIdu/zl0hG8cRF5bD9ruIY X-MS-Office365-Filtering-Correlation-Id: 02a9ba02-5398-4fd6-7da4-08d5baf31b2c X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2018 06:06:01.5075 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02a9ba02-5398-4fd6-7da4-08d5baf31b2c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0701MB3637 Subject: [dpdk-dev] [PATCH v3 3/6] lib/cryptodev: add asymmetric crypto capability in cryptodev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2018 06:06:05 -0000 Extend cryptodev with asymmetric capability APIs and definitions. changes from v2: - remove redundant xform_type from asym capability struct - rename rte_cryptodev_get_asym_xform_enum to be more consistent with other API names Signed-off-by: Shally Verma Signed-off-by: Sunila Sahu Signed-off-by: Ashish Gupta --- User must apply patch "lib/cryptodev: add asymmetric algos in cryptodev" before compilation --- --- lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_cryptodev.c | 73 +++++++++++++++++ lib/librte_cryptodev/rte_cryptodev.h | 107 ++++++++++++++++++++++++- lib/librte_cryptodev/rte_cryptodev_version.map | 11 ++- 4 files changed, 186 insertions(+), 6 deletions(-) diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index 138e627dc..93f9d2d45 100644 --- a/lib/librte_cryptodev/Makefile +++ b/lib/librte_cryptodev/Makefile @@ -12,6 +12,7 @@ LIBABIVER := 4 # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf LDLIBS += -lrte_kvargs diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 4015872ed..ee76cef07 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -242,6 +242,24 @@ rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum, return -1; } +int __rte_experimental +rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum, + const char *xform_string) +{ + unsigned int i; + + for (i = 1; i < RTE_DIM(rte_crypto_asym_xform_strings); i++) { + if (strcmp(xform_string, + rte_crypto_asym_xform_strings[i]) == 0) { + *xform_enum = (enum rte_crypto_asym_xform_type) i; + return 0; + } + } + + /* Invalid string */ + return -1; +} + /** * The crypto auth operation strings identifiers. * It could be used in application command line. @@ -287,6 +305,28 @@ rte_cryptodev_sym_capability_get(uint8_t dev_id, } +const struct rte_cryptodev_asymmetric_xfrm_capability * __rte_experimental +rte_cryptodev_asym_capability_get(uint8_t dev_id, + const struct rte_cryptodev_asym_capability_idx *idx) +{ + const struct rte_cryptodev_capabilities *capability; + struct rte_cryptodev_info dev_info; + unsigned int i = 0; + + memset(&dev_info, 0, sizeof(struct rte_cryptodev_info)); + rte_cryptodev_info_get(dev_id, &dev_info); + + while ((capability = &dev_info.capabilities[i++])->op != + RTE_CRYPTO_OP_TYPE_UNDEFINED) { + if (capability->op != RTE_CRYPTO_OP_TYPE_ASYMMETRIC) + continue; + + if (capability->asym.xfrm_capa.xform_type == idx->type) + return &capability->asym.xfrm_capa; + } + return NULL; +}; + #define param_range_check(x, y) \ (((x < y.min) || (x > y.max)) || \ (y.increment != 0 && (x % y.increment) != 0)) @@ -342,6 +382,39 @@ rte_cryptodev_sym_capability_check_aead( return 0; } +int __rte_experimental +rte_cryptodev_asym_xfrm_capability_check_optype( + const struct rte_cryptodev_asymmetric_xfrm_capability *capability, + enum rte_crypto_asym_op_type op_type) +{ + if (capability->op_types & (1 << op_type)) + return 1; + + return 0; +} + +int __rte_experimental +rte_cryptodev_asym_xfrm_capability_check_modlen( + const struct rte_cryptodev_asymmetric_xfrm_capability *capability, + uint16_t modlen) +{ + /* handle special case of 0 which means PMD doesn't define + * any limit + */ + if ((capability->modlen.min != 0) && + ((modlen < capability->modlen.min) || + (capability->modlen.increment != 0 && + (modlen % (capability->modlen.increment))))) + return -1; + if ((capability->modlen.max != 0) && + ((modlen > capability->modlen.max) || + (capability->modlen.increment != 0 && + (modlen % (capability->modlen.increment))))) + return -1; + + return 0; +} + const char * rte_cryptodev_get_feature_name(uint64_t flag) diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 623459a95..6c13d23f8 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -178,6 +178,35 @@ struct rte_cryptodev_symmetric_capability { }; }; +/** + * Asymmetric Xform Crypto Capability + * + */ +struct rte_cryptodev_asymmetric_xfrm_capability { + enum rte_crypto_asym_xform_type xform_type; + /**< Transform type: RSA/MODEXP/DH/DSA/MODINV */ + + uint32_t op_types; + /**< bitmask for supported rte_crypto_asym_op_type */ + + __extension__ + union { + struct rte_crypto_param_range modlen; + /**< Range of modulus length supported by modulus based xform. + * Value 0 mean implementation default + */ + }; +}; + +/** + * Asymmetric Crypto Capability + * + */ +struct rte_cryptodev_asymmetric_capability { + struct rte_cryptodev_asymmetric_xfrm_capability xfrm_capa; +}; + + /** Structure used to capture a capability of a crypto device */ struct rte_cryptodev_capabilities { enum rte_crypto_op_type op; @@ -187,6 +216,8 @@ struct rte_cryptodev_capabilities { union { struct rte_cryptodev_symmetric_capability sym; /**< Symmetric operation capability parameters */ + struct rte_cryptodev_asymmetric_capability asym; + /**< Asymmetric operation capability parameters */ }; }; @@ -201,7 +232,17 @@ struct rte_cryptodev_sym_capability_idx { }; /** - * Provide capabilities available for defined device and algorithm + * Structure used to describe asymmetric crypto xforms + * Each xform maps to one asym algorithm. + * + */ +struct rte_cryptodev_asym_capability_idx { + enum rte_crypto_asym_xform_type type; + /**< Asymmetric xform (algo) type */ +}; + +/** + * Provide capabilities available for defined device and algorithm * * @param dev_id The identifier of the device. * @param idx Description of crypto algorithms. @@ -214,6 +255,20 @@ const struct rte_cryptodev_symmetric_capability * rte_cryptodev_sym_capability_get(uint8_t dev_id, const struct rte_cryptodev_sym_capability_idx *idx); +/** + * Provide capabilities available for defined device and algorithm + * + * @param dev_id The identifier of the device. + * @param algo Description of crypto algorithms. + * + * @return + * - Return description of the asymmetric crypto capability if exist. + * - Return NULL if the capability not exist. + */ +const struct rte_cryptodev_asymmetric_xfrm_capability * __rte_experimental +rte_cryptodev_asym_capability_get(uint8_t dev_id, + const struct rte_cryptodev_asym_capability_idx *idx); + /** * Check if key size and initial vector are supported * in crypto cipher capability @@ -269,6 +324,36 @@ rte_cryptodev_sym_capability_check_aead( uint16_t key_size, uint16_t digest_size, uint16_t aad_size, uint16_t iv_size); +/** + * Check if op type is supported + * + * @param capability Description of the asymmetric crypto capability. + * @param op_type op type + * + * @return + * - Return 1 if the op type is supported + * - Return 0 if unsupported + */ +int __rte_experimental +rte_cryptodev_asym_xfrm_capability_check_optype( + const struct rte_cryptodev_asymmetric_xfrm_capability *capability, + enum rte_crypto_asym_op_type op_type); + +/** + * Check if modulus length is in supported range + * + * @param capability Description of the asymmetric crypto capability. + * @param modlen modulus length. + * + * @return + * - Return 0 if the parameters are in range of the capability. + * - Return -1 if the parameters are out of range of the capability. + */ +int __rte_experimental +rte_cryptodev_asym_xfrm_capability_check_modlen( + const struct rte_cryptodev_asymmetric_xfrm_capability *capability, + uint16_t modlen); + /** * Provide the cipher algorithm enum, given an algorithm string * @@ -314,6 +399,22 @@ int rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum, const char *algo_string); +/** + * Provide the Asymmetric xform enum, given an xform string + * + * @param xform_enum A pointer to the xform type + * enum to be filled + * @param xform_string xform string + * + * @return + * - Return -1 if string is not valid + * - Return 0 if the string is valid + */ +int __rte_experimental +rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum, + const char *xform_string); + + /** Macro used at end of crypto PMD list */ #define RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() \ { RTE_CRYPTO_OP_TYPE_UNDEFINED } @@ -1164,7 +1265,7 @@ int __rte_experimental rte_cryptodev_asym_session_set_private_data( struct rte_cryptodev_asym_session *sess, void *data, - uint16_t size) + uint16_t size); /** * Get private data of a session. @@ -1178,7 +1279,7 @@ rte_cryptodev_asym_session_set_private_data( */ void * __rte_experimental rte_cryptodev_asym_session_get_private_data( - struct rte_cryptodev_asym_session *sess) + struct rte_cryptodev_asym_session *sess); #ifdef __cplusplus diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index 62b782444..817cf9f70 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -89,13 +89,18 @@ DPDK_17.11 { EXPERIMENTAL { global: - rte_cryptodev_asym_get_private_session_size + rte_cryptodev_asym_capability_get; + rte_cryptodev_asym_get_private_session_size; + rte_cryptodev_asym_get_xform_enum; + rte_crypto_asym_op_strings; rte_cryptodev_asym_session_clear; rte_cryptodev_asym_session_create; rte_cryptodev_asym_session_free; rte_cryptodev_asym_session_init; - rte_cryptodev_asym_session_get_private_data - rte_cryptodev_asym_session_set_private_data + rte_cryptodev_asym_session_get_private_data; + rte_cryptodev_asym_session_set_private_data; + rte_cryptodev_asym_xfrm_capability_check_optype; + rte_crypto_asym_xform_strings; rte_cryptodev_sym_session_get_private_data; rte_cryptodev_sym_session_set_private_data; } DPDK_17.11; -- 2.14.3