tc_cbc_mode_encrypt() function
CBC encryption procedure CBC encrypts inlen bytes of the in buffer into the out buffer using the encryption key schedule provided, prepends iv to out
Arguments
out
IN/OUT -- buffer to receive the ciphertext
outlen
IN -- length of ciphertext buffer in bytes
in
IN -- plaintext to encrypt
inlen
IN -- length of plaintext buffer in bytes
iv
IN -- the IV for the this encrypt/decrypt
sched
IN -- AES key schedule for this encrypt
Return value
returns TC_CRYPTO_SUCCESS (1) returns TC_CRYPTO_FAIL (0) if: out == NULL or in == NULL or ctr == NULL or sched == NULL or inlen == 0 or (inlen % TC_AES_BLOCK_SIZE) != 0 or (outlen % TC_AES_BLOCK_SIZE) != 0 or outlen != inlen + TC_AES_BLOCK_SIZE
Notes
Assumes: - sched has been configured by aes_set_encrypt_key - iv contains a 16 byte random string - out buffer is large enough to hold the ciphertext + iv - out buffer is a contiguous buffer - in holds the plaintext and is a contiguous buffer - inlen gives the number of bytes in the in buffer
![]()
int tc_cbc_mode_encrypt(uint8_t *out, unsigned int outlen, const uint8_t *in,![]()
int tc_cbc_mode_encrypt(uint8_t *out, unsigned int outlen, const uint8_t *in,![]()
int tc_cbc_mode_encrypt(uint8_t *out, unsigned int outlen, const uint8_t *in,![]()
int tc_cbc_mode_encrypt(uint8_t *out, unsigned int outlen, const uint8_t *in,
tc_cbc_mode_encrypt() calls 2 functions:
![]()
tc_cbc_mode_encrypt()
tc_cbc_mode_encrypt():
![]()
tc_cbc_mode_encrypt()