From bef610f14930b50af370a0a582f904204285d084 Mon Sep 17 00:00:00 2001 From: rasky Date: Fri, 24 Sep 2010 13:08:47 +0000 Subject: [PATCH] SEC: move SHA-1 benchmark into generic file. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4297 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/sec/benchmarks.c | 24 +++++++++++++++++++++++ bertos/sec/benchmarks.h | 8 ++++++++ bertos/sec/hash/sha1.c | 43 ----------------------------------------- 3 files changed, 32 insertions(+), 43 deletions(-) create mode 100644 bertos/sec/benchmarks.c create mode 100644 bertos/sec/benchmarks.h diff --git a/bertos/sec/benchmarks.c b/bertos/sec/benchmarks.c new file mode 100644 index 00000000..f5fbd79b --- /dev/null +++ b/bertos/sec/benchmarks.c @@ -0,0 +1,24 @@ +#include "benchmarks.h" +#include +#include +#include + +void hash_benchmark(Hash *h, const char *hname, int numk) +{ + static uint8_t buf[512]; + memset(buf, 0x12, sizeof(buf)); + + ticks_t t = timer_clock(); + + for (int j=0;j<64;++j) { + hash_begin(h); + for (int i=0; i + +void hash_benchmark(Hash *h, const char *hname, int numk); + +#endif /* SEC_BENCHMARKS_H */ diff --git a/bertos/sec/hash/sha1.c b/bertos/sec/hash/sha1.c index d9dc5c86..0f0aba50 100644 --- a/bertos/sec/hash/sha1.c +++ b/bertos/sec/hash/sha1.c @@ -254,46 +254,3 @@ void SHA1_init(SHA1_Context* ctx) ctx->h.update = SHA1_update; ctx->h.final = SHA1_final; } - -#include - -void SHA1_benchmark(int numk) -{ - SHA1_Context context; - SHA1_init(&context); - - static uint8_t buf[512]; - memset(buf, 0x12, sizeof(buf)); - - ticks_t t = timer_clock(); - - for (int j=0;j<64;++j) { - SHA1_begin(&context.h); - for (int i=0; i