Function esp_idf_svc::sys::psa_cipher_finish

source ยท
pub unsafe extern "C" fn psa_cipher_finish(
    operation: *mut psa_cipher_operation_s,
    output: *mut u8,
    output_size: usize,
    output_length: *mut usize,
) -> i32
Expand description

Finish encrypting or decrypting a message in a cipher operation.

The application must call psa_cipher_encrypt_setup() or psa_cipher_decrypt_setup() before calling this function. The choice of setup function determines whether this function encrypts or decrypts its input.

This function finishes the encryption or decryption of the message formed by concatenating the inputs passed to preceding calls to psa_cipher_update().

When this function returns successfully, the operation becomes inactive. If this function returns an error status, the operation enters an error state and must be aborted by calling psa_cipher_abort().

\param[in,out] operation Active cipher operation. \param[out] output Buffer where the output is to be written. \param output_size Size of the \p output buffer in bytes. \param[out] output_length On success, the number of bytes that make up the returned output.

\retval #PSA_SUCCESS Success. \retval #PSA_ERROR_INVALID_ARGUMENT The total input size passed to this operation is not valid for this particular algorithm. For example, the algorithm is a based on block cipher and requires a whole number of blocks, but the total input size is not a multiple of the block size. \retval #PSA_ERROR_INVALID_PADDING This is a decryption operation for an algorithm that includes padding, and the ciphertext does not contain valid padding. \retval #PSA_ERROR_BUFFER_TOO_SMALL The size of the \p output buffer is too small. \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription \retval #PSA_ERROR_BAD_STATE The operation state is not valid (it must be active, with an IV set if required for the algorithm), or the library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.