|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
Enable SHARKSSL_USE_SHAKE for SHAKE128 and SHAKE256.
Initialize an operation, call psa_xof_setup(), append input with psa_xof_update(), then read any needed output with psa_xof_output(). Further output calls continue the same stream. SHAKE accepts no customization context. The first output call ends input, including when requesting zero bytes. Call psa_xof_abort() after completion or an error to clear the state. These operations use caller-owned storage without heap allocation; serialize access to each operation.
Data Structures | |
| struct | psa_xof_operation_s |
| Opaque extendable-output function (XOF) state owned by the caller. More... | |
Typedefs | |
| typedef struct psa_xof_operation_s | psa_xof_operation_t |
| Opaque extendable-output function (XOF) state owned by the caller. More... | |
Functions | |
| psa_xof_operation_t | psa_xof_operation_init (void) |
| Create an inactive XOF operation. More... | |
| psa_status_t | psa_xof_setup (psa_xof_operation_t *operation, psa_algorithm_t alg) |
| Start a SHAKE operation with no customization context. More... | |
| psa_status_t | psa_xof_set_context (psa_xof_operation_t *operation, const uint8_t *context, size_t context_length) |
| Reject customization contexts for this provider's SHAKE algorithms. More... | |
| psa_status_t | psa_xof_update (psa_xof_operation_t *operation, const uint8_t *input, size_t input_length) |
| Append SHAKE input before the first output call. More... | |
| psa_status_t | psa_xof_output (psa_xof_operation_t *operation, uint8_t *output, size_t output_length) |
| Read bytes from the SHAKE output stream. More... | |
| psa_status_t | psa_xof_abort (psa_xof_operation_t *operation) |
| Clear an XOF operation and reset it for setup or release. More... | |
| typedef struct psa_xof_operation_s psa_xof_operation_t |
Opaque extendable-output function (XOF) state owned by the caller.
Initialize with PSA_XOF_OPERATION_INIT or psa_xof_operation_init(). Do not inspect or modify members. Input and output buffers must not overlap this object. Finish with psa_xof_abort() to clear it before reuse or release.
| psa_status_t psa_xof_abort | ( | psa_xof_operation_t * | operation | ) |
Clear an XOF operation and reset it for setup or release.
Safe for an initialized operation in any phase, including after an error.
| operation | psa_xof_operation_t *; required initialized operation. |
| psa_xof_operation_t psa_xof_operation_init | ( | void | ) |
Create an inactive XOF operation.
| psa_status_t psa_xof_output | ( | psa_xof_operation_t * | operation, |
| uint8_t * | output, | ||
| size_t | output_length | ||
| ) |
Read bytes from the SHAKE output stream.
The first call finalizes input, even for zero output bytes. Further calls continue the stream; no later update is allowed. Abort after the last output.
| operation | psa_xof_operation_t *; required active SHAKE state. |
| output | uint8_t *; caller-owned buffer of at least output_length bytes, disjoint from operation; NULL only when output_length is 0. |
| output_length | size_t; requested byte count; 0 is allowed. |
| psa_status_t psa_xof_set_context | ( | psa_xof_operation_t * | operation, |
| const uint8_t * | context, | ||
| size_t | context_length | ||
| ) |
Reject customization contexts for this provider's SHAKE algorithms.
Do not call this function for SHAKE, even with an empty context. An active operation is cleared and marked failed; abort it before reuse.
| operation | psa_xof_operation_t *; operation to configure. |
| context | const uint8_t *; ignored; no bytes are read or retained. |
| context_length | size_t; ignored requested context length in bytes. |
| psa_status_t psa_xof_setup | ( | psa_xof_operation_t * | operation, |
| psa_algorithm_t | alg | ||
| ) |
Start a SHAKE operation with no customization context.
Requires SHARKSSL_USE_SHAKE. Failure leaves an inactive operation inactive; attempting setup on an active operation does not replace it.
| operation | psa_xof_operation_t *; required initialized, inactive state. |
| alg | psa_algorithm_t; PSA_ALG_SHAKE128 or PSA_ALG_SHAKE256. |
| psa_status_t psa_xof_update | ( | psa_xof_operation_t * | operation, |
| const uint8_t * | input, | ||
| size_t | input_length | ||
| ) |
Append SHAKE input before the first output call.
May be called repeatedly. Input is consumed synchronously and not retained.
| operation | psa_xof_operation_t *; required state after successful setup, with no output call yet. |
| input | const uint8_t *; borrowed input, disjoint from operation; NULL is allowed only when input_length is 0. |
| input_length | size_t; input length in bytes; 0 is allowed. |