From: rasky Date: Thu, 30 Sep 2010 14:18:35 +0000 (+0000) Subject: Add benchmarks for block ciphers. X-Git-Tag: 2.6.0~11 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=9515451824a811e15bebc2b5c011cd273191d6ce;p=bertos.git Add benchmarks for block ciphers. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4390 38d2e660-2303-0410-9eaa-f027e97ec537 --- 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 */