HSE AES182 encryption not working correctly

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HSE AES182 encryption not working correctly

ソリューションへジャンプ
528件の閲覧回数
Rmpr
Contributor II

Hello, I'm trying to encrypt an array of 16 of a plain text:

uint8 Data_au8[AES128_ECB_PLAIN_TEXT_SIZE] = {
    0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
};

 

With the array initialized like this, this works fine since it gives the the following encrypted array:

Rmpr_0-1746450034995.png

 

But, this is not what I want my code to do, I want to change the values of the array in my main function, but If I do this:

uint8 Status_u8 = 0x01u;

uint8 Data_au8[AES128_ECB_PLAIN_TEXT_SIZE] = {
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
};

int main()
{
    Data_au8[0] = Status_u8;
    Data_au8[1] = Status_u8;

    /* Encryption */
}

 

It doesn't encrypt properly:

Rmpr_1-1746450566196.png

 

What could be causing this?

Thank you in advance!

タグ(4)
0 件の賞賛
返信
1 解決策
507件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Rmpr 

This sounds like data cache issue. All the data objects used for communication with HSE must be forced to non-cacheable memory. The data cache is usually configured to copy-back mode and HSE can't see the data cache on core(s), so this may cause coherency issues. HSE always accesses physical addresses only.

For quick test, you can try to disable the data cache completely. Either in your project settings or in your debugger:

lukaszadrapa_0-1746517563666.png

lukaszadrapa_1-1746517680478.png 

Regards,

Lukas

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
508件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Rmpr 

This sounds like data cache issue. All the data objects used for communication with HSE must be forced to non-cacheable memory. The data cache is usually configured to copy-back mode and HSE can't see the data cache on core(s), so this may cause coherency issues. HSE always accesses physical addresses only.

For quick test, you can try to disable the data cache completely. Either in your project settings or in your debugger:

lukaszadrapa_0-1746517563666.png

lukaszadrapa_1-1746517680478.png 

Regards,

Lukas

 

 

0 件の賞賛
返信
499件の閲覧回数
Rmpr
Contributor II
That solved the problem.
Thank you!
0 件の賞賛
返信