2
0

wolfsslRunTests.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* wolfsslRunTests.c
  2. *
  3. * Copyright (C) 2006-2024 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 <includes.h> /* master includes from Micrium Freescale Kinetis K70*/
  22. #include <wolfssl/ssl.h>
  23. /*
  24. * Description : This function runs wolfssl tests.
  25. * Caller(s) : main() in app.c
  26. * Note(s) : none.
  27. */
  28. int wolfsslRunTests (void)
  29. {
  30. CLK_ERR err;
  31. CLK_TS_SEC ts_unix_sec;
  32. CPU_BOOLEAN valid;
  33. static int initialized = 0;
  34. if(!initialized) {
  35. Clk_Init(&err);
  36. if (err == CLK_ERR_NONE) {
  37. APP_TRACE_INFO(("Clock module successfully initialized\n"));
  38. } else {
  39. APP_TRACE_INFO(("Clock module initialization failed\n"));
  40. return -1;
  41. }
  42. valid = Clk_GetTS_Unix(&ts_unix_sec);
  43. if (valid == DEF_OK) {
  44. APP_TRACE_INFO(("Timestamp Unix = %u\n", ts_unix_sec));
  45. } else {
  46. APP_TRACE_INFO(("Get TS Unix error\n"));
  47. }
  48. #if defined(CURRENT_UNIX_TS)
  49. valid = Clk_SetTS_Unix(CURRENT_UNIX_TS);
  50. if (valid != DEF_OK) {
  51. APP_TRACE_INFO(("Clk_SetTS_Unix error\n"));
  52. return -1;
  53. }
  54. #endif
  55. initialized = 1;
  56. }
  57. #if defined(WOLFSSL_WOLFCRYPT_TEST)
  58. wolfcrypt_test(NULL);
  59. #endif
  60. #if defined(WOLFSSL_BENCHMARK_TEST)
  61. benchmark_test(NULL);
  62. #endif
  63. #if defined(WOLFSSL_CLIENT_TEST)
  64. wolfssl_client_test();
  65. #endif
  66. #if defined(WOLFSSL_SERVER_TEST)
  67. wolfssl_server_test();
  68. #endif
  69. return 0;
  70. }