From 1d4da2e1236a33435beab88e682bb6ce12d83833 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Sun, 25 Oct 2009 12:36:53 +0000
Subject: [PATCH] - Added benchmark of 2048 and 4096 bits RSA
---
programs/test/benchmark.c | 62 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index bb5671ea4..5aeb4e32a 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -287,11 +287,71 @@ int main( void )
rsa_private( &rsa, buf, buf );
}
- printf( "%9lu private/s\n\n", i / 3 );
+ printf( "%9lu private/s\n", i / 3 );
+
+ rsa_free( &rsa );
+
+ rsa_init( &rsa, RSA_PKCS_V15, 0, myrand, NULL );
+ rsa_gen_key( &rsa, 2048, 65537 );
+
+ printf( " RSA-2048 : " );
+ fflush( stdout );
+ set_alarm( 3 );
+
+ for( i = 1; ! alarmed; i++ )
+ {
+ buf[0] = 0;
+ rsa_public( &rsa, buf, buf );
+ }
+
+ printf( "%9lu public/s\n", i / 3 );
+
+ printf( " RSA-2048 : " );
+ fflush( stdout );
+ set_alarm( 3 );
+
+ for( i = 1; ! alarmed; i++ )
+ {
+ buf[0] = 0;
+ rsa_private( &rsa, buf, buf );
+ }
+
+ printf( "%9lu private/s\n", i / 3 );
+
+ rsa_free( &rsa );
+
+ rsa_init( &rsa, RSA_PKCS_V15, 0, myrand, NULL );
+ rsa_gen_key( &rsa, 4096, 65537 );
+
+ printf( " RSA-4096 : " );
+ fflush( stdout );
+ set_alarm( 3 );
+
+ for( i = 1; ! alarmed; i++ )
+ {
+ buf[0] = 0;
+ rsa_public( &rsa, buf, buf );
+ }
+
+ printf( "%9lu public/s\n", i / 3 );
+
+ printf( " RSA-4096 : " );
+ fflush( stdout );
+ set_alarm( 3 );
+
+ for( i = 1; ! alarmed; i++ )
+ {
+ buf[0] = 0;
+ rsa_private( &rsa, buf, buf );
+ }
+
+ printf( "%9lu private/s\n", i / 3 );
rsa_free( &rsa );
#endif
+ printf( "\n" );
+
#ifdef WIN32
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();