pub unsafe extern "C" fn mbedtls_cipher_finish_padded(
ctx: *mut mbedtls_cipher_context_t,
output: *mut c_uchar,
olen: *mut usize,
invalid_padding: *mut usize,
) -> c_intExpand description
\brief The generic cipher finalization function. If data still needs to be flushed from an incomplete block, the data contained in it is padded to the size of the last block, and written to the \p output buffer.
\note This function is similar to mbedtls_cipher_finish(). The only difference is that it reports invalid padding decryption differently, through the \p invalid_padding parameter rather than an error code. For encryption, and in modes without padding (including all authenticated modes), this function is identical to mbedtls_cipher_finish().
\param[in,out] ctx The generic cipher context. This must be initialized and bound to a key. \param[out] output The buffer to write data to. This needs to be a writable buffer of at least block_size Bytes. \param[out] olen The length of the data written to the \p output buffer. This may not be \c NULL. Note that when decrypting in a mode with padding, the actual output length is sensitive and may be used to mount a padding oracle attack (see warning on mbedtls_cipher_finish()). \param[out] invalid_padding If this function returns \c 0 on decryption, \p *invalid_padding is \c 0 if the ciphertext was valid, and all-bits-one if the ciphertext had invalid padding. On encryption, or in a mode without padding (including all authenticated modes), \p *invalid_padding is \c 0 on success. The value in \p *invalid_padding is unspecified if this function returns a nonzero status.
\return \c 0 on success. Also \c 0 for decryption with invalid padding. \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on parameter-verification failure. \return #MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED on decryption expecting a full block but not receiving one. \return A cipher-specific error code on failure.