Signed-off-by: Robbie King <[email protected]>
---
 platform/linux-generic/include/api/odp_crypto.h | 93 +++++++++++++------------
 1 file changed, 47 insertions(+), 46 deletions(-)

diff --git a/platform/linux-generic/include/api/odp_crypto.h 
b/platform/linux-generic/include/api/odp_crypto.h
index 337e7cf..fe54358 100644
--- a/platform/linux-generic/include/api/odp_crypto.h
+++ b/platform/linux-generic/include/api/odp_crypto.h
@@ -141,6 +141,7 @@ typedef struct odp_crypto_session_params {
  */
 typedef struct odp_crypto_op_params {
        odp_crypto_session_t session;   /**< Session handle from creation */
+       void *ctx;                      /**< User context */
        odp_packet_t pkt;               /**< Input packet buffer */
        odp_packet_t out_pkt;           /**< Output packet buffer */
        uint8_t *override_iv_ptr;       /**< Override session IV pointer */
@@ -210,6 +211,21 @@ typedef struct odp_crypto_compl_status {
        enum crypto_hw_err  hw_err;   /**< Hardware specific return code */
 } odp_crypto_compl_status_t;
 
+/**
+ * Cryto API completion event
+ */
+typedef odp_buffer_t odp_crypto_compl_event_t;
+
+/**
+ * Crypto API operation result
+ */
+typedef struct odp_crypto_op_result {
+       bool  ok;                         /**< Request completed successfully */
+       void *ctx;                        /**< User context from request */
+       odp_packet_t pkt;                 /**< Output packet */
+       odp_crypto_compl_status_t cipher; /**< Cipher status */
+       odp_crypto_compl_status_t auth;   /**< Authentication status */
+} odp_crypto_op_result_t;
 
 /**
  * Crypto session creation (synchronous)
@@ -225,76 +241,61 @@ odp_crypto_session_create(odp_crypto_session_params_t 
*params,
                          odp_crypto_session_t *session,
                          enum odp_crypto_ses_create_err *status);
 
-
 /**
- * Crypto per packet operation
+ * Release crypto completion event
  *
- * Performs the cryptographic operations specified during session creation
- * on the packet.  If the operation is performed synchronously, "posted"
- * will return FALSE and the result of the operation is immediately available
- * in the completion event.  If "posted" returns TRUE the result will be
- * delivered via the completion queue specified when the session was created.
- *
- * @todo Resolve if completion_event is necessary, can/should the output
- *       packet buffer always be used instead.
- *
- * @param params            Operation parameters
- * @param posted            Pointer to return posted, TRUE for async operation
- * @param completion_event  Event by which the operation results are delivered.
- *
- * @return 0 if successful else -1
+ * @param completion_event  Completion event we are done accessing
  */
-int
-odp_crypto_operation(odp_crypto_op_params_t *params,
-                    bool *posted,
-                    odp_buffer_t completion_event);
+void
+odp_crypto_release_compl_event(odp_crypto_compl_event_t completion_event);
 
 /**
- * Crypto per packet operation set user context in completion event
+ * Reset crypto completion event
  *
- * @param completion_event  Event containing operation results
- * @param ctx               User data
+ * @param completion_event  Completion event we are initializing
  */
 void
-odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event,
-                                  void *ctx);
+odp_crypto_reset_compl_event(odp_crypto_compl_event_t *completion_event);
 
 /**
- * Crypto per packet operation completion status
+ * Convert buffer to completion event
  *
- * Accessor function for obtaining operation status from the completion event.
+ * @param buffer       Generic ODP buffer
  *
- * @param completion_event  Event containing operation results
- * @param auth              Pointer to store authentication results
- * @param cipher            Pointer to store cipher results
+ * @return Completion event
  */
-void
-odp_crypto_get_operation_compl_status(odp_buffer_t completion_event,
-                                     odp_crypto_compl_status_t *auth,
-                                     odp_crypto_compl_status_t *cipher);
+odp_crypto_compl_event_t
+odp_crypto_compl_event_from_buffer(odp_buffer_t buffer);
 
 /**
- * Crypto per packet operation query completed operation packet
+ * Crypto per packet operation
  *
- * Accessor function for obtaining current packet buffer, can be
- * different from input packet buffer on some systems
+ * Performs the cryptographic operations specified during session creation
+ * on the packet.  If the operation is performed synchronously, "posted"
+ * will return FALSE and the result of the operation is immediately available.
+ * If "posted" returns TRUE the result will be delivered via the completion
+ * queue specified when the session was created.
  *
- * @param completion_event  Event containing operation results
+ * @param params            Operation parameters
+ * @param posted            Pointer to return posted, TRUE for async operation
+ * @param result            Results of operation (when posted returns FALSE)
  *
- * @return Packet structure where data now resides
+ * @return 0 if successful else -1
  */
-odp_packet_t
-odp_crypto_get_operation_compl_packet(odp_buffer_t completion_event);
+int
+odp_crypto_operation(odp_crypto_op_params_t *params,
+                    bool *posted,
+                    odp_crypto_op_result_t *result);
 
 /**
- * Crypto per packet operation query user context in completion event
+ * Crypto per packet operation query result from completion event
  *
  * @param completion_event  Event containing operation results
- *
- * @return User data
+ * @param result            Pointer to result structure
  */
-void *
-odp_crypto_get_operation_compl_ctx(odp_buffer_t completion_event);
+void
+odp_crypto_get_compl_event_result(odp_crypto_compl_event_t completion_event,
+                                 odp_crypto_op_result_t *result);
 
 /**
  * Generate random byte string
-- 
1.9.1


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to