Skip to content

Commit de7d5c8

Browse files
committed
Adding GitHub Action CI testing for TPM features.
1 parent 7d6c49e commit de7d5c8

31 files changed

+743
-77
lines changed

.github/workflows/footprint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Footprint test
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
footprint_test:
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Wolfboot Reusable Build Workflow - Simulator with TPM
2+
3+
on:
4+
5+
workflow_call:
6+
inputs:
7+
arch:
8+
required: true
9+
type: string
10+
config-file:
11+
required: true
12+
type: string
13+
make-args:
14+
required: false
15+
type: string
16+
rot-args:
17+
required: false
18+
type: string
19+
20+
jobs:
21+
22+
build:
23+
runs-on: ubuntu-20.04
24+
25+
steps:
26+
# setup ibmswtpm2
27+
- uses: actions/checkout@master
28+
with:
29+
repository: kgoldman/ibmswtpm2
30+
path: ibmswtpm2
31+
- name: ibmswtpm2 make
32+
working-directory: ./ibmswtpm2/src
33+
run: |
34+
make
35+
./ibmswtpm2/src/tpm_server &
36+
37+
- uses: actions/checkout@v3
38+
with:
39+
submodules: true
40+
41+
- name: make distclean
42+
run: |
43+
make distclean
44+
45+
- name: Select config
46+
run: |
47+
cp ${{inputs.config-file}} .config
48+
49+
- name: Build tools
50+
run: |
51+
make keytools && make tpmtools
52+
53+
- name: Write TPM ROT to TPM
54+
run: |
55+
./tools/tpm/rot -write ${{rot-args}}
56+
57+
- name: Build wolfboot
58+
run: |
59+
make ${{inputs.make-args}}
60+
61+
- name: Run wolfBoot
62+
run: |
63+
./wolfboot.elf get_version

.github/workflows/test-configs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Test Example Configs
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010

.github/workflows/test-keytools.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Wolfboot keytools test workflow
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010

.github/workflows/test-powerfail-simulator.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Power-failure during update - test with simulator target
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
powerfail_simulator_tests:

.github/workflows/test-renode-fastmath-smallstack.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Renode Automated multi memory configurations
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
renode_automated_fastmath_smallstack:

.github/workflows/test-renode-fastmath.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Renode Automated multi memory configurations
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
renode_automated_fastmath:

.github/workflows/test-renode-noasm-smallstack.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Renode Automated multi memory configurations
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
renode_automated_noasm_smallstack:

.github/workflows/test-renode-noasm.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Renode Automated multi memory configurations
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
renode_automated_noasm:

.github/workflows/test-renode-nrf52.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Renode Automated - Base Tests
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
renode_automated_base:

.github/workflows/test-renode-sha3.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Renode Automated multi SHA algorithms
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
renode_automated_multi_sha:

.github/workflows/test-renode-sha384.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Renode Automated multi SHA algorithms
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
renode_automated_multi_sha:

.github/workflows/test-renode-smallstack.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Renode Automated multi memory configurations
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
renode_automated_smallstack:

.github/workflows/test-tpm.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Test TPM Configs
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
11+
sim_tpm_ecc256:
12+
uses: ./.github/workflows/test-build-sim-tpm.yml
13+
with:
14+
arch: host
15+
config-file: ./config/examples/sim-tpm.config
16+
make-args: SIGN=ECC256 HASH=SHA256
17+
18+
sim_tpm_ecc384:
19+
uses: ./.github/workflows/test-build-sim-tpm.yml
20+
with:
21+
arch: host
22+
config-file: ./config/examples/sim-tpm.config
23+
make-args: SIGN=ECC384 HASH=SHA384
24+
25+
sim_tpm_rsa2048:
26+
uses: ./.github/workflows/test-build-sim-tpm.yml
27+
with:
28+
arch: host
29+
config-file: ./config/examples/sim-tpm.config
30+
make-args: SIGN=RSA2048 HASH=SHA256
31+
32+
33+
sim_tpm_measure_ecc256:
34+
uses: ./.github/workflows/test-build-sim-tpm.yml
35+
with:
36+
arch: host
37+
config-file: ./config/examples/sim-tpm-measured.config
38+
make-args: SIGN=ECC256 HASH=SHA256
39+
40+
sim_tpm_measure_ecc384:
41+
uses: ./.github/workflows/test-build-sim-tpm.yml
42+
with:
43+
arch: host
44+
config-file: ./config/examples/sim-tpm-measured.config
45+
make-args: SIGN=ECC384 HASH=SHA384
46+
47+
sim_tpm_measure_rsa2048:
48+
uses: ./.github/workflows/test-build-sim-tpm.yml
49+
with:
50+
arch: host
51+
config-file: ./config/examples/sim-tpm-measured.config
52+
make-args: SIGN=RSA2048 HASH=SHA256
53+
54+
55+
sim_tpm_keystore_ecc256:
56+
uses: ./.github/workflows/test-build-sim-tpm.yml
57+
with:
58+
arch: host
59+
config-file: ./config/examples/sim-tpm-keystore.config
60+
make-args: SIGN=ECC256 HASH=SHA256
61+
62+
sim_tpm_keystore_ecc384:
63+
uses: ./.github/workflows/test-build-sim-tpm.yml
64+
with:
65+
arch: host
66+
config-file: ./config/examples/sim-tpm-keystore.config
67+
make-args: SIGN=ECC384 HASH=SHA384
68+
rot-args: -sha384
69+
70+
sim_tpm_keystore_rsa2048:
71+
uses: ./.github/workflows/test-build-sim-tpm.yml
72+
with:
73+
arch: host
74+
config-file: ./config/examples/sim-tpm-keystore.config
75+
make-args: SIGN=RSA2048 HASH=SHA256

.github/workflows/test-units.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Unit tests
22

33
on:
4-
push:
5-
branches: [master]
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
66
pull_request:
7-
branches: [master]
7+
branches: [ '*' ]
88

99
jobs:
1010
unit_tests:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ tools/uart-flash-server/ufserver
100100
tools/unit-tests/unit-parser
101101
tools/bin-assemble/bin-assemble
102102
tools/elf-parser/elf-parser
103+
tools/tpm/rot
103104
config/*.ld
104105

105106
# Generated confiuguration file

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ keytools:
167167
@$(MAKE) -C tools/keytools -s clean
168168
@$(MAKE) -C tools/keytools -j
169169

170+
tpmtools:
171+
@echo "Building TPM tools"
172+
@$(MAKE) -C tools/tpm -s clean
173+
@$(MAKE) -C tools/tpm -j
174+
170175
test-app/image_v1_signed.bin: $(BOOT_IMG)
171176
@echo "\t[SIGN] $(BOOT_IMG)"
172177
$(Q)(test $(SIGN) = NONE) || $(SIGN_TOOL) $(SIGN_OPTIONS) $(BOOT_IMG) $(PRIVATE_KEY) 1

config/examples/sim-tpm-keystore.config

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
ARCH=sim
22
TARGET=sim
3-
SIGN?=ECC384
4-
HASH?=SHA384
3+
SIGN?=ECC256
4+
HASH?=SHA256
55
SPI_FLASH=0
66
DEBUG=1
77
WOLFTPM=1
88

9+
# Measured boot at test PCR index 16
10+
MEASURED_BOOT?=1
11+
MEASURED_PCR_A?=16
12+
13+
# Use NV for TPM based Root of Trust
914
WOLFBOOT_TPM_KEYSTORE?=1
1015
WOLFBOOT_TPM_KEYSTORE_NV_INDEX?=0x01400200
1116

config/examples/sim-tpm-measured.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARCH=sim
22
TARGET=sim
3-
SIGN?=ED25519
3+
SIGN?=ECC256
44
HASH?=SHA256
55
WOLFBOOT_SMALL_STACK=1
66
SPI_FLASH=0

config/examples/sim-tpm.config

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARCH=sim
22
TARGET=sim
3-
SIGN?=ECC384
4-
HASH?=SHA384
3+
SIGN?=ECC256
4+
HASH?=SHA256
55
SPI_FLASH=0
66
DEBUG=1
77
WOLFTPM=1

hal/sim.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void hal_init(void)
140140
ret = mmap_file(EXTERNAL_FLASH_FILE,
141141
(uint8_t*)ARCH_FLASH_OFFSET + 0x10000000, &flash_base);
142142
if (ret != 0) {
143-
fprintf(stderr, "failed to load internal flash file\n");
143+
fprintf(stderr, "failed to load external flash file\n");
144144
exit(-1);
145145
}
146146
#endif /* EXT_FLASH */

0 commit comments

Comments
 (0)