27 #define AES_BLOCK_SIZE (16) 96 for (cur_pos = counter + 7; cur_pos >=
counter; cur_pos--) {
115 uint8_t* encrypted_counter_pos;
117 while (src < src_end) {
126 cur_end_pos =
FFMIN(cur_end_pos, src_end);
131 while (src < cur_end_pos) {
132 *dst++ = *src++ ^ *encrypted_counter_pos++;
uint8_t counter[AES_BLOCK_SIZE]
static void av_aes_ctr_increment_be64(uint8_t *counter)
void av_aes_crypt(AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Encrypt or decrypt a buffer using a previously initialized context.
void av_aes_ctr_increment_iv(struct AVAESCTR *a)
Increment the top 64 bit of the iv (performed after each frame)
uint8_t encrypted_counter[AES_BLOCK_SIZE]
void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int count)
Process a buffer using a previously initialized context.
void av_aes_ctr_free(struct AVAESCTR *a)
Release an AVAESCTR context.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
struct AVAES * av_aes_alloc(void)
Allocate an AVAES context.
struct AVAESCTR * av_aes_ctr_alloc(void)
Allocate an AVAESCTR context.
void av_aes_ctr_set_random_iv(struct AVAESCTR *a)
Generate a random iv.
int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
Initialize an AVAES context.
void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t *iv)
Forcefully change the 8-byte iv.
common internal and external API header
int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key)
Initialize an AVAESCTR context.
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t *iv)
Forcefully change the "full" 16-byte iv, including the counter.
const uint8_t * av_aes_ctr_get_iv(struct AVAESCTR *a)
Get the current iv.