summaryrefslogtreecommitdiffstats
path: root/src/tests/md5_test.c
diff options
context:
space:
mode:
authorMichael Brown2012-09-26 15:54:02 +0200
committerMichael Brown2012-09-26 15:54:02 +0200
commit681a219caaa5f9379641232157cc0b38e64a839d (patch)
tree3fa186320f8f1a6bdee04edfb2fd42a09666c515 /src/tests/md5_test.c
parent[efi] Provide guaranteed space in transmitted packets (diff)
downloadipxe-681a219caaa5f9379641232157cc0b38e64a839d.tar.gz
ipxe-681a219caaa5f9379641232157cc0b38e64a839d.tar.xz
ipxe-681a219caaa5f9379641232157cc0b38e64a839d.zip
[test] Add speed tests for digest algorithms
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/tests/md5_test.c')
-rw-r--r--src/tests/md5_test.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tests/md5_test.c b/src/tests/md5_test.c
index e54296ac..ba5f24c3 100644
--- a/src/tests/md5_test.c
+++ b/src/tests/md5_test.c
@@ -70,9 +70,11 @@ static struct digest_test_fragments md5_test_fragments[] = {
static void md5_test_exec ( void ) {
struct digest_algorithm *digest = &md5_algorithm;
struct md5_test_vector *test;
+ unsigned long cost;
unsigned int i;
unsigned int j;
+ /* Correctness test */
for ( i = 0 ; i < ( sizeof ( md5_test_vectors ) /
sizeof ( md5_test_vectors[0] ) ) ; i++ ) {
test = &md5_test_vectors[i];
@@ -85,6 +87,10 @@ static void md5_test_exec ( void ) {
test->data, test->len, test->digest );
}
}
+
+ /* Speed test */
+ cost = digest_cost ( digest );
+ DBG ( "MD5 required %ld cycles per byte\n", cost );
}
/** MD5 self-test */