mbedtls_psa_aead_finish() function
Finish encrypting a message in an AEAD operation. The operation must have been set up by the PSA core with mbedtls_psa_aead_encrypt_setup(). This function finishes the authentication of the additional data formed by concatenating the inputs passed to preceding calls to mbedtls_psa_aead_update_ad() with the plaintext formed by concatenating the inputs passed to preceding calls to mbedtls_psa_aead_update(). This function has two output buffers: - \p ciphertext contains trailing ciphertext that was buffered from preceding calls to mbedtls_psa_aead_update(). - \p tag contains the authentication tag. Whether or not this function returns successfully, the PSA core subsequently calls mbedtls_psa_aead_abort() to deactivate the operation.
Arguments
operation
Active AEAD operation.
ciphertext
Buffer where the last part of the ciphertext is to be written.
ciphertext_size
Size of the \p ciphertext buffer in bytes. This must be appropriate for the selected algorithm and key: - A sufficient output size is #PSA_AEAD_FINISH_OUTPUT_SIZE(\c key_type, \c alg) where \c key_type is the type of key and \c alg is the algorithm that were used to set up the operation. - #PSA_AEAD_FINISH_OUTPUT_MAX_SIZE evaluates to the maximum output size of any supported AEAD algorithm.
ciphertext_length
On success, the number of bytes of returned ciphertext.
tag
Buffer where the authentication tag is to be written.
tag_size
Size of the \p tag buffer in bytes. This must be appropriate for the selected algorithm and key: - The exact tag size is #PSA_AEAD_TAG_LENGTH(\c key_type, \c key_bits, \c alg) where \c key_type and \c key_bits are the type and bit-size of the key, and \c alg are the algorithm that were used in the call to mbedtls_psa_aead_encrypt_setup(). - #PSA_AEAD_TAG_MAX_SIZE evaluates to the maximum tag size of any supported AEAD algorithm.
tag_length
On success, the number of bytes that make up the returned tag.
Return value
#PSA_SUCCESS Success. #PSA_ERROR_BUFFER_TOO_SMALL The size of the \p tag buffer is too small. #PSA_AEAD_TAG_LENGTH(\c key_type, key_bits, \c alg) or #PSA_AEAD_TAG_MAX_SIZE can be used to determine the required \p tag buffer size.
Notes
The signature of this function is that of a PSA driver aead_finish entry point. This function behaves as an aead_finish entry point as defined in the PSA driver interface specification for transparent drivers.
mbedtls_psa_aead_finish() is called by 2 functions and calls 4 functions:
![]()
mbedtls_psa_aead_finish()
mbedtls_psa_aead_finish() reads 3 variables:
![]()
mbedtls_psa_aead_finish()