blob: 59d7e747fff31ea75306b2193a2f70c2a5baa9f9 [file] [log] [blame] [view]
Fabio Utzigd7f6c762017-07-27 20:50:50 -03001## mcuboot test plan
2
3The current target for running the tests is the Freedom K64F board.
4
5### Basic sign support (RSA/EC/EC256)
6
7For each supported signing algorithm, check that non-signed, and signed
8with wrong key images are not swapped to, and image signed with correct key
9is swapped to.
10
11For the 3 algorithms supported, rsa, ec and ec256, two files are provided:
12key_<sign-algo>.pem, key_<sign-algo>_2.pem. And a keys file with the C public
13key data for key_<sign-algo>.pem.
14
Francesco Servidio4ff0c182021-10-20 15:27:16 +020015Build and load MCUboot:
Fabio Utzigd7f6c762017-07-27 20:50:50 -030016
17* `newt build k64f_boot_<sign-algo>`
18* `newt load k64f_boot_<sign-algo>`
19
20Build and load good image in slot 0:
21
22* `newt create-image k64f_blinky 1.0.1 key_<sign-algo>.pem`
23* `newt load k64f_blinky`
24
25NOTE: If testing RSA/PSS `newt create-image` needs to be passed in the extra
26flag `--rsa-pss` eg:
27
28`newt create-image k64f_blinky 1.0.1 key_rsa.pem --rsa-pss`
29
30Build and load image in slot 1 with no signing, signed with
31key_<sign-algo>_2.pem and signed with key_<sign-algo>.pem. Mark each one as
32test image and check that swap only happens for image signed with
33key_<sign-algo>.pem. Both others should be erased.
34
35* `newt create-image k64f_blinky2 1.0.2 <one-of-the-sign-keys-or-none>`
36* `newtmgr image upload k64f_blinky2`
37* `newtmgr image list`
38* `newtmgr image test <hash of slot 1>`
39
40### Image signed with more than one key
41
42FIXME: this is currently not functional, skip this section!
43
Francesco Servidio4ff0c182021-10-20 15:27:16 +020044Build and load MCUboot:
Fabio Utzigd7f6c762017-07-27 20:50:50 -030045
46* `newt build k64f_boot_rsa_ec`
47* `newt load k64f_boot_rsa_ec`
48
49Build and load good image in slot 0:
50
51* `newt create-image k64f_blinky 1.0.1 key_rsa.pem`
52* `newt load k64f_blinky`
53
54Build and load image in slot 1 with no signing, signed with
55key_<sign-algo>_2.pem and signed with key_<sign-algo>.pem. Mark each one as
56test image and check that swap only happens for image signed with
57key_<sign-algo>.pem. Both others should be erased.
58
59Use all of this options:
60
61* `newt create-image k64f_blinky2 1.0.2`
62
63And load
64
65* `newtmgr image upload k64f_blinky2`
66* `newtmgr image list`
67* `newtmgr image test <hash of slot 1>`
68
69### Overwrite only functionality
70
Francesco Servidio4ff0c182021-10-20 15:27:16 +020071Build/load MCUboot:
Fabio Utzigd7f6c762017-07-27 20:50:50 -030072
73* `newt build k64f_boot_rsa_noswap`
74* `newt load k64f_boot_rsa_noswap`
75
76Build/load blinky to slot 0:
77
78* `newt create-image k64f_blinky 1.0.1 key_rsa.pem`
79* `newt load k64f_blinky`
80
81Build/load blinky2 both with bad and good key, followed by a permanent swap
82request:
83
84* `newt create-image k64f_blinky2 1.0.2 <bad and good rsa keys>.pem`
85* `newtmgr image upload k64f_blinky2`
86* `newtmgr image list`
87* `newtmgr image confirm <hash of slot 1>`
88
89This should not swap and delete the image in slot 1 when signed with the wrong
90key, otherwise the image in slot 1 should be *moved* to slot 0 and slot 1 should
91be empty.
92
93### Validate slot 0 option
94
Francesco Servidio4ff0c182021-10-20 15:27:16 +020095Build/load MCUboot:
Fabio Utzigd7f6c762017-07-27 20:50:50 -030096
97* `newt build k64f_boot_rsa_validate0`
98* `newt load k64f_boot_rsa_validate0`
99
100Build non-signed image:
101
102* `newt create-image k64f_blinky 1.0.1`
103* `newt load k64f_blinky`
104* Reset and no image should be run
105
106Build signed image with invalid key:
107
108* `newt create-image k64f_blinky 1.0.1 key_rsa_2.pem`
109* `newt load k64f_blinky`
110* Reset and no image should be run
111
112Build signed image with *valid* key:
113
114* `newt create-image k64f_blinky 1.0.1 key_rsa.pem`
115* `newt load k64f_blinky`
116* Reset and image *should* run
117
118### Swap with random failures
119
120DISCLAIMER: be careful with copy/paste of commands, this test uses another
121target/app!
122
Francesco Servidio4ff0c182021-10-20 15:27:16 +0200123Build/load MCUboot:
Fabio Utzigd7f6c762017-07-27 20:50:50 -0300124
125* `newt build k64f_boot_rsa`
126* `newt load k64f_boot_rsa`
127
128Build/load slinky to slot 0:
129
130* `newt create-image k64f_slinky 1.0.1 key_rsa.pem`
131* `newt load k64f_slinky`
132
133Build/load slinky2 to slot 1:
134
135* `newt create-image k64f_slinky2 1.0.2 key_rsa.pem`
136* `newtmgr image upload k64f_slinky2`
137
138Confirm that both images are installed, request a permanent request to the
139image in slot 1 and check that it works.
140
141* `newtmgr image list`
142* `newtmgr image confirm <hash of slot 1>`
143
144If everything works, now proceed with requests for permanent swap to the image
145in slot 1 and do random swaps (as much as you like!). When the swap finishes
146confirm that the swap was finished with the previous slot 1 image now in
147slot 0 and vice-versa.
148
149### Help
150
151* Mass erase MCU
152
Maureen Helm0e0c4882019-02-18 17:20:00 -0600153 $ pyocd erase --chip
Fabio Utzigd7f6c762017-07-27 20:50:50 -0300154
155* Flashing image in slot 1:
156
Maureen Helm0e0c4882019-02-18 17:20:00 -0600157 $ pyocd flash -e sector -a 0x80000 ${IMG_FILE} bin