mbedtls_aria_crypt_cbc() function
This function performs an ARIA-CBC encryption or decryption operation on full blocks. It performs the operation defined in the \p mode parameter (encrypt/decrypt), on the input data buffer defined in the \p input parameter. It can be called as many times as needed, until all the input data is processed. mbedtls_aria_init(), and either mbedtls_aria_setkey_enc() or mbedtls_aria_setkey_dec() must be called before the first call to this API with the same context.
Arguments
ctx
The ARIA context to use for encryption or decryption. This must be initialized and bound to a key.
mode
The mode of operation. This must be either #MBEDTLS_ARIA_ENCRYPT for encryption, or #MBEDTLS_ARIA_DECRYPT for decryption.
length
The length of the input data in Bytes. This must be a multiple of the block size (16 Bytes).
iv
Initialization vector (updated after use). This must be a readable buffer of size 16 Bytes.
input
The buffer holding the input data. This must be a readable buffer of length \p length Bytes.
output
The buffer holding the output data. This must be a writable buffer of length \p length Bytes.
Return value
\c 0 on success. A negative error code on failure.
Notes
This function operates on aligned blocks, that is, the input size must be a multiple of the ARIA block size of 16 Bytes. Upon exit, the content of the IV is updated so that you can call the same function again on the next block(s) of data and get the same result as if it was encrypted in one call. This allows a "streaming" usage. If you need to retain the contents of the IV, you should either save it manually or use the cipher module instead.