Leonardo Sandoval | 6eff3f7 | 2021-05-03 11:12:37 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2021, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | # Expect script for Linux/Buildroot using Measured Boot & fTPM |
| 7 | # |
| 8 | |
Leonardo Sandoval | 5cfc11f | 2021-09-08 16:08:13 -0500 | [diff] [blame^] | 9 | non_zero_pcr='(?!(\s00){16})((\s([0-9a-f]){2}){16}\s)' |
| 10 | |
| 11 | # Parse the event log from the debug logs and store the digests |
| 12 | # so they can be matched later with what the fTPM read. |
| 13 | |
| 14 | expect_string+=('m;Booting Trusted Firmware;Booting BL31;Digest(\s|\w)*:\s(\w{2}\s){16}@: (\w{2}\s){16}@Event(\s|\w)*:\s\w+\s') |
| 15 | |
| 16 | # Wait for the login prompt |
| 17 | expect_string+=('i;buildroot login:') |
| 18 | |
| 19 | # Load the fTPM driver and retrieves PCR0 |
| 20 | # Pass condition: PCR0 must not be all zeros. |
| 21 | expect_string+=("i;#;${non_zero_pcr};;root@ftpm") |
| 22 | |
| 23 | # Iterate over the rest of PCRs and check that they all are zeros. |
| 24 | zero_pcr="(\s00){16}\s+(00\s){16}" |
| 25 | for i in $(seq 1 11); do |
| 26 | expect_string+=("i;#;${zero_pcr};;pcrread -ha $i") |
| 27 | done |
| 28 | |