summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2020-05-05 19:27:59 +0200
committerAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2020-05-06 10:12:32 +0200
commitecab4cdc0c5a1560851161a5e321a81136b6d783 (patch)
tree061c4bce68c0cbc99fb4c7de96de571bf56fb4d7
parentd51399272886d909fbc40f2c5e26db3e87a45a0a (diff)
downloadgnutls-ecab4cdc0c5a1560851161a5e321a81136b6d783.tar.gz
benchmark: enable AES-XTS cipher
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
-rw-r--r--src/benchmark-cipher.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/benchmark-cipher.c b/src/benchmark-cipher.c
index 26d2c63c22..03e1d45fef 100644
--- a/src/benchmark-cipher.c
+++ b/src/benchmark-cipher.c
@@ -153,6 +153,12 @@ static void cipher_bench(int algo, int size, int aead)
return;
memset(_key, 0xf0, keysize);
+ /* For AES-XTS, the block and tweak key must be different */
+ if (algo == GNUTLS_CIPHER_AES_128_XTS ||
+ algo == GNUTLS_CIPHER_AES_256_XTS) {
+ memset((uint8_t *)_key + (keysize / 2), 0x0f, (keysize / 2));
+ }
+
_iv = malloc(ivsize);
if (_iv == NULL) {
free(_key);
@@ -303,6 +309,8 @@ void benchmark_cipher(int debug_level)
printf("\nChecking ciphers, payload size: %u\n", size * 1024);
cipher_bench(GNUTLS_CIPHER_3DES_CBC, size, 0);
cipher_bench(GNUTLS_CIPHER_AES_128_CBC, size, 0);
+ cipher_bench(GNUTLS_CIPHER_AES_128_XTS, size, 0);
+ cipher_bench(GNUTLS_CIPHER_AES_256_XTS, size, 0);
cipher_bench(GNUTLS_CIPHER_SALSA20_256, size, 0);
cipher_bench(GNUTLS_CIPHER_NULL, size, 1);
#ifdef ENABLE_GOST