File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: BSD-3-Clause
2+
3+ source helpers.sh
4+
5+ start_up
6+
7+ alg_pem_load=ecc
8+ pem_parent=prim
9+ pem_file=mykey
10+ Pem_persistent_parent=0x81100000
11+
12+ cleanup () {
13+
14+ rm -f $file_load_key_pub $file_load_key_priv $file_load_key_name \
15+ $file_load_key_ctx
16+
17+ tpm2 evictcontrol -Q -Co -c $Handle_parent 2> /dev/null || true
18+
19+ if [ $( ina " $@ " " keep_ctx" ) -ne 0 ]; then
20+ rm -f $file_primary_key_ctx
21+ fi
22+
23+ if [ $( ina " $@ " " no-shut-down" ) -ne 0 ]; then
24+ shut_down
25+ fi
26+ }
27+ trap cleanup EXIT
28+
29+ cleanup " no-shut-down"
30+
31+ tpm2 clear
32+
33+ # test to check negative parent in TSS pem file
34+
35+ tpm2 createprimary -G $alg_pem_load -C o \
36+ -a " fixedtpm|fixedparent|sensitivedataorigin|userwithauth|restricted|decrypt|noda" \
37+ -c $pem_parent .ctx
38+
39+ tpm2 create -C $pem_parent .ctx -u $pem_file .pub -r $pem_file .priv
40+
41+ tpm2 evictcontrol -C o -c $pem_parent .ctx $Pem_persistent_parent
42+
43+ tpm2 encodeobject -C $Pem_persistent_parent -u $pem_file .pub \
44+ -r $pem_file .priv -o $pem_file .pem
45+
46+ tpm2 load -r $pem_file .pem -c $pem_file .ctx
47+
48+ PARENTVAL=` openssl asn1parse -in $pem_file .pem -inform pem | awk ' {print $7}' `
49+ if egrep -q " ^:-[0-9a-fA-F]{8}" <<< " $PARENTVAL"
50+ then
51+ echo " Fail: Parent value is negative"
52+ exit 1
53+ fi
54+
55+ exit 0
56+
57+ cleanup " no-shut-down"
You can’t perform that action at this time.
0 commit comments