Skip to content

Commit ca48718

Browse files
committed
Documentation cleanups. Renamed zynqmp CSU PKA to HW_SHA3. Disabled CSU PUF code, since it is only supported with eFuses (it cannot be used adhoc).
1 parent 5ab9970 commit ca48718

File tree

5 files changed

+18
-60
lines changed

5 files changed

+18
-60
lines changed

arch.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ ifeq ($(ARCH),AARCH64)
7676
CFLAGS+=-DWOLFBOOT_UBOOT_LEGACY
7777
CFLAGS+=-DWOLFBOOT_DUALBOOT
7878

79-
ifeq ($(PKA),1)
79+
ifeq ($(HW_SHA3),1)
8080
# Use HAL for hash (see zynqmp.c)
81-
PKA_HASH_HAL=1
81+
HASH_HAL=1
8282
CFLAGS+=-DWOLFBOOT_ZYNQMP_CSU
8383
endif
8484
else

config/examples/zynqmp.config

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ HASH?=SHA3
99
IMAGE_HEADER_SIZE?=1024
1010

1111
# 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
12+
# 1. ARMv8+Crypto Assembly: HW_SHA3=0 and NO_ARM_ASM=0 (default)
13+
# 2. CSU SHA3 hardware acceleration HW_SHA3=1 and NO_ARM_ASM=1
14+
# 3. C Only HW_SHA3=0 and NO_ARM_ASM=1
1515
NO_ARM_ASM?=0
16-
PKA?=0
16+
HW_SHA3?=0
1717

1818
# XMSS/XMSS^MT is a post-quantum, stateful, hash-based signature scheme.
1919
# Use the helper script `tools/xmss/xmss_siglen.sh`
@@ -49,6 +49,7 @@ V?=0
4949
SPMATH?=1
5050
RAM_CODE?=0
5151
DUALBANK_SWAP?=0
52+
PKA?=0
5253
WOLFTPM?=0
5354
EXT_FLASH?=1
5455
SPI_FLASH?=0

docs/Targets.md

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This README describes configuration of supported targets.
1919
* [NXP LPC54xxx](#nxp-lpc54xxx)
2020
* [NXP LS1028A](#nxp-ls1028a)
2121
* [NXP MCXA153](#nxp-mcxa153)
22-
* [NXP MCXW716C](#nxp-mcxw716c)
22+
* [NXP MCXW716](#nxp-mcxw716)
2323
* [NXP P1021 PPC](#nxp-qoriq-p1021-ppc)
2424
* [NXP T1024 PPC](#nxp-qoriq-t1024-ppc)
2525
* [NXP T2080 PPC](#nxp-qoriq-t2080-ppc)
@@ -1296,7 +1296,7 @@ My board version is: 0xA020D3
12961296
Trying partition 0 at 0x140000
12971297
Boot partition: 0x140000 (size 14901760, version 0x1)
12981298
....
1299-
````
1299+
```
13001300
Note: Now, integrity-check takes 2 - 3 minutes to complete before running Linux kernel.
13011301

13021302
o Kernel panic after wolfboot message
@@ -1399,38 +1399,6 @@ qemu-system-aarch64 -machine xlnx-zcu102 -cpu cortex-a53 -serial stdio -display
13991399
14001400
```
14011401

1402-
### Testing with qemu-system-aarch64
1403-
1404-
* Build wolfboot using the example configuration (RSA4096, SHA3)
1405-
1406-
```
1407-
cp config/examples/raspi3.config .config
1408-
make clean
1409-
make wolfboot.bin CROSS_COMPILE=aarch64-linux-gnu-
1410-
```
1411-
1412-
* Sign Linux kernel image
1413-
```
1414-
make keytools
1415-
./tools/keytools/sign --rsa4096 --sha3 Image wolfboot_signing_private_key.der 1
1416-
```
1417-
1418-
* Compose the image
1419-
1420-
```
1421-
tools/bin-assemble/bin-assemble wolfboot_linux_raspi.bin 0x0 wolfboot.bin \
1422-
0xc0000 Image_v1_signed.bin
1423-
dd if=bcm2710-rpi-3-b.dtb of=wolfboot_linux_raspi.bin bs=1 seek=128K conv=notrunc
1424-
```
1425-
1426-
* Test boot using qemu
1427-
1428-
```
1429-
qemu-system-aarch64 -M raspi3b -m 1024 -serial stdio -kernel wolfboot_linux_raspi.bin -cpu cortex-a53
1430-
```
1431-
1432-
1433-
14341402
#### Signing Zynq
14351403

14361404
`tools/keytools/sign --rsa4096 --sha3 /srv/linux-rpi4/vmlinux.bin wolfboot_signing_private_key.der 1`

hal/zynq.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ void wc_Sha3_384_Free(wc_Sha3* sha)
338338
(void)sha;
339339
}
340340
#else
341-
# error PKA=1 only supported with HASH=SHA3
341+
# error HW_SHA3=1 only supported with HASH=SHA3
342342
#endif
343343

344344
/* CSU PUF */
@@ -573,33 +573,17 @@ int csu_aes_key_zero(void)
573573
return ret;
574574
}
575575

576-
#ifdef CSU_PUF_ROT
577-
#define KEY_WRAP_SZ 32
578-
/* Red (sensitive key), Black (protected key), Grey (unknown) */
579-
/* Example key to encrypt */
580-
static const uint8_t XALIGNED(32) redKey[KEY_WRAP_SZ] = {
581-
0x64, 0xF0, 0x3A, 0xFD, 0x7D, 0x0C, 0x70, 0xD2,
582-
0x59, 0x1C, 0xDF, 0x34, 0x30, 0x5F, 0x7B, 0x8A,
583-
0x5B, 0xA4, 0x59, 0x3C, 0x0A, 0x0E, 0x1B, 0x8C,
584-
0x5E, 0xCD, 0xFF, 0x9F, 0x59, 0x00, 0x19, 0x2C
585-
};
586-
/* Example IV to use for wrapping */
587-
static const uint8_t XALIGNED(32) blackIv[AES_GCM_TAG_SZ] = {
588-
0xD1, 0x42, 0xAC, 0x7C, 0x56, 0x0F, 0x15, 0x8B,
589-
0xA9, 0x5A, 0x21, 0x31
590-
};
591-
static uint8_t XALIGNED(32) blackKey[KEY_WRAP_SZ+AES_GCM_TAG_SZ];
592-
#endif
593-
594576
int csu_init(void)
595577
{
596578
int ret = 0;
597579
#ifdef CSU_PUF_ROT
580+
#if 0
598581
uint32_t syndrome[CSU_PUF_SYNDROME_WORDS];
599582
uint32_t chash=0, aux=0;
600583
#if defined(DEBUG_CSU) && DEBUG_CSU >= 1
601584
uint32_t idx;
602585
#endif
586+
#endif
603587
#endif
604588
uint32_t reg1 = pmu_mmio_read(CSU_IDCODE);
605589
uint32_t reg2 = pmu_mmio_read(CSU_VERSION);
@@ -637,6 +621,10 @@ int csu_init(void)
637621
pmu_efuse_read(ZYNQMP_EFUSE_PUF_AUX, &reg2, sizeof(reg2));
638622
wolfBoot_printf("eFuse PUF CHASH 0x%08x, AUX 0x%08x\n", reg1, reg2);
639623

624+
/* CSU PUF only supported with eFuses */
625+
/* Keeping code for reference in future generations like Versal */
626+
/* Red (sensitive key), Black (protected key), Grey (unknown) */
627+
#if 0
640628
memset(syndrome, 0, sizeof(syndrome));
641629
ms = hal_timer_ms();
642630
ret = csu_puf_register(syndrome, &chash, &aux);
@@ -676,6 +664,7 @@ int csu_init(void)
676664
}
677665
wolfBoot_printf("\n");
678666
#endif
667+
#endif
679668
}
680669
#endif
681670

options.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ ifeq ($(WOLFBOOT_NO_PARTITIONS),1)
748748
endif
749749

750750
ifeq ($(HASH),SHA3)
751-
ifeq ($(PKA_HASH_HAL),)
751+
ifeq ($(HASH_HAL),)
752752
WOLFCRYPT_OBJS+=./lib/wolfssl/wolfcrypt/src/sha3.o
753753
endif
754754
CFLAGS+=-D"WOLFBOOT_HASH_SHA3_384"

0 commit comments

Comments
 (0)