- Added first version of Camellia
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index 3e70c2c..525c852 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -37,6 +37,7 @@
#include "polarssl/arc4.h"
#include "polarssl/des.h"
#include "polarssl/aes.h"
+#include "polarssl/camellia.h"
#include "polarssl/rsa.h"
#include "polarssl/timing.h"
@@ -67,6 +68,9 @@
#if defined(POLARSSL_AES_C)
aes_context aes;
#endif
+#if defined(POLARSSL_CAMELLIA_C)
+ camellia_context camellia;
+#endif
#if defined(POLARSSL_RSA_C)
rsa_context rsa;
#endif
@@ -215,6 +219,30 @@
}
#endif
+#if defined(POLARSSL_CAMELLIA_C)
+ for( keysize = 128; keysize <= 256; keysize += 64 )
+ {
+ printf( " CAMELLIA-%d : ", keysize );
+ fflush( stdout );
+
+ memset( buf, 0, sizeof( buf ) );
+ memset( tmp, 0, sizeof( tmp ) );
+ camellia_setkey_enc( &camellia, tmp, keysize );
+
+ set_alarm( 1 );
+
+ for( i = 1; ! alarmed; i++ )
+ camellia_crypt_cbc( &camellia, CAMELLIA_ENCRYPT, BUFSIZE, tmp, buf, buf );
+
+ tsc = hardclock();
+ for( j = 0; j < 4096; j++ )
+ camellia_crypt_cbc( &camellia, CAMELLIA_ENCRYPT, BUFSIZE, tmp, buf, buf );
+
+ printf( "%9lu Kb/s, %9lu cycles/byte\n", i * BUFSIZE / 1024,
+ ( hardclock() - tsc ) / ( j * BUFSIZE ) );
+ }
+#endif
+
#if defined(POLARSSL_RSA_C)
rsa_init( &rsa, RSA_PKCS_V15, 0, myrand, NULL );
rsa_gen_key( &rsa, 1024, 65537 );
diff --git a/programs/test/selftest.c b/programs/test/selftest.c
index 9607c07..12d82fe 100644
--- a/programs/test/selftest.c
+++ b/programs/test/selftest.c
@@ -126,6 +126,11 @@
return( ret );
#endif
+#if defined(POLARSSL_CAMELLIA_C)
+ if( ( ret = camellia_self_test( v ) ) != 0 )
+ return( ret );
+#endif
+
if( v != 0 )
{
printf( " [ All tests passed ]\n\n" );