[dpdk-dev] [PATCH v1 1/2] lib/crypto: declare crypto asym xform immutable
Ayuj Verma
ayverma at marvell.com
Wed Jul 24 10:51:56 CEST 2019
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 at 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
More information about the dev
mailing list