Function esp_idf_sys::psa_aead_update_ad
source ยท pub unsafe extern "C" fn psa_aead_update_ad(
operation: *mut psa_aead_operation_t,
input: *const u8,
input_length: usize,
) -> psa_status_t
Expand description
Pass additional data to an active AEAD operation.
Additional data is authenticated, but not encrypted.
You may call this function multiple times to pass successive fragments of the additional data. You may not call this function after passing data to encrypt or decrypt with psa_aead_update().
Before calling this function, you must:
- Call either psa_aead_encrypt_setup() or psa_aead_decrypt_setup().
- Set the nonce with psa_aead_generate_nonce() or psa_aead_set_nonce().
If this function returns an error status, the operation enters an error state and must be aborted by calling psa_aead_abort().
\warning When decrypting, until psa_aead_verify() has returned #PSA_SUCCESS, there is no guarantee that the input is valid. Therefore, until you have called psa_aead_verify() and it has returned #PSA_SUCCESS, treat the input as untrusted and prepare to undo any action that depends on the input if psa_aead_verify() returns an error status.
\param[in,out] operation Active AEAD operation. \param[in] input Buffer containing the fragment of additional data. \param input_length Size of the \p input buffer in bytes.
\retval #PSA_SUCCESS Success. \retval #PSA_ERROR_INVALID_ARGUMENT The total input length overflows the additional data length that was previously specified with psa_aead_set_lengths(). \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, have a nonce set, have lengths set if required by the algorithm, and psa_aead_update() must not have been called yet), 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.