CTR mode encryption/decryption procedure.
CTR mode encrypts (or decrypts) inlen bytes from in buffer into out buffer
- Returns
- 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 outlen == 0 or inlen != outlen
- Note
- Assumes:- The current value in ctr has NOT been used with sched
- out points to inlen bytes
- in points to inlen bytes
- ctr is an integer counter in littleEndian format
- sched was initialized by aes_set_encrypt_key
- Parameters
-
| out | OUT – produced ciphertext (plaintext) |
| outlen | IN – length of ciphertext buffer in bytes |
| in | IN – data to encrypt (or decrypt) |
| inlen | IN – length of input data in bytes |
| ctr | IN/OUT – the current counter value |
| sched | IN – an initialized AES key schedule |