This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Where is QSPI Encryption function and registers ((ENC.KEY, ENC.NONCE. ENC.ENABLE, and etc)) in nrf5340

Dear, 

Based on the material (https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf5340%2Fqspi.html), Encryption should be enabled independently for XIP and EasyDMA, with separate keys and nonce like as shown in Figure 3. Steam Cipher. 

However, I couldn't find any related function or registers (like ENC.KEY, ENC.NONCE, ENC.ENABLE in Figure 3.) for this Encryption feature.

Where are they?    How can I use the Encryption feature indepentaly?

Also, in the hal/nordic/nrfx/hal/nrf_qspi.h, I could find only XIP and EasyDMA functions only as shown blow:

#if NRF_QSPI_HAS_XIP_ENC
NRF_STATIC_INLINE void nrf_qspi_xip_encryption_configure(NRF_QSPI_Type * p_reg,
nrf_qspi_encryption_t const * p_cfg)
{
p_reg->XIP_ENC.KEY0 = p_cfg->key[0];
p_reg->XIP_ENC.KEY1 = p_cfg->key[1];
p_reg->XIP_ENC.KEY2 = p_cfg->key[2];
p_reg->XIP_ENC.KEY3 = p_cfg->key[3];
p_reg->XIP_ENC.NONCE0 = p_cfg->nonce[0];
p_reg->XIP_ENC.NONCE1 = p_cfg->nonce[1];
p_reg->XIP_ENC.NONCE2 = p_cfg->nonce[2];
}

NRF_STATIC_INLINE void nrf_qspi_xip_encryption_set(NRF_QSPI_Type * p_reg, bool enable)
{
p_reg->XIP_ENC.ENABLE =
(enable ? QSPI_XIP_ENC_ENABLE_ENABLE_Enabled << QSPI_XIP_ENC_ENABLE_ENABLE_Pos
: QSPI_XIP_ENC_ENABLE_ENABLE_Disabled << QSPI_XIP_ENC_ENABLE_ENABLE_Pos);
}
#endif

#if NRF_QSPI_HAS_DMA_ENC
NRF_STATIC_INLINE void nrf_qspi_dma_encryption_configure(NRF_QSPI_Type * p_reg,
nrf_qspi_encryption_t const * p_cfg)
{
p_reg->DMA_ENC.KEY0 = p_cfg->key[0];
p_reg->DMA_ENC.KEY1 = p_cfg->key[1];
p_reg->DMA_ENC.KEY2 = p_cfg->key[2];
p_reg->DMA_ENC.KEY3 = p_cfg->key[3];
p_reg->DMA_ENC.NONCE0 = p_cfg->nonce[0];
p_reg->DMA_ENC.NONCE1 = p_cfg->nonce[1];
p_reg->DMA_ENC.NONCE2 = p_cfg->nonce[2];
}

NRF_STATIC_INLINE void nrf_qspi_dma_encryption_set(NRF_QSPI_Type * p_reg, bool enable)
{
p_reg->DMA_ENC.ENABLE =
(enable ? QSPI_DMA_ENC_ENABLE_ENABLE_Enabled << QSPI_DMA_ENC_ENABLE_ENABLE_Pos
: QSPI_DMA_ENC_ENABLE_ENABLE_Disabled << QSPI_DMA_ENC_ENABLE_ENABLE_Pos);
}
#endif

Regards,

Jae

Parents
  • Updated:  I guess there is the specific Encryption module but it should be a general idea to explain XIP_ENC and DMA_ENC.  I was confused with them. 

    BTW, if so, how to secure the AES key to setup ENC.KEY without put the key into the source code?   For security purpose, can we use KMU instead?  If you put the AES key into source code, can everyone easily hack the source code?

Reply
  • Updated:  I guess there is the specific Encryption module but it should be a general idea to explain XIP_ENC and DMA_ENC.  I was confused with them. 

    BTW, if so, how to secure the AES key to setup ENC.KEY without put the key into the source code?   For security purpose, can we use KMU instead?  If you put the AES key into source code, can everyone easily hack the source code?

Children
No Data
Related