From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0045.outbound.protection.outlook.com [104.47.42.45]) by dpdk.org (Postfix) with ESMTP id 873D54C93 for ; Tue, 27 Mar 2018 14:55:17 +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; bh=b/cwoWvZtPWIHNJ86xYzpxnc3QwuuMMhna8UW3P7U3I=; b=NfuvDGN/A7EHFrGya54bddyt+zoVmllCAaV9Bv8hyu5vMkqxCTfwNd1vcsMIcWE7xsuMAWbUDUToYhLmcCsRJSJ2unHkKgisy1w+NshQjpYEMEQ+IaX4r6UHC1zVyfxGAYrOKnw8NKM+TYm1NiX3i/b3necsgu1kIbeQpIqcna4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by MWHPR0701MB3644.namprd07.prod.outlook.com (2603:10b6:301:7d::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Tue, 27 Mar 2018 12:55:13 +0000 From: Shally Verma To: pablo.de.lara.guarch@intel.com Cc: declan.doherty@intel.com, fiona.trahe@intel.com, pathreya@caviumnetworks.com, ssahu@caviumnetworks.com, agupta@caviumnetworks.com, dev@dpdk.org, Sunila Sahu , Ashish Gupta Date: Tue, 27 Mar 2018 18:24:40 +0530 Message-Id: <1522155281-16329-3-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1522155281-16329-1-git-send-email-shally.verma@caviumnetworks.com> References: <1522155281-16329-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: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::29) To MWHPR0701MB3644.namprd07.prod.outlook.com (2603:10b6:301:7d::37) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 900a1bf4-53c2-44fa-7fcf-08d593e1fcb8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MWHPR0701MB3644; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3644; 3:syM3ysJqebDiRP4tATpeapbJlx5bImQCBdrFPyXWwDHrPyaA7JvFyw1Z8Plps2YuHB6K4ThdSl6sfSYgD9B7cHkschmZJ8EtiyS86u2tupv4NaZnScskj15WTn6hGG15fqAv/N0qhWXdcD/tZkGXhHtzC7lZVJEkKma5mPlVx+R/U7yFxODAAWGYeFS6dsytpnlNdPV8ywy9+EEFeE2UDobsFYue62/Dr7h5svzeyEQe26rEJqL2HlCv+U5uNsaJ; 25:PfeEp0ndH60wf60P8KMxbiozs8urmfME5LxvQcvj+9smWwyGv0dVafA4k8rDMfqlUEFZ7exW4Zrpo2ttlio7XkmC00aBpZhi2nuY4phc9UKk78eWdj/LZ/THXm5FTUZoPgzDiTvQL469l6mUmzgsu46ORY64DyaQ8BB0DK2b/YBP6KuS07AZOIAP5/C1+uwefvgr+pheXaav0w+NM4TniNjZbPL5gvUoaLbTIpFqkVvWGjyoypQYol6hs9O0/hjcqj53sjnNDFcr4uVIqekoDhbMT79cPWCh50ikY37qbisbSGWM1Qu7ghZtNwMiaE1xrOPPCEyZIK6x0ctP00djCw==; 31:yC/dkLxsD0b3i7TMXFYTjcrl0GScRUGAeD8IJobziGTl+Gr4z+i8dyCwFOoToRm92DzikLRksx/sOeRJbHAXlFjygl1sP9rSVuzg6xXH5gj/8cDGrpzIe8qs1jOwS5S7/+ViYYxuZSnY8wChdd9W15gjK8jFgxpNNZeU+NOG3cBwqqOo0HS0dRBnehPKacACYLDu8dIhnvFW3xHqvra6F43e7+3ypz2/JVvV+5qO8x4= X-MS-TrafficTypeDiagnostic: MWHPR0701MB3644: X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3644; 20:oNhV2hJiuF2o7S/3og7OircxoM5Z3U94yPw3gXg7o+g8k/OIc+nE5q81o6PCZEo2Lxced1G5SryyPaNReU/zbMnwLFw2Pb3xH/M+YHpzFRFU8yuHJ7iHShefKi4v1MrbGNq9xtFNPtAAuUVNkWGfNg83/nY+MGMzpk6YzDIrD78qCyrgZkhYKtc25+4cnBP3DOKmqw4uuqQaQsn5HZQZVI5ZWQkCFP3Ld/WsyPTtm6yyTyOPR/5tTqqi72q+XzchbH26wrNg5wr2EU602rVd99WyiL1QRcIbgjcSM3zFpQypdD5YuYSjb0EDOUjwH6Vtcd1VIO+MpJLhPr9SX4cktbJZx15WKKckIFIF/4YjSS3rOlR84KEsZh0RzJWKVIQQlleqtMSXxSykD4ZGP4QLYZbpfSDJYzPMsU4lK8RTRNbLFesbM3lxtu87G7CjW6x7YvMS0jxZLRrZC6MMX00n7NJz603/KUjLNrPCG4wnt6K8xgGo8SYXi3eSIFQEzA6358/AcyPQmuWwu0Av7NppNcF6CuCrod8xJR2p7pA2m+q+zi97HiR9PmRKFOO/LbV7179C+4M3Gp8NRaWVmCWXqfbfr3dSnW7aGFlETmn4Kd0=; 4:/vTlw2E/q1DZkxjEO20yHyYDFhE57Ln14gkgKAJ1qvspD+jW9QX62TSjaY7/mEWQqlOQZimFMuLc3NLecUEoJ6Wq12YGE7CKqaf25JQS2iGKFkhouUqTtNS5hOGOEHquX0tSui+lEdk60TY+vWb3JQv/3YFbDS38n6w/lTpsVVrNomvF76OZEVQYDMy6jzQpMSd/nMGdfY/eJZrH+0RO8L/DFRhtw+M8mWZO+gzyJjUzj0cp8QKdlRkvYgMOP4MRO/p41glk2IA949Dt2EzUAw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231221)(944501327)(52105095)(93006095)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:MWHPR0701MB3644; BCL:0; PCL:0; RULEID:; SRVR:MWHPR0701MB3644; X-Forefront-PRVS: 0624A2429E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(366004)(39850400004)(396003)(376002)(39380400002)(189003)(199004)(55236004)(36756003)(81166006)(16586007)(68736007)(81156014)(50466002)(6666003)(106356001)(6916009)(53416004)(8676002)(5660300001)(478600001)(105586002)(2906002)(72206003)(50226002)(4326008)(3846002)(6116002)(69596002)(107886003)(48376002)(8936002)(2361001)(316002)(2351001)(97736004)(54906003)(6512007)(26005)(305945005)(42882007)(2616005)(446003)(16526019)(186003)(11346002)(6486002)(59450400001)(47776003)(7736002)(956004)(25786009)(53936002)(386003)(6506007)(51416003)(486005)(52116002)(76176011)(476003)(486005)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3644; H:hyd1sverma-dt.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR0701MB3644; 23:+5h5nsycGDhq5/X5VNnHQ1XQiBUE63SiHNLk25N?= =?us-ascii?Q?XNsKgftS5DFZ082VhbQmfccPPTzhyllqq5pQIIhM31OglF00HTkIrsZhbi4t?= =?us-ascii?Q?ylWriQCq7AA6FBf/XToJTkts3PYYPWpUfTcNnlqsAuZTh/KbHchindgLZ9Ky?= =?us-ascii?Q?ojJaOrGRr6+iuAlH0LXy3hR1nJB5QVD2CWGP0NN7RjoMEZ4ba4+Oir2EJHMb?= =?us-ascii?Q?gf4eP6cwkERv29TgmHks7BMBYyHvWeSLjOUql93jpiryRoZolgQ4bEkOZDeo?= =?us-ascii?Q?LTcRFF2ykmDHRaXDyMUyo5Ymbm5w4OWliOef/ivWTKcByummhzekUtosvy2Q?= =?us-ascii?Q?okoVsDU4idphnS0IUbqtAaX8/z2gBDqcdsuUqajQOg3J18oJ+U7/aig89bZt?= =?us-ascii?Q?nzgpKbhDBmclc4o4zUCXgKxLsAEgM/t/t3Vg/jOq3d+6bsIWnm+LIrAHlI0w?= =?us-ascii?Q?AOy7eEQ0QCmDD4lH7d+2SMKX+2OpIkA+hktcedK6SCig0rNclOZx99pwwJ4s?= =?us-ascii?Q?UJgpt4q7PH+czTmqDvHCJGK26HnWMfvRy/YUOI6TewjXAIpAu5xOJ7nXnG3K?= =?us-ascii?Q?IorpibLmJdItz9bNTPFDB7wTQ0xRbWKSYpPxA8kWxhGCprZrMgGt6RZi9hvy?= =?us-ascii?Q?l70Q2eDUnoxD45U/8lDKon0nOrhxSPQsuqeRiMiM6rEqm/EauX82AwMvCkq9?= =?us-ascii?Q?7ehsj6b4NtKcvaFNILe76eZtpYxKBLKvi0qLYg1cPPKfygy3gNm5euvdMhDa?= =?us-ascii?Q?hysFZRxWSGKU6GU9dJJ0Flvr+gegBQhfHttGGgpqH4SlLqXIn6JXvkZjuoeJ?= =?us-ascii?Q?O/i4/mkQtyK2gYyPI66AUEf5620t/vHcS4LyDoSuI3BuocA6+ehv0VvSQgPB?= =?us-ascii?Q?b66eQtiizQWQvjyJaHSWIraS9v5U9iReJI+tv9pYGks56YZwHoCBQM6dUbkr?= =?us-ascii?Q?YEvMAvifGxI1pJ2MJnsvW7DZf0hmGeXp5bdYUVXT87VagZK4PdG7npLs1ejr?= =?us-ascii?Q?XKYHTFYyKn43PwdmEGStTeL/kidRFGMCzEg9YbZ8/ZGRp2rVIuvOHFvAirdt?= =?us-ascii?Q?TirHw2xO+80yNSA2gm5wXtA4ozaQc2zsI1wlGCaqLG4K3LjxHrdiZnC3vPPP?= =?us-ascii?Q?GMILLQKAFUAaTXA35owWIK6tLWP3MGEH+GA6BK1YF1TI8LRrwxs1a6Y4E3Tv?= =?us-ascii?Q?r+DXNODVRl8IzmQCMpflNnvSRCGsK7NVMPHjD07dFVEit+faeKB+WlQihtFc?= =?us-ascii?Q?8trVn1NYRsrezhVk8TX30eQ2XJXVXS0z6/OUtpx+oZejgEyuQHeCL1NTjwgC?= =?us-ascii?Q?LVPVVImIqQg39bBeeFSqsTF3VZLJBxjbXXn92dNV0x8P6kfapn7PTqqFC+XO?= =?us-ascii?Q?KxL85/tNzHdcLPLJD0vACZDpKhFw=3D?= X-Microsoft-Antispam-Message-Info: I2GnzDjQJrvRUzgrSFAkmDAPCplJJhreACacKSAhuXu+TVeMW5LvTvx5XInl/ZSbh33jpdxNGoTm8qhnDPrAez0HFGSL0v3aFjb/kuJ4IkwWEz1RQKqoWo2nMh7WaGLkHRXm5NIV8zntztzEmaHj3T01qXJAtBDWyRofZ8fDU2ErJdmCoFTVxp1B7JetrFnE X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3644; 6:iSKzzHKKaauA6q3332Q3w392gsNqbjm6vuTas4rJp/zXBSkxdAdGziLxizzr2ImIluT6ucibw8t3OSEL4LkYZn3IPd+0L8rRXeoUpmboq+XgGkKUBHvFmZ+MchYT2a9emtUNoOzT3zK8Hqi5NkKFumQEIMCx9634F2hBSgFaWNIZXT69mmpQq0DAENLNRu4nvQdN+37pQBoP+t4MEa6C91hbOElYHuT7HRG5mA0Q7ycpj608Vb6EWnlQdqtiQFeKUaBw47JLKvz+QO5wav+wlJTtt7ey466N3XJ/eM7w2qQMqg8qOIAHjslNJK1hkDyg1xRPV0RcEXSOelT5EFCiz7xYrtznMi8vK6nyJqj8DEmmhiKiCR29f7aIKhB0CvU+RXidp4meJFoHf7fyVyHmNeX8D9rAsz7pGEpmUDBUX3jBNdbLsa/uU1l2mTrM6SG9WMafK7z5h6SjbAyBuAKE2g==; 5:tNi0rR1J7fhiJZpHBhb3paRY2gUtu+lIUNusFoGUo7vKhQdN2WBy32kgWLJQamHLqHKkrYN04dbeQoQ2DcsL6tLODyJnje4jcdi7I3pWpShP8Yo9k/rMmwRCvUcza1elKF+g87MVWfRJdVCtDytKGgRVa3UFNITbUj+y+Ye6yhA=; 24:sojI02jueTmkbYvSxcDe/iL+jYOTum1RLDPY72Rc2JBiEXgovg3FMzv3jp0gbX05k/cdG0MI7QHjlVRjQyX2ckfE2xeTIJFxG+Ae8OOl3Cw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3644; 7:EgWJb2YN+kYvt415/DE6Evrg0v4TOgBxhkc4oiyLTY/Ha66TZlZyIus1L3DxkGcOXgCUXZYGScB4dIcA780WHsEDwjTJwSYQQhmK4kYT/2umNkWRjh/aENmpL3sW9mRQB3CiWgP6WQ/OYKnnIiw9ysKV3Tc1uznoeJxkq9LVa32lp+2h8cKTTy7dE2X82a77WeIYZ+PXwwko3YzTl5aVtRHW+URq6RGXRUmTJf7Gddeyz9ypgABKsRtKVDU75dC7 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2018 12:55:13.3104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 900a1bf4-53c2-44fa-7fcf-08d593e1fcb8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0701MB3644 Subject: [dpdk-dev] [PATCH v1 2/3] 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: Tue, 27 Mar 2018 12:55:18 -0000 Extend cryptodev with asymmetric capability APIs and definitions. Signed-off-by: Shally Verma Signed-off-by: Sunila Sahu Signed-off-by: Ashish Gupta --- lib/librte_cryptodev/rte_cryptodev.c | 96 ++++++++++++++++++++++ lib/librte_cryptodev/rte_cryptodev.h | 105 ++++++++++++++++++++++++- lib/librte_cryptodev/rte_cryptodev_version.map | 4 + 3 files changed, 204 insertions(+), 1 deletion(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index cca8d4cd4..f1e9f7d70 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -166,6 +166,31 @@ rte_crypto_aead_operation_strings[] = { [RTE_CRYPTO_AEAD_OP_DECRYPT] = "decrypt" }; +/** + * Asymmetric crypto transform operation strings identifiers. + */ +const char *rte_crypto_asym_xform_strings[] = { + [RTE_CRYPTO_ASYM_XFORM_NONE] = "none", + [RTE_CRYPTO_ASYM_XFORM_RSA] = "rsa", + [RTE_CRYPTO_ASYM_XFORM_MODEX] = "modexp", + [RTE_CRYPTO_ASYM_XFORM_MODINV] = "modinv", + [RTE_CRYPTO_ASYM_XFORM_DH] = "dh", + [RTE_CRYPTO_ASYM_XFORM_DSA] = "dsa", +}; + +/** + * Asymmetric crypto operation strings identifiers. + */ +const char *rte_crypto_asym_op_strings[] = { + [RTE_CRYPTO_ASYM_OP_ENCRYPT] = "encrypt", + [RTE_CRYPTO_ASYM_OP_DECRYPT] = "decrypt", + [RTE_CRYPTO_ASYM_OP_SIGN] = "sign", + [RTE_CRYPTO_ASYM_OP_VERIFY] = "verify", + [RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE] = "priv_key_generate", + [RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE] = "pub_key_generate", + [RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE] = "sharedsecret_compute", +}; + int rte_cryptodev_get_cipher_algo_enum(enum rte_crypto_cipher_algorithm *algo_enum, const char *algo_string) @@ -217,6 +242,24 @@ rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum, return -1; } +int __rte_experimental +rte_cryptodev_get_asym_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. @@ -262,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.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)) @@ -317,6 +382,37 @@ 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 mean PMD define no limit defined */ + 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 68d1ae19e..deae3d656 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -178,6 +178,37 @@ 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 { + enum rte_crypto_asym_xform_type xform_type; + /**< Transform type: RSA/MODEXP/DH/DSA/MODINV */ + 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 +218,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 +234,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 +257,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 +326,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 +401,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_get_asym_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 } diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index d5bd12a6a..e7cef19f2 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -89,11 +89,15 @@ DPDK_17.11 { EXPERIMENTAL { global: + rte_cryptodev_asym_capability_get; rte_cryptodev_asym_session_clear; rte_cryptodev_asym_session_create; rte_cryptodev_asym_session_free; rte_cryptodev_asym_session_init; + rte_cryptodev_asym_xfrm_capability_check_modlen; + rte_cryptodev_asym_xfrm_capability_check_optype; rte_cryptodev_get_asym_session_private_size; + rte_cryptodev_get_asym_xform_enum; local: *; }; -- 2.14.3