#include <inttypes.h>
#include "avutil.h"
#include "common.h"
#include "intreadwrite.h"
#include "des.h"
Go to the source code of this file.
Defines | |
#define | T(a, b, c, d, e, f, g, h) 64-a,64-b,64-c,64-d,64-e,64-f,64-g,64-h |
#define | T(a, b, c, d, e, f, g) 64-a,64-b,64-c,64-d,64-e,64-f,64-g |
#define | T(a, b, c, d, e, f) 56-a,56-b,56-c,56-d,56-e,56-f |
Typedefs | |
typedef struct AVDES | AVDES |
Functions | |
static uint64_t | shuffle (uint64_t in, const uint8_t *shuffle, int shuffle_len) |
static uint64_t | shuffle_inv (uint64_t in, const uint8_t *shuffle, int shuffle_len) |
static uint32_t | f_func (uint32_t r, uint64_t k) |
static uint64_t | key_shift_left (uint64_t CDn) |
rotate the two halves of the expanded 56 bit key each 1 bit left | |
static void | gen_roundkeys (uint64_t K[16], uint64_t key) |
static uint64_t | des_encdec (uint64_t in, uint64_t K[16], int decrypt) |
int | av_des_init (AVDES *d, const uint8_t *key, int key_bits, int decrypt) |
Initializes an AVDES context. | |
static void | av_des_crypt_mac (AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt, int mac) |
void | av_des_crypt (AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) |
Encrypts / decrypts using the DES algorithm. | |
void | av_des_mac (AVDES *d, uint8_t *dst, const uint8_t *src, int count) |
Calculates CBC-MAC using the DES algorithm. | |
Variables | |
static const uint8_t | IP_shuffle [] |
static const uint8_t | PC1_shuffle [] |
static const uint8_t | PC2_shuffle [] |
static const uint32_t | S_boxes_P_shuffle [8][64] |
This table contains the results of applying both the S-box and P-shuffle. |
void av_des_crypt | ( | struct AVDES * | d, | |
uint8_t * | dst, | |||
const uint8_t * | src, | |||
int | count, | |||
uint8_t * | iv, | |||
int | decrypt | |||
) |
Encrypts / decrypts using the DES algorithm.
count | number of 8 byte blocks | |
dst | destination array, can be equal to src, must be 8-byte aligned | |
src | source array, can be equal to dst, must be 8-byte aligned, may be NULL | |
iv | initialization vector for CBC mode, if NULL then ECB will be used, must be 8-byte aligned | |
decrypt | 0 for encryption, 1 for decryption |
Definition at line 331 of file des.c.
Referenced by ff_asfcrypt_dec(), nprobe(), oma_read_packet(), and rprobe().
static void av_des_crypt_mac | ( | AVDES * | d, | |
uint8_t * | dst, | |||
const uint8_t * | src, | |||
int | count, | |||
uint8_t * | iv, | |||
int | decrypt, | |||
int | mac | |||
) | [static] |
int av_des_init | ( | struct AVDES * | d, | |
const uint8_t * | key, | |||
int | key_bits, | |||
int | decrypt | |||
) |
void av_des_mac | ( | struct AVDES * | d, | |
uint8_t * | dst, | |||
const uint8_t * | src, | |||
int | count | |||
) |
static uint64_t des_encdec | ( | uint64_t | in, | |
uint64_t | K[16], | |||
int | decrypt | |||
) | [static] |
static uint32_t f_func | ( | uint32_t | r, | |
uint64_t | k | |||
) | [static] |
static void gen_roundkeys | ( | uint64_t | K[16], | |
uint64_t | key | |||
) | [static] |
static uint64_t key_shift_left | ( | uint64_t | CDn | ) | [static] |
rotate the two halves of the expanded 56 bit key each 1 bit left
Note: the specification calls this "shift", so I kept it although it is confusing.
Definition at line 250 of file des.c.
Referenced by gen_roundkeys().
static uint64_t shuffle | ( | uint64_t | in, | |
const uint8_t * | shuffle, | |||
int | shuffle_len | |||
) | [static] |
static uint64_t shuffle_inv | ( | uint64_t | in, | |
const uint8_t * | shuffle, | |||
int | shuffle_len | |||
) | [static] |
const uint8_t IP_shuffle[] [static] |
Initial value:
{ T(58, 50, 42, 34, 26, 18, 10, 2), T(60, 52, 44, 36, 28, 20, 12, 4), T(62, 54, 46, 38, 30, 22, 14, 6), T(64, 56, 48, 40, 32, 24, 16, 8), T(57, 49, 41, 33, 25, 17, 9, 1), T(59, 51, 43, 35, 27, 19, 11, 3), T(61, 53, 45, 37, 29, 21, 13, 5), }
Definition at line 30 of file des.c.
Referenced by des_encdec().
const uint8_t PC1_shuffle[] [static] |
const uint8_t PC2_shuffle[] [static] |
const uint32_t S_boxes_P_shuffle[8][64] [static] |