summaryrefslogtreecommitdiffstats
path: root/src/tests/aes_cbc_test.c
diff options
context:
space:
mode:
authorMichael Brown2012-09-26 16:27:33 +0200
committerMichael Brown2012-09-26 16:27:33 +0200
commitc1adf7dabee103c1ca0b73e78c2d5a79b241830e (patch)
tree67ff39116bd8b2258cc974169a78087377a2128c /src/tests/aes_cbc_test.c
parent[test] Add speed tests for digest algorithms (diff)
downloadipxe-c1adf7dabee103c1ca0b73e78c2d5a79b241830e.tar.gz
ipxe-c1adf7dabee103c1ca0b73e78c2d5a79b241830e.tar.xz
ipxe-c1adf7dabee103c1ca0b73e78c2d5a79b241830e.zip
[test] Add speed tests for cipher algorithms
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/tests/aes_cbc_test.c')
-rw-r--r--src/tests/aes_cbc_test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tests/aes_cbc_test.c b/src/tests/aes_cbc_test.c
index 09d38075..4ae3a92e 100644
--- a/src/tests/aes_cbc_test.c
+++ b/src/tests/aes_cbc_test.c
@@ -169,9 +169,21 @@ AES_CBC_TEST ( test_256,
*
*/
static void aes_cbc_test_exec ( void ) {
+ struct cipher_algorithm *cipher = &aes_cbc_algorithm;
+ /* Correctness tests */
aes_cbc_ok ( &test_128 );
aes_cbc_ok ( &test_256 );
+
+ /* Speed tests */
+ DBG ( "AES128 encryption required %ld cycles per byte\n",
+ cbc_cost_encrypt ( cipher, test_128.key_len ) );
+ DBG ( "AES128 decryption required %ld cycles per byte\n",
+ cbc_cost_decrypt ( cipher, test_128.key_len ) );
+ DBG ( "AES256 encryption required %ld cycles per byte\n",
+ cbc_cost_encrypt ( cipher, test_256.key_len ) );
+ DBG ( "AES256 decryption required %ld cycles per byte\n",
+ cbc_cost_decrypt ( cipher, test_256.key_len ) );
}
/** AES-in-CBC-mode self-test */