# AES hardware engine for Xilinx Zynq platform
## Features:
- modes of operation:
| GCM | ECB | CBC | CTR | CFB | OFB | PCBC |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| :heavy_check_mark:<sup>**<sup> | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
- 128/256-bit keys
- IPSEC offloading OK
- driver compatible with linux-xlnx v5.4 branch
#### Notes on GCM support:
Currently, the hw engine is limited to receiving full 128-bit blocks for
processing. This works well for ECB/CBC/PCBC/CTR/CFB/OFB modes of operation
since they only deal with block-sized data, but GCM can process arbitrary-sized
AAD/CRYPTDATA.
The consequence is that we pad AAD/CRYPTDATA with zeros in the Linux kernel
driver before sending it for processing. This means splitting the scatterlist
provided by the crypto layer and creating a new one, which introduces
considerable overhead.
Therefore, there is a lot of room for improvement in this area (converting the
processing pipeline input to deal with arbitrary-sized data).
## TODO list
- [ ] add fallback cipher in linux driver to handle 192-bit keys
- [ ] convert the processing pipeline to deal with arbitrary-sized data
- [ ] add support for XTS mode
## Quick Start
Generate bitstream for your platform (must have vivado environment sourced).
In my case, the part code for ARTY Z7-20 board is xc7z020clg400-1:
```sh
make PART="xc7z020clg400-1" bitstream
```
Get the bitstream from:
```sh
$ ls -lah synthesis/zynq_aes/zynq_aes.runs/impl_1/*bit
-rw-rw-r-- 1 xxx xxx 2,0M sep 17 22:31 synthesis/zynq_aes/zynq_aes.runs/impl_1/zynq_aes_bd_wrapper.bit
```
Run regression tests (XSIM):
```sh
make test
```
## Petalinux Build
Note: vivado and petalinux environment scripts must be sourced prior to running these.
### Setup workdir
```sh
mkdir zynq-aes-petalinux
cd zynq-aes-petalinux
git clone https://github.com/ovpanait/zynq-aes.git zynq-aes-hw && cd zynq-aes-hw
```
### Generate bitstream and update petalinux layer
In my case, the part code for ARTY Z7-20 board is xc7z020clg400-1:
```sh
make PART="xc7z020clg400-1" bitstream # this can take some time
make yocto
```
### Create Petalinux image
```sh
export ZYNQAES_XSA="$(realpath synthesis/output/zynqaes_hw.xsa)"
export ZYNQAES_YOCTO_LAYER="$(realpath yocto/meta-zynqaes)"
cd ..
petalinux-create --type project --template zynq --name zynq-aes-build && cd zynq-aes-build
petalinux-config --get-hw-description "${ZYNQAES_XSA}"
echo "BBLAYERS += \"${ZYNQAES_YOCTO_LAYER}\" " >> build/conf/bblayers.conf
echo "IMAGE_INSTALL_append = \" zynqaes-mod\"" >> build/conf/local.conf
petalinux-build
```
### Sanity runtime test
After booting the generated image, run on target:
```sh
mkdir -p /sys/kernel/config/device-tree/overlays/zynqaes
cat /boot/devicetree/pl-zynqaes.dtbo > /sys/kernel/config/device-tree/overlays/zynqaes/dtbo
root@zynq-aes-build:~# modprobe tcrypt mode=500 sec=1
tcrypt:
testing speed of async ecb(aes) (zynqaes-ecb) encryption
tcrypt: test 0 (128 bit key, 16 byte blocks): 8397 operations in 1 seconds (134352 bytes)
tcrypt: test 1 (128 bit key, 64 byte blocks): 9120 operations in 1 seconds (583680 bytes)
tcrypt: test 2 (128 bit key, 256 byte blocks): 9046 operations in 1 seconds (2315776 bytes)
tcrypt: test 3 (128 bit key, 1024 byte blocks): 7142 operations in 1 seconds (7313408 bytes)
tcrypt: test 4 (128 bit key, 1472 byte blocks): 7132 operations in 1 seconds (10498304 bytes)
tcrypt: test 5 (128 bit key, 8192 byte blocks): 4220 operations in 1 seconds (34570240 bytes)
...
```
## Block design and AXI DMA config
![](https://github.com/ovpanait/zynq-aes/blob/master/bd/block_design.png)
![](https://github.com/ovpanait/zynq-aes/blob/master/bd/axi_dma.png)
没有合适的资源?快使用搜索试试~ 我知道了~
适用于XilinxZynq平台的AES硬件引擎_C_Verilog_下载.zip
共118个文件
v:16个
c:16个
txt:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 127 浏览量
2023-04-29
22:29:45
上传
评论
收藏 501KB ZIP 举报
温馨提示
适用于XilinxZynq平台的AES硬件引擎_C_Verilog_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
适用于XilinxZynq平台的AES硬件引擎_C_Verilog_下载.zip (118个子文件)
zynqaes-mod_0.1.1.bb 518B
device-tree.bbappend 145B
linux-xlnx_%.bbappend 137B
zynqaes_aead.c 16KB
zynqaes_aead.c 14KB
zynqaes_skcipher.c 13KB
zynqaes_skcipher.c 10KB
stress.c 8KB
gcm.c 8KB
af_alg.c 7KB
zynqaes.c 6KB
zynqaes.c 6KB
gcm.c 5KB
decipher.c 5KB
key_expansion.c 3KB
cipher.c 3KB
test.c 1KB
aes_utils.c 607B
test_utils.c 530B
ipsec.cfg 584B
usercrypto.cfg 356B
ftrace.cfg 289B
CHANGELOG 535B
layer.conf 409B
COPYING 18KB
COPYING 18KB
gcm_vectors.data 5KB
gcm_vectors128.data 5KB
pl-zynqaes.dts 465B
pl.dtsi 1KB
.gitignore 117B
.gitignore 17B
zynqaes.h 4KB
zynqaes.h 4KB
af_alg.h 1KB
aes.h 697B
test.h 187B
LICENSE 1KB
Makefile 2KB
Makefile 1KB
Makefile 551B
Makefile 551B
Makefile 392B
README.md 4KB
README.md 378B
block_design.png 115KB
axi_dma.png 45KB
async_fifo.sby 389B
aes_controller_input.sby 352B
fifo.sby 194B
axi_stream_master.sby 192B
axi_stream_slave.sby 188B
block_ram.sby 155B
usercrypto.scc 167B
ftrace.scc 119B
ipsec.scc 117B
xsim.sh 1KB
tb_main.sv 6KB
tb_main.sv 5KB
tb_main.sv 3KB
tb_main.sv 3KB
tb_main.sv 3KB
tb_main.sv 3KB
tb_main.sv 2KB
tb_main.sv 2KB
axi_stream_slave_tb.sv 2KB
axi_stream_master_tb.sv 2KB
tb_main.sv 1KB
tb_main.sv 1KB
zynq_aes_bd.tcl 42KB
zynq_aes_tb.tcl 4KB
create_ip.tcl 3KB
create_axi_stream_sim_proj.tcl 2KB
gen_bitstream.tcl 2KB
export_sim.tcl 1KB
xsim_init.tcl 452B
pcbc_ciphertext_128.txt 32KB
ctr_ciphertext_128.txt 32KB
ctr_plaintext_128.txt 32KB
cbc_ciphertext_128.txt 32KB
cbc_plaintext_256.txt 32KB
cbc_plaintext_128.txt 32KB
pcbc_plaintext_128.txt 32KB
ecb_plaintext_256.txt 32KB
ecb_plaintext_128.txt 32KB
cbc_ciphertext_256.txt 32KB
ecb_ciphertext_128.txt 32KB
ecb_ciphertext_256.txt 32KB
cfb_ciphertext_128.txt 8KB
ofb_ciphertext_128.txt 8KB
ofb_plaintext_128.txt 8KB
cfb_plaintext_128.txt 8KB
modes.v 26KB
aes_controller.v 21KB
async_fifo.v 11KB
decipher.v 8KB
cipher.v 6KB
fifo.v 5KB
gcm.v 5KB
aes_controller_input.v 5KB
共 118 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功