From fbadcf67dac8952961771a4dc4bb4617d903a404 Mon Sep 17 00:00:00 2001 From: John Bland Date: Tue, 11 Apr 2023 13:58:50 -0400 Subject: [PATCH] add the STM32 peripheral clock enable and disable calls to the benchmark program so the benchmark program can use hardware accleration --- wolfcrypt/benchmark/benchmark.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index eb571949a..46122ab0f 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -2941,6 +2941,11 @@ int benchmark_init(void) benchmark_static_init(0); +#ifdef WOLFSSL_STM32_CUBEMX + /* enable the peripheral clock */ + __HAL_RCC_CRYP_CLK_ENABLE(); +#endif + #ifdef WOLFSSL_STATIC_MEMORY ret = wc_LoadStaticMemory(&HEAP_HINT, gBenchMemory, sizeof(gBenchMemory), WOLFMEM_GENERAL, 1); @@ -3049,6 +3054,11 @@ int benchmark_free(void) printf("%serror %d with wolfCrypt_Cleanup\n", err_prefix, ret); } +#ifdef WOLFSSL_STM32_CUBEMX + /* disable the peripheral clock */ + __HAL_RCC_CRYP_CLK_DISABLE(); +#endif + return ret; }