From ebfd9bcf16e4aaddcfe2d1b76b50e3dd6d3242e2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 22 Jun 2005 13:27:23 -0700 Subject: [CRYPTO]: Add cipher speed tests From: Reyk Floeter I recently had the requirement to do some benchmarking on cryptoapi, and I found reyk's very useful performance test patch [1]. However, I could not find any discussion on why that extension (or something providing a similar feature but different implementation) was not merged into mainline. If there was such a discussion, can someone please point me to the archive[s]? I've now merged the old patch into 2.6.12-rc1, the result can be found attached to this email. [1] http://lists.logix.cz/pipermail/padlock/2004/000010.html Signed-off-by: Harald Welte Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- crypto/tcrypt.h | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) (limited to 'crypto/tcrypt.h') diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h index 72d40704042f..c01a0ce9b40a 100644 --- a/crypto/tcrypt.h +++ b/crypto/tcrypt.h @@ -12,7 +12,8 @@ * Software Foundation; either version 2 of the License, or (at your option) * any later version. * - * 14 - 09 - 2003 Changes by Kartikey Mahendra Bhatt + * 2004-08-09 Cipher speed tests by Reyk Floeter + * 2003-09-14 Changes by Kartikey Mahendra Bhatt * */ #ifndef _CRYPTO_TCRYPT_H @@ -58,6 +59,11 @@ struct cipher_testvec { unsigned char tap[MAX_TAP]; }; +struct cipher_speed { + unsigned char klen; + unsigned int blen; +}; + /* * MD4 test vectors from RFC1320 */ @@ -2728,4 +2734,88 @@ static struct hash_testvec michael_mic_tv_template[] = { } }; +/* + * Cipher speed tests + */ +static struct cipher_speed aes_speed_template[] = { + { .klen = 16, .blen = 16, }, + { .klen = 16, .blen = 64, }, + { .klen = 16, .blen = 256, }, + { .klen = 16, .blen = 1024, }, + { .klen = 16, .blen = 8192, }, + { .klen = 24, .blen = 16, }, + { .klen = 24, .blen = 64, }, + { .klen = 24, .blen = 256, }, + { .klen = 24, .blen = 1024, }, + { .klen = 24, .blen = 8192, }, + { .klen = 32, .blen = 16, }, + { .klen = 32, .blen = 64, }, + { .klen = 32, .blen = 256, }, + { .klen = 32, .blen = 1024, }, + { .klen = 32, .blen = 8192, }, + + /* End marker */ + { .klen = 0, .blen = 0, } +}; + +static struct cipher_speed des3_ede_speed_template[] = { + { .klen = 24, .blen = 16, }, + { .klen = 24, .blen = 64, }, + { .klen = 24, .blen = 256, }, + { .klen = 24, .blen = 1024, }, + { .klen = 24, .blen = 8192, }, + + /* End marker */ + { .klen = 0, .blen = 0, } +}; + +static struct cipher_speed twofish_speed_template[] = { + { .klen = 16, .blen = 16, }, + { .klen = 16, .blen = 64, }, + { .klen = 16, .blen = 256, }, + { .klen = 16, .blen = 1024, }, + { .klen = 16, .blen = 8192, }, + { .klen = 24, .blen = 16, }, + { .klen = 24, .blen = 64, }, + { .klen = 24, .blen = 256, }, + { .klen = 24, .blen = 1024, }, + { .klen = 24, .blen = 8192, }, + { .klen = 32, .blen = 16, }, + { .klen = 32, .blen = 64, }, + { .klen = 32, .blen = 256, }, + { .klen = 32, .blen = 1024, }, + { .klen = 32, .blen = 8192, }, + + /* End marker */ + { .klen = 0, .blen = 0, } +}; + +static struct cipher_speed blowfish_speed_template[] = { + /* Don't support blowfish keys > 256 bit in this test */ + { .klen = 8, .blen = 16, }, + { .klen = 8, .blen = 64, }, + { .klen = 8, .blen = 256, }, + { .klen = 8, .blen = 1024, }, + { .klen = 8, .blen = 8192, }, + { .klen = 32, .blen = 16, }, + { .klen = 32, .blen = 64, }, + { .klen = 32, .blen = 256, }, + { .klen = 32, .blen = 1024, }, + { .klen = 32, .blen = 8192, }, + + /* End marker */ + { .klen = 0, .blen = 0, } +}; + +static struct cipher_speed des_speed_template[] = { + { .klen = 8, .blen = 16, }, + { .klen = 8, .blen = 64, }, + { .klen = 8, .blen = 256, }, + { .klen = 8, .blen = 1024, }, + { .klen = 8, .blen = 8192, }, + + /* End marker */ + { .klen = 0, .blen = 0, } +}; + #endif /* _CRYPTO_TCRYPT_H */ -- cgit v1.2.3