OpenSSL and Tomcrypt des modules are not benched together as there's some naming collisions between the two.
Signed-off-by: James Almer <jamr...@gmail.com> --- tools/crypto_bench.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tools/crypto_bench.c b/tools/crypto_bench.c index fb749ac..5af2dc1 100644 --- a/tools/crypto_bench.c +++ b/tools/crypto_bench.c @@ -76,6 +76,7 @@ struct hash_impl { #include "libavutil/ripemd.h" #include "libavutil/aes.h" #include "libavutil/blowfish.h" +#include "libavutil/des.h" #include "libavutil/camellia.h" #include "libavutil/cast5.h" #include "libavutil/twofish.h" @@ -147,6 +148,16 @@ static void run_lavu_cast128(uint8_t *output, av_cast5_crypt(cast, output, input, size >> 3, 0); } +static void run_lavu_des(uint8_t *output, + const uint8_t *input, unsigned size) +{ + static struct AVDES *des; + if (!des && !(des = av_des_alloc())) + fatal_error("out of memory"); + av_des_init(des, hardcoded_key, 64, 0); + av_des_crypt(des, output, input, size >> 3, NULL, 0); +} + static void run_lavu_twofish(uint8_t *output, const uint8_t *input, unsigned size) { @@ -190,6 +201,9 @@ static void run_lavu_xtea(uint8_t *output, #include <openssl/blowfish.h> #include <openssl/camellia.h> #include <openssl/cast.h> +#if !((USE_EXT_LIBS) & USE_tomcrypt) +#include <openssl/des.h> +#endif #include <openssl/rc4.h> #define DEFINE_CRYPTO_WRAPPER(suffix, function) \ @@ -240,6 +254,19 @@ static void run_crypto_camellia(uint8_t *output, Camellia_ecb_encrypt(input + i, output + i, &camellia, 1); } +#if !((USE_EXT_LIBS) & USE_tomcrypt) +static void run_crypto_des(uint8_t *output, + const uint8_t *input, unsigned size) +{ + DES_key_schedule des; + unsigned i; + + DES_set_key(hardcoded_key, &des); + for (i = 0; i < size; i += 8) + DES_ecb_encrypt(input + i, output + i, &des, 1); +} +#endif + static void run_crypto_cast128(uint8_t *output, const uint8_t *input, unsigned size) { @@ -326,6 +353,16 @@ static void run_gcrypt_cast128(uint8_t *output, gcry_cipher_encrypt(cast, output, size, input, size); } +static void run_gcrypt_des(uint8_t *output, + const uint8_t *input, unsigned size) +{ + static gcry_cipher_hd_t des; + if (!des) + gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); + gcry_cipher_setkey(des, hardcoded_key, 8); + gcry_cipher_encrypt(des, output, size, input, size); +} + static void run_gcrypt_twofish(uint8_t *output, const uint8_t *input, unsigned size) { @@ -400,6 +437,19 @@ static void run_tomcrypt_camellia(uint8_t *output, camellia_ecb_encrypt(input + i, output + i, &camellia); } +#if !((USE_EXT_LIBS) & USE_crypto) +static void run_tomcrypt_des(uint8_t *output, + const uint8_t *input, unsigned size) +{ + symmetric_key des; + unsigned i; + + des_setup(hardcoded_key, 8, 0, &des); + for (i = 0; i < size; i += 8) + des_ecb_encrypt(input + i, output + i, &des); +} +#endif + static void run_tomcrypt_cast128(uint8_t *output, const uint8_t *input, unsigned size) { @@ -519,6 +569,14 @@ struct hash_impl implementations[] = { IMPL_ALL("AES-128", aes128, "crc:ff6bc888") IMPL_ALL("CAMELLIA", camellia, "crc:7abb59a7") IMPL_ALL("CAST-128", cast128, "crc:456aa584") + IMPL(lavu, "DES", des, "crc:31291e0b") + IMPL(gcrypt, "DES", des, "crc:31291e0b") +#if !((USE_EXT_LIBS) & USE_tomcrypt) + IMPL(crypto, "DES", des, "crc:31291e0b") +#endif +#if !((USE_EXT_LIBS) & USE_crypto) + IMPL(tomcrypt, "DES", des, "crc:31291e0b") +#endif IMPL_ALL("BLOWFISH", blowfish, "crc:33e8aa74") IMPL(lavu, "TWOFISH", twofish, "crc:9edbd5c1") IMPL(gcrypt, "TWOFISH", twofish, "crc:9edbd5c1") -- 2.5.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel