---
tools/crypto_bench.c | 82
1 file changed, 82 insertions(+)
diff --git a/tools/crypto_bench.c b/tools/crypto_bench.c
index b3b24a6..ad20f95 100644
--- a/tools/crypto_bench.c
+++ b/tools/crypto_bench.c
@@ -118,6 +118,24 @@ static void run_lavu_aes128(uint8_t *output,
av_aes_crypt(aes, output, input, size >> 4, NULL, 0);
}
+static void run_lavu_aes192(uint8_t *output, const uint8_t *input, unsigned
size)
+{
+static struct AVAES *aes;
+if (!aes && !(aes = av_aes_alloc()))
+fatal_error("out of memory");
+av_aes_init(aes, hardcoded_key, 192, 0);
+av_aes_crypt(aes, output, input, size >> 4, NULL, 0);
+}
+
+static void run_lavu_aes256(uint8_t *output, const uint8_t *input, unsigned
size)
+{
+static struct AVAES *aes;
+if (!aes && !(aes = av_aes_alloc()))
+fatal_error("out of memory");
+av_aes_init(aes, hardcoded_key, 256, 0);
+av_aes_crypt(aes, output, input, size >> 4, NULL, 0);
+}
+
static void run_lavu_blowfish(uint8_t *output,
const uint8_t *input, unsigned size)
{
@@ -218,6 +236,28 @@ static void run_crypto_aes128(uint8_t *output,
AES_encrypt(input + i, output + i, &aes);
}
+static void run_crypto_aes192(uint8_t *output, const uint8_t *input, unsigned
size)
+{
+AES_KEY aes;
+unsigned i;
+
+AES_set_encrypt_key(hardcoded_key, 192, &aes);
+size -= 15;
+for (i = 0; i < size; i += 16)
+AES_encrypt(input + i, output + i, &aes);
+}
+
+static void run_crypto_aes256(uint8_t *output, const uint8_t *input, unsigned
size)
+{
+AES_KEY aes;
+unsigned i;
+
+AES_set_encrypt_key(hardcoded_key, 256, &aes);
+size -= 15;
+for (i = 0; i < size; i += 16)
+AES_encrypt(input + i, output + i, &aes);
+}
+
static void run_crypto_blowfish(uint8_t *output,
const uint8_t *input, unsigned size)
{
@@ -297,6 +337,24 @@ static void run_gcrypt_aes128(uint8_t *output,
gcry_cipher_encrypt(aes, output, size, input, size);
}
+static void run_gcrypt_aes192(uint8_t *output, const uint8_t *input, unsigned
size)
+{
+static gcry_cipher_hd_t aes;
+if (!aes)
+gcry_cipher_open(&aes, GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_ECB, 0);
+gcry_cipher_setkey(aes, hardcoded_key, 24);
+gcry_cipher_encrypt(aes, output, size, input, size);
+}
+
+static void run_gcrypt_aes256(uint8_t *output, const uint8_t *input, unsigned
size)
+{
+static gcry_cipher_hd_t aes;
+if (!aes)
+gcry_cipher_open(&aes, GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_ECB, 0);
+gcry_cipher_setkey(aes, hardcoded_key, 32);
+gcry_cipher_encrypt(aes, output, size, input, size);
+}
+
static void run_gcrypt_blowfish(uint8_t *output,
const uint8_t *input, unsigned size)
{
@@ -379,6 +437,28 @@ static void run_tomcrypt_aes128(uint8_t *output,
aes_ecb_encrypt(input + i, output + i, &aes);
}
+static void run_tomcrypt_aes192(uint8_t *output, const uint8_t *input,
unsigned size)
+{
+symmetric_key aes;
+unsigned i;
+
+aes_setup(hardcoded_key, 24, 0, &aes);
+size -= 15;
+for (i = 0; i < size; i += 16)
+aes_ecb_encrypt(input + i, output + i, &aes);
+}
+
+static void run_tomcrypt_aes256(uint8_t *output, const uint8_t *input,
unsigned size)
+{
+symmetric_key aes;
+unsigned i;
+
+aes_setup(hardcoded_key, 32, 0, &aes);
+size -= 15;
+for (i = 0; i < size; i += 16)
+aes_ecb_encrypt(input + i, output + i, &aes);
+}
+
static void run_tomcrypt_blowfish(uint8_t *output,
const uint8_t *input, unsigned size)
{
@@ -521,6 +601,8 @@ struct hash_impl implementations[] = {
IMPL(tomcrypt, "RIPEMD-128", ripemd128, "9ab8bfba2ddccc5d99c9d4cdfb844a5f")
IMPL_ALL("RIPEMD-160", ripemd160,
"62a5321e4fc8784903bb43ab7752c75f8b25af00")
IMPL_ALL("AES-128",aes128,"crc:ff6bc888")
+IMPL_ALL("AES-192",aes192,"crc:1022815b")
+IMPL_ALL("AES-256",aes256,"crc:792e4e8a")
IMPL_ALL("CAMELLIA", camellia, "crc:7abb59a7")
IMPL_ALL("CAST-128", cast128, "crc:456aa584")
IMPL_ALL("BLOWFISH", blowfish, "crc:33e8aa74")
--
2.6.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel