diff options
author | Werner Koch <wk@gnupg.org> | 2007-11-30 16:33:09 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2007-11-30 16:33:09 +0000 |
commit | e63c8ab3860ba635132d20a9bca54621635edb71 (patch) | |
tree | 33297bf568d9036f66f5b8e1b529289ad800b2c3 /tests/benchmark.c | |
parent | f1c4026ae146419f5112cc355a92107f7ca13abe (diff) | |
download | libgcrypt-e63c8ab3860ba635132d20a9bca54621635edb71.tar.gz |
Add support for the HW RNG. However i was not able to test it because it
seems to be disabled by the OS.
Diffstat (limited to 'tests/benchmark.c')
-rw-r--r-- | tests/benchmark.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/tests/benchmark.c b/tests/benchmark.c index 3b2e8f9f..4dcd0220 100644 --- a/tests/benchmark.c +++ b/tests/benchmark.c @@ -14,8 +14,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * License along with this program; if not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H @@ -34,6 +33,8 @@ #define PGM "benchmark" +static int verbose; + static const char sample_private_dsa_key_1024[] = "(private-key\n" " (dsa\n" @@ -347,6 +348,8 @@ random_bench (int very_strong) printf (" %s", elapsed_time ()); putchar ('\n'); + if (verbose) + gcry_control (GCRYCTL_DUMP_RANDOM_STATS); } @@ -928,6 +931,8 @@ mpi_bench (void) int main( int argc, char **argv ) { + int last_argc = -1; + if (argc) { argc--; argv++; } @@ -942,6 +947,33 @@ main( int argc, char **argv ) gcry_control (GCRYCTL_USE_RANDOM_DAEMON, 1); argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + { + fputs ("usage: benchmark " + "[md|cipher|random|mpi|rsa|dsa|ecc [algonames]]\n", + stdout); + exit (0); + } + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--use-random-daemon")) + { + gcry_control (GCRYCTL_USE_RANDOM_DAEMON, 1); + argc--; argv++; + } + } gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); @@ -960,10 +992,6 @@ main( int argc, char **argv ) putchar ('\n'); random_bench (0); } - else if ( !strcmp (*argv, "--help")) - fputs ("usage: benchmark " - "[md|cipher|random|mpi|rsa|dsa|ecc [algonames]]\n", - stdout); else if ( !strcmp (*argv, "random") || !strcmp (*argv, "strongrandom")) { if (argc == 1) |