Added session parameters init function which should be
used to initialize the structure before calling
odp_crypto_session_create().

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
 include/odp/api/spec/crypto.h       | 16 +++++++++++++++-
 platform/linux-generic/odp_crypto.c |  5 +++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index b136a80..22fd735 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -472,7 +472,11 @@ int odp_crypto_auth_capa(odp_auth_alg_t auth,
                         odp_crypto_auth_capa_t capa[], int num);
 
 /**
- * Crypto session creation (synchronous)
+ * Crypto session creation
+ *
+ * Create a crypto session according to the session parameters. Use
+ * odp_crypto_session_params_init() to initialize parameters into their
+ * default values.
  *
  * @param params            Session parameters
  * @param session           Created session else ODP_CRYPTO_SESSION_INVALID
@@ -582,6 +586,16 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t 
hdl);
 uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl);
 
 /**
+ * Initialize crypto session parameters
+ *
+ * Initialize an odp_crypto_session_params_t to its default values for
+ * all fields.
+ *
+ * @param params   Pointer to odp_crypto_session_params_t to be initialized
+ */
+void odp_crypto_session_params_init(odp_crypto_session_params_t *params);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index a64b5a2..bdb06a9 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -1041,3 +1041,8 @@ odp_crypto_compl_free(odp_crypto_compl_t completion_event)
                odp_buffer_from_event((odp_event_t)completion_event),
                ODP_EVENT_PACKET);
 }
+
+void odp_crypto_session_params_init(odp_crypto_session_params_t *params)
+{
+       memset(params, 0, sizeof(odp_crypto_session_params_t));
+}
-- 
2.8.1

Reply via email to