- Added Blowfish to benchmarks

This commit is contained in:
Paul Bakker 2012-07-04 17:15:31 +00:00
parent 6132d0aa93
commit 3d58fe8af6

View file

@ -41,6 +41,7 @@
#include "polarssl/arc4.h" #include "polarssl/arc4.h"
#include "polarssl/des.h" #include "polarssl/des.h"
#include "polarssl/aes.h" #include "polarssl/aes.h"
#include "polarssl/blowfish.h"
#include "polarssl/camellia.h" #include "polarssl/camellia.h"
#include "polarssl/gcm.h" #include "polarssl/gcm.h"
#include "polarssl/rsa.h" #include "polarssl/rsa.h"
@ -104,6 +105,9 @@ int main( int argc, char *argv[] )
gcm_context gcm; gcm_context gcm;
#endif #endif
#endif #endif
#if defined(POLARSSL_BLOWFISH_C)
blowfish_context blowfish;
#endif
#if defined(POLARSSL_CAMELLIA_C) #if defined(POLARSSL_CAMELLIA_C)
camellia_context camellia; camellia_context camellia;
#endif #endif
@ -327,6 +331,30 @@ int main( int argc, char *argv[] )
} }
#endif #endif
#if defined(POLARSSL_BLOWFISH_C)
for( keysize = 128; keysize <= 256; keysize += 64 )
{
printf( " BLOWFISH-CBC-%d: ", keysize );
fflush( stdout );
memset( buf, 0, sizeof( buf ) );
memset( tmp, 0, sizeof( tmp ) );
blowfish_setkey( &blowfish, tmp, keysize );
set_alarm( 1 );
for( i = 1; ! alarmed; i++ )
blowfish_crypt_cbc( &blowfish, BLOWFISH_ENCRYPT, BUFSIZE, tmp, buf, buf );
tsc = hardclock();
for( j = 0; j < 4096; j++ )
blowfish_crypt_cbc( &blowfish, BLOWFISH_ENCRYPT, BUFSIZE, tmp, buf, buf );
printf( "%9lu Kb/s, %9lu cycles/byte\n", i * BUFSIZE / 1024,
( hardclock() - tsc ) / ( j * BUFSIZE ) );
}
#endif
#if defined(POLARSSL_HAVEGE_C) #if defined(POLARSSL_HAVEGE_C)
printf( HEADER_FORMAT, "HAVEGE" ); printf( HEADER_FORMAT, "HAVEGE" );
fflush( stdout ); fflush( stdout );