FFmpeg  4.3
Data Structures | Macros | Functions | Variables
cast5.c File Reference
#include "cast5.h"
#include "common.h"
#include "intreadwrite.h"
#include "attributes.h"

Go to the source code of this file.

Data Structures

struct  AVCAST5
 

Macros

#define IA(x)   ((x) >> 24)
 
#define IB(x)   (((x) >> 16) & 0xff)
 
#define IC(x)   (((x) >> 8) & 0xff)
 
#define ID(x)   ((x) & 0xff)
 
#define LR(x, c)   (((x) << (c)) | ((x) >> (32 - (c))))
 
#define F3(l, r, i)
 
#define F2(l, r, i)
 
#define F1(l, r, i)
 
#define COMPUTE_Z
 
#define COMPUTE_X
 

Functions

static void generate_round_keys (int rnds, uint32_t *K, uint32_t *x, uint32_t *z)
 
static void encipher (AVCAST5 *cs, uint8_t *dst, const uint8_t *src)
 
static void decipher (AVCAST5 *cs, uint8_t *dst, const uint8_t *src, uint8_t *iv)
 
struct AVCAST5av_cast5_alloc (void)
 Allocate an AVCAST5 context To free the struct: av_free(ptr) More...
 
av_cold int av_cast5_init (AVCAST5 *cs, const uint8_t *key, int key_bits)
 Initialize an AVCAST5 context. More...
 
void av_cast5_crypt2 (AVCAST5 *cs, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
 Encrypt or decrypt a buffer using a previously initialized context. More...
 
void av_cast5_crypt (AVCAST5 *cs, uint8_t *dst, const uint8_t *src, int count, int decrypt)
 Encrypt or decrypt a buffer using a previously initialized context, ECB mode only. More...
 

Variables

const int av_cast5_size = sizeof(AVCAST5)
 
static const uint32_t S1 [256]
 
static const uint32_t S2 [256]
 
static const uint32_t S3 [256]
 
static const uint32_t S4 [256]
 
static const uint32_t S5 [256]
 
static const uint32_t S6 [256]
 
static const uint32_t S7 [256]
 
static const uint32_t S8 [256]
 

Macro Definition Documentation

◆ IA

#define IA (   x)    ((x) >> 24)

Definition at line 26 of file cast5.c.

◆ IB

#define IB (   x)    (((x) >> 16) & 0xff)

Definition at line 27 of file cast5.c.

◆ IC

#define IC (   x)    (((x) >> 8) & 0xff)

Definition at line 28 of file cast5.c.

◆ ID

#define ID (   x)    ((x) & 0xff)

Definition at line 29 of file cast5.c.

◆ LR

#define LR (   x,
  c 
)    (((x) << (c)) | ((x) >> (32 - (c))))

Definition at line 31 of file cast5.c.

◆ F3

#define F3 (   l,
  r,
  i 
)
Value:
do { \
I = LR(cs->Km[i] - r, cs->Kr[i]); \
f = ((S1[IA(I)] + S2[IB(I)]) ^ S3[IC(I)]) - S4[ID(I)]; \
l = f ^ l; \
} while (0)

Definition at line 33 of file cast5.c.

◆ F2

#define F2 (   l,
  r,
  i 
)
Value:
do { \
I = LR(cs->Km[i] ^ r, cs->Kr[i]); \
f = ((S1[IA(I)] - S2[IB(I)]) + S3[IC(I)]) ^ S4[ID(I)]; \
l = f ^ l; \
} while (0)

Definition at line 40 of file cast5.c.

◆ F1

#define F1 (   l,
  r,
  i 
)
Value:
do { \
I = LR(cs->Km[i] + r, cs->Kr[i]); \
f = ((S1[IA(I)] ^ S2[IB(I)]) - S3[IC(I)]) + S4[ID(I)]; \
l = f ^ l; \
} while (0)

Definition at line 47 of file cast5.c.

◆ COMPUTE_Z

#define COMPUTE_Z
Value:
do { \
z[0] = x[0] ^ S5[IB(x[3])] ^ S6[ID(x[3])] ^ S7[IA(x[3])] ^ S8[IC(x[3])] ^ S7[IA(x[2])]; \
z[1] = x[2] ^ S5[IA(z[0])] ^ S6[IC(z[0])] ^ S7[IB(z[0])] ^ S8[ID(z[0])] ^ S8[IC(x[2])]; \
z[2] = x[3] ^ S5[ID(z[1])] ^ S6[IC(z[1])] ^ S7[IB(z[1])] ^ S8[IA(z[1])] ^ S5[IB(x[2])]; \
z[3] = x[1] ^ S5[IC(z[2])] ^ S6[IB(z[2])] ^ S7[ID(z[2])] ^ S8[IA(z[2])] ^ S6[ID(x[2])]; \
} while (0)

Definition at line 54 of file cast5.c.

◆ COMPUTE_X

#define COMPUTE_X
Value:
do { \
x[0] = z[2] ^ S5[IB(z[1])] ^ S6[ID(z[1])] ^ S7[IA(z[1])] ^ S8[IC(z[1])] ^ S7[IA(z[0])]; \
x[1] = z[0] ^ S5[IA(x[0])] ^ S6[IC(x[0])] ^ S7[IB(x[0])] ^ S8[ID(x[0])] ^ S8[IC(z[0])]; \
x[2] = z[1] ^ S5[ID(x[1])] ^ S6[IC(x[1])] ^ S7[IB(x[1])] ^ S8[IA(x[1])] ^ S5[IB(z[0])]; \
x[3] = z[3] ^ S5[IC(x[2])] ^ S6[IB(x[2])] ^ S7[ID(x[2])] ^ S8[IA(x[2])] ^ S6[ID(z[0])]; \
} while (0)

Definition at line 62 of file cast5.c.

Function Documentation

◆ generate_round_keys()

static void generate_round_keys ( int  rnds,
uint32_t *  K,
uint32_t *  x,
uint32_t *  z 
)
static

Definition at line 359 of file cast5.c.

Referenced by av_cast5_init().

◆ encipher()

static void encipher ( AVCAST5 cs,
uint8_t dst,
const uint8_t src 
)
static

Definition at line 392 of file cast5.c.

Referenced by av_cast5_crypt(), and av_cast5_crypt2().

◆ decipher()

static void decipher ( AVCAST5 cs,
uint8_t dst,
const uint8_t src,
uint8_t iv 
)
static

Definition at line 419 of file cast5.c.

Referenced by av_cast5_crypt(), and av_cast5_crypt2().

Variable Documentation

◆ S1

const uint32_t S1[256]
static

Definition at line 79 of file cast5.c.

◆ S2

const uint32_t S2[256]
static

Definition at line 114 of file cast5.c.

◆ S3

const uint32_t S3[256]
static

Definition at line 149 of file cast5.c.

◆ S4

const uint32_t S4[256]
static

Definition at line 184 of file cast5.c.

◆ S5

const uint32_t S5[256]
static

Definition at line 219 of file cast5.c.

Referenced by generate_round_keys().

◆ S6

const uint32_t S6[256]
static

Definition at line 254 of file cast5.c.

Referenced by generate_round_keys().

◆ S7

const uint32_t S7[256]
static

Definition at line 289 of file cast5.c.

Referenced by generate_round_keys().

◆ S8

const uint32_t S8[256]
static

Definition at line 324 of file cast5.c.

Referenced by generate_round_keys().

S2
static const uint32_t S2[256]
Definition: cast5.c:114
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
IA
#define IA(x)
Definition: cast5.c:26
LR
#define LR(x, c)
Definition: cast5.c:31
S3
static const uint32_t S3[256]
Definition: cast5.c:149
IB
#define IB(x)
Definition: cast5.c:27
f
#define f(width, name)
Definition: cbs_vp9.c:255
S5
static const uint32_t S5[256]
Definition: cast5.c:219
S7
static const uint32_t S7[256]
Definition: cast5.c:289
S1
static const uint32_t S1[256]
Definition: cast5.c:79
S6
static const uint32_t S6[256]
Definition: cast5.c:254
r
#define r
Definition: input.c:40
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
S4
static const uint32_t S4[256]
Definition: cast5.c:184
ID
#define ID(x)
Definition: cast5.c:29
IC
#define IC(x)
Definition: cast5.c:28
S8
static const uint32_t S8[256]
Definition: cast5.c:324