1 /*
2  * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 typedef enum {
14     ESP_CRYPTO_DPA_SEC_LEVEL_OFF = 0,      /*!< DPA protection disabled */
15     ESP_CRYPTO_DPA_SEC_LEVEL_LOW,          /*!< DPA protection level low */
16     ESP_CRYPTO_DPA_SEC_LEVEL_MIDDLE,       /*!< DPA protection level medium */
17     ESP_CRYPTO_DPA_SEC_LEVEL_HIGH,         /*!< DPA protection level high */
18 } esp_crypto_dpa_sec_level_t;
19 
20 /**
21  * @brief Enable DPA (Differential Power Analysis) related protection
22  *
23  * @note
24  * Enabling the DPA protection can help to make it difficult to perform SCA
25  * attacks on the crypto peripherals. However, based on the security level
26  * set there will be a performance impact, higher the level higher the impact.
27  * Please refer to the TRM for more details.
28  *
29  * @param level DPA Security Level of type `esp_crypto_dpa_sec_level_t`
30  */
31 void esp_crypto_dpa_protection_enable(esp_crypto_dpa_sec_level_t level);
32 
33 /**
34  * @brief Disable DPA (Differential Power Analysis) related protection
35  */
36 void esp_crypto_dpa_protection_disable(void);
37 
38 #ifdef __cplusplus
39 }
40 #endif
41