<acronym id="s8ci2"><small id="s8ci2"></small></acronym>
<rt id="s8ci2"></rt><rt id="s8ci2"><optgroup id="s8ci2"></optgroup></rt>
<acronym id="s8ci2"></acronym>
<acronym id="s8ci2"><center id="s8ci2"></center></acronym>
0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

AMD MPSoC R5 AES示例

jf_pJlTbmA9 ? 來源:jf_pJlTbmA9 ? 作者:jf_pJlTbmA9 ? 2023-07-10 16:56 ? 次閱讀

測試環境

測試單板
ZCU106

測試工具
Vitis 2021.2

R5 AES 測試流程

創建Platform
在Vitis的 “File - New ” 中,選擇“Platform Project”, 指定名稱如“zcu106_r5”, 再選擇對應的XSA文件和 Processor 如 “psu_cortexr5_0”。

使能AES庫

1. 打開hw_platform工程。

2. 雙擊“platform.spr”文件。

3. 雙擊“psu_cortexr5_0”的 “board support package”。

4. 點擊 “Modif BSP Settings”。

5. 在“Supported Libraries”中選擇xilsecure。

100570888-302272-01.png
100570888-302273-02.png

導入AES示例

1. 打開hw_platform工程。

2. 雙擊“platform.spr”文件。

3. 雙擊“psu_cortexr5_0”的 “board support package”。

4. 等待Libraries窗口顯示

5. 點擊xilsecure行右邊的import examples

6. 選擇"xilsecure_aes_example"

100570888-302274-03.png
100570888-302275-04.png

定制

導入example, 創建的工程里有文件xilsecure_aes_example.c。 打開文件,確認AES 密鑰和數據地址。

AES密鑰

AES密鑰如下:

/*
* The hard coded aes key for decryption, in case user given key is being used
* it will be loaded in KUP before decryption
*/
static const u8 CsuKey[] = {
0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18,
0xe8, 0x68, 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08,
0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10,
0xe0, 0x60, 0xa0, 0x20, 0xc0, 0x40, 0x80, 0x00
};

/*
* The hard coded iv used for decryption secure header and block 0
*/
u8 CsuIv[] = {
0xD2, 0x45, 0x0E, 0x07, 0xEA, 0x5D, 0xE0, 0x42, 0x6C, 0x0F, 0xA1, 0x33,
0x00, 0x00, 0x00, 0x00
};

內存地址

默認保存密文和明文的內存地址都是0x04000000,需要和代碼中的地址對應,可以根據自己需要更改。

static u32 ImageOffset = 0x04000000;
static u32 DestinationAddr = 0x04000000;

創建密文

AMD提供工具bootgen,加密數據,創建密文。

bootgen的配置文件user_data_example.bif如下:

the_ROM_image:
{
[keysrc_encryption]kup_key
[encryption=aes, aeskeyfile=user_data_kup_key_example.nky, load=0x04000000]data.bin
}

上面的data.bin是明文文件; user_data_kup_key_example.nky是AES的密鑰。如果不存在AES的密鑰, 工具bootgen會自動生成密鑰。 生成密鑰后,需要更新文件xilsecure_aes_example.c。

在“Xilinx Software Command Line Tool 2021.2”中執行命令,“ bootgen -arch zynqmp -p userdata -image user_data_example.bif -o data.bin.enc -w on -log error”,可以得到密文文件data.bin.enc。

xsct% bootgen -arch zynqmp -p userdata -image user_data_example.bif -o data.bin.enc -w on -log error
WARNING: [Common 17-259] Unknown Tcl command 'bootgen -arch zynqmp -p userdata -image user_data_example.bif -o data.bin.enc -w on -log error' sending command to the OS shell for execution. It is recommended to use 'exec' to send the command to the OS shell.

****** Xilinx Bootgen v2021.2
**** Build date : Oct 19 2021-03:13:27
** Copyright 1986-2021 Xilinx, Inc. All Rights Reserved.

[INFO] : Bootimage generated successfully

運行AES

以調試模式運行工程xilsecure_aes_example_1。當Vitis SDK停在main()入口時,在xsct界面里下載密文到0x4000000。下載完成后,再繼續運行xilsecure_aes_example_1。 運行完XSecure_AesDecrypt()后,暫停程序,顯示存儲器0x4000000的內容,可以看到它的內容和明文的16進制值一樣。

AES解碼成功。

xsct%

Info: Cortex-R5 #0 (target 6) Stopped at 0x0 (Suspended)

Downloading Program -- C:/prj/zcu102/v212/vitis_space_r5_csu2/xilsecure_aes_example_1/Debug/xilsecure_aes_example_1.elf
section, .vectors: 0x00000000 - 0x00000467
.................
section, .stack: 0x001044f0 - 0x00107cef
0% 0MB 0.0MB/s ??:?? ETA
100% 0MB 0.5MB/s 00:00
Setting PC to Program Start Address 0x000001d0
Successfully downloaded C:/prj/zcu102/v212/vitis_space_r5_csu2/xilsecure_aes_example_1/Debug/xilsecure_aes_example_1.elf
Info: Cortex-R5 #0 (target 6) Running
Info: Cortex-R5 #0 (target 6) Stopped at 0x1001b8 (Breakpoint)
main() at ../src/xilsecure_aes_example.c: 123
123: Status = SecureAesExample();

xsct% dow -data data.bin.enc 0x04000000
0% 0MB 0.0MB/s ??:?? ETA
100% 0MB 0.4MB/s 00:00

Successfully downloaded C:/prj/zcu102/v212/vitis_space_r5_csu2/xilsecure_aes_example_1/data.bin.enc
xsct% Info: Cortex-R5 #0 (target 6) Running
xsct% Info: Cortex-R5 #0 (target 6) Stopped at 0x100204 (Step)
SecureAesExample() at ../src/xilsecure_aes_example.c: 153
153: u8 *Dst = (u8 *)(UINTPTR)DestinationAddr;
xsct% Info: Cortex-R5 #0 (target 6) Running
xsct% Info: Cortex-R5 #0 (target 6) Stopped at 0x100214 (Step)
....................
xsct% Info: Cortex-R5 #0 (target 6) Stopped at 0x100370 (Breakpoint)
189: Status = XSecure_AesDecrypt(&Secure_Aes, Dst,
xsct% Info: Cortex-R5 #0 (target 6) Running
xsct% Info: Cortex-R5 #0 (target 6) Stopped at 0x10038c (Step)
194: if(Status != XST_SUCCESS)

xsct% mrd 0x04000000
4000000: 6D783F3C

xsct% mrd 0x04000000 20
4000000: 6D783F3C
4000004: 6576206C
4000008: 6F697372
400000C: 31223D6E
4000010: 2022302E
4000014: 6F636E65
4000018: 676E6964
400001C: 5455223D
4000020: 22382D46
4000024: 61747320
4000028: 6C61646E
400002C: 3D656E6F
4000030: 226F6E22
4000034: 0A0D3E3F
4000038: 69663F3C
400003C: 6556656C
4000040: 6F697372
4000044: 2E34206E
4000048: 3F302E30
400004C: 70633C3E
xsct%


審核編輯:湯梓紅

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。 舉報投訴
  • amd
    amd
    +關注

    關注

    25

    文章

    5251

    瀏覽量

    132812
  • AES
    AES
    +關注

    關注

    0

    文章

    97

    瀏覽量

    33090
  • MPSoC
    +關注

    關注

    0

    文章

    194

    瀏覽量

    24143
  • Vitis
    +關注

    關注

    0

    文章

    144

    瀏覽量

    7184
收藏 人收藏

    評論

    相關推薦

    matlab如何繪出矩形序列R5(n)的波形

    如何繪出矩形序列R5(n)的波形
    發表于 09-08 23:23

    為什么要接上拉電阻R5???

    接上拉電阻R5是因為芯片IO口開漏輸出要求嗎?還有沒有其他原因?
    發表于 10-31 21:07

    請問AD9742時鐘連接R4和R5的作用是?

    請教各位前輩,R4和R5的作用,以及添加DVDD的作用
    發表于 09-10 09:47

    請問使用ADA4927-1評估板R5、R6、R7、R8、R9、R10的值怎么選擇?

    請教大家一個問題,在使用ADA4927-1評估板時,R5、R6、R7、R8、R9、R10的值怎么
    發表于 10-09 18:03

    請問AD8333的R4 R5是否要連接?

    對于AD8333的I1PO和I2PO之間有一個用虛線連接的R4OPT 以及Q1PO和Q2PO之間有一個用虛線連接的R5OPT不知R4 R5是否要連接 如果要連接阻值是多少?(附有原理圖
    發表于 10-09 15:51

    MPSoC可擴展集成電源參考設計包括BOM及框圖

    ?-A53 應用處理器和雙核 ARM? Cortex?-R5 實時處理器的 ZU2CG(...)主要特色17 個可通過硬件配置的電源軌輕松更改硬件中的任何輸出電壓只需 1 個輸入電壓是適用于以下 Xilinx
    發表于 10-25 16:06

    英特爾DP55WB主板是否與Radeon R5 220顯卡兼容?

    我一直在努力安裝Radeon R5 220 2GB圖形接口卡,以支持HD VGA。這是一款帶有4G內存的W7,i5系統?,F有的Radeon VGA接口工作正常。 R5無法啟動。停止使用5
    發表于 12-04 10:52

    R2=R4, R5=R6, 使Vout 的范圍 是0-2.5V ,懇請問如何配置電阻

    R2=R4, R5=R6, 使Vout 的范圍 是0-2.5V ,問如何配置電阻
    發表于 04-19 17:48

    開關量輸入輸出R2和R5的取值相矛盾

    能形成回路,電容濾除尖脈沖;2.輸入電壓達到3.5V,但未達到穩壓管穩壓值時,R2與光耦形成回路,3.當輸入電壓逐漸升高時,高于穩壓管穩壓值,穩壓管發生作用,配合R5給光耦工作現在的問題是R2和
    發表于 05-17 06:36

    R5作用是什么

    R5作用是什么
    發表于 11-21 17:42

    AD9742 R4和R5的作用是什么?

    請教各位前輩,R4和R5的作用,以及添加DVDD的作用
    發表于 12-18 07:18

    AMD推出R9 3900和R5 3500X兩款處理器

    根據消息報道,AMD昨天正式發布了R9 3900和R5 3500X這兩款處理器,其中R5 3500X為中國獨占。
    的頭像 發表于 10-09 15:51 ?6004次閱讀

    AMD R5 5600X 最新跑分:單核性能超 i9-10900K

    AMD R5 5600X 是首批上市 Ryzen 5000 系列處理器中規格最低的一款,6 核 12 線程,299 美元?,F在,PassMark 網站更新了其 CPU 跑分排名,Ryzen
    的頭像 發表于 10-23 16:46 ?8489次閱讀
    <b class='flag-5'>AMD</b> <b class='flag-5'>R5</b> 5600X 最新跑分:單核性能超 i9-10900K

    AMD-Xilinx MPSoC的Watchdog在Linux中使用的簡明教程

    AMD-Xilinx MPSoC的器件里,提供了內置的Watchdog
    的頭像 發表于 07-07 14:15 ?684次閱讀

    Zynq UltraScale+ MPSoC的隔離設計示例

    電子發燒友網站提供《Zynq UltraScale+ MPSoC的隔離設計示例.pdf》資料免費下載
    發表于 09-13 11:28 ?2次下載
    Zynq UltraScale+ <b class='flag-5'>MPSoC</b>的隔離設計<b class='flag-5'>示例</b>
    亚洲欧美日韩精品久久_久久精品AⅤ无码中文_日本中文字幕有码在线播放_亚洲视频高清不卡在线观看
    <acronym id="s8ci2"><small id="s8ci2"></small></acronym>
    <rt id="s8ci2"></rt><rt id="s8ci2"><optgroup id="s8ci2"></optgroup></rt>
    <acronym id="s8ci2"></acronym>
    <acronym id="s8ci2"><center id="s8ci2"></center></acronym>