mbedtls_camellia_crypt_cbc() function
Perform a CAMELLIA-CBC buffer encryption/decryption operation.
Arguments
ctx
The CAMELLIA context to use. This must be initialized and bound to a key.
mode
The mode of operation. This must be either #MBEDTLS_CAMELLIA_ENCRYPT or #MBEDTLS_CAMELLIA_DECRYPT.
length
The length in Bytes of the input data \p input. This must be a multiple of \c 16 Bytes.
iv
The initialization vector. This must be a read/write buffer of length \c 16 Bytes. It is updated to allow streaming use as explained above.
input
The buffer holding the input data. This must point to a readable buffer of length \p length Bytes.
output
The buffer holding the output data. This must point to a writable buffer of length \p length Bytes.
Return value
\c 0 if successful. A negative error code on failure.
Notes
Upon exit, the content of the IV is updated so that you can call the function same function again on the following block(s) of data and get the same result as if it was encrypted in one call. This allows a "streaming" usage. If on the other hand you need to retain the contents of the IV, you should either save it manually or use the cipher module instead.