test_main.c 2.3 KB

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