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

Signed-off-by: Petri Savolainen <[email protected]>
---
 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 4b94824..0fb6d05 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -479,7 +479,11 @@ int odp_crypto_auth_capability(odp_auth_alg_t auth,
                               odp_crypto_auth_capability_t capa[], int num);
 
 /**
- * Crypto session creation (synchronous)
+ * Crypto session creation
+ *
+ * Create a crypto session according to the session parameters. Use
+ * odp_crypto_session_param_init() to initialize parameters into their
+ * default values.
  *
  * @param param             Session parameters
  * @param session           Created session else ODP_CRYPTO_SESSION_INVALID
@@ -589,6 +593,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_param_t to its default values for
+ * all fields.
+ *
+ * @param param   Pointer to odp_crypto_session_param_t to be initialized
+ */
+void odp_crypto_session_param_init(odp_crypto_session_param_t *param);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index fd121c8..6b7d60e 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -1042,3 +1042,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_param_init(odp_crypto_session_param_t *param)
+{
+       memset(param, 0, sizeof(odp_crypto_session_param_t));
+}
-- 
2.8.1

Reply via email to