fix(hal): Clear reset on parent crpyto lock while resetting a crypto peripheral

pull/13651/head
harshal.patil 2024-04-04 14:28:17 +05:30
rodzic e0cb43b9ab
commit 5ba9b53667
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 5B5EC97C35B9A2E5
8 zmienionych plików z 25 dodań i 9 usunięć

Wyświetl plik

@ -48,7 +48,8 @@ static inline void aes_ll_reset_register(void)
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_aes = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_aes = 0;
// Clear reset on digital signature, otherwise AES is held in reset
// Clear reset on digital signature and parent crypto, otherwise AES is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ds = 0;
}
@ -308,11 +309,11 @@ static inline void aes_ll_gcm_set_j0(const uint8_t *j0)
}
/**
* @brief Sets the number of effective bits of incomplete blocks in plaintext/cipertext.
* @brief Sets the number of effective bits of incomplete blocks in plaintext/ciphertext.
*
* @note Only affects AES-GCM
*
* @param num_valid_bits the number of effective bits of incomplete blocks in plaintext/cipertext.
* @param num_valid_bits the number of effective bits of incomplete blocks in plaintext/ciphertext.
*/
static inline void aes_ll_gcm_set_num_valid_bit(size_t num_valid_bits)
{

Wyświetl plik

@ -46,6 +46,9 @@ static inline void ds_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ds = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ds = 0;
// Clear reset on parent crypto, otherwise DS is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
}
/// use a macro to wrap the function, force the caller to use it in a critical section

Wyświetl plik

@ -47,7 +47,8 @@ static inline void ecc_ll_reset_register(void)
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecc = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecc = 0;
// Clear reset on ECDSA, otherwise ECC is held in reset
// Clear reset on ECDSA and parent crypto, otherwise ECC is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecdsa = 0;
}

Wyświetl plik

@ -92,6 +92,9 @@ static inline void ecdsa_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecdsa = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecdsa = 0;
// Clear reset on parent crypto, otherwise ECDSA is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
}
/**

Wyświetl plik

@ -53,6 +53,9 @@ static inline void hmac_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_hmac = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_hmac = 0;
// Clear reset on parent crypto, otherwise HMAC is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
}
/// use a macro to wrap the function, force the caller to use it in a critical section

Wyświetl plik

@ -59,6 +59,9 @@ static inline void key_mgr_ll_reset_register(void)
{
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_km = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_km = 0;
// Clear reset on parent crypto, otherwise Key Manager is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
}
/// use a macro to wrap the function, force the caller to use it in a critical section
@ -183,7 +186,7 @@ static inline void key_mgr_ll_lock_use_sw_init_key_reg(void)
/**
* @brief Set the lock for the use_sw_init_key_reg
* After this lock has been set,
* The Key manager configuration about whether to use a paricular key from efuse or key manager cannot be changed.
* The Key manager configuration about whether to use a particular key from efuse or key manager cannot be changed.
*/
static inline void key_mgr_ll_lock_use_efuse_key_reg(esp_key_mgr_key_type_t key_type)
{
@ -198,14 +201,14 @@ static inline void key_mgr_ll_lock_use_efuse_key_reg(esp_key_mgr_key_type_t key_
}
}
/* @brief Configure the key purpose to be used by the Key Manager for key generator opearation */
/* @brief Configure the key purpose to be used by the Key Manager for key generator operation */
static inline void key_mgr_ll_set_key_purpose(const esp_key_mgr_key_purpose_t key_purpose)
{
REG_SET_FIELD(KEYMNG_CONF_REG, KEYMNG_KEY_PURPOSE, key_purpose);
}
/**
* @brief Configure the mode which is used by the Key Manager for the generator key deployement process
* @brief Configure the mode which is used by the Key Manager for the generator key deployment process
*/
static inline void key_mgr_ll_set_key_generator_mode(const esp_key_mgr_key_generator_mode_t mode)
{

Wyświetl plik

@ -40,7 +40,8 @@ static inline void mpi_ll_reset_register(void)
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_rsa = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_rsa = 0;
// Clear reset on digital signature and ECDSA, otherwise RSA is held in reset
// Clear reset on digital signature, ECDSA and parent crypto, otherwise RSA is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ds = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecdsa = 0;
}

Wyświetl plik

@ -36,7 +36,8 @@ static inline void sha_ll_reset_register(void)
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_sha = 1;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_sha = 0;
// Clear reset on digital signature, hmac and ecdsa, otherwise SHA is held in reset
// Clear reset on digital signature, hmac, ecdsa and parent crypto, otherwise SHA is held in reset
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_crypto = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ds = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_hmac = 0;
HP_SYS_CLKRST.hp_rst_en2.reg_rst_en_ecdsa = 0;