diff mbox

[PATCHv4,04/10] linux-generic: crypto: add strong typing support

Message ID 1422749807-20228-5-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Feb. 1, 2015, 12:16 a.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 include/odp/api/crypto.h                           | 26 ++++++++++++++++++++++
 .../linux-generic/include/odp/plat/crypto_types.h  | 13 ++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index 545c1a5..8f0a486 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -344,6 +344,32 @@  int
 odp_hw_random_get(uint8_t *buf, size_t *len, odp_bool_t use_entropy);
 
 /**
+ * Get printable value for an odp_crypto_session_t
+ *
+ * @param hdl  odp_crypto_session_t handle to be printed
+ * @return     uint64_t value that can be used to print/display this
+ *             handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_crypto_session_t handle.
+ */
+uint64_t odp_crypto_session_t_print(odp_crypto_session_t hdl);
+
+/**
+ * Get printable value for an odp_crypto_compl_t
+ *
+ * @param hdl  odp_crypto_compl_t handle to be printed
+ * @return     uint64_t value that can be used to print/display this
+ *             handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_crypto_compl_t handle.
+ */
+uint64_t odp_crypto_compl_t_print(odp_crypto_compl_t hdl);
+
+/**
  * @}
  */
 
diff --git a/platform/linux-generic/include/odp/plat/crypto_types.h b/platform/linux-generic/include/odp/plat/crypto_types.h
index d0c61b0..0d74584 100644
--- a/platform/linux-generic/include/odp/plat/crypto_types.h
+++ b/platform/linux-generic/include/odp/plat/crypto_types.h
@@ -25,7 +25,7 @@  extern "C" {
 #define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL)
 
 typedef uint64_t odp_crypto_session_t;
-typedef odp_packet_t odp_crypto_compl_t;
+typedef odp_handle_t odp_crypto_compl_t;
 
 enum odp_crypto_op_mode {
 	ODP_CRYPTO_SYNC,
@@ -68,6 +68,17 @@  enum crypto_hw_err {
 	ODP_CRYPTO_HW_ERR_BP_DEPLETED,
 };
 
+/** Get printable format of odp_crypto_session_t */
+static inline uint64_t odp_crypto_session_t_print(odp_crypto_session_t hdl)
+{
+	return (uint64_t)hdl;
+}
+
+/** Get printable format of odp_crypto_compl_t_t */
+static inline uint64_t odp_crypto_compl_t_print(odp_crypto_compl_t hdl)
+{
+	return _odp_pri(hdl);
+}
 
 /**
  * @}