add idea benchmark, cleanup
This commit is contained in:
parent
c4e1bdcb29
commit
d669fc28c2
@ -1155,7 +1155,7 @@ AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"])
|
||||
|
||||
# IDEA
|
||||
AC_ARG_ENABLE([idea],
|
||||
[ --enable-idea Enable IDEA (default: disabled)],
|
||||
[AS_HELP_STRING([--enable-idea],[Enable IDEA Cipher (default: disabled)])],
|
||||
[ ENABLED_IDEA=$enableval ],
|
||||
[ ENABLED_IDEA=no ]
|
||||
)
|
||||
|
@ -50,6 +50,9 @@ int unit_test(int argc, char** argv)
|
||||
(void)argv;
|
||||
printf("starting unit tests...\n");
|
||||
|
||||
#if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND)
|
||||
wolfSSL_Debugging_ON();
|
||||
#endif
|
||||
#ifdef HAVE_CAVIUM
|
||||
ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
|
||||
if (ret != 0)
|
||||
|
@ -61,6 +61,9 @@
|
||||
#ifdef HAVE_ECC
|
||||
#include <wolfssl/wolfcrypt/ecc.h>
|
||||
#endif
|
||||
#ifdef HAVE_IDEA
|
||||
#include <wolfssl/wolfcrypt/idea.h>
|
||||
#endif
|
||||
#ifdef HAVE_CURVE25519
|
||||
#include <wolfssl/wolfcrypt/curve25519.h>
|
||||
#endif
|
||||
@ -121,6 +124,7 @@
|
||||
|
||||
|
||||
void bench_des(void);
|
||||
void bench_idea(void);
|
||||
void bench_arc4(void);
|
||||
void bench_hc128(void);
|
||||
void bench_rabbit(void);
|
||||
@ -303,6 +307,9 @@ int benchmark_test(void *args)
|
||||
#ifndef NO_DES3
|
||||
bench_des();
|
||||
#endif
|
||||
#ifdef HAVE_IDEA
|
||||
bench_idea();
|
||||
#endif
|
||||
|
||||
printf("\n");
|
||||
|
||||
@ -661,6 +668,41 @@ void bench_des(void)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_IDEA
|
||||
void bench_idea(void)
|
||||
{
|
||||
Idea enc;
|
||||
double start, total, persec;
|
||||
int i, ret;
|
||||
|
||||
ret = wc_IdeaSetKey(&enc, key, IDEA_KEY_SIZE, iv, IDEA_ENCRYPTION);
|
||||
if (ret != 0) {
|
||||
printf("Des3_SetKey failed, ret = %d\n", ret);
|
||||
return;
|
||||
}
|
||||
start = current_time(1);
|
||||
BEGIN_INTEL_CYCLES
|
||||
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
wc_IdeaCbcEncrypt(&enc, plain, cipher, sizeof(plain));
|
||||
|
||||
END_INTEL_CYCLES
|
||||
total = current_time(0) - start;
|
||||
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("IDEA %d %s took %5.3f seconds, %8.3f MB/s", numBlocks,
|
||||
blockType, total, persec);
|
||||
SHOW_INTEL_CYCLES
|
||||
printf("\n");
|
||||
}
|
||||
#endif /* HAVE_IDEA */
|
||||
|
||||
|
||||
#ifndef NO_RC4
|
||||
void bench_arc4(void)
|
||||
{
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#ifdef HAVE_IDEA
|
||||
|
Loading…
Reference in New Issue
Block a user