Skip to content

Commit 7cf327f

Browse files
committed
Added Xilinx UltraScale+ MPSoC CSU Support CSU support.
Enabled support for offloading SHA3 hashing to CSU hardware using PKA=1. Added support for enabling JTAG at runtime if CSU_DEBUG is set. Requires patching PMUFW to enable register access. See: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2587197506/Zynq+UltraScale+MPSoC+JTAG+Enable+in+U-Boot
1 parent 519e3b7 commit 7cf327f

File tree

7 files changed

+540
-49
lines changed

7 files changed

+540
-49
lines changed

IDE/XilinxSDK/README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,7 @@ Note: If not using Position Independent Code (PIC) the linker script `ldscript.l
7878

7979
## Zynq UltraScale+ ARMv8 Crypto Extensions
8080

81-
To enable ARM assembly speedups for SHA:
82-
83-
1) Add these build symbols:
84-
85-
```
86-
WOLFSSL_ARMASM
87-
WOLFSSL_ARMASM_INLINE
88-
```
89-
90-
2) Add these compiler misc flags: `-mcpu=generic+crypto -mstrict-align -DWOLFSSL_AARCH64_NO_SQRMLSH`
81+
By default the ARM assembly speedups for SHA will be enabled. This uses inline assembly in wolfcrypt/src/port/arm/ and the armb8 crypto extensions. To disable set `NO_ARM_ASM=1`.
9182

9283

9384
## Generate signing key
@@ -154,7 +145,7 @@ the_ROM_image:
154145
}
155146
```
156147

157-
You can also use exception level 3 or 1 depending on your needs.
148+
You can use exception level 3, 2 or 1 depending on your needs. See hal/zynq.h options EL3_SECURE, EL2_HYPERVISOR and EL1_NONSECURE for enabled/disabling entry support for each. Default is support for EL2.
158149

159150
From the workspace root:
160151

@@ -208,13 +199,12 @@ Hello World
208199
Successfully ran Hello World application
209200
```
210201

211-
212202
### Adding RSA Authentication
213203

214204
1. Generate keys:
215-
* `bootgen.exe -generate_keys auth pem -arch zynqmp -image boot.bif`
205+
* `bootgen.exe -generate_keys auth pem -arch zynqmp -image boot_auth.bif`
216206
2. Create hash for primary key:
217-
* `bootgen.exe -image boot.bif -arch zynqmp -w -o i BOOT.BIN -efuseppkbits ppkf_hash.txt`
207+
* `bootgen.exe -image boot_auth.bif -arch zynqmp -w -o i BOOT.BIN -efuseppkbits ppkf_hash.txt`
218208
3. Import example project for programming eFuses:
219209
* New BSP project (program efuses , ZCU102_hw_platform, standalone, CPU: PSU_cortexa53_0)
220210
* Goto Xilinx Board Support Packet Settings.
@@ -235,11 +225,23 @@ Successfully ran Hello World application
235225
```
236226
237227
6. Build “boot.bin” image:
238-
* `bootgen -image boot.bif -arch zynqmp -o i BOOT.BIN -w`
228+
* `bootgen -image boot_auth.bif -arch zynqmp -o i BOOT.BIN -w`
229+
230+
Note: During testing add `[fsbl_config] bh_auth_enable` to allow skipping of the eFuse check of the PPK hash. In production the RSA_EN eFuses must be blown to force checking of the PPK hash.
239231
240232
Note: To generate a report of a boot.bin use the `bootgen_utility` or after 2022.1 use `bootgen -read`:
241233
`bootgen -arch zynqmp -read BOOT.BIN`
242234
235+
236+
# CSU Support
237+
238+
Enabling PMU firmware support for access to the CSU.
239+
In PetaLinux menuconfig under PMU Configuration add compiler flag `-DSECURE_ACCESS_VAL=1`.
240+
```sh
241+
petalinux-build -c pmufw
242+
petalinux-build
243+
```
244+
243245
## Post Quantum
244246

245247
### PQ XMSS

arch.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ ifeq ($(ARCH),AARCH64)
7575
# Support detection and skip of U-Boot legacy header */
7676
CFLAGS+=-DWOLFBOOT_UBOOT_LEGACY
7777
CFLAGS+=-DWOLFBOOT_DUALBOOT
78+
79+
ifeq ($(PKA),1)
80+
# Use HAL for hash (see zynqmp.c)
81+
PKA_HASH_HAL=1
82+
CFLAGS+=-DWOLFBOOT_ZYNQMP_CSU
83+
endif
7884
else
7985
ifeq ($(TARGET),nxp_ls1028a)
8086
ARCH_FLAGS=-mcpu=cortex-a72+crypto -march=armv8-a+crypto -mtune=cortex-a72

config/examples/zynqmp.config

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ SIGN?=RSA4096
88
HASH?=SHA3
99
IMAGE_HEADER_SIZE?=1024
1010

11+
# Hashing Option
12+
# 1. ARMv8+Crypto Assembly: PKA=0 and NO_ARM_ASM=0 (default)
13+
# 2. CSU SHA3 hardware acceleration PKA=1 and NO_ARM_ASM=1
14+
# 3. C Only PKA=0 and NO_ARM_ASM=1
15+
NO_ARM_ASM?=0
16+
PKA?=0
17+
1118
# XMSS/XMSS^MT is a post-quantum, stateful, hash-based signature scheme.
1219
# Use the helper script `tools/xmss/xmss_siglen.sh`
1320
# to calculate your signature length given an xmss parameter string.
@@ -36,14 +43,12 @@ CFLAGS_EXTRA+=-DDEBUG_ZYNQ=1
3643
VTOR?=1
3744
CORTEX_M0?=0
3845
NO_ASM?=0
39-
NO_ARM_ASM?=0
4046
ALLOW_DOWNGRADE?=0
4147
NVM_FLASH_WRITEONCE?=0
4248
V?=0
4349
SPMATH?=1
4450
RAM_CODE?=0
4551
DUALBANK_SWAP?=0
46-
PKA?=1
4752
WOLFTPM?=0
4853
EXT_FLASH?=1
4954
SPI_FLASH?=0

0 commit comments

Comments
 (0)