summaryrefslogtreecommitdiffstats
path: root/src/tests/sha256_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/sha256_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/sha256_test.c')
-rw-r--r--src/tests/sha256_test.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tests/sha256_test.c b/src/tests/sha256_test.c
index 77b6b10f..06a8cae2 100644
--- a/src/tests/sha256_test.c
+++ b/src/tests/sha256_test.c
@@ -78,9 +78,11 @@ static struct digest_test_fragments sha256_test_fragments[] = {
static void sha256_test_exec ( void ) {
struct digest_algorithm *digest = &sha256_algorithm;
struct sha256_test_vector *test;
+ unsigned long cost;
unsigned int i;
unsigned int j;
+ /* Correctness test */
for ( i = 0 ; i < ( sizeof ( sha256_test_vectors ) /
sizeof ( sha256_test_vectors[0] ) ) ; i++ ) {
test = &sha256_test_vectors[i];
@@ -93,6 +95,10 @@ static void sha256_test_exec ( void ) {
test->data, test->len, test->digest );
}
}
+
+ /* Speed test */
+ cost = digest_cost ( digest );
+ DBG ( "SHA256 required %ld cycles per byte\n", cost );
}
/** SHA-256 self-test */