Go to the documentation of this file.
27 #define AES_BLOCK_SIZE (16)
50 memcpy(
a->counter, iv,
sizeof(
a->counter));
78 memset(
a->counter, 0,
sizeof(
a->counter));
115 uint8_t* encrypted_counter_pos;
117 while (
src < src_end) {
118 if (
a->block_offset == 0) {
124 encrypted_counter_pos =
a->encrypted_counter +
a->block_offset;
126 cur_end_pos =
FFMIN(cur_end_pos, src_end);
128 a->block_offset += cur_end_pos -
src;
131 while (
src < cur_end_pos) {
132 *dst++ = *
src++ ^ *encrypted_counter_pos++;
int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
Initialize an AVAES context.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key)
Initialize an AVAESCTR context.
const uint8_t * av_aes_ctr_get_iv(struct AVAESCTR *a)
Get the current iv.
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
struct AVAESCTR * av_aes_ctr_alloc(void)
Allocate an AVAESCTR context.
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_set_random_iv(struct AVAESCTR *a)
Generate a random iv.
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.
struct AVAES * av_aes_alloc(void)
Allocate an AVAES context.
void av_aes_ctr_free(struct AVAESCTR *a)
Release an AVAESCTR context.
void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t *iv)
Forcefully change the 8-byte iv.
uint8_t encrypted_counter[AES_BLOCK_SIZE]
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t *iv)
Forcefully change the "full" 16-byte iv, including the counter.
uint8_t counter[AES_BLOCK_SIZE]
void av_aes_ctr_increment_iv(struct AVAESCTR *a)
Increment the top 64 bit of the iv (performed after each frame)
static void av_aes_ctr_increment_be64(uint8_t *counter)