FFmpeg
Data Structures | Macros | Functions | Variables
crypto_bench.c File Reference
#include <stdlib.h>
#include <math.h>
#include "libavutil/avutil.h"
#include "libavutil/avstring.h"
#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/timer.h"
#include "compat/getopt.c"
#include "libavutil/md5.h"
#include "libavutil/sha.h"
#include "libavutil/sha512.h"
#include "libavutil/ripemd.h"
#include "libavutil/aes.h"
#include "libavutil/blowfish.h"
#include "libavutil/camellia.h"
#include "libavutil/cast5.h"
#include "libavutil/des.h"
#include "libavutil/twofish.h"
#include "libavutil/rc4.h"
#include "libavutil/xtea.h"

Go to the source code of this file.

Data Structures

struct  hash_impl
 

Macros

#define USE_crypto   0x01 /* OpenSSL's libcrypto */
 
#define USE_gcrypt   0x02 /* GnuTLS's libgcrypt */
 
#define USE_tomcrypt   0x04 /* LibTomCrypt */
 
#define USE_mbedcrypto   0x08 /* mbed TLS */
 
#define AV_READ_TIME(x)   0
 
#define MAX_INPUT_SIZE   1048576
 
#define MAX_OUTPUT_SIZE   128
 
#define IMPL_USE_lavu   IMPL_USE
 
#define DEFINE_LAVU_MD(suffix, type, namespace, hsize)
 
#define IMPL_USE_crypto(...)   /* ignore */
 
#define IMPL_USE_gcrypt(...)   /* ignore */
 
#define IMPL_USE_mbedcrypto(...)   /* ignore */
 
#define IMPL_USE_tomcrypt(...)   /* ignore */
 
#define IMPL_USE(lib, name, symbol, output)   { #lib, name, run_ ## lib ## _ ## symbol, output },
 
#define IMPL(lib, ...)   IMPL_USE_ ## lib(lib, __VA_ARGS__)
 
#define IMPL_ALL(...)
 

Functions

static void fatal_error (const char *tag)
 
static void run_lavu_md5 (uint8_t *output, const uint8_t *input, unsigned size)
 
 DEFINE_LAVU_MD (sha1, AVSHA, sha, 160)
 
 DEFINE_LAVU_MD (sha256, AVSHA, sha, 256)
 
 DEFINE_LAVU_MD (sha512, AVSHA512, sha512, 512)
 
 DEFINE_LAVU_MD (ripemd128, AVRIPEMD, ripemd, 128)
 
 DEFINE_LAVU_MD (ripemd160, AVRIPEMD, ripemd, 160)
 
static void run_lavu_aes128 (uint8_t *output, const uint8_t *input, unsigned size)
 
static void run_lavu_blowfish (uint8_t *output, const uint8_t *input, unsigned size)
 
static void run_lavu_camellia (uint8_t *output, const uint8_t *input, unsigned size)
 
static void run_lavu_cast128 (uint8_t *output, const uint8_t *input, unsigned size)
 
static void run_lavu_des (uint8_t *output, const uint8_t *input, unsigned size)
 
static void run_lavu_twofish (uint8_t *output, const uint8_t *input, unsigned size)
 
static void run_lavu_rc4 (uint8_t *output, const uint8_t *input, unsigned size)
 
static void run_lavu_xtea (uint8_t *output, const uint8_t *input, unsigned size)
 
static unsigned crc32 (const uint8_t *data, unsigned size)
 
static void run_implementation (const uint8_t *input, uint8_t *output, struct hash_impl *impl, unsigned size)
 
int main (int argc, char **argv)
 

Variables

static const char * enabled_libs
 
static const char * enabled_algos
 
static unsigned specified_runs
 
static const uint8_thardcoded_key = "FFmpeg is the best program ever."
 
struct hash_impl implementations []
 

Macro Definition Documentation

#define USE_crypto   0x01 /* OpenSSL's libcrypto */

Definition at line 23 of file crypto_bench.c.

Referenced by main().

#define USE_gcrypt   0x02 /* GnuTLS's libgcrypt */

Definition at line 24 of file crypto_bench.c.

Referenced by main().

#define USE_tomcrypt   0x04 /* LibTomCrypt */

Definition at line 25 of file crypto_bench.c.

Referenced by main().

#define USE_mbedcrypto   0x08 /* mbed TLS */

Definition at line 26 of file crypto_bench.c.

Referenced by main().

#define AV_READ_TIME (   x)    0

Definition at line 38 of file crypto_bench.c.

Referenced by run_implementation().

#define MAX_INPUT_SIZE   1048576

Definition at line 48 of file crypto_bench.c.

Referenced by main().

#define MAX_OUTPUT_SIZE   128

Definition at line 49 of file crypto_bench.c.

Referenced by run_implementation().

#define IMPL_USE_lavu   IMPL_USE

Definition at line 87 of file crypto_bench.c.

#define DEFINE_LAVU_MD (   suffix,
  type,
  namespace,
  hsize 
)
Value:
static void run_lavu_ ## suffix(uint8_t *output, \
const uint8_t *input, unsigned size) \
{ \
static struct type *h; \
if (!h && !(h = av_ ## namespace ## _alloc())) \
fatal_error("out of memory"); \
av_ ## namespace ## _init(h, hsize); \
av_ ## namespace ## _update(h, input, size); \
av_ ## namespace ## _final(h, output); \
}
GLint GLenum type
Definition: opengl_enc.c:104
uint8_t
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
ptrdiff_t size
Definition: opengl_enc.c:100
const char * suffix
Definition: checkasm.c:197
if(ret)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
static void fatal_error(const char *tag)
Definition: crypto_bench.c:57

Definition at line 95 of file crypto_bench.c.

#define IMPL_USE_crypto (   ...)    /* ignore */

Definition at line 291 of file crypto_bench.c.

#define IMPL_USE_gcrypt (   ...)    /* ignore */

Definition at line 336 of file crypto_bench.c.

#define IMPL_USE_mbedcrypto (   ...)    /* ignore */

Definition at line 446 of file crypto_bench.c.

#define IMPL_USE_tomcrypt (   ...)    /* ignore */

Definition at line 567 of file crypto_bench.c.

#define IMPL_USE (   lib,
  name,
  symbol,
  output 
)    { #lib, name, run_ ## lib ## _ ## symbol, output },

Definition at line 630 of file crypto_bench.c.

#define IMPL (   lib,
  ... 
)    IMPL_USE_ ## lib(lib, __VA_ARGS__)

Definition at line 632 of file crypto_bench.c.

#define IMPL_ALL (   ...)
Value:
IMPL(lavu, __VA_ARGS__) \
IMPL(crypto, __VA_ARGS__) \
IMPL(gcrypt, __VA_ARGS__) \
IMPL(mbedcrypto, __VA_ARGS__) \
IMPL(tomcrypt, __VA_ARGS__)
#define IMPL(lib,...)
Definition: crypto_bench.c:632

Definition at line 633 of file crypto_bench.c.

Function Documentation

static void fatal_error ( const char *  tag)
static
static void run_lavu_md5 ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 89 of file crypto_bench.c.

DEFINE_LAVU_MD ( sha1  ,
AVSHA  ,
sha  ,
160   
)
DEFINE_LAVU_MD ( sha256  ,
AVSHA  ,
sha  ,
256   
)
DEFINE_LAVU_MD ( sha512  ,
AVSHA512  ,
sha512  ,
512   
)
DEFINE_LAVU_MD ( ripemd128  ,
AVRIPEMD  ,
ripemd  ,
128   
)
DEFINE_LAVU_MD ( ripemd160  ,
AVRIPEMD  ,
ripemd  ,
160   
)
static void run_lavu_aes128 ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 113 of file crypto_bench.c.

static void run_lavu_blowfish ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 123 of file crypto_bench.c.

static void run_lavu_camellia ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 133 of file crypto_bench.c.

static void run_lavu_cast128 ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 143 of file crypto_bench.c.

static void run_lavu_des ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 153 of file crypto_bench.c.

static void run_lavu_twofish ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 163 of file crypto_bench.c.

static void run_lavu_rc4 ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 173 of file crypto_bench.c.

static void run_lavu_xtea ( uint8_t output,
const uint8_t input,
unsigned  size 
)
static

Definition at line 183 of file crypto_bench.c.

static unsigned crc32 ( const uint8_t data,
unsigned  size 
)
static

Definition at line 574 of file crypto_bench.c.

Referenced by run_implementation().

static void run_implementation ( const uint8_t input,
uint8_t output,
struct hash_impl impl,
unsigned  size 
)
static

Definition at line 579 of file crypto_bench.c.

Referenced by main().

int main ( int  argc,
char **  argv 
)

Definition at line 666 of file crypto_bench.c.

Variable Documentation

const char* enabled_libs
static

Definition at line 51 of file crypto_bench.c.

Referenced by main(), and run_implementation().

const char* enabled_algos
static

Definition at line 52 of file crypto_bench.c.

Referenced by main(), and run_implementation().

unsigned specified_runs
static

Definition at line 53 of file crypto_bench.c.

Referenced by main(), and run_implementation().

const uint8_t* hardcoded_key = "FFmpeg is the best program ever."
static
struct hash_impl implementations[]
Initial value:
= {
IMPL_ALL("SHA-512", sha512, "3afdd44a80d99af15c87bd724cb717243193767835ce866dd5d58c02d674bb57"
"7c25b9e118c200a189fcd5a01ef106a4e200061f3e97dbf50ba065745fd46bef")
}
#define IMPL_ALL(...)
Definition: crypto_bench.c:633

Definition at line 640 of file crypto_bench.c.