libavutil/aes.c File Reference

#include "common.h"
#include "aes.h"

Go to the source code of this file.

Data Structures

struct  AVAES

Functions

static void addkey (uint64_t dst[2], const uint64_t src[2], const uint64_t round_key[2])
static void subshift (uint8_t s0[2][16], int s, const uint8_t *box)
static int mix_core (uint32_t multbl[4][256], int a, int b, int c, int d)
static void mix (uint8_t state[2][4][4], uint32_t multbl[4][256], int s1, int s3)
static void crypt (AVAES *a, int s, const uint8_t *sbox, const uint32_t *multbl)
void av_aes_crypt (AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
 Encrypts / decrypts.
static void init_multbl2 (uint8_t tbl[1024], const int c[4], const uint8_t *log8, const uint8_t *alog8, const uint8_t *sbox)
int av_aes_init (AVAES *a, const uint8_t *key, int key_bits, int decrypt)
 Initializes an AVAES context.

Variables

const int av_aes_size = sizeof(AVAES)
static const uint8_t rcon [10]
static uint8_t sbox [256]
static uint8_t inv_sbox [256]
static uint32_t enc_multbl [4][256]
static uint32_t dec_multbl [4][256]


Function Documentation

static void addkey ( uint64_t  dst[2],
const uint64_t  src[2],
const uint64_t  round_key[2] 
) [inline, static]

Definition at line 50 of file aes.c.

Referenced by av_aes_crypt(), and crypt().

void av_aes_crypt ( struct AVAES a,
uint8_t *  dst,
const uint8_t *  src,
int  count,
uint8_t *  iv,
int  decrypt 
)

Encrypts / decrypts.

Parameters:
count number of 16 byte blocks
dst destination array, can be equal to src
src source array, can be equal to dst
iv initialization vector for CBC mode, if NULL then ECB will be used
decrypt 0 for encryption, 1 for decryption

Definition at line 90 of file aes.c.

Referenced by mxf_decrypt_triplet().

int av_aes_init ( struct AVAES a,
const uint8_t *  key,
int  key_bits,
int  decrypt 
)

Initializes an AVAES context.

Parameters:
key_bits 128, 192 or 256
decrypt 0 for encryption, 1 for decryption

Definition at line 125 of file aes.c.

Referenced by mxf_decrypt_triplet().

static void crypt ( AVAES a,
int  s,
const uint8_t *  sbox,
const uint32_t *  multbl 
) [inline, static]

Definition at line 80 of file aes.c.

Referenced by av_aes_crypt().

static void init_multbl2 ( uint8_t  tbl[1024],
const int  c[4],
const uint8_t *  log8,
const uint8_t *  alog8,
const uint8_t *  sbox 
) [static]

Definition at line 111 of file aes.c.

Referenced by av_aes_init().

static void mix ( uint8_t  state[2][4][4],
uint32_t  multbl[4][256],
int  s1,
int  s3 
) [inline, static]

Definition at line 73 of file aes.c.

static int mix_core ( uint32_t  multbl[4][256],
int  a,
int  b,
int  c,
int  d 
) [inline, static]

Definition at line 64 of file aes.c.

Referenced by mix().

static void subshift ( uint8_t  s0[2][16],
int  s,
const uint8_t *  box 
) [static]

Definition at line 55 of file aes.c.

Referenced by av_aes_init(), and crypt().


Variable Documentation

const int av_aes_size = sizeof(AVAES)

Definition at line 34 of file aes.c.

Referenced by mxf_decrypt_triplet().

uint32_t dec_multbl[4][256] [static]

Definition at line 47 of file aes.c.

Referenced by av_aes_crypt(), and av_aes_init().

uint32_t enc_multbl[4][256] [static]

Definition at line 46 of file aes.c.

Referenced by av_aes_crypt(), and av_aes_init().

uint8_t inv_sbox[256] [static]

Definition at line 41 of file aes.c.

Referenced by av_aes_crypt(), and av_aes_init().

const uint8_t rcon[10] [static]

Initial value:

 {
  0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36
}

Definition at line 36 of file aes.c.

Referenced by av_aes_init().

uint8_t sbox[256] [static]

Definition at line 40 of file aes.c.

Referenced by av_aes_crypt(), and av_aes_init().


Generated on Fri Oct 26 02:35:46 2012 for FFmpeg by  doxygen 1.5.8