2
0

main.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* main.c
  2. *
  3. * Copyright (C) 2006-2023 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. #include <predef.h>
  22. #include <stdio.h>
  23. #include <ctype.h>
  24. #include <startnet.h>
  25. #include <autoupdate.h>
  26. #include <dhcpclient.h>
  27. #include <random.h>
  28. #include <init.h>
  29. #include <wolfssl/wolfcrypt/settings.h>
  30. #include <wolfcrypt/benchmark/benchmark.h>
  31. extern "C" {
  32. void UserMain(void * pd);
  33. }
  34. const char * AppName="benchmark";
  35. typedef struct func_args {
  36. int argc;
  37. char** argv;
  38. int return_code;
  39. } func_args;
  40. void UserMain(void * pd) {
  41. InitializeStack();
  42. GetDHCPAddressIfNecessary();
  43. OSChangePrio(MAIN_PRIO);
  44. EnableAutoUpdate();
  45. init();
  46. iprintf("wolfcrypt benchmark Application started\n");
  47. iprintf("waiting for sufficient entropy before starting...\n\r");
  48. iprintf("looks like NetBurner is using uart/tcp to seed GetRandomX so ..."
  49. " input enough uart characters.\n\r");
  50. {
  51. BYTE b;
  52. do {
  53. b = GetRandomByte();
  54. iprintf(".");
  55. } while (!RandomValid());
  56. iprintf("\n\r");
  57. (void)b;
  58. }
  59. /* run wolfCrypt benchmarks */
  60. {
  61. func_args args;
  62. args.argc = 0;
  63. args.argv = NULL;
  64. benchmark_test(&args);
  65. }
  66. while (1) {
  67. OSTimeDly(TICKS_PER_SECOND);
  68. }
  69. }