main.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. /**
  2. * Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #include "ssi_pal_types.h"
  41. #include "ssi_pal_mem.h"
  42. #include "sns_silib.h"
  43. #include "crys_ecpki_build.h"
  44. #include "crys_ecpki_ecdsa.h"
  45. #include "crys_ecpki_dh.h"
  46. #include "crys_ecpki_kg.h"
  47. #include "crys_ecpki_domain.h"
  48. #include "integration_test_plat_defs.h"
  49. #include "integration_test_ssi_defs.h"
  50. #include "integration_test_ssi_data.h"
  51. #ifdef DX_LINUX_PLATFORM /*for linux platform only !!*/
  52. #include <pthread.h>
  53. #endif
  54. /*ECC test data vectors*/
  55. extern eccSignDataStuct eccSignVectors[];
  56. extern eccDHDataStuct eccDHVectors[];
  57. /*RNG Global variables*/
  58. extern CRYS_RND_State_t* rndState_ptr;
  59. extern CRYS_RND_WorkBuff_t* rndWorkBuff_ptr;
  60. int ecc_DH_tests(void)
  61. {
  62. uint32_t ret = 0;
  63. int test_index;
  64. uint8_t pubKeyBuff1[ECC_KEY_MAX_LENGHT];
  65. uint8_t privKeyBuff1[ECC_KEY_MAX_LENGHT];
  66. uint8_t pubKeyBuff2[ECC_KEY_MAX_LENGHT];
  67. uint8_t privKeyBuff2[ECC_KEY_MAX_LENGHT];
  68. CRYS_ECPKI_UserPrivKey_t UserPrivKey1;
  69. CRYS_ECPKI_UserPublKey_t UserPublKey1;
  70. CRYS_ECPKI_UserPrivKey_t UserPrivKey2;
  71. CRYS_ECPKI_UserPublKey_t UserPublKey2;
  72. CRYS_ECPKI_BUILD_TempData_t TempBuff;
  73. CRYS_ECDH_TempData_t *TempDHBuffptr;
  74. CRYS_ECPKI_KG_TempData_t *TempECCKGBuffptr;
  75. CRYS_ECPKI_KG_FipsContext_t FipsBuff;
  76. uint8_t sharedSecret1ptr[SHARED_SECRET_MAX_LENGHT];
  77. uint8_t sharedSecret2ptr[SHARED_SECRET_MAX_LENGHT];
  78. const CRYS_ECPKI_Domain_t *pDomain;
  79. CRYS_ECDH_TempData_t TempDHBuff;
  80. CRYS_ECPKI_KG_TempData_t TempECCKGBuff;
  81. uint32_t sharedSecret1Size = SHARED_SECRET_MAX_LENGHT;
  82. uint32_t sharedSecret2Size = SHARED_SECRET_MAX_LENGHT;
  83. SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc = CRYS_RND_GenerateVector;
  84. /*Run all ECC tests*/
  85. for (test_index = 0; test_index < ECC_DH_TESTS_NUMBER; test_index++)
  86. {
  87. SaSi_PalMemSetZero(pubKeyBuff1,ECC_KEY_MAX_LENGHT);
  88. SaSi_PalMemSetZero(privKeyBuff1,ECC_KEY_MAX_LENGHT);
  89. SaSi_PalMemSetZero(pubKeyBuff2,ECC_KEY_MAX_LENGHT);
  90. SaSi_PalMemSetZero(privKeyBuff2,ECC_KEY_MAX_LENGHT);
  91. SaSi_PalMemSetZero(sharedSecret1ptr,SHARED_SECRET_MAX_LENGHT);
  92. SaSi_PalMemSetZero(sharedSecret2ptr,SHARED_SECRET_MAX_LENGHT);
  93. /*Copy public key1 data to pubKeyBuff buffer*/
  94. SaSi_PalMemCopy(pubKeyBuff1, eccDHVectors[test_index].eccDHTest_PubKey1, eccDHVectors[test_index].eccDHTest_PubKeySize1);
  95. /*Copy private key1 data to pubKeyBuff buffer*/
  96. SaSi_PalMemCopy(privKeyBuff1, eccDHVectors[test_index].eccDHTest_PrivKey1, eccDHVectors[test_index].eccDHTest_PrivKeySize1);
  97. /*Copy public key2 data to pubKeyBuff buffer*/
  98. SaSi_PalMemCopy(pubKeyBuff2, eccDHVectors[test_index].eccDHTest_PubKey2, eccDHVectors[test_index].eccDHTest_PubKeySize2);
  99. /*Copy private key2 data to pubKeyBuff buffer*/
  100. SaSi_PalMemCopy(privKeyBuff2, eccDHVectors[test_index].eccDHTest_PrivKey2, eccDHVectors[test_index].eccDHTest_PrivKeySize2);
  101. TempDHBuffptr = (CRYS_ECDH_TempData_t*)&TempDHBuff;
  102. TempECCKGBuffptr = (CRYS_ECPKI_KG_TempData_t*)&TempECCKGBuff;
  103. INTEG_TEST_PRINT("ECC DH Test number 0x%x Parameters : \n-----%s-----\n \n",test_index,(uint32_t)eccDHVectors[test_index].eccDHTest_name);
  104. pDomain = CRYS_ECPKI_GetEcDomain(eccDHVectors[test_index].eccDHTest_DomainID);
  105. if (test_index > 0){
  106. /*Generate first key pair*/
  107. ret = CRYS_ECPKI_GenKeyPair (rndState_ptr, rndGenerateVectFunc,
  108. pDomain,
  109. &UserPrivKey1,
  110. &UserPublKey1,
  111. TempECCKGBuffptr,&FipsBuff);
  112. if (ret != SA_SILIB_RET_OK){
  113. INTEG_TEST_PRINT(" CRYS_ECPKI_GenKeyPair for key pair 1 failed with 0x%x \n",ret);
  114. return ret;
  115. }
  116. /*Generate second key pair*/
  117. ret = CRYS_ECPKI_GenKeyPair (rndState_ptr, rndGenerateVectFunc,
  118. pDomain,
  119. &UserPrivKey2,
  120. &UserPublKey2,
  121. TempECCKGBuffptr,&FipsBuff);
  122. if (ret != SA_SILIB_RET_OK){
  123. INTEG_TEST_PRINT(" CRYS_ECPKI_GenKeyPair key pair 1 failed with 0x%x \n",ret);
  124. return ret;
  125. }
  126. } else {
  127. /*Call CRYS_ECPKI_BuildPrivKey to create private key1 from external key buffer*/
  128. ret = CRYS_ECPKI_BuildPrivKey(pDomain,
  129. privKeyBuff1,
  130. eccDHVectors[test_index].eccDHTest_PrivKeySize1,
  131. &UserPrivKey1);
  132. if (ret != SA_SILIB_RET_OK){
  133. INTEG_TEST_PRINT(" CRYS_ECPKI_BuildPrivKey for key 1 failed with 0x%x \n",ret);
  134. return ret;
  135. }
  136. /*Call CRYS_ECPKI_BuildPublKeyFullCheck to create public key1 from external key buffer*/
  137. ret = CRYS_ECPKI_BuildPublKeyFullCheck(pDomain,
  138. pubKeyBuff1,
  139. eccDHVectors[test_index].eccDHTest_PubKeySize1,
  140. &UserPublKey1,
  141. &TempBuff);
  142. if (ret != SA_SILIB_RET_OK){
  143. INTEG_TEST_PRINT(" CRYS_ECPKI_BuildPublKeyFullCheck for key 1 failed with 0x%x \n",ret);
  144. return ret;
  145. }
  146. /*Call CRYS_ECPKI_BuildPrivKey to create private key2 from external key buffer*/
  147. ret = CRYS_ECPKI_BuildPrivKey(pDomain,
  148. privKeyBuff2,
  149. eccDHVectors[test_index].eccDHTest_PrivKeySize2,
  150. &UserPrivKey2);
  151. if (ret != SA_SILIB_RET_OK){
  152. INTEG_TEST_PRINT(" CRYS_ECPKI_BuildPrivKey for key 2 failed with 0x%x \n",ret);
  153. return ret;
  154. }
  155. /*Call CRYS_ECPKI_BuildPublKeyFullCheck to create public key2 from external key buffer*/
  156. ret = CRYS_ECPKI_BuildPublKeyFullCheck(pDomain,
  157. pubKeyBuff2,
  158. eccDHVectors[test_index].eccDHTest_PubKeySize2,
  159. &UserPublKey2,
  160. &TempBuff);
  161. if (ret != SA_SILIB_RET_OK){
  162. INTEG_TEST_PRINT(" CRYS_ECPKI_BuildPublKeyFullCheck for key 2 failed with 0x%x \n",ret);
  163. return ret;
  164. }
  165. }
  166. /* Generating the Secret for user 1*/
  167. /*---------------------------------*/
  168. ret = CRYS_ECDH_SVDP_DH(&UserPublKey2,
  169. &UserPrivKey1,
  170. sharedSecret1ptr,
  171. &sharedSecret1Size,
  172. TempDHBuffptr);
  173. if (ret != SA_SILIB_RET_OK){
  174. INTEG_TEST_PRINT(" CRYS_ECDH_SVDP_DH for secret 1 failed with 0x%x \n",ret);
  175. return ret;
  176. }
  177. /* Generating the Secret for user 2*/
  178. /*---------------------------------*/
  179. ret = CRYS_ECDH_SVDP_DH(&UserPublKey1,
  180. &UserPrivKey2,
  181. sharedSecret2ptr,
  182. &sharedSecret2Size,
  183. TempDHBuffptr);
  184. if (ret != SA_SILIB_RET_OK){
  185. INTEG_TEST_PRINT(" CRYS_ECDH_SVDP_DH for secret 2 failed with 0x%x \n",ret);
  186. return ret;
  187. }
  188. /* Verifying we have the same Secret Key both for user1 & user2 */
  189. /*----------------------------------------------------------------*/
  190. ret = (CRYSError_t)SaSi_PalMemCmp(sharedSecret1ptr ,
  191. sharedSecret2ptr,
  192. sharedSecret2Size);
  193. if (ret != SA_SILIB_RET_OK){
  194. INTEG_TEST_PRINT(" SaSi_PalMemCmp of shared secrets failed");
  195. return ret;
  196. }
  197. INTEG_TEST_PRINT("Test 0x%x passed \n",test_index);
  198. }
  199. INTEG_TEST_PRINT("All DH tests passed \n=======================\n");
  200. return ret;
  201. }
  202. int ecc_sign_tests(void)
  203. {
  204. uint32_t ret = 0;
  205. int test_index;
  206. uint8_t dataInBuff[MAX_TEST_DATA_SIZE];
  207. CRYS_ECDH_TempData_t signOutBuff;
  208. uint8_t pubKeyBuff[MAX_TEST_DATA_SIZE];
  209. uint8_t privKeyBuff[MAX_TEST_DATA_SIZE];
  210. CRYS_ECPKI_UserPrivKey_t UserPrivKey;
  211. CRYS_ECPKI_UserPublKey_t UserPublKey;
  212. CRYS_ECPKI_BUILD_TempData_t TempBuff;
  213. CRYS_ECDSA_SignUserContext_t SignUserContext;
  214. CRYS_ECDSA_VerifyUserContext_t VerifyUserContext;
  215. CRYS_ECPKI_KG_TempData_t TempECCKGBuff;
  216. CRYS_ECPKI_KG_FipsContext_t FipsBuff;
  217. const CRYS_ECPKI_Domain_t *pDomain;
  218. SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc = CRYS_RND_GenerateVector;
  219. /*Run all ECC tests*/
  220. for (test_index = 0; test_index < ECC_SIGN_TESTS_NUMBER; test_index++)
  221. {
  222. SaSi_PalMemSetZero(dataInBuff,MAX_TEST_DATA_SIZE);
  223. SaSi_PalMemSetZero(pubKeyBuff,MAX_TEST_DATA_SIZE);
  224. SaSi_PalMemSetZero(privKeyBuff,MAX_TEST_DATA_SIZE);
  225. SaSi_PalMemSetZero(&signOutBuff,sizeof(CRYS_ECDH_TempData_t));
  226. SaSi_PalMemSetZero(&TempECCKGBuff,sizeof(TempECCKGBuff));
  227. /*Copy input text data to input buffer*/
  228. SaSi_PalMemCopy(dataInBuff, eccSignVectors[test_index].eccTest_InputData, eccSignVectors[test_index].eccTest_InputDataSize);
  229. /*Copy public key data to pubKeyBuff buffer*/
  230. SaSi_PalMemCopy(pubKeyBuff, eccSignVectors[test_index].eccTest_PubKey, eccSignVectors[test_index].eccTest_PubKeySize);
  231. /*Copy private key data to pubKeyBuff buffer*/
  232. SaSi_PalMemCopy(privKeyBuff, eccSignVectors[test_index].eccTest_PrivKey, eccSignVectors[test_index].eccTest_PrivKeySize);
  233. INTEG_TEST_PRINT("ECC Sign Test numer 0x%x Parameters : \n-----%s-----\n \n",test_index,(uint32_t)eccSignVectors[test_index].eccTest_name);
  234. pDomain = CRYS_ECPKI_GetEcDomain(eccDHVectors[test_index].eccDHTest_DomainID);
  235. if (test_index > 0){
  236. /*Generate first key pair*/
  237. ret = CRYS_ECPKI_GenKeyPair (rndState_ptr, rndGenerateVectFunc,
  238. pDomain,
  239. &UserPrivKey,
  240. &UserPublKey,
  241. &TempECCKGBuff,&FipsBuff);
  242. if (ret != SA_SILIB_RET_OK){
  243. INTEG_TEST_PRINT(" CRYS_ECPKI_GenKeyPair for key pair 1 failed with 0x%x \n",ret);
  244. return ret;
  245. }
  246. } else {
  247. /*Call CRYS_ECPKI_BuildPrivKey to create private key from external key buffer*/
  248. ret = CRYS_ECPKI_BuildPrivKey(pDomain,
  249. privKeyBuff,
  250. eccSignVectors[test_index].eccTest_PrivKeySize,
  251. &UserPrivKey);
  252. if (ret != SA_SILIB_RET_OK){
  253. INTEG_TEST_PRINT(" CRYS_ECPKI_BuildPrivKey failed with 0x%x \n",ret);
  254. return ret;
  255. }
  256. /*Call CRYS_ECPKI_BuildPublKeyFullCheck to create public key from external key buffer*/
  257. ret = CRYS_ECPKI_BuildPublKeyFullCheck(pDomain,
  258. pubKeyBuff,
  259. eccSignVectors[test_index].eccTest_PubKeySize,
  260. &UserPublKey,
  261. &TempBuff);
  262. if (ret != SA_SILIB_RET_OK){
  263. INTEG_TEST_PRINT(" CRYS_ECPKI_BuildPublKeyFullCheck failed with 0x%x \n",ret);
  264. return ret;
  265. }
  266. }
  267. /*Call CRYS_ECDSA_Sign to create signature from input buffer using created private key*/
  268. ret = CRYS_ECDSA_Sign (rndState_ptr, rndGenerateVectFunc,
  269. &SignUserContext,
  270. &UserPrivKey,
  271. eccSignVectors[test_index].eccTest_HashMode,
  272. dataInBuff,
  273. eccSignVectors[test_index].eccTest_InputDataSize,
  274. (uint8_t*)&signOutBuff,
  275. &eccSignVectors[test_index].eccTest_SignitureSize);
  276. if (ret != SA_SILIB_RET_OK){
  277. INTEG_TEST_PRINT(" CRYS_ECDSA_Sign failed with 0x%x \n",ret);
  278. return ret;
  279. }
  280. /*Call CRYS_ECDSA_Verify to verify the signature using created public key*/
  281. ret = CRYS_ECDSA_Verify (&VerifyUserContext,
  282. &UserPublKey,
  283. eccSignVectors[test_index].eccTest_HashMode,
  284. (uint8_t*)&signOutBuff,
  285. eccSignVectors[test_index].eccTest_SignitureSize,
  286. dataInBuff,
  287. eccSignVectors[test_index].eccTest_InputDataSize);
  288. if (ret != SA_SILIB_RET_OK){
  289. INTEG_TEST_PRINT(" CRYS_ECDSA_Verify failed with 0x%x \n",ret);
  290. return ret;
  291. }
  292. INTEG_TEST_PRINT(" Test 0x%x passed \n",test_index);
  293. }
  294. INTEG_TEST_PRINT(" All sign tests Passed \n=======================\n");
  295. return ret;
  296. }
  297. #ifdef DX_LINUX_PLATFORM /*for linux platform only -> we need to use contiguous memory for stack !!*/
  298. /*ecc_wrap_tests creates thread with defined stack address to and calls to ecc tests */
  299. void* ecc_thread(void)
  300. {
  301. uint32_t* threadReturnValue = SaSi_PalMemMalloc(sizeof(uint32_t));
  302. *threadReturnValue =ecc_sign_tests();
  303. if (*threadReturnValue != SA_SILIB_RET_OK) {
  304. INTEG_TEST_PRINT("Failure in ecc_sign_tests,ret = 0x%x\n", *threadReturnValue);
  305. goto exit;
  306. }
  307. /*Call chacha poly test*/
  308. *threadReturnValue = ecc_DH_tests();
  309. if (*threadReturnValue != SA_SILIB_RET_OK) {
  310. INTEG_TEST_PRINT("Failure in ecc_DH_tests,ret = 0x%x\n", *threadReturnValue);
  311. goto exit;
  312. }
  313. exit:
  314. pthread_exit(threadReturnValue);
  315. }
  316. int ecc_wrap_tests(void){
  317. uint32_t rc = 0;
  318. pthread_t threadId;
  319. pthread_attr_t threadAttr;
  320. int threadRc;
  321. void *threadRet;
  322. int num = 6;
  323. threadRc = pthread_attr_init(&threadAttr);
  324. if (threadRc != 0) {
  325. INTEG_TEST_PRINT("pthread_attr_init failed\n");
  326. return -1;
  327. }
  328. threadRc = pthread_attr_setstack(&threadAttr, g_test_stack_base_addr, PTHREAD_STACK_SIZE);
  329. if (threadRc != 0) {
  330. INTEG_TEST_PRINT("pthread_attr_setstack failed\n");
  331. return -1;
  332. }
  333. /* Create independent thread which run with */
  334. threadRc = pthread_create( &threadId, &threadAttr, (void *)ecc_thread, &num);
  335. if (threadRc != 0) {
  336. INTEG_TEST_PRINT( "pthread_create failed\n");
  337. return -1;
  338. }
  339. /* Wait till thread is complete before main continues */
  340. threadRc = pthread_join( threadId, &threadRet);
  341. if (threadRc != 0) {
  342. INTEG_TEST_PRINT( "pthread_join failed\n");
  343. return -1;
  344. }
  345. rc =*((uint32_t *)*&threadRet);
  346. SaSi_PalMemFree(threadRet);
  347. threadRc = pthread_attr_destroy(&threadAttr);
  348. if (threadRc != 0) {
  349. INTEG_TEST_PRINT("pthread_attr_destroy failed\n");
  350. }
  351. return rc;
  352. }
  353. #endif
  354. int main(void)
  355. {
  356. int ret = 0;
  357. /*Perform memory mapping*/
  358. ret = integration_tests_setup();
  359. if (ret != 0)
  360. {
  361. INTEG_TEST_PRINT("integration_tests_setup failed\n");
  362. return ret;
  363. }
  364. /*Init SaSi library*/
  365. ret = SaSi_LibInit();
  366. if (ret != SA_SILIB_RET_OK) {
  367. INTEG_TEST_PRINT("Failed SaSi_LibInit - ret = 0x%x\n", ret);
  368. goto exit_1;
  369. }
  370. ret = CRYS_RndInit(rndState_ptr, rndWorkBuff_ptr);
  371. if (ret != SA_SILIB_RET_OK) {
  372. INTEG_TEST_PRINT("Failed CRYS_RndInit - ret = 0x%x\n", ret);
  373. goto exit_1;
  374. }
  375. #ifdef DX_LINUX_PLATFORM
  376. ret = ecc_wrap_tests();
  377. if (ret != SA_SILIB_RET_OK) {
  378. INTEG_TEST_PRINT("Failure in ecc tests,ret = 0x%x\n", ret);
  379. goto exit_0;
  380. }
  381. #else
  382. /*Call ecc test*/
  383. ret = ecc_sign_tests();
  384. if (ret != SA_SILIB_RET_OK) {
  385. INTEG_TEST_PRINT("Failure in ecc_sign_tests,ret = 0x%x\n", ret);
  386. goto exit_0;
  387. }
  388. ret = ecc_DH_tests();
  389. if (ret != SA_SILIB_RET_OK) {
  390. INTEG_TEST_PRINT("Failure in ecc_DH_tests,ret = 0x%x\n", ret);
  391. goto exit_0;
  392. }
  393. #endif
  394. INTEG_TEST_PRINT("All tests passed \n");
  395. exit_0:
  396. /*Finish SaSi library*/
  397. SaSi_LibFini();
  398. ret = CRYS_RND_UnInstantiation(rndState_ptr);
  399. if (ret) {
  400. INTEG_TEST_PRINT("Failure in CRYS_RND_UnInstantiation,ret = 0x%x\n", ret);
  401. }
  402. exit_1:
  403. integration_tests_clear();
  404. return ret;
  405. }