From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50041.outbound.protection.outlook.com [40.107.5.41]) by dpdk.org (Postfix) with ESMTP id C32741B93F for ; Fri, 12 Oct 2018 16:41:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CcpSwO8VgDpLWOl+AqtJWwwFnsishU02D/yJ+ungwV8=; b=w9CpLgE5tBmlgeSXpOMH5ka6xUSmdPK0PfnSMGDsTbwcw1nCDY/qxPLzBEzvkiyCkUfVy1udj2rP/UISN71rwBmmDp0qPp88TwPKxN+9DpN3HoUHF945N+h96lJHnL4sxBMKSI1trxmY07/UxNpYMJvrMaq/s2T7LsBWKs+J9UQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; Received: from Tophie.ap.freescale.net (14.142.187.166) by HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Fri, 12 Oct 2018 14:41:48 +0000 From: Gagandeep Singh To: dev@dpdk.org, akhil.goyal@nxp.com Cc: Gagandeep Singh , Hemant Agrawal Date: Fri, 12 Oct 2018 20:10:50 +0530 Message-Id: <20181012144055.9461-10-g.singh@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181012144055.9461-1-g.singh@nxp.com> References: <20180913060846.29930-1-g.singh@nxp.com> <20181012144055.9461-1-g.singh@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR0101CA0039.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::25) To HE1PR04MB1530.eurprd04.prod.outlook.com (2a01:111:e400:59a8::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 007a274c-b052-4a39-5d00-08d63050d7f0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB1530; X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1530; 3:ODPtJn3QM2KC691oT8ndQW5YNtpdHnLu5/hcK+LN3BxGnLJHZsdYSHgqDayutARiJettmOYCeDD5RaIec1a4UDSkUZueya9xL7MJswZ36ioLG1bNhbjsNgMlLjHfoYrcNZHFNwVPKpnhAgvSu5MoUWvvuv1I/uvHv979Av+iIqTDAOoxvFhBbGuEhzpIFYu/0X8gJ8kYHUoeTydb/rKboIRO3gxjfZ0MYHu7dxXKLoXD1H3rtNZ80Ajg2HS7VLU5; 25:aQjgialRsSLOoSCsBUWYlmibM7wvN3QOhVc4HBva0VbalRBWrO39oT7agLbBEcTAqJRPxgpWIznYpy2tAfCLQZKvIygC3DJAS3tIBAZMXfw4UEzX5iObPWKW3q170FcV8fR2C1h4CTfduMclwP+vrU1YYWPB2tujl6T8DOmF2LJVSP1eVH+PQ5sctypWQKR0zAOReS+1xWCb4nDGAtLPBq49qGfBBjHkR+gzq/GeXClmJTaoJNsFLq9SahUMx+0cv15dIVUk/2dpDP5DZySbesqDo3kw0ihOLBW+Y9iM0BcWDowBfB2PsaV1HZh8rLWasyTYO/izWpXJ5Fppea4JQg==; 31:ilF92geAARPzl9PVcaLBrBqXiJx7zp5XDKRh9bvG7KsSfBeAFI+AMV3kIxiiio9E9ql1+LgNWb4FkQHmrNetRThBk/YgaJOF8XrCMVa7oGeWJq+lr+dhNShWTzXKdq/XH2LeWD4NBVclVKexLbWhVfpceOMKJ+T0q8ljS+o62Gn1rDpP/jqDewDZBtEZ0QsDwA1l4nQDlts2d+AKrDliv+CsMsTzMSk9d6sFM4tIr2o= X-MS-TrafficTypeDiagnostic: HE1PR04MB1530: X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1530; 20:iWvyFSv33Uuk2iWi5nowlrg2zvk4JlBmWHTO8yvCDMVkDn88Ahe/7uWRG+rYE1px4PkdSs2gP5emRBUNIaFc+Rvud0yMhHy9E8NSYqJG5J9byX3Wg/fTEnG+QED/7iUBcJreRaQ36752Tl/3Pl8R8ZBsrCyjCKQqaCBh3IQX5n45AEPDTcwwqBC1yvCuROm6VF+m7/WT00yG39dcwzEFCvLuCMOjq8KZBwNoLERcuwzeILxDnpHx2nT1gyPU7dtvPfWZbNGEi9S/dudxuphbyoZORIB49ERxJyXWqJ+VZD/ReTsKhUTDVmPnNq00D/sXUHWwc44on8uXpDpYabhkmKCEQ32nFxA60jq8S3rW3KF5O2DrmKI8UA0pJDjhORlzd4cvvfNCJg68ifjdWoBXxAkUnrMzwJ+cwIpeWX1iG9LoM/umoQAkHdXQ1OXUL27/4JeD0l1ut3wfmBkFjSYaW5X/X6W5hzy2pZRVvFXgCujxycNX4vsFL/iRuV25BDId; 4:G8Diks07L9bAQMQhl0UxV3N8l6d9ImOlmmX17/jeqx/u3QjfbNiuLqrPUmlNQRw58ZjsnDN6moVP1VCyOnbb39Pic835rrIwCoQvcoy9+yDkVQfEcn6cybRPCAV1Cpcp8fbPCSBiI09ddLVcNeig5OBGe4lzSgBGCMOuNpiSGaoNAd5mCK3NpK2HXb5X2toDL6weg3IFrT9vjIzU5+W1daYhnMVMDPkN2jKG/oL66NIlKStlf6Hj4+dwQvoaslCFoAUTfLTb8tbIUYs6nZs64o4/YKfqIb9K/2+RA24j4oVn1oomSyczB+zhzzQRUH09 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(201708071742011)(7699051); SRVR:HE1PR04MB1530; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB1530; X-Forefront-PRVS: 0823A5777B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(396003)(136003)(39860400002)(189003)(199004)(316002)(305945005)(8936002)(386003)(55236004)(6636002)(6506007)(106356001)(25786009)(36756003)(16586007)(5660300001)(72206003)(52116002)(53936002)(26005)(6512007)(478600001)(54906003)(68736007)(186003)(16526019)(50226002)(7736002)(105586002)(51416003)(97736004)(76176011)(78486009)(3846002)(2906002)(66066001)(1076002)(4326008)(956004)(446003)(2616005)(47776003)(11346002)(6666004)(1006002)(6116002)(486006)(14444005)(476003)(8676002)(50466002)(48376002)(81156014)(86362001)(81166006)(6486002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB1530; H:Tophie.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR04MB1530; 23:itvkn1uIperZyt6bthniqtYYf17GZI24JdKUoIl4A?= =?us-ascii?Q?Me8RG2TBKNAy3EilT9CLXozZhchdda85s1Ay1pigTfkJGMpbjAFUdL7bjYBb?= =?us-ascii?Q?OWFlK62ycN0yp34ncJ5V/wabsnXzwSOdP18C76rE/wbmWW0cX3XkjvqKFcJ8?= =?us-ascii?Q?lR1cIxEUH8T8rDkZ/5ZKnI7TuTOwQ36KUMs/4DuRqNBc8AaQyKr5VB4AVtEO?= =?us-ascii?Q?KO7OJ4PC8umXzPthlLCtFCxgzYBKIz1BXkuFS4HaIDy7RItPpxLuqkwcWKA1?= =?us-ascii?Q?XPxjE+7A8v+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yJh+VRPMGcPe8SqzhvNx5SfQ==; 5:weqNVxXVzd9gu3VlNH7Xsn7e/f2gSxWMH2crZ/7bh8FaH8wtj4K+UwpN8DOElCLtIObQ+0ePLticLuN0FsAig4QhQrhoNKATFP5KbOYSFRAIXj0x1JBS5ovtq1ytj2E+9cqA+Q/QO2rDhVzAlghj2KcTajQdTiEJyKPBto6KeOw=; 7:HHw6rN5G0wykOTNBWrDQdmVTbNGjZxgA26w7QAAMRAUxwMM790GPG7j6q1W9brtB8o72tMq+IGNb7HZQSes3VCUdDFkkTGJdlK0po0hlfpAGrQvxlR8KZVLDHgCsUO+aMRf7t21UOMxBMHDyMZ2kdDOxAIuZ2mkELNosN8srsUk75ZIiRIJrvTMpyhnbJVApfSExsths1iPQ6mXqznqgNM/RH/0XTVfkkCuIUzscrEDvtcOllniq40a3/icUILVq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2018 14:41:48.5842 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 007a274c-b052-4a39-5d00-08d63050d7f0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1530 Subject: [dpdk-dev] [PATCH v2 09/14] crypto/caam_jr: add session configuration methods 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: Fri, 12 Oct 2018 14:41:52 -0000 This patch add support to create session configuration of various types i.e. cipher, auth and aead etc. Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal --- drivers/crypto/caam_jr/caam_jr.c | 215 +++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index 78bc75f69..f6c2565cf 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -24,8 +24,11 @@ /* RTA header files */ #include +#include +#include #include +#define CAAM_JR_DBG 0 #define CRYPTODEV_NAME_CAAM_JR_PMD crypto_caam_jr static uint8_t cryptodev_driver_id; int caam_jr_logtype; @@ -159,6 +162,214 @@ caam_jr_queue_pair_count(struct rte_cryptodev *dev) return dev->data->nb_queue_pairs; } +/* Returns the size of the aesni gcm session structure */ +static unsigned int +caam_jr_sym_session_get_size(struct rte_cryptodev *dev __rte_unused) +{ + PMD_INIT_FUNC_TRACE(); + + return sizeof(struct caam_jr_session); +} + +static int +caam_jr_cipher_init(struct rte_cryptodev *dev __rte_unused, + struct rte_crypto_sym_xform *xform, + struct caam_jr_session *session) +{ + PMD_INIT_FUNC_TRACE(); + session->cipher_alg = xform->cipher.algo; + session->iv.length = xform->cipher.iv.length; + session->iv.offset = xform->cipher.iv.offset; + session->cipher_key.data = rte_zmalloc(NULL, xform->cipher.key.length, + RTE_CACHE_LINE_SIZE); + if (session->cipher_key.data == NULL && xform->cipher.key.length > 0) { + CAAM_JR_ERR("No Memory for cipher key\n"); + return -ENOMEM; + } + session->cipher_key.length = xform->cipher.key.length; + + memcpy(session->cipher_key.data, xform->cipher.key.data, + xform->cipher.key.length); + session->dir = (xform->cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ? + DIR_ENC : DIR_DEC; + + return 0; +} + +static int +caam_jr_auth_init(struct rte_cryptodev *dev __rte_unused, + struct rte_crypto_sym_xform *xform, + struct caam_jr_session *session) +{ + PMD_INIT_FUNC_TRACE(); + session->auth_alg = xform->auth.algo; + session->auth_key.data = rte_zmalloc(NULL, xform->auth.key.length, + RTE_CACHE_LINE_SIZE); + if (session->auth_key.data == NULL && xform->auth.key.length > 0) { + CAAM_JR_ERR("No Memory for auth key\n"); + return -ENOMEM; + } + session->auth_key.length = xform->auth.key.length; + session->digest_length = xform->auth.digest_length; + + memcpy(session->auth_key.data, xform->auth.key.data, + xform->auth.key.length); + session->dir = (xform->auth.op == RTE_CRYPTO_AUTH_OP_GENERATE) ? + DIR_ENC : DIR_DEC; + + return 0; +} + +static int +caam_jr_aead_init(struct rte_cryptodev *dev __rte_unused, + struct rte_crypto_sym_xform *xform, + struct caam_jr_session *session) +{ + PMD_INIT_FUNC_TRACE(); + session->aead_alg = xform->aead.algo; + session->iv.length = xform->aead.iv.length; + session->iv.offset = xform->aead.iv.offset; + session->auth_only_len = xform->aead.aad_length; + session->aead_key.data = rte_zmalloc(NULL, xform->aead.key.length, + RTE_CACHE_LINE_SIZE); + if (session->aead_key.data == NULL && xform->aead.key.length > 0) { + CAAM_JR_ERR("No Memory for aead key\n"); + return -ENOMEM; + } + session->aead_key.length = xform->aead.key.length; + session->digest_length = xform->aead.digest_length; + + memcpy(session->aead_key.data, xform->aead.key.data, + xform->aead.key.length); + session->dir = (xform->aead.op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ? + DIR_ENC : DIR_DEC; + + return 0; +} + +static int +caam_jr_set_session_parameters(struct rte_cryptodev *dev, + struct rte_crypto_sym_xform *xform, void *sess) +{ + struct sec_job_ring_t *internals = dev->data->dev_private; + struct caam_jr_session *session = sess; + + PMD_INIT_FUNC_TRACE(); + + if (unlikely(sess == NULL)) { + CAAM_JR_ERR("invalid session struct"); + return -EINVAL; + } + + /* Default IV length = 0 */ + session->iv.length = 0; + + /* Cipher Only */ + if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER && xform->next == NULL) { + session->auth_alg = RTE_CRYPTO_AUTH_NULL; + caam_jr_cipher_init(dev, xform, session); + + /* Authentication Only */ + } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH && + xform->next == NULL) { + session->cipher_alg = RTE_CRYPTO_CIPHER_NULL; + caam_jr_auth_init(dev, xform, session); + + /* Cipher then Authenticate */ + } else if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER && + xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH) { + if (xform->cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) { + caam_jr_cipher_init(dev, xform, session); + caam_jr_auth_init(dev, xform->next, session); + } else { + CAAM_JR_ERR("Not supported: Auth then Cipher"); + goto err1; + } + + /* Authenticate then Cipher */ + } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH && + xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER) { + if (xform->next->cipher.op == RTE_CRYPTO_CIPHER_OP_DECRYPT) { + caam_jr_auth_init(dev, xform, session); + caam_jr_cipher_init(dev, xform->next, session); + } else { + CAAM_JR_ERR("Not supported: Auth then Cipher"); + goto err1; + } + + /* AEAD operation for AES-GCM kind of Algorithms */ + } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AEAD && + xform->next == NULL) { + caam_jr_aead_init(dev, xform, session); + + } else { + CAAM_JR_ERR("Invalid crypto type"); + return -EINVAL; + } + session->ctx_pool = internals->ctx_pool; + + return 0; + +err1: + rte_free(session->cipher_key.data); + rte_free(session->auth_key.data); + memset(session, 0, sizeof(struct caam_jr_session)); + + return -EINVAL; +} + +static int +caam_jr_sym_session_configure(struct rte_cryptodev *dev, + struct rte_crypto_sym_xform *xform, + struct rte_cryptodev_sym_session *sess, + struct rte_mempool *mempool) +{ + void *sess_private_data; + int ret; + + PMD_INIT_FUNC_TRACE(); + + if (rte_mempool_get(mempool, &sess_private_data)) { + CAAM_JR_ERR("Couldn't get object from session mempool"); + return -ENOMEM; + } + + memset(sess_private_data, 0, sizeof(struct caam_jr_session)); + ret = caam_jr_set_session_parameters(dev, xform, sess_private_data); + if (ret != 0) { + CAAM_JR_ERR("failed to configure session parameters"); + /* Return session to mempool */ + rte_mempool_put(mempool, sess_private_data); + return ret; + } + + set_sym_session_private_data(sess, dev->driver_id, sess_private_data); + + return 0; +} + +/* Clear the memory of session so it doesn't leave key material behind */ +static void +caam_jr_sym_session_clear(struct rte_cryptodev *dev, + struct rte_cryptodev_sym_session *sess) +{ + uint8_t index = dev->driver_id; + void *sess_priv = get_sym_session_private_data(sess, index); + struct caam_jr_session *s = (struct caam_jr_session *)sess_priv; + + PMD_INIT_FUNC_TRACE(); + + if (sess_priv) { + struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv); + + rte_free(s->cipher_key.data); + rte_free(s->auth_key.data); + memset(s, 0, sizeof(struct caam_jr_session)); + set_sym_session_private_data(sess, index, NULL); + rte_mempool_put(sess_mp, sess_priv); + } +} + static int caam_jr_dev_configure(struct rte_cryptodev *dev, struct rte_cryptodev_config *config __rte_unused) @@ -228,6 +439,7 @@ caam_jr_dev_infos_get(struct rte_cryptodev *dev, if (info != NULL) { info->max_nb_queue_pairs = internals->max_nb_queue_pairs; info->feature_flags = dev->feature_flags; + info->capabilities = caam_jr_get_cryptodev_capabilities(); info->sym.max_nb_sessions = internals->max_nb_sessions; info->driver_id = cryptodev_driver_id; } @@ -242,6 +454,9 @@ static struct rte_cryptodev_ops caam_jr_ops = { .queue_pair_setup = caam_jr_queue_pair_setup, .queue_pair_release = caam_jr_queue_pair_release, .queue_pair_count = caam_jr_queue_pair_count, + .sym_session_get_size = caam_jr_sym_session_get_size, + .sym_session_configure = caam_jr_sym_session_configure, + .sym_session_clear = caam_jr_sym_session_clear }; -- 2.17.1