|
Mbed TLS v4.1.1
|
Macros | |
| #define | PSA_XOF_OPERATION_INIT { 0, 0, 0, 0, 0, 0, 0, { 0 } } |
Typedefs | |
| typedef struct psa_xof_operation_s | psa_xof_operation_t |
Functions | |
| static psa_xof_operation_t | psa_xof_operation_init (void) |
| psa_status_t | psa_xof_setup (psa_xof_operation_t *operation, psa_algorithm_t alg) |
| psa_status_t | psa_xof_set_context (psa_xof_operation_t *operation, const uint8_t *context, size_t context_length) |
| psa_status_t | psa_xof_update (psa_xof_operation_t *operation, const uint8_t *input, size_t input_length) |
| psa_status_t | psa_xof_output (psa_xof_operation_t *operation, uint8_t *output, size_t output_length) |
| psa_status_t | psa_xof_abort (psa_xof_operation_t *operation) |
| #define PSA_XOF_OPERATION_INIT { 0, 0, 0, 0, 0, 0, 0, { 0 } } |
This macro returns a suitable initializer for a XOF operation object of type psa_xof_operation_t.
Definition at line 116 of file crypto_struct.h.
Referenced by psa_xof_operation_init().
| typedef struct psa_xof_operation_s psa_xof_operation_t |
The type of the state data structure for multipart XOF operations.
Before calling any function on a XOF operation object, the application must initialize it by any of the following means:
This is an implementation-defined struct. Applications should not make any assumptions about the content of this structure. Implementation details can change in future versions without notice.
| psa_status_t psa_xof_abort | ( | psa_xof_operation_t * | operation | ) |
Abort a multipart XOF (extendable-operation function) operation.
| [in,out] | operation | The operation object to abort. It must have been initialized as per the documentation for psa_xof_operation_t and not yet in use. |
| PSA_SUCCESS | Success. |
| PSA_ERROR_INSUFFICIENT_MEMORY | |
| PSA_ERROR_COMMUNICATION_FAILURE | |
| PSA_ERROR_HARDWARE_FAILURE | |
| PSA_ERROR_CORRUPTION_DETECTED | |
| PSA_ERROR_BAD_STATE | The operation state is corrupted. |
|
static |
Return an initial value for a XOF operation object.
Referenced by psa_xof_operation_init().
| psa_status_t psa_xof_output | ( | psa_xof_operation_t * | operation, |
| uint8_t * | output, | ||
| size_t | output_length ) |
Extract output from a multipart XOF (extendable-operation function) operation.
This function switches the operation to output mode, even when output_length is 0.
| [in,out] | operation | The operation object to use. It must have been set up with psa_xof_setup(). It must have a context set with psa_xof_set_context() if the algorithm requires it. It must not yet have been aborted with psa_xof_abort(). |
| [out] | output | On success, the output fragment. |
| output_length | The number of bytes to write to output. |
| PSA_SUCCESS | Success. |
| PSA_ERROR_INSUFFICIENT_MEMORY | |
| PSA_ERROR_COMMUNICATION_FAILURE | |
| PSA_ERROR_HARDWARE_FAILURE | |
| PSA_ERROR_CORRUPTION_DETECTED | |
| PSA_ERROR_BAD_STATE | The operation state is not valid (it must be active, and it must have a context set if the algorithm requires it). |
| psa_status_t psa_xof_set_context | ( | psa_xof_operation_t * | operation, |
| const uint8_t * | context, | ||
| size_t | context_length ) |
Pass a context to a multipart XOF (extendable-operation function) operation.
| [in,out] | operation | The operation object to use. It must have been set up with psa_xof_setup(), and must not yet have been received a context with psa_xof_set_context(), received input with psa_xof_update(), switched to output mode with psa_xof_output(), or aborted with psa_xof_abort(). |
| [in] | context | The context to use. |
| context_length | Size of the context buffer in bytes. |
| PSA_SUCCESS | Success. |
| PSA_ERROR_INVALID_ARGUMENT | The algorithm used by operation does not allow a context, or the context value is invalid for this algorithm. |
| PSA_ERROR_INSUFFICIENT_MEMORY | |
| PSA_ERROR_COMMUNICATION_FAILURE | |
| PSA_ERROR_HARDWARE_FAILURE | |
| PSA_ERROR_CORRUPTION_DETECTED | |
| PSA_ERROR_BAD_STATE | The operation state is not valid (it must be active, it must not already have a context set, it must not already have input, and it must not have already been switched to output mode). |
| psa_status_t psa_xof_setup | ( | psa_xof_operation_t * | operation, |
| psa_algorithm_t | alg ) |
Set up a multipart XOF (extendable-operation function) operation.
The sequence of operations to calculate a XOF is as follows:
If an error occurs at any step after a call to psa_xof_setup(), the operation will need to be reset by a call to psa_xof_abort(). The application may call psa_xof_abort() at any time after the operation has been initialized.
After a successful call to psa_xof_setup(), the application must eventually terminate the operation by calling psa_xof_abort().
| [in,out] | operation | The operation object to set up. It must have been initialized as per the documentation for psa_xof_operation_t and not yet in use. |
| alg | The XOF algorithm to compute (PSA_ALG_XXX value such that PSA_ALG_IS_XOF(alg) is true). |
| PSA_SUCCESS | Success. |
| PSA_ERROR_NOT_SUPPORTED | alg is not supported. |
| PSA_ERROR_INSUFFICIENT_MEMORY | |
| PSA_ERROR_COMMUNICATION_FAILURE | |
| PSA_ERROR_HARDWARE_FAILURE | |
| PSA_ERROR_CORRUPTION_DETECTED | |
| PSA_ERROR_BAD_STATE | The operation state is not valid (it must be inactive). |
| psa_status_t psa_xof_update | ( | psa_xof_operation_t * | operation, |
| const uint8_t * | input, | ||
| size_t | input_length ) |
Pass input to a multipart XOF (extendable-operation function) operation.
This function switches the operation to input mode, even when input_length is 0.
| [in,out] | operation | The operation object to use. It must have been set up with psa_xof_setup(). It must have a context set with psa_xof_set_context() if the algorithm requires it. It must not yet have been switched to output mode with psa_xof_output() or aborted with psa_xof_abort(). |
| [in] | input | The input fragment. |
| input_length | Size of the input buffer in bytes. |
| PSA_SUCCESS | Success. |
| PSA_ERROR_INSUFFICIENT_MEMORY | |
| PSA_ERROR_COMMUNICATION_FAILURE | |
| PSA_ERROR_HARDWARE_FAILURE | |
| PSA_ERROR_CORRUPTION_DETECTED | |
| PSA_ERROR_BAD_STATE | The operation state is not valid (it must be active, it must have a context set if the algorithm requires it, and it must not yet have been switched to output mode). |