mbedtls_chachapoly_finish() function
This function finished the ChaCha20-Poly1305 operation and generates the MAC (authentication tag). \warning Decryption with the piecewise API is discouraged, see the warning on \c mbedtls_chachapoly_init().
Arguments
ctx
The ChaCha20-Poly1305 context to use. This must be initialized.
mac
The buffer to where the 128-bit (16 bytes) MAC is written.
Return value
\c 0 on success. #MBEDTLS_ERR_CHACHAPOLY_BAD_STATE if the operation has not been started or has been finished. Another negative error code on other kinds of failure.