[v1,1/2] lib/crypto: declare crypto asym xform immutable
Checks
Commit Message
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(-)
@@ -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)
@@ -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;
@@ -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);
/**
@@ -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);
/**