Function esp_idf_sys::esp_aes_gcm_update

source ยท
pub unsafe extern "C" fn esp_aes_gcm_update(
    ctx: *mut esp_gcm_context,
    input: *const c_uchar,
    input_length: usize,
    output: *mut c_uchar,
    output_size: usize,
    output_length: *mut usize,
) -> c_int
Expand description

\brief This function feeds an input buffer into an ongoing GCM encryption or decryption operation.

             You may call this function zero, one or more times
             to pass successive parts of the input: the plaintext to
             encrypt, or the ciphertext (not including the tag) to
             decrypt. After the last part of the input, call
             mbedtls_gcm_finish().

             This function may produce output in one of the following
             ways:
             - Immediate output: the output length is always equal
               to the input length.
             - Buffered output: the output consists of a whole number
               of 16-byte blocks. If the total input length so far
               (not including associated data) is 16 \* *B* + *A*
               with *A* < 16 then the total output length is 16 \* *B*.

             In particular:
             - It is always correct to call this function with
               \p output_size >= \p input_length + 15.
             - If \p input_length is a multiple of 16 for all the calls
               to this function during an operation, then it is
               correct to use \p output_size = \p input_length.

\note For decryption, the output buffer cannot be the same as input buffer. If the buffers overlap, the output buffer must trail at least 8 Bytes behind the input buffer.

\param ctx The GCM context. This must be initialized. \param input The buffer holding the input data. If \p input_length is greater than zero, this must be a readable buffer of at least \p input_length bytes. \param input_length The length of the input data in bytes. \param output The buffer for the output data. If \p output_size is greater than zero, this must be a writable buffer of of at least \p output_size bytes. \param output_size The size of the output buffer in bytes. See the function description regarding the output size. \param output_length On success, \p *output_length contains the actual length of the output written in \p output. On failure, the content of \p *output_length is unspecified.

\return \c 0 on success. \return #MBEDTLS_ERR_GCM_BAD_INPUT on failure: total input length too long, unsupported input/output buffer overlap detected, or \p output_size too small.