Skip to content

Commit a56e225

Browse files
dgarskedanielinux
authored andcommitted
Revert the TPM based key store (root of trust). This feature is not ready for next release.
1 parent be037ca commit a56e225

13 files changed

Lines changed: 2 additions & 935 deletions

File tree

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ tools/keytools/x64
7070
tools/keytools/Debug
7171
tools/keytools/Release
7272

73-
# preseal binary
74-
tools/preseal/preseal
75-
tools/preseal/preseal.exe
76-
7773
# delta binaries
7874
tools/delta/bmdiff
7975
tools/delta/bmpatch

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ keytools:
166166
@$(MAKE) -C tools/keytools clean
167167
@$(MAKE) -C tools/keytools
168168

169-
preseal:
170-
@$(MAKE) -C tools/preseal
171-
172169
test-app/image_v1_signed.bin: $(BOOT_IMG)
173170
@echo "\t[SIGN] $(BOOT_IMG)"
174171
$(Q)(test $(SIGN) = NONE) || $(SIGN_TOOL) $(SIGN_OPTIONS) $(BOOT_IMG) $(PRIVATE_KEY) 1

config/examples/sim-tpm-keystore.config

Lines changed: 0 additions & 22 deletions
This file was deleted.

config/examples/stm32f4-tpm-keystore.config

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/PubkeySealing.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

docs/Targets.md

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -64,48 +64,6 @@ On other systems, the SWAP space can be as small as 512B, if multiple smaller fl
6464
6565
More information about the geometry of the flash and in-application programming (IAP) can be found in the manufacturer manual of each target device.
6666
67-
### Using the TPM to store the verification public key
68-
69-
If you want to keep your public key in the TPM, wolfBoot can unseal and use the key through wolfTPM by defining the following arguments in your config:
70-
71-
```
72-
SIGN?=ECC256
73-
WOLFBOOT_TPM_KEYSTORE?=1
74-
WOLFBOOT_TPM_KEYSTORE_NV_INDEX?=0x01800200
75-
WOLFBOOT_TPM_POLICY_NV_INDEX?=0x01800201
76-
```
77-
78-
You can also set a custom PCR index to use if the default 16 is not desired:
79-
80-
```
81-
WOLFBOOT_TPM_PCR_INDEX?=15
82-
```
83-
84-
Using this feature also requires you that keep 2 keys and use --manual-sign, the verification key for which the public section is kept in wolfTPM and the PolicySigned key for which the public section is bundled with the wolfBoot partation when /tools/keytools/sign is called. To create the PolicySigned signature you need hash and sign an expiration time as per the TPM2's documentation like below:
85-
86-
```
87-
$ echo -n -e '\x00\x00\x00\x00' > zeroExpiry
88-
$ openssl dgst -sha256 -sign policy_signed_ecc.pem -out policySigned zeroExpiry
89-
```
90-
91-
The output `policySigned` is in DER format and we need the signature in raw format, to convert we run the following commands:
92-
93-
```
94-
$ openssl asn1parse -inform DER -in policySigned
95-
0:d=0 hl=2 l= 69 cons: SEQUENCE
96-
2:d=1 hl=2 l= 32 prim: INTEGER :74BD2EAD183EE4B3A9A81ABC14B35DEB124148B9EF756C51B163A15CD9F37F7E
97-
36:d=1 hl=2 l= 33 prim: INTEGER :8A42B3E9CD1E7721B1697E08841D2982CC38756E6511938C2DB187FF16E5076C
98-
$ echo "74BD2EAD183EE4B3A9A81ABC14B35DEB124148B9EF756C51B163A15CD9F37F7E8A42B3E9CD1E7721B1697E08841D2982CC38756E6511938C2DB187FF16E5076C" | xxd -r -p - policySigned.raw
99-
```
100-
101-
policySigned.raw will now only contain the raw signature as wolfBoot needs it. Then we can put everything together in our sign command with the --policy-signed and --manual-sign flags:
102-
103-
```
104-
tools/keytools/sign --ecc256 --sha256 --manual-sign --policy-signed my_image.bin policy_signed_ecc.raw 1 my_image_sig policySigned.raw
105-
```
106-
107-
#### NOTE: Currently tpm keystore only supports ECC256 as the key type
108-
10967
### STM32F4 Programming
11068
11169
```

include/image.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,6 @@ uint8_t* wolfBoot_peek_image(struct wolfBoot_image *img, uint32_t offset,
569569
uint16_t wolfBoot_find_header(uint8_t *haystack, uint16_t type, uint8_t **ptr);
570570

571571

572-
#if defined(WOLFBOOT_TPM) && defined(WOLFTPM_KEYSTORE)
573-
#if defined(WOLFTPM_ENCRYPT_KEYSTORE) && defined(EXT_ENCRYPTED)
574-
int wolfBoot_unseal_encryptkey(uint8_t* key, uint32_t* keySz);
575-
#endif
576-
577-
int wolfBoot_reseal_keys(struct wolfBoot_image* newImg,
578-
struct wolfBoot_image* backupImg);
579-
#endif
580572

581573
#ifdef EXT_FLASH
582574
# ifdef PART_BOOT_EXT

options.mk

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,6 @@ ifeq ($(MEASURED_BOOT),1)
55
CFLAGS+=-D"WOLFBOOT_MEASURED_PCR_A=$(MEASURED_PCR_A)"
66
endif
77

8-
## use tpm to store true pubkey
9-
ifeq ($(WOLFBOOT_TPM_KEYSTORE),1)
10-
ifneq ($(WOLFBOOT_TPM_KEYSTORE_NV_INDEX),)
11-
ifneq ($(WOLFBOOT_TPM_POLICY_NV_INDEX),)
12-
WOLFTPM:=1
13-
CFLAGS+=-DWOLFTPM_KEYSTORE -DWOLFTPM_KEYSTORE_INDEX=$(WOLFBOOT_TPM_KEYSTORE_NV_INDEX) -DWOLFTPM_POLICY_DIGEST_INDEX=$(WOLFBOOT_TPM_POLICY_NV_INDEX) -DWOLFSSL_AES_CFB
14-
15-
ifeq ($(WOLFBOOT_TPM_ENCRYPT_KEYSTORE),1)
16-
ifneq ($(WOLFBOOT_TPM_ENCRYPT_KEYSTORE_NV_INDEX),)
17-
CFLAGS+=-DWOLFTPM_ENCRYPT_KEYSTORE -DWOLFTPM_ENCRYPT_KEYSTORE_INDEX=$(WOLFBOOT_TPM_ENCRYPT_KEYSTORE_NV_INDEX)
18-
endif
19-
endif
20-
21-
ifeq ($(WOLFBOOT_TPM_PCR_INDEX),)
22-
CFLAGS+=-DWOLFTPM_PCR_INDEX=16
23-
else
24-
CFLAGS+=-DWOLFTPM_PCR_INDEX=$(WOLFBOOT_TPM_PCR_INDEX)
25-
endif
26-
endif
27-
endif
28-
endif
29-
308
## DSA Settings
319

3210
ifeq ($(SIGN),NONE)

0 commit comments

Comments
 (0)