1
0

test_main.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* test_main.c
  2. *
  3. * Copyright (C) 2006-2021 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. #ifdef HAVE_CONFIG_H
  22. #include <config.h>
  23. #endif
  24. #include <wolfssl/wolfcrypt/settings.h>
  25. #include <wolfssl/wolfcrypt/wc_port.h>
  26. #include <wolfcrypt/test/test.h>
  27. #include <stdio.h>
  28. #include "hw.h"
  29. typedef struct func_args {
  30. int argc;
  31. char** argv;
  32. int return_code;
  33. } func_args;
  34. static func_args args = { 0 } ;
  35. void main(void)
  36. {
  37. int test_num = 0;
  38. wolfCrypt_Init(); /* required for ksdk_port_init */
  39. do
  40. {
  41. /* Used for testing, must have a delay so no data is missed while serial is initializing */
  42. #ifdef WOLFSSL_FRDM_K64_JENKINS
  43. /* run twice */
  44. if(test_num == 2){
  45. printf("\n&&&&&&&&&&&&& done &&&&&&&&&&&&&&&");
  46. delay_us(1000000);
  47. break;
  48. }
  49. delay_us(1000000); /* 1 second */
  50. #endif
  51. printf("\nCrypt Test %d:\n", test_num);
  52. wolfcrypt_test(&args);
  53. printf("Crypt Test %d: Return code %d\n", test_num, args.return_code);
  54. test_num++;
  55. } while(args.return_code == 0);
  56. /* Print this again for redundancy */
  57. #ifdef WOLFSSL_FRDM_K64_JENKINS
  58. printf("\n&&&&&&&&&&&&&& done &&&&&&&&&&&&&\n");
  59. delay_us(1000000);
  60. #endif
  61. wolfCrypt_Cleanup();
  62. }
  63. /* SAMPLE OUTPUT:
  64. Crypt Test 0:
  65. SHA test passed!
  66. SHA-256 test passed!
  67. SHA-384 test passed!
  68. SHA-512 test passed!
  69. HMAC-SHA test passed!
  70. HMAC-SHA256 test passed!
  71. HMAC-SHA384 test passed!
  72. HMAC-SHA512 test passed!
  73. GMAC test passed!
  74. Chacha test passed!
  75. POLY1305 test passed!
  76. ChaCha20-Poly1305 AEAD test passed!
  77. AES test passed!
  78. AES-GCM test passed!
  79. AES-CCM test passed!
  80. RANDOM test passed!
  81. RSA test passed!
  82. ECC test passed!
  83. CURVE25519 test passed!
  84. ED25519 test passed!
  85. Crypt Test 0: Return code 0
  86. */