starcore_test.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. /* starcore_test.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 <prototype.h>
  22. #include <wolfssl/wolfcrypt/settings.h>
  23. #ifndef WOLFSSL_USER_SETTINGS
  24. #error "USER SETTINGS not set"
  25. #endif
  26. #include <wolfcrypt/test/test.h>
  27. #include <wolfssl/wolfcrypt/wc_port.h>
  28. #include <wolfssl/wolfcrypt/error-crypt.h>
  29. #include <wolfssl/wolfcrypt/random.h>
  30. #include <wolfcrypt/benchmark/benchmark.h>
  31. #ifdef HAVE_FIPS
  32. #include <wolfssl/wolfcrypt/fips_test.h>
  33. /* #include <wolfacvp/wolfacvp.h> */
  34. #if 1
  35. #include <op_test.h>
  36. #endif
  37. #endif
  38. typedef struct test_func_args {
  39. int argc;
  40. char** argv;
  41. int return_code;
  42. } test_func_args;
  43. #ifdef HAVE_FIPS
  44. static void appFipsCb(int ok, int err, const char* hash)
  45. {
  46. printf("in appFipsCb Fips callback, ok = %d, err = %d\n", ok, err);
  47. fflush(stdout);
  48. printf("message = %s\n", wc_GetErrorString(err));
  49. fflush(stdout);
  50. printf("hash = %s\n", hash);
  51. fflush(stdout);
  52. if (err == IN_CORE_FIPS_E) {
  53. printf("In core integrity hash check failure, copy above hash\n");
  54. fflush(stdout);
  55. printf("into verifyCore[] in fips_test.c and rebuild\n");
  56. fflush(stdout);
  57. }
  58. fflush(stdout);
  59. }
  60. #endif
  61. int my_rng_generate_seed(unsigned char* output, int sz)
  62. {
  63. unsigned int i;
  64. long t;
  65. time(&t); /* init */
  66. srand(t); /* init */
  67. for (i = 0; i < sz; i++) {
  68. output[i] = (unsigned char) rand();
  69. }
  70. return 0;
  71. }
  72. #define SAMPLE_SIZE 32
  73. int simpleRngTest(void)
  74. {
  75. WC_RNG rng;
  76. int ret;
  77. char block[SAMPLE_SIZE] = {0};
  78. ret = wc_InitRng(&rng);
  79. if (ret != 0) {
  80. printf("Failed to init RNG with return %d\n", ret);
  81. fflush(stdout);
  82. return ret;
  83. }
  84. ret = wc_RNG_GenerateBlock(&rng, (byte*) block, SAMPLE_SIZE);
  85. /* This should trigger FIPS callback if the hash needs updated */
  86. printf("ret from wc_RNG_GenerateBlock was %d\n", ret);
  87. fflush(stdout);
  88. return ret;
  89. }
  90. #define FILE_PATH_LEN 160
  91. /* The directory used to hold the vector files, update accordingly */
  92. #define FIXED_PATH "../../../../fips/wolfACVP/wolfSSL-14699641-PRODUCTION/"
  93. void reset_path(char* fName) {
  94. memset(fName, 0, FILE_PATH_LEN);
  95. strncpy(fName, FIXED_PATH, strlen(FIXED_PATH));
  96. }
  97. #if 0
  98. /* Disable when not processing vector files */
  99. int process_a_file(char* fName)
  100. {
  101. int ret = 0;
  102. test_func_args args = {0};
  103. char* argIn[3] = {0};
  104. argIn[0] = "wolfacvp_client";
  105. argIn[1] = "-i";
  106. argIn[2] = fName;
  107. #if 0
  108. argIn[3] = "-K"; /* Remove this when processing vectors from the lab,
  109. * we don't know the answers to those */
  110. args.argc = 4; /* change to 3 when processing vectors from the lab */
  111. #else
  112. args.argc = 3;
  113. #endif
  114. args.argv = argIn;
  115. printf("Case: START\n");
  116. ret = wolfacvp_harness(args.argc, args.argv);
  117. if (ret != 0) {
  118. printf("Result of wolfCrypt harness is %d\n", ret); fflush(stdout);
  119. } else {
  120. printf("Case: END\n");
  121. }
  122. return ret;
  123. }
  124. #endif
  125. void check_ret(int ret)
  126. {
  127. if(ret != 0) {
  128. exit(-1);
  129. }
  130. }
  131. int testharness_main()
  132. {
  133. int ret = -1;
  134. int* CpuidAddr=(int*) 0xFFF28028;
  135. printf("The CPU ID is stored at 0xFFF28028 and it's value is %04x\n", *CpuidAddr);
  136. #ifdef HAVE_FIPS
  137. wolfCrypt_SetCb_fips(appFipsCb);
  138. /* fipsEntry(); */ /* Prior to Vortec Scheduler was called here, call is
  139. * now at the vortec Scheduler level during Core Init
  140. */
  141. #endif
  142. ret = simpleRngTest();
  143. if (ret == 0) {
  144. /* uncomment to see performance */
  145. #if 0 /* Benchmark */
  146. printf("Kicking off the benchmark\n"); fflush(stdout);
  147. ret = benchmark_test(NULL);
  148. printf("Result of wolfCrypt benchmark is %d\n", ret); fflush(stdout);
  149. #endif
  150. #if 0 /* File-based Harness */
  151. #ifdef HAVE_FIPS
  152. char* testFN = "grep-for-this-file.txt";
  153. char* testStr = "This is my test string, hello from STARCORE!\n";
  154. char path[FILE_PATH_LEN] = {0};
  155. FILE* fstream = fopen(testFN, "wb");
  156. strncpy(path, FIXED_PATH, strlen(FIXED_PATH));
  157. #if 0 /* Crypto Tests */
  158. printf("Running testwolfcrypt on starcore\n"); fflush(stdout);
  159. wolfcrypt_test(NULL);
  160. #endif
  161. if (fstream == NULL) {
  162. printf("Failed to open testFN\n");
  163. } else {
  164. ret = fwrite(testStr, 1, strlen(testStr), fstream);
  165. printf("Wrote %d bytes to fstream\n", ret);
  166. fclose(fstream);
  167. }
  168. #if 0 /* PRODUCTION VECTORS */
  169. //process_a_file(strcat(path, "acvp-v1-testSessions-19392-vectorSets-215826.json")); reset_path(path); /* AES-ECB */
  170. //process_a_file(strcat(path, "acvp-v1-testSessions-19392-vectorSets-215827.json")); reset_path(path); /* AES-CBC */
  171. //process_a_file(strcat(path, "acvp-v1-testSessions-19392-vectorSets-215828.json")); reset_path(path); /* AES-CTR */
  172. //process_a_file(strcat(path, "acvp-v1-testSessions-19397-vectorSets-215833.json")); reset_path(path); /* ECDSA keyGen */
  173. //process_a_file(strcat(path, "acvp-v1-testSessions-19397-vectorSets-215834.json")); reset_path(path); /* ECDSA keyVer */
  174. //process_a_file(strcat(path, "acvp-v1-testSessions-19397-vectorSets-215835.json")); reset_path(path); /* ECDSA sigGen */
  175. //process_a_file(strcat(path, "acvp-v1-testSessions-19397-vectorSets-215836.json")); reset_path(path); /* ECDSA sigVer */
  176. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215845.json")); reset_path(path); /* HMAC-SHA1 */
  177. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215846.json")); reset_path(path); /* HMAC-SHA2-224 */
  178. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215847.json")); reset_path(path); /* HMAC-SHA2-256 */
  179. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215848.json")); reset_path(path); /* HMAC-SHA2-384 */
  180. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215849.json")); reset_path(path); /* HMAC-SHA2-512 */
  181. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215850.json")); reset_path(path); /* HMAC-SHA3-224 */
  182. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215851.json")); reset_path(path); /* HMAC-SHA3-256 */
  183. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215852.json")); reset_path(path); /* HMAC-SHA3-384 */
  184. //process_a_file(strcat(path, "acvp-v1-testSessions-19400-vectorSets-215853.json")); reset_path(path); /* HMAC-SHA3-512 */
  185. process_a_file(strcat(path, "acvp-v1-testSessions-19404-vectorSets-215857.json")); reset_path(path); /* RSA keyGen */
  186. //process_a_file(strcat(path, "acvp-v1-testSessions-19404-vectorSets-215858.json")); reset_path(path); /* RSA sigGen */
  187. //process_a_file(strcat(path, "acvp-v1-testSessions-19404-vectorSets-215859.json")); reset_path(path); /* RSA sigVer */
  188. //process_a_file(strcat(path, "acvp-v1-testSessions-19404-vectorSets-215860.json")); reset_path(path); /* RSA decPrim */
  189. //process_a_file(strcat(path, "acvp-v1_testSessions_19395_vectorSets_215831.json")); reset_path(path); /* hashDRBG */
  190. //process_a_file(strcat(path, "acvp-v1_testSessions_19396_vectorSets_215832.json")); reset_path(path); /* DSA */
  191. //process_a_file(strcat(path, "acvp-v1_testSessions_19401_vectorSets_215854.json")); reset_path(path); /* KAS-ECC */
  192. //process_a_file(strcat(path, "acvp-v1_testSessions_19402_vectorSets_215855.json")); reset_path(path); /* KAS-ECC-SSC */
  193. //process_a_file(strcat(path, "acvp-v1_testSessions_19403_vectorSets_215856.json")); reset_path(path); /* KAS-FFC-SSC */
  194. //process_a_file(strcat(path, "acvp-v1_testSessions_19407_vectorSets_215870.json")); reset_path(path); /* TDES */
  195. //process_a_file(strcat(path, "acvp-v1_testSessions_19394_vectorSets_215830.json")); reset_path(path); /* CMAC_AES */
  196. //process_a_file(strcat(path, "acvp-v1_testSessions_19393_vectorSets_215829.json")); reset_path(path); /* AES-CCM */
  197. //process_a_file(strcat(path, "acvp-v1-testSessions-19398-vectorSets-215837.json")); reset_path(path); /* AES-GCM */
  198. //process_a_file(strcat(path, "acvp-v1-testSessions-19398-vectorSets-215838.json")); reset_path(path); /* AES-GCM */
  199. //process_a_file(strcat(path, "acvp-v1-testSessions-19398-vectorSets-215839.json")); reset_path(path); /* AES-GCM */
  200. //process_a_file(strcat(path, "acvp-v1-testSessions-19398-vectorSets-215840.json")); reset_path(path); /* AES-GCM */
  201. //process_a_file(strcat(path, "acvp-v1-testSessions-19399-vectorSets-215841.json")); reset_path(path); /* AES-GMAC */
  202. //process_a_file(strcat(path, "acvp-v1-testSessions-19399-vectorSets-215842.json")); reset_path(path); /* AES-GMAC */
  203. //process_a_file(strcat(path, "acvp-v1-testSessions-19399-vectorSets-215843.json")); reset_path(path); /* AES-GMAC */
  204. //process_a_file(strcat(path, "acvp-v1-testSessions-19399-vectorSets-215844.json")); reset_path(path); /* AES-GMAC */
  205. //process_a_file(strcat(path, "acvp-v1-testSessions-19405-vectorSets-215861.json")); reset_path(path); /* SHA-1 */
  206. //process_a_file(strcat(path, "acvp-v1-testSessions-19406-vectorSets-215866.json")); reset_path(path); /* SHA3-224 */
  207. //process_a_file(strcat(path, "acvp-v1-testSessions-19406-vectorSets-215867.json")); reset_path(path); /* SHA3-256 */
  208. //process_a_file(strcat(path, "acvp-v1-testSessions-19406-vectorSets-215868.json")); reset_path(path); /* SHA3-384 */
  209. //process_a_file(strcat(path, "acvp-v1-testSessions-19406-vectorSets-215869.json")); reset_path(path); /* SHA3-512 */
  210. //process_a_file(strcat(path, "acvp-v1-testSessions-19405-vectorSets-215862.json")); reset_path(path); /* SHA2-224*/
  211. //process_a_file(strcat(path, "acvp-v1-testSessions-19405-vectorSets-215863.json")); reset_path(path); /* SHA2-256 */
  212. //process_a_file(strcat(path, "acvp-v1-testSessions-19405-vectorSets-215864.json")); reset_path(path); /* SHA2-384 */
  213. //process_a_file(strcat(path, "acvp-v1-testSessions-19405-vectorSets-215865.json")); reset_path(path); /* SHA2-512 */
  214. #endif
  215. #if 0 /* DEMO VECTORS */
  216. //process_a_file(strcat(path, "acvp-v1-testSessions-365458-vectorSets-1479140.json")); reset_path(path);
  217. //process_a_file(strcat(path, "acvp-v1-testSessions-365458-vectorSets-1479141.json")); reset_path(path);
  218. //process_a_file(strcat(path, "acvp-v1-testSessions-365458-vectorSets-1479142.json")); reset_path(path);
  219. //process_a_file(strcat(path, "acvp-v1-testSessions-365465-vectorSets-1479149.json")); reset_path(path);
  220. //process_a_file(strcat(path, "acvp-v1-testSessions-365465-vectorSets-1479150.json")); reset_path(path);
  221. //process_a_file(strcat(path, "acvp-v1-testSessions-365465-vectorSets-1479151.json")); reset_path(path);
  222. //process_a_file(strcat(path, "acvp-v1-testSessions-365465-vectorSets-1479152.json")); reset_path(path);
  223. //process_a_file(strcat(path, "acvp-v1-testSessions-365467-vectorSets-1479154.json")); reset_path(path);
  224. //process_a_file(strcat(path, "acvp-v1-testSessions-365467-vectorSets-1479155.json")); reset_path(path);
  225. //process_a_file(strcat(path, "acvp-v1-testSessions-365467-vectorSets-1479156.json")); reset_path(path);
  226. //process_a_file(strcat(path, "acvp-v1-testSessions-365467-vectorSets-1479157.json")); reset_path(path);
  227. //process_a_file(strcat(path, "acvp-v1-testSessions-365469-vectorSets-1479161.json")); reset_path(path);
  228. //process_a_file(strcat(path, "acvp-v1-testSessions-365469-vectorSets-1479162.json")); reset_path(path);
  229. //process_a_file(strcat(path, "acvp-v1-testSessions-365469-vectorSets-1479163.json")); reset_path(path);
  230. //process_a_file(strcat(path, "acvp-v1-testSessions-365469-vectorSets-1479164.json")); reset_path(path);
  231. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479170.json")); reset_path(path);
  232. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479171.json")); reset_path(path);
  233. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479172.json")); reset_path(path);
  234. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479173.json")); reset_path(path);
  235. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479174.json")); reset_path(path);
  236. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479175.json")); reset_path(path);
  237. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479176.json")); reset_path(path);
  238. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479177.json")); reset_path(path);
  239. //process_a_file(strcat(path, "acvp-v1-testSessions-365473-vectorSets-1479178.json")); reset_path(path);
  240. //process_a_file(strcat(path, "acvp-v1-testSessions-365485-vectorSets-1479194.json")); reset_path(path);
  241. //process_a_file(strcat(path, "acvp-v1-testSessions-365485-vectorSets-1479195.json")); reset_path(path);
  242. //process_a_file(strcat(path, "acvp-v1-testSessions-365485-vectorSets-1479196.json")); reset_path(path);
  243. //process_a_file(strcat(path, "acvp-v1-testSessions-365485-vectorSets-1479197.json")); reset_path(path);
  244. //process_a_file(strcat(path, "acvp-v1-testSessions-365488-vectorSets-1479202.json")); reset_path(path);
  245. //process_a_file(strcat(path, "acvp-v1-testSessions-365488-vectorSets-1479203.json")); reset_path(path);
  246. //process_a_file(strcat(path, "acvp-v1-testSessions-365488-vectorSets-1479204.json")); reset_path(path);
  247. //process_a_file(strcat(path, "acvp-v1-testSessions-365488-vectorSets-1479205.json")); reset_path(path);
  248. //process_a_file(strcat(path, "acvp-v1-testSessions-365488-vectorSets-1479206.json")); reset_path(path);
  249. //process_a_file(strcat(path, "acvp-v1-testSessions-365490-vectorSets-1479211.json")); reset_path(path);
  250. //process_a_file(strcat(path, "acvp-v1-testSessions-365490-vectorSets-1479212.json")); reset_path(path);
  251. //process_a_file(strcat(path, "acvp-v1-testSessions-365490-vectorSets-1479213.json")); reset_path(path);
  252. //process_a_file(strcat(path, "acvp-v1-testSessions-365490-vectorSets-1479214.json")); reset_path(path);
  253. //process_a_file(strcat(path, "acvp-v1_testSessions_365459_vectorSets_1479143.json")); reset_path(path);
  254. //process_a_file(strcat(path, "acvp-v1_testSessions_365461_vectorSets_1479145.json")); reset_path(path);
  255. //process_a_file(strcat(path, "acvp-v1_testSessions_365462_vectorSets_1479146.json")); reset_path(path);
  256. //process_a_file(strcat(path, "acvp-v1_testSessions_365463_vectorSets_1479147.json")); reset_path(path);
  257. //process_a_file(strcat(path, "acvp-v1_testSessions_365481_vectorSets_1479190.json")); reset_path(path);
  258. //process_a_file(strcat(path, "acvp-v1_testSessions_365483_vectorSets_1479192.json")); reset_path(path);
  259. //process_a_file(strcat(path, "acvp-v1_testSessions_365484_vectorSets_1479193.json")); reset_path(path);
  260. //process_a_file(strcat(path, "acvp-v1_testSessions_365491_vectorSets_1479215.json")); reset_path(path);
  261. #endif
  262. #if 0 /* VECTORS that passed previously (sanity check before asking FIPS lab
  263. to send vectors) */
  264. /* ------------------------------------------------------------------- */
  265. process_a_file(strcat(path, "hashDRBG_47251.json"));// Success
  266. process_a_file(strcat(path, "AES_CBC_47242.json")); // Failed to allocate buffer large enough for file, fixed by chopping into smaller sections
  267. process_a_file(strcat(path, "AES_CCM_47247.json")); // Failed, increase stack/heap
  268. process_a_file(strcat(path, "AES_CCM_47247-part1.json")); // Failed to write out the entire response (got 104 of 370 tgId's in the response)
  269. process_a_file(strcat(path, "AES_CCM_47247-part2.json")); // Failed ot write out the entire response (started at 371 and got to 429 of 741 tgId's in the response) looks like alloc failures, increase HEAP
  270. process_a_file(strcat(path, "DSA_keyGen_47253.json")); // Success
  271. process_a_file(strcat(path, "RSA_DecPrim_47306.json")); // Success
  272. process_a_file(strcat(path, "ECDSA_sigVer_47258.json")); // Success
  273. process_a_file(strcat(path, "AES_CMAC_47249.json")); // Success
  274. process_a_file(strcat(path, "AES_CTR_47243.json")); // Success
  275. process_a_file(strcat(path, "AES_ECB_47241.json")); // Success
  276. process_a_file(strcat(path, "AES_GCM_external_8_2_1_47263.json")); // Success
  277. process_a_file(strcat(path, "AES_GCM_external_8_2_2_47265.json")); // Success
  278. process_a_file(strcat(path, "AES_GCM_internal_8_2_1_47267.json")); // Success
  279. process_a_file(strcat(path, "AES_GCM_internal_8_2_2_47269.json")); // Success
  280. process_a_file(strcat(path, "AES_GMAC_external_8_2_1_47271.json")); // Failed to alloc response (passed but couldn't output), use smaller chunks
  281. process_a_file(strcat(path, "AES_CMAC_47249.json")); // Success
  282. process_a_file(strcat(path, "AES_CTR_47243.json")); // Success
  283. process_a_file(strcat(path, "AES_CBC_47242.json")); // Success
  284. process_a_file(strcat(path, "AES_CCM_47247.json")); // Success
  285. process_a_file(strcat(path, "AES_CMAC_47249.json")); // Success
  286. process_a_file(strcat(path, "AES_CTR_47243.json")); // Success
  287. process_a_file(strcat(path, "AES_ECB_47241.json")); // Success
  288. process_a_file(strcat(path, "AES_GCM_external_8_2_1_47263.json")); // Success
  289. process_a_file(strcat(path, "AES_GCM_external_8_2_2_47265.json")); // Success
  290. process_a_file(strcat(path, "AES_GCM_internal_8_2_1_47267.json")); // Success
  291. process_a_file(strcat(path, "AES_GCM_internal_8_2_2_47269.json")); // Success
  292. process_a_file(strcat(path, "AES_GMAC_external_8_2_1_47271.json")); // Success
  293. process_a_file(strcat(path, "AES_GMAC_external_8_2_2_47273.json")); // Success
  294. process_a_file(strcat(path, "AES_GMAC_internal_8_2_1_47275.json")); // Success
  295. process_a_file(strcat(path, "AES_GMAC_internal_8_2_2_47277.json")); // Success
  296. process_a_file(strcat(path, "ECDSA_keyGen_47255.json")); // Success
  297. process_a_file(strcat(path, "ECDSA_keyVer_47256.json")); // Success
  298. process_a_file(strcat(path, "ECDSA_sigGen_47257.json")); // Success
  299. process_a_file(strcat(path, "HMAC_SHA1_47279.json")); // Success
  300. process_a_file(strcat(path, "HMAC_SHA2_224_47280.json")); // Success
  301. process_a_file(strcat(path, "HMAC_SHA2_256_47281.json")); // Success
  302. process_a_file(strcat(path, "HMAC_SHA2_384_47282.json")); // Success
  303. process_a_file(strcat(path, "HMAC_SHA2_512_47283.json")); // Success
  304. process_a_file(strcat(path, "HMAC_SHA3_224_47284.json")); // Success
  305. process_a_file(strcat(path, "HMAC_SHA3_256_47285.json")); // Success
  306. process_a_file(strcat(path, "HMAC_SHA3_384_47286.json")); // Success
  307. process_a_file(strcat(path, "HMAC_SHA3_512_47287.json")); // Success
  308. process_a_file(strcat(path, "KAS_ECC_47299.json")); // Success
  309. process_a_file(strcat(path, "KAS_ECC_CDH_Component_47297.json")); // Success
  310. process_a_file(strcat(path, "KAS_ECC_SSC_652956.json")); // Success
  311. process_a_file(strcat(path, "KAS_FFC_47301.json")); // Success
  312. process_a_file(strcat(path, "KAS_FFC_SSC_652957.json")); // Success
  313. process_a_file(strcat(path, "RSA_keyGen_47303.json")); // Success
  314. process_a_file(strcat(path, "RSA_sigGen_47304.json")); // Success
  315. process_a_file(strcat(path, "RSA_sigVer_47305.json")); // Success
  316. process_a_file(strcat(path, "SHA1_47311.json")); // Success
  317. process_a_file(strcat(path, "SHA2_224_47312.json")); // Success
  318. process_a_file(strcat(path, "SHA2_256_47313.json")); // Success
  319. process_a_file(strcat(path, "SHA2_384_47314.json")); // Success
  320. process_a_file(strcat(path, "SHA2_512_47315.json")); // Success
  321. process_a_file(strcat(path, "SHA3_224_47321.json")); // Success
  322. process_a_file(strcat(path, "SHA3_256_47322.json")); // Success
  323. process_a_file(strcat(path, "SHA3_384_47323.json")); // Success
  324. process_a_file(strcat(path, "SHA3_512_47324.json")); // Success
  325. #endif
  326. #endif /* HAVE_FIPS */
  327. #endif /* Harness if */
  328. #if 1 /* optest */
  329. #ifdef HAVE_FIPS
  330. #define VALUES_LEN 15
  331. int i;
  332. printf("Kicking off the operational test app\n"); fflush(stdout);
  333. {
  334. int values[VALUES_LEN] = { 0, -203, -204, -205, -206, -207, -208, -209, -210, -242, -256, -257,
  335. -258, -259, 0 };
  336. for (i = 0; i < VALUES_LEN; i++) {
  337. ret = op_test(values[i], 0);
  338. printf("ret from running case %d = %d\n", values[i], ret); fflush(stdout);
  339. }
  340. }
  341. #endif /* HAVE_FIPS */
  342. #endif /* optest if */
  343. } else {
  344. printf("Skipping test until hash is updated\n"); fflush(stdout);
  345. }
  346. wolfCrypt_Cleanup();
  347. return 0;
  348. }