From 9515451824a811e15bebc2b5c011cd273191d6ce Mon Sep 17 00:00:00 2001 From: rasky Date: Thu, 30 Sep 2010 14:18:35 +0000 Subject: [PATCH] Add benchmarks for block ciphers. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4390 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/sec/benchmarks.c | 37 ++++++++++++++++++++++++++++++++++--- bertos/sec/benchmarks.h | 2 ++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/bertos/sec/benchmarks.c b/bertos/sec/benchmarks.c index 727697d3..92c99089 100644 --- a/bertos/sec/benchmarks.c +++ b/bertos/sec/benchmarks.c @@ -1,5 +1,4 @@ #include "benchmarks.h" -#include #include #include @@ -31,8 +30,10 @@ void prng_benchmark(PRNG *prng, const char *hname, int numbytes) prng_reseed(prng, buf); ticks_t t = timer_clock(); + enum { CYCLES = 2048 }; - for (int j=0;j<2048;++j) { + for (int j=0;j= cipher_key_len(c)); + cipher_set_key(c, buf); + + uint8_t iv[cipher_block_len(c)]; + memset(iv, 0, sizeof(iv)); + + ticks_t t = timer_clock(); + enum { CYCLES = 64 }; + + for (int j=0;j #include +#include void hash_benchmark(Hash *h, const char *hname, int numk); void prng_benchmark(PRNG *prng, const char *hname, int numk); +void cipher_benchmark(BlockCipher *c, const char *cname, int msg_len); #endif /* SEC_BENCHMARKS_H */ -- 2.25.1