NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
DOCA SHA Engine

Typedefs

typedef void(* doca_sha_task_hash_completion_cb_t) (struct doca_sha_task_hash *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
typedef void(* doca_sha_task_partial_hash_completion_cb_t) (struct doca_sha_task_partial_hash *task, union doca_data task_user_data, union doca_data ctx_user_data)
 

Enumerations

enum  doca_sha_algorithm { DOCA_SHA_ALGORITHM_SHA1 , DOCA_SHA_ALGORITHM_SHA256 , DOCA_SHA_ALGORITHM_SHA512 }
 

Functions

DOCA_EXPERIMENTAL doca_error_t doca_sha_create (struct doca_dev *dev, struct doca_sha **sha)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_destroy (struct doca_sha *sha)
 
DOCA_EXPERIMENTAL struct doca_ctx * doca_sha_as_ctx (struct doca_sha *sha)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_task_hash_get_supported (struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_task_partial_hash_get_supported (struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_list_buf_num_elem (struct doca_devinfo const *devinfo, uint32_t *max_list_buf_num_elem)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_src_buf_size (struct doca_devinfo const *devinfo, uint64_t *max_src_buf_size)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_min_dst_buf_size (struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm, uint32_t *min_dst_buf_size)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_partial_hash_block_size (struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm, uint32_t *partial_block_size)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_num_tasks (struct doca_sha *sha, uint32_t *max_num_tasks)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_conf (struct doca_sha *sha, doca_sha_task_hash_completion_cb_t task_completion_cb, doca_sha_task_hash_completion_cb_t task_error_cb, uint8_t log_num_tasks)
 This method sets the doca_sha hash task pool configuration. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_alloc_init (struct doca_sha *sha, enum doca_sha_algorithm algorithm, struct doca_buf const *src_buf, struct doca_buf *dst_buf, union doca_data user_data, struct doca_sha_task_hash **task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_src (struct doca_sha_task_hash *task, struct doca_buf const *src_buf)
 
DOCA_EXPERIMENTAL struct doca_buf const * doca_sha_task_hash_get_src (struct doca_sha_task_hash const *task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_dst (struct doca_sha_task_hash *task, struct doca_buf *dst_buf)
 
DOCA_EXPERIMENTAL struct doca_buf const * doca_sha_task_hash_get_dst (struct doca_sha_task_hash const *task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_algorithm (struct doca_sha_task_hash *task, enum doca_sha_algorithm algorithm)
 
DOCA_EXPERIMENTAL enum doca_sha_algorithm doca_sha_task_hash_get_algorithm (struct doca_sha_task_hash const *task)
 
DOCA_EXPERIMENTAL struct doca_task * doca_sha_task_hash_as_task (struct doca_sha_task_hash *task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_conf (struct doca_sha *sha, doca_sha_task_partial_hash_completion_cb_t task_completion_cb, doca_sha_task_partial_hash_completion_cb_t task_error_cb, uint8_t log_num_tasks)
 This method sets the doca_sha partial hash task pool configuration. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_alloc_init (struct doca_sha *sha, enum doca_sha_algorithm algorithm, struct doca_buf const *src_buf, struct doca_buf *dst_buf, union doca_data user_data, struct doca_sha_task_partial_hash **task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_reset (struct doca_sha_task_partial_hash *task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_src (struct doca_sha_task_partial_hash *task, struct doca_buf const *src_buf)
 
DOCA_EXPERIMENTAL struct doca_buf const * doca_sha_task_partial_hash_get_src (struct doca_sha_task_partial_hash const *task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_dst (struct doca_sha_task_partial_hash *task, struct doca_buf *dst_buf)
 
DOCA_EXPERIMENTAL struct doca_buf const * doca_sha_task_partial_hash_get_dst (struct doca_sha_task_partial_hash const *task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_algorithm (struct doca_sha_task_partial_hash *task, enum doca_sha_algorithm algorithm)
 
DOCA_EXPERIMENTAL enum doca_sha_algorithm doca_sha_task_partial_hash_get_algorithm (struct doca_sha_task_partial_hash const *task)
 
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_is_final_buf (struct doca_sha_task_partial_hash *task)
 
DOCA_EXPERIMENTAL uint8_t doca_sha_task_partial_hash_get_is_final (struct doca_sha_task_partial_hash const *task)
 
DOCA_EXPERIMENTAL uint8_t doca_sha_task_partial_hash_get_has_result (struct doca_sha_task_partial_hash const *task)
 
DOCA_EXPERIMENTAL struct doca_task * doca_sha_task_partial_hash_as_task (struct doca_sha_task_partial_hash *task)
 

Detailed Description

DOCA SHA library. For more details please refer to the user guide on DOCA devzone.

Typedef Documentation

◆ doca_sha_task_hash_completion_cb_t

typedef void(* doca_sha_task_hash_completion_cb_t) (struct doca_sha_task_hash *task, union doca_data task_user_data, union doca_data ctx_user_data)

Signature of a doca_sha_task_hash completion or error call-back.

Note: A callback may choose to invoke doca_task_free to release the task during the execution of the callback.

Parameters
[in]taskCompleted task. The implementation can assume this value is never NULL.
[in]task_user_dataUser data as provided during doca_sha_task_hash_alloc_init.
[in]ctx_user_dataUser data as provided during doca_ctx_set_user_data.

Definition at line 283 of file doca_sha.h.

◆ doca_sha_task_partial_hash_completion_cb_t

typedef void(* doca_sha_task_partial_hash_completion_cb_t) (struct doca_sha_task_partial_hash *task, union doca_data task_user_data, union doca_data ctx_user_data)

Signature of doca_sha_task_partial_hash completion or error call-back.

Note: A callback may choose to invoke doca_task_free to release the task during the execution of the callback.

Parameters
[in]taskCompleted task. The implementation can assume this value is never NULL.
[in]task_user_dataUser data as provided during doca_sha_task_hash_alloc_init.
[in]ctx_user_dataUser data as provided during doca_ctx_set_user_data.

Definition at line 496 of file doca_sha.h.

Enumeration Type Documentation

◆ doca_sha_algorithm

Doca sha action type enums, used to specify sha task types.

Enumerator
DOCA_SHA_ALGORITHM_SHA1 
DOCA_SHA_ALGORITHM_SHA256 
DOCA_SHA_ALGORITHM_SHA512 

Definition at line 108 of file doca_sha.h.

Function Documentation

◆ doca_sha_as_ctx()

DOCA_EXPERIMENTAL struct doca_ctx* doca_sha_as_ctx ( struct doca_sha *  sha)

Adapt a pointer to a doca_sha instance to a general doca_ctx pointer for use with core objects. This does not imply any transfer of ownership. The existing owner of the doca_sha instance continues to be responsible for its' lifetime and must ensure it outlives any core objects which refer to it.

Parameters
[in]shadoca_sha instance.
Returns
Non NULL upon success, NULL otherwise.

◆ doca_sha_cap_get_max_list_buf_num_elem()

DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_list_buf_num_elem ( struct doca_devinfo const *  devinfo,
uint32_t *  max_list_buf_num_elem 
)

Query the maximum number of chained doca buffers which can be processed for any task submitted to doca_sha

Parameters
[in]devinfoThe DOCA device information.
[out]max_list_buf_num_elemThe maximum supported number of elements in DOCA linked-list buffer. The value 1 indicates that only a single element is supported.
Returns
DOCA_SUCCESS - The query executed successfully, *max_list_buf_num_elem holds a valid value Upon failure *max_list_buf_num_elem may be uninitialized. Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NOT_SUPPORTED - Device has no doca_sha support. Any other error reported likely means the query failed to execute.

◆ doca_sha_cap_get_max_num_tasks()

DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_num_tasks ( struct doca_sha *  sha,
uint32_t *  max_num_tasks 
)

Get the maximum number of tasks

This method retrieves the maximum number of tasks for a device.

Parameters
[in]shaThe sha context
[out]max_num_tasksMax number of doca_sha_task_hash or doca_sha_task_partial_hash tasks
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - in case of invalid input.

◆ doca_sha_cap_get_max_src_buf_size()

DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_src_buf_size ( struct doca_devinfo const *  devinfo,
uint64_t *  max_src_buf_size 
)

Query the maximum length of data that can be submitted with a task (chained or un-chained)

Parameters
[in]devinfoThe DOCA device information.
[out]max_src_buf_sizeThe maximum supported buffer size in bytes.
Returns
DOCA_SUCCESS - The query executed successfully, *max_src_buf_size holds a valid value Upon failure *max_src_buf_size may be uninitialized. Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NOT_SUPPORTED - Device has no doca_sha support. Any other error reported likely means the query failed to execute.

◆ doca_sha_cap_get_min_dst_buf_size()

DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_min_dst_buf_size ( struct doca_devinfo const *  devinfo,
enum doca_sha_algorithm  algorithm,
uint32_t *  min_dst_buf_size 
)

Query the minimum length of an output buffer for any doca_sha task. A task must have at least this much space in its' output buffer but it may not write to all of it, the actual size of the result can be queried from the output doca buffer when the task has produced an output. Providing an output buffer with less space than this is undefined behavior. The user is responsible for ensuring this requirement is met, it will not be checked during task submission unless task verification is requested.

Parameters
[in]devinfoThe DOCA device information.
[in]algorithmThe algorithm for which to query this capability.
[out]min_dst_buf_sizeThe minimum required output buffer space.
Returns
DOCA_SUCCESS - The query executed successfully, *min_dst_buf_size holds a valid value Upon failure *min_dst_buf_size may be uninitialized. Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NOT_SUPPORTED - Device has no doca_sha support. Any other error reported likely means the query failed to execute.

◆ doca_sha_cap_get_partial_hash_block_size()

DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_partial_hash_block_size ( struct doca_devinfo const *  devinfo,
enum doca_sha_algorithm  algorithm,
uint32_t *  partial_block_size 
)

All intermediate (non final) input buffers submitted for a partial SHA task must be a multiple of the value returned form this function. The user is responsible for ensuring this requirement is met, it will not be checked during task submission unless task verification is requested.

Parameters
[in]devinfoThe DOCA device information.
[in]algorithmThe algorithm for which to query this capability.
[out]partial_block_sizeThe partial input buffer block size.
Returns
DOCA_SUCCESS - The query executed successfully, *partial_block_size holds a valid value Upon failure *partial_block_size may be uninitialized. Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NOT_SUPPORTED - Device has no doca_sha support. Any other error reported likely means the query failed to execute.

◆ doca_sha_cap_task_hash_get_supported()

DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_task_hash_get_supported ( struct doca_devinfo const *  devinfo,
enum doca_sha_algorithm  algorithm 
)

Query if the device represented by the given devinfo is capable of performing doca_sha hash tasks using a given algorithm.

Parameters
[in]devinfoThe DOCA device information.
[in]algorithmThe algorithm to check support for.
Returns
DOCA_SUCCESS - The device represented by this devinfo is capable of performing the desired operation Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NOT_SUPPORTED the desired operation is not supported by this device. Any other error reported likely means the query failed to execute.

◆ doca_sha_cap_task_partial_hash_get_supported()

DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_task_partial_hash_get_supported ( struct doca_devinfo const *  devinfo,
enum doca_sha_algorithm  algorithm 
)

Query if the device represented by the given devinfo is capable of performing doca_sha partial hash tasks using a given algorithm.

Parameters
[in]devinfoThe DOCA device information.
[in]algorithmThe algorithm to check support for.
Returns
DOCA_SUCCESS - The device represented by this devinfo is capable of performing the desired operation Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NOT_SUPPORTED the desired operation is not supported by this device. Any other error reported likely means the query failed to execute.

◆ doca_sha_create()

DOCA_EXPERIMENTAL doca_error_t doca_sha_create ( struct doca_dev *  dev,
struct doca_sha **  sha 
)

Create an instance of doca_sha

Parameters
[in]devThe device this doca_sha instance will operate with
[out]shaPointer to a pointer which will be populated to point to the newly created doca_sha instance upon success. Caller assumes ownership of the created doca_sha instance and is responsible for destroying it later when no longer required
Returns
DOCA_SUCCESS - sha instance was created and *sha points to a valid object Any other status code means the operation failed and *sha may be uninitialized. Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NO_MEMORY - Failed to create a new object.

◆ doca_sha_destroy()

DOCA_EXPERIMENTAL doca_error_t doca_sha_destroy ( struct doca_sha *  sha)

Destroy an instance of doca_sha.

Parameters
[in]shaPointer to the doca_sha instance to destroy
Returns
DOCA_SUCCESS - sha instance was destroyed. sha is now a dangling pointer and should not be referenced to again. Any other status code means the operation failed. Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument.
  • DOCA_ERROR_IN_USE - Object is in use and should be stopped before destruction.

◆ doca_sha_task_hash_alloc_init()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_alloc_init ( struct doca_sha *  sha,
enum doca_sha_algorithm  algorithm,
struct doca_buf const *  src_buf,
struct doca_buf *  dst_buf,
union doca_data  user_data,
struct doca_sha_task_hash **  task 
)

Allocate doca_sha hash task

This method allocates and initializes a task. The user can choose to modify the task using the associated setters while the task is not in flight. The user may choose to reconfigure and reuse a task or to release it and get a new task as per their own requirements.

Parameters
[in]shaThe doca_sha context to allocate the task from.
[in]algorithmSHA algorithm to use.
[in]src_bufSource buffer.
[in]dst_bufDestination buffer.
[in]user_datadoca_data that can be retrieved from the task (usually when the task is completed).
[out]taskThe allocated task.
Returns
DOCA_SUCCESS - Operation succeeded, *task holds a valid value. Upon failure *task may be uninitialized. Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NO_MEMORY - All tasks in the pool are in use.
  • DOCA_ERROR_BAD_STATE - The context is not currently running (stopped).

◆ doca_sha_task_hash_as_task()

DOCA_EXPERIMENTAL struct doca_task* doca_sha_task_hash_as_task ( struct doca_sha_task_hash *  task)

Adapt a pointer to a doca_sha hash task instance to a general doca_task pointer for use with core objects. This does not imply any transfer of ownership. The existing owner of the task continues to be responsible for its' lifetime and must ensure it remains alive until it has completed (successfully, with an error or it was flushed).

Parameters
[in]taskTask to adapt to a doca_task.
Returns
Non NULL upon success, NULL otherwise.

◆ doca_sha_task_hash_get_algorithm()

DOCA_EXPERIMENTAL enum doca_sha_algorithm doca_sha_task_hash_get_algorithm ( struct doca_sha_task_hash const *  task)

Get the current algorithm in use by this task.

The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.

Parameters
[in]taskTask to query.
Returns
Algorithm in use.

◆ doca_sha_task_hash_get_dst()

DOCA_EXPERIMENTAL struct doca_buf const* doca_sha_task_hash_get_dst ( struct doca_sha_task_hash const *  task)

Get the current destination buffer in use by this task.

The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.

Parameters
[in]taskTask to query.
Returns
Pointer to the destination buffer.

◆ doca_sha_task_hash_get_src()

DOCA_EXPERIMENTAL struct doca_buf const* doca_sha_task_hash_get_src ( struct doca_sha_task_hash const *  task)

Get the current source buffer in use by this task.

The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.

Parameters
[in]taskTask to query.
Returns
Pointer to the source buffer.

◆ doca_sha_task_hash_set_algorithm()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_algorithm ( struct doca_sha_task_hash *  task,
enum doca_sha_algorithm  algorithm 
)

Set the SHA algorithm to use for this task.

Parameters
[in]taskTask to configure.
[in]algorithmSHA algorithm to use.
Returns
DOCA_SUCCESS - Operation succeeded Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).

◆ doca_sha_task_hash_set_conf()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_conf ( struct doca_sha *  sha,
doca_sha_task_hash_completion_cb_t  task_completion_cb,
doca_sha_task_hash_completion_cb_t  task_error_cb,
uint8_t  log_num_tasks 
)

This method sets the doca_sha hash task pool configuration.

Parameters
[in]shaThe SHA context to configure.
[in]task_completion_cbTask completion callback.
[in]task_error_cbTask error callback.
[in]log_num_tasksLog2 of number of tasks.
Returns
DOCA_SUCCESS Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_BAD_STATE - The context is currently running (started).

◆ doca_sha_task_hash_set_dst()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_dst ( struct doca_sha_task_hash *  task,
struct doca_buf *  dst_buf 
)

Set a doca buffer as the destination data for this task.

Parameters
[in]taskTask to configure.
[in]dst_bufDestination buffer to use.
Returns
DOCA_SUCCESS - Operation succeeded Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).

◆ doca_sha_task_hash_set_src()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_src ( struct doca_sha_task_hash *  task,
struct doca_buf const *  src_buf 
)

Set a doca buffer as the source data for this task.

Parameters
[in]taskTask to configure.
[in]src_bufSource buffer to use.
Returns
DOCA_SUCCESS - Operation succeeded Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).

◆ doca_sha_task_partial_hash_alloc_init()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_alloc_init ( struct doca_sha *  sha,
enum doca_sha_algorithm  algorithm,
struct doca_buf const *  src_buf,
struct doca_buf *  dst_buf,
union doca_data  user_data,
struct doca_sha_task_partial_hash **  task 
)

Allocate doca_sha hash task

This method allocates and initializes a task. The user can choose to modify the task using the associated setters while the task is not in flight. With partial tasks it is expected that a user will re-use and re-submit the same task with a new source buffer each time to progress the partial SHA calculation. Once the final part of a partial SHA is completed the user can then either reset or release the task.

Parameters
[in]shaThe doca_sha context to allocate the task from.
[in]algorithmSHA algorithm to use.
[in]src_bufSource buffer.
[in]dst_bufDestination buffer.
[in]user_datadoca_data that can be retrieved from the task (Only set after the final task is completed)
[out]taskThe allocated task.
Returns
DOCA_SUCCESS - Operation succeeded, *task holds a valid value. Upon failure *task may be uninitialized. Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_NO_MEMORY - All tasks in the pool are in use.
  • DOCA_ERROR_BAD_STATE - The context is not currently running (stopped).

◆ doca_sha_task_partial_hash_as_task()

DOCA_EXPERIMENTAL struct doca_task* doca_sha_task_partial_hash_as_task ( struct doca_sha_task_partial_hash *  task)

Adapt a pointer to a doca_sha partial hash task instance to a general doca_task pointer for use with core objects. This does not imply any transfer of ownership. The existing owner of the task continues to be responsible for its' lifetime and must ensure it remains alive until it has completed (successfully, with an error or it was flushed).

Parameters
[in]taskTask to adapt to a doca_task.
Returns
Non NULL upon success, NULL otherwise.

◆ doca_sha_task_partial_hash_get_algorithm()

DOCA_EXPERIMENTAL enum doca_sha_algorithm doca_sha_task_partial_hash_get_algorithm ( struct doca_sha_task_partial_hash const *  task)

Get the current algorithm in use by this task.

The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.

Parameters
[in]taskTask to query.
Returns
Algorithm in use.

◆ doca_sha_task_partial_hash_get_dst()

DOCA_EXPERIMENTAL struct doca_buf const* doca_sha_task_partial_hash_get_dst ( struct doca_sha_task_partial_hash const *  task)

Get the current destination buffer in use by this task.

The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.

Parameters
[in]taskTask to query.
Returns
Pointer to the destination buffer.

◆ doca_sha_task_partial_hash_get_has_result()

DOCA_EXPERIMENTAL uint8_t doca_sha_task_partial_hash_get_has_result ( struct doca_sha_task_partial_hash const *  task)

Does the destination buffer of this task hold a valid value.

Parameters
[in]taskTask to configure
Returns
1 when the destination buffer holds a valid value, 0 otherwise.

◆ doca_sha_task_partial_hash_get_is_final()

DOCA_EXPERIMENTAL uint8_t doca_sha_task_partial_hash_get_is_final ( struct doca_sha_task_partial_hash const *  task)

Get if this task is marked as the final segment of a partial SHA calculation or not.

The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.

Parameters
[in]taskTask to query.
Returns
1 if this task is / was the final segment of a partial hash calculation, 0 otherwise.

◆ doca_sha_task_partial_hash_get_src()

DOCA_EXPERIMENTAL struct doca_buf const* doca_sha_task_partial_hash_get_src ( struct doca_sha_task_partial_hash const *  task)

Get the current source buffer in use by this task.

The user is responsible to ensure this function is only called for a task which has been returned by alloc_init and has not yet been released. Calling this function in that circumstance is undefined behavior.

Parameters
[in]taskTask to query.
Returns
Pointer to the source buffer.

◆ doca_sha_task_partial_hash_reset()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_reset ( struct doca_sha_task_partial_hash *  task)

Reset the partial state of this task so it can be re-used. This can be called at any time. All existing partial session state will be lost and cannot be recovered.

Parameters
[in]taskTask to reset.
Returns
DOCA_SUCCESS- Operation succeeded Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).

◆ doca_sha_task_partial_hash_set_algorithm()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_algorithm ( struct doca_sha_task_partial_hash *  task,
enum doca_sha_algorithm  algorithm 
)

Set the SHA algorithm to use for this task.

This value can only be set before the first task is sent. (after alloc_init, or after clearing reset)

Parameters
[in]taskTask to configure
[in]algorithmSHA algorithm to use.
Returns
DOCA_SUCCESS- Operation succeeded Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_BAD_STATE - The partial hash is in progress

◆ doca_sha_task_partial_hash_set_conf()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_conf ( struct doca_sha *  sha,
doca_sha_task_partial_hash_completion_cb_t  task_completion_cb,
doca_sha_task_partial_hash_completion_cb_t  task_error_cb,
uint8_t  log_num_tasks 
)

This method sets the doca_sha partial hash task pool configuration.

Parameters
[in]shaThe SHA context to configure.
[in]task_completion_cbTask completion callback.
[in]task_error_cbTask error callback.
[in]log_num_tasksLog2 of number of tasks.
Returns
DOCA_SUCCESS Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_BAD_STATE - The context is currently running (started).

◆ doca_sha_task_partial_hash_set_dst()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_dst ( struct doca_sha_task_partial_hash *  task,
struct doca_buf *  dst_buf 
)

Set a doca buffer as the destination data for this task.

This value can only be set before the first task is sent. (after alloc_init, or after calling reset)

Parameters
[in]taskTask to configure
[in]dst_bufDestination buffer to use.
Returns
DOCA_SUCCESS- Operation succeeded Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_BAD_STATE - The partial hash is in progress

◆ doca_sha_task_partial_hash_set_is_final_buf()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_is_final_buf ( struct doca_sha_task_partial_hash *  task)

Identify this task as the final part of the partial SHA. Upon successful completion of this task

This must not be set on the first partial buffer. Instead you should use a non partial hash task.

Note: Setting the final flag on the first buffer is undefined behavior.

Parameters
[in]taskTask to configure
Returns
DOCA_SUCCESS- Operation succeeded Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).
  • DOCA_ERROR_BAD_STATE - The partial hash is in progress

◆ doca_sha_task_partial_hash_set_src()

DOCA_EXPERIMENTAL doca_error_t doca_sha_task_partial_hash_set_src ( struct doca_sha_task_partial_hash *  task,
struct doca_buf const *  src_buf 
)

Set a doca buffer as the source data for this task.

NOTE: If this is the non final segment of a partial hash it must have a data length that is a multiple of the SHA block size. The user is responsible to ensuring this, failure to ensure this is undefined behavior. The final source buffer is not required to be a multiple of the SHA block size.

Parameters
[in]taskTask to configure.
[in]src_bufSource buffer to use.
Returns
DOCA_SUCCESS- Operation succeeded Typical error codes for this function include:
  • DOCA_ERROR_INVALID_VALUE - Invalid argument(s).