mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
feat(hal/aes): Enable pseudo rounds function during AES operations
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "soc/hwcrypto_reg.h"
|
||||
#include "soc/aes_reg.h"
|
||||
#include "soc/pcr_struct.h"
|
||||
#include "hal/aes_types.h"
|
||||
|
||||
@@ -241,6 +241,28 @@ static inline void aes_ll_interrupt_clear(void)
|
||||
REG_WRITE(AES_INT_CLEAR_REG, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable the pseudo-round function during AES operations
|
||||
*
|
||||
* @param enable true to enable, false to disable
|
||||
* @param base basic number of pseudo rounds, zero if disable
|
||||
* @param increment increment number of pseudo rounds, zero if disable
|
||||
* @param key_rng_cnt update frequency of the pseudo-key, zero if disable
|
||||
*/
|
||||
static inline void aes_ll_enable_pseudo_rounds(bool enable, uint8_t base, uint8_t increment, uint8_t key_rng_cnt)
|
||||
{
|
||||
REG_SET_FIELD(AES_PSEUDO_REG, AES_PSEUDO_EN, enable);
|
||||
|
||||
if (enable) {
|
||||
REG_SET_FIELD(AES_PSEUDO_REG, AES_PSEUDO_BASE, base);
|
||||
REG_SET_FIELD(AES_PSEUDO_REG, AES_PSEUDO_INC, increment);
|
||||
REG_SET_FIELD(AES_PSEUDO_REG, AES_PSEUDO_RNG_CNT, key_rng_cnt);
|
||||
} else {
|
||||
REG_SET_FIELD(AES_PSEUDO_REG, AES_PSEUDO_BASE, 0);
|
||||
REG_SET_FIELD(AES_PSEUDO_REG, AES_PSEUDO_INC, 0);
|
||||
REG_SET_FIELD(AES_PSEUDO_REG, AES_PSEUDO_RNG_CNT, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user