blob: f305198e14d5c1d94f94149202902dce12674fa1 [file] [log] [blame]
Leonardo Sandoval6eff3f72021-05-03 11:12:37 -05001#
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 Sandoval5cfc11f2021-09-08 16:08:13 -05009non_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
14expect_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
Leonardo Sandoval34f51832021-11-04 16:42:04 -060017expect_string+=("i;buildroot login:")
Leonardo Sandoval5cfc11f2021-09-08 16:08:13 -050018
Leonardo Sandoval34f51832021-11-04 16:42:04 -060019# Login then load the fTPM driver and retrieves PCR0
Manish V Badarkhefc146c42021-11-24 15:34:00 +000020# Pass condition: PCR0 and PCR1 must not be all zeros.
Leonardo Sandoval34f51832021-11-04 16:42:04 -060021expect_string+=("i;#;;;root")
22expect_string+=("i;${non_zero_pcr};;;ftpm")
Manish V Badarkhefc146c42021-11-24 15:34:00 +000023expect_string+=("i;#")
24expect_string+=("i;${non_zero_pcr};;;pcrread -ha 1")
Leonardo Sandoval5cfc11f2021-09-08 16:08:13 -050025
26# Iterate over the rest of PCRs and check that they all are zeros.
27zero_pcr="(\s00){16}\s+(00\s){16}"
Manish V Badarkhefc146c42021-11-24 15:34:00 +000028for i in $(seq 2 11); do
Leonardo Sandoval34f51832021-11-04 16:42:04 -060029 expect_string+=("i;#")
30 expect_string+=("i;${zero_pcr};;;pcrread -ha $i")
Leonardo Sandoval5cfc11f2021-09-08 16:08:13 -050031done
Chris Kay07756bc2022-11-24 17:21:48 +000032
33expect_string+=("i;#;;;@") # Flush newline after final prompt