From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8CDC7A046B for ; Wed, 24 Jul 2019 10:52:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB5971C19C; Wed, 24 Jul 2019 10:52:08 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id F1BFE1C199 for ; Wed, 24 Jul 2019 10:52:07 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6O8oV2A031646; Wed, 24 Jul 2019 01:52:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=Rs9QWRklE/Dj0cS0CKgv/9Ll0JHjPV35i6/H8MczMoU=; b=ZbrlpqvfG9Z98+nZ/eN1HV/6Eeh2bt5HDZTXxN1KG72/M8QJbcm/gVnI70p9Fx38uxkq WVcL7cSoEmXpmOHB345axhr/kOC5XuTeeik9kY0A43xXX4Pzf+hl0d1rQHwqKLl90+MZ R3J6T3tZ4YAYPh4bMF4qZYNYa5FK0RbR5H3iuYs1JXtXbqRrivb5xXNMIZByV3uvQYWZ bM2/nwavH8jFeMAQ450+O7ug8VE2kC4X8Ln9SxQbjonRHtKczdHKi4NNYZVea4VBs6QS xz9bH/i3SG8m6U3BL8GofnvqNc57F7hKtDESwuL2CZr6q5cXzBIH+t90WVUOhA8FpS3N MA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2tx61rb9uw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 24 Jul 2019 01:52:06 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 24 Jul 2019 01:52:05 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 24 Jul 2019 01:52:05 -0700 Received: from localhost.marvell.com (unknown [10.28.10.76]) by maili.marvell.com (Postfix) with ESMTP id 8A74C3F7043; Wed, 24 Jul 2019 01:52:03 -0700 (PDT) From: Ayuj Verma To: CC: , , , , , , Ayuj Verma Date: Wed, 24 Jul 2019 14:21:56 +0530 Message-ID: <1563958317-480-2-git-send-email-ayverma@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1563958317-480-1-git-send-email-ayverma@marvell.com> References: <1563958317-480-1-git-send-email-ayverma@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-24_03:2019-07-23,2019-07-24 signatures=0 Subject: [dpdk-dev] [PATCH v1 1/2] lib/crypto: declare crypto asym xform immutable 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Update asym xform usage in cryptodev documentation. Change lib spec to mark xform as const read only pointer which cannot be manipulated once initiallized on session. Signed-off-by: Ayuj Verma --- doc/guides/prog_guide/cryptodev_lib.rst | 10 ++++++++++ lib/librte_cryptodev/rte_cryptodev.c | 2 +- lib/librte_cryptodev/rte_cryptodev.h | 2 +- lib/librte_cryptodev/rte_cryptodev_pmd.h | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 9719944..cf0930a 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -894,6 +894,16 @@ asymmetric crypto chaining is Diffie-Hellman private key generation followed by public generation. Also, currently API does not support chaining of symmetric and asymmetric crypto xforms. +Transform is attached to session during asym session initialization should not be +modified either by PMD or application during and after session configuration. + +It and all the data buffers it points to should +remain read only till the end of life span of a session. It should be used as it +is in PMD, PMDs which requires modification of these immutable data should internally +do memcpy of data and perform required operations. In that case, it's the PMDs +responsibility to ensure that any private data copied to local PMD storage +during session configuration is not stored by the PMD for longer than the session lifetime + Each xform defines specific asymmetric crypto algo. Currently supported are: * RSA * Modular operations (Exponentiation and Inverse) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 43bc335..1cee406 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1272,7 +1272,7 @@ struct rte_cryptodev * int rte_cryptodev_asym_session_init(uint8_t dev_id, struct rte_cryptodev_asym_session *sess, - struct rte_crypto_asym_xform *xforms, + const struct rte_crypto_asym_xform *xforms, struct rte_mempool *mp) { struct rte_cryptodev *dev; diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index e175b83..4de23bb 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -1118,7 +1118,7 @@ struct rte_cryptodev_asym_session * int rte_cryptodev_asym_session_init(uint8_t dev_id, struct rte_cryptodev_asym_session *sess, - struct rte_crypto_asym_xform *xforms, + const struct rte_crypto_asym_xform *xforms, struct rte_mempool *mempool); /** diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index defe05e..1f083ea 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -290,7 +290,7 @@ typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev, * - Returns -ENOMEM if the private session could not be allocated. */ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev, - struct rte_crypto_asym_xform *xform, + const struct rte_crypto_asym_xform *xform, struct rte_cryptodev_asym_session *session, struct rte_mempool *mp); /** -- 1.8.3.1