static ret_code_t cc310_backend_uninit(void) { #if defined(NRF_CRYPTO_RNG_AUTO_INIT_ENABLED) && (NRF_CRYPTO_RNG_AUTO_INIT_ENABLED == 1) uint32_t ret_val; ret_val = nrf_crypto_rng_init(NULL, NULL); VERIFY_SUCCESS(ret_val); #elif defined(NRF_CRYPTO_RNG_AUTO_INIT_ENABLED) && (NRF_CRYPTO_RNG_AUTO_INIT_ENABLED == 0) // Do nothing #else #warning NRF_CRYPTO_RNG_AUTO_INIT_ENABLED define not found in sdk_config.h (Is the sdk_config.h valid?). #endif // NRF_CRYPTO_RNG_AUTO_INIT_ENABLED // Initialize the CC310 HW to do shutdown. NRF_CRYPTOCELL->ENABLE = 1; SaSi_LibFini(); // Shut down CC310 after shutdown. NRF_CRYPTOCELL->ENABLE = 0; return NRF_SUCCESS; }
int main(void) { int ret = 0; /*Perform memory mapping*/ ret = integration_tests_setup(); if (ret != 0) { INTEG_TEST_PRINT("integration_tests_setup failed\n"); return ret; } /*Init SaSi library*/ ret = SaSi_LibInit(rndContext_ptr, rndWorkBuff_ptr); if (ret != SA_SILIB_RET_OK) { INTEG_TEST_PRINT("Failed SaSi_SiLibInit - ret = 0x%x\n", ret); goto exit_1; } /*Call ecc test*/ ret = rnd_tests(); if (ret != SA_SILIB_RET_OK) { INTEG_TEST_PRINT("Failure in rnd_test,ret = 0x%x\n", ret); goto exit_0; } INTEG_TEST_PRINT("All tests passed \n"); exit_0: /*Finish SaSi library*/ SaSi_LibFini(rndContext_ptr); exit_1: /*Unmap memory*/ integration_tests_clear(); return ret; }
void crypto_platform_terminate( crypto_platform_ctx *ctx ) { SaSi_LibFini( &ctx->rndState ); NRF_CRYPTOCELL->ENABLE = 0; }