File: fapi-get-platform-certificates.sh

package info (click to toggle)
tpm2-tools 5.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,988 kB
  • sloc: ansic: 45,737; sh: 14,915; xml: 8,342; makefile: 610; python: 51
file content (44 lines) | stat: -rw-r--r-- 784 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

set -e
source helpers.sh

start_up

CRYPTO_PROFILE="RSA"
setup_fapi $CRYPTO_PROFILE

PATH=${abs_builddir}/tools/fapi:$PATH

function cleanup {
    tss2 delete --path=/
    shut_down
}

trap cleanup EXIT

CERTIFICATES_OUTPUT_FILE=$TEMP_DIR/certificates_output.file

tss2 provision

expect <<EOF
# Try with missing certificates
spawn tss2 getplatformcertificates
set ret [wait]
if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
    Command has not failed as expected\n"
    exit 1
}
EOF

expect <<EOF
# Try normal command; should fail since no certificates present
spawn tss2 getplatformcertificates --certificates=$CERTIFICATES_OUTPUT_FILE \
    --force
set ret [wait]
if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
    Command has not failed as expected\n"
    exit 1
}
EOF

exit 0