DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ayuj Verma <ayverma@marvell.com>
To: <akhil.goyal@nxp.com>
Cc: <arkadiuszx.kusztal@intel.com>, <shallyv@marvell.com>,
	<ssahu@marvell.com>, <kkotamarthy@marvell.com>,
	<anoobj@marvell.com>, <dev@dpdk.org>,
	Ayuj Verma <ayverma@marvell.com>
Subject: [dpdk-dev] [PATCH v1 1/2] lib/crypto: declare crypto asym xform immutable
Date: Wed, 24 Jul 2019 14:21:56 +0530	[thread overview]
Message-ID: <1563958317-480-2-git-send-email-ayverma@marvell.com> (raw)
In-Reply-To: <1563958317-480-1-git-send-email-ayverma@marvell.com>

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 <ayverma@marvell.com>
---
 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


  reply	other threads:[~2019-07-24  8:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24  8:51 [dpdk-dev] [PATCH v1 0/2] " Ayuj Verma
2019-07-24  8:51 ` Ayuj Verma [this message]
2019-07-24  8:51 ` [dpdk-dev] [PATCH v1 2/2] crypto/openssl: mark asym xform constant Ayuj Verma
2019-07-24  8:52 ` [dpdk-dev] [PATCH v1 0/2] declare crypto asym xform immutable Ayuj Verma
2019-07-25  4:15   ` Anoob Joseph
2019-07-25  5:21     ` Shally Verma
2019-07-25  5:26       ` Anoob Joseph
2019-07-25  6:37       ` Anoob Joseph
2019-07-25  7:58         ` Shally Verma
2019-07-25 14:27           ` Kusztal, ArkadiuszX
2019-07-29 11:38             ` Ayuj Verma
2019-09-05  9:22               ` Kusztal, ArkadiuszX
2019-09-05 14:22                 ` Shally Verma
2019-09-06  6:08                   ` Anoob Joseph
2019-09-06 11:25                     ` Trahe, Fiona
2019-09-13 14:02                       ` Sunila Sahu
2019-09-13 14:59                         ` Kusztal, ArkadiuszX
2019-07-25 11:27         ` Akhil Goyal
2019-07-25 11:35           ` Shally Verma
2019-07-25 11:42             ` Akhil Goyal
2019-07-25 11:46               ` Shally Verma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1563958317-480-2-git-send-email-ayverma@marvell.com \
    --to=ayverma@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=anoobj@marvell.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=kkotamarthy@marvell.com \
    --cc=shallyv@marvell.com \
    --cc=ssahu@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).