main.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 <wolfssl/wolfcrypt/logging.h>
  31. #include <wolfcrypt/test/test.h>
  32. extern "C" {
  33. void UserMain(void * pd);
  34. }
  35. const char * AppName="testwolfcrypt";
  36. typedef struct func_args {
  37. int argc;
  38. char** argv;
  39. int return_code;
  40. } func_args;
  41. void UserMain(void * pd) {
  42. InitializeStack();
  43. GetDHCPAddressIfNecessary();
  44. OSChangePrio(MAIN_PRIO);
  45. EnableAutoUpdate();
  46. init();
  47. iprintf("wolfcrypt test Application started\n\r");
  48. iprintf("waiting for sufficient entropy before starting...\n\r");
  49. iprintf("looks like NetBurner is using uart/tcp to seed GetRandomX so ..."
  50. " input enough uart characters.\n\r");
  51. {
  52. BYTE b;
  53. do {
  54. b = GetRandomByte();
  55. iprintf(".");
  56. } while (!RandomValid());
  57. iprintf("\n\r");
  58. (void)b;
  59. }
  60. /* run wolfCrypt tests */
  61. {
  62. func_args args;
  63. args.argc = 0;
  64. args.argv = NULL;
  65. wolfcrypt_test(&args);
  66. }
  67. while (1) {
  68. OSTimeDly(TICKS_PER_SECOND);
  69. }
  70. }