File tree Expand file tree Collapse file tree 5 files changed +10
-16
lines changed
test_apps/crypto/main/mpi Expand file tree Collapse file tree 5 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,10 @@ void esp_crypto_mpi_enable_periph_clk(bool enable)
8080 MPI_RCC_ATOMIC () {
8181 mpi_ll_enable_bus_clock (enable );
8282 if (enable ) {
83+ mpi_ll_power_up ();
8384 mpi_ll_reset_register ();
85+ } else {
86+ mpi_ll_power_down ();
8487 }
8588 }
8689}
Original file line number Diff line number Diff line change @@ -253,12 +253,14 @@ static void ds_acquire_enable(void)
253253 // We also enable SHA and HMAC here. SHA is used by HMAC, HMAC is used by DS.
254254 esp_crypto_hmac_enable_periph_clk (true);
255255 esp_crypto_sha_enable_periph_clk (true);
256+ esp_crypto_mpi_enable_periph_clk (true);
256257 esp_crypto_ds_enable_periph_clk (true);
257258}
258259
259260static void ds_disable_release (void )
260261{
261262 esp_crypto_ds_enable_periph_clk (false);
263+ esp_crypto_mpi_enable_periph_clk (false);
262264 esp_crypto_sha_enable_periph_clk (false);
263265 esp_crypto_hmac_enable_periph_clk (false);
264266
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ size_t mpi_hal_calc_hardware_words(size_t words)
1515
1616void mpi_hal_enable_hardware_hw_op (void )
1717{
18- mpi_ll_power_up ();
1918 while (mpi_ll_check_memory_init_complete ()) {
2019 }
2120 // Note: from enabling RSA clock to here takes about 1.3us
@@ -27,7 +26,7 @@ void mpi_hal_enable_hardware_hw_op(void)
2726
2827void mpi_hal_disable_hardware_hw_op (void )
2928{
30- mpi_ll_power_down ();
29+
3130}
3231
3332void mpi_hal_interrupt_enable (bool enable )
Original file line number Diff line number Diff line change 11/*
2- * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
2+ * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33 *
44 * SPDX-License-Identifier: Unlicense OR CC0-1.0
55 */
1919#include "hal/mpi_hal.h"
2020#include "hal/mpi_ll.h"
2121#include "mpi_params.h"
22+ #include "esp_crypto_periph_clk.h"
2223
2324#define _DEBUG_ 0
2425
2526static void esp_mpi_enable_hardware_hw_op ( void )
2627{
27- /* Enable RSA hardware */
28- MPI_RCC_ATOMIC () {
29- mpi_ll_enable_bus_clock (true);
30- mpi_ll_reset_register ();
31- }
32-
28+ esp_crypto_mpi_enable_periph_clk (true);
3329 mpi_hal_enable_hardware_hw_op ();
3430}
3531
3632
3733static void esp_mpi_disable_hardware_hw_op ( void )
3834{
3935 mpi_hal_disable_hardware_hw_op ();
40-
41- /* Disable RSA hardware */
42- MPI_RCC_ATOMIC () {
43- mpi_ll_enable_bus_clock (false);
44- }
36+ esp_crypto_mpi_enable_periph_clk (false);
4537}
4638
4739
Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ void esp_mpi_enable_hardware_hw_op( void )
2424
2525void esp_mpi_disable_hardware_hw_op ( void )
2626{
27- mpi_hal_disable_hardware_hw_op ();
28-
2927 /* Disable RSA hardware */
3028 esp_crypto_mpi_enable_periph_clk (false);
3129
You can’t perform that action at this time.
0 commit comments