benchmark_main.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* benchmark_main.c
  2. *
  3. * Copyright (C) 2006-2015 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL. (formerly known as CyaSSL)
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  20. */
  21. #ifdef HAVE_CONFIG_H
  22. #include <config.h>
  23. #endif
  24. #include <wolfssl/wolfcrypt/settings.h>
  25. #include <stdio.h>
  26. typedef struct func_args {
  27. int argc;
  28. char** argv;
  29. int return_code;
  30. } func_args;
  31. static func_args args = { 0 } ;
  32. extern double current_time(int reset) ;
  33. extern int benchmark_test(void *args) ;
  34. void main(void)
  35. {
  36. int test_num = 0;
  37. do
  38. {
  39. printf("\nBenchmark Test %d:\n", test_num);
  40. benchmark_test(&args);
  41. printf("Benchmark Test %d: Return code %d\n", test_num, args.return_code);
  42. test_num++;
  43. } while(args.return_code == 0);
  44. }
  45. /*
  46. SAMPLE OUTPUT: Freescale K64 running at 96MHz with no MMCAU:
  47. Benchmark Test 1:
  48. AES 25 kB took 0.073 seconds, 0.334 MB/s
  49. ARC4 25 kB took 0.033 seconds, 0.740 MB/s
  50. RABBIT 25 kB took 0.027 seconds, 0.904 MB/s
  51. 3DES 25 kB took 0.375 seconds, 0.065 MB/s
  52. MD5 25 kB took 0.016 seconds, 1.526 MB/s
  53. SHA 25 kB took 0.044 seconds, 0.555 MB/s
  54. SHA-256 25 kB took 0.119 seconds, 0.205 MB/s
  55. RSA 1024 encryption took 91.000 milliseconds, avg over 1 iterations
  56. RSA 1024 decryption took 573.000 milliseconds, avg over 1 iterations
  57. DH 1024 key generation 253.000 milliseconds, avg over 1 iterations
  58. DH 1024 key agreement 311.000 milliseconds, avg over 1 iterations
  59. Benchmark Test 1: Return code 0
  60. SAMPLE OUTPUT: Freescale K64 running at 96MHz with MMCAU enabled:
  61. Benchmark Test 1:
  62. AES 25 kB took 0.019 seconds, 1.285 MB/s
  63. ARC4 25 kB took 0.033 seconds, 0.740 MB/s
  64. RABBIT 25 kB took 0.028 seconds, 0.872 MB/s
  65. 3DES 25 kB took 0.026 seconds, 0.939 MB/s
  66. MD5 25 kB took 0.005 seconds, 4.883 MB/s
  67. SHA 25 kB took 0.008 seconds, 3.052 MB/s
  68. SHA-256 25 kB took 0.013 seconds, 1.878 MB/s
  69. RSA 1024 encryption took 89.000 milliseconds, avg over 1 iterations
  70. RSA 1024 decryption took 573.000 milliseconds, avg over 1 iterations
  71. DH 1024 key generation 250.000 milliseconds, avg over 1 iterations
  72. DH 1024 key agreement 308.000 milliseconds, avg over 1 iterations
  73. Benchmark Test 1: Return code 0
  74. */