@@ -103,17 +103,21 @@ key="$(jose fmt -j- -Og key -u- <<< "$cfg")" || key="ecc"
103
103
104
104
pcr_bank=" $( jose fmt -j- -Og pcr_bank -u- <<< " $cfg" ) " || pcr_bank=" sha1"
105
105
106
+ # Trim the spaces from the config, so that we will not have issues parsing
107
+ # the PCR IDs.
108
+ pcr_cfg=${cfg// [[:space:]]/ }
106
109
# Issue #103: We support passing pcr_ids using both a single string, as in
107
- # "1,3", as well as an actual JSON array, such as ["1,"3"]. Let's handle both
110
+ # "1,3", as well as an actual JSON array, such as ["1" ,"3"]. Let's handle both
108
111
# cases here.
109
- if jose fmt -j- -Og pcr_ids 2> /dev/null <<< " $cfg" \
110
- && ! pcr_ids=" $( jose fmt -j- -Og pcr_ids -u- 2> /dev/null <<< " $cfg" ) " ; then
112
+ if jose fmt -j- -Og pcr_ids 2> /dev/null <<< " ${pcr_cfg}" \
113
+ && ! pcr_ids=" $( jose fmt -j- -Og pcr_ids -u- 2> /dev/null \
114
+ <<< " ${pcr_cfg}" ) " ; then
111
115
112
116
# We failed to parse a string, so let's try to parse a JSON array instead.
113
- if jose fmt -j- -Og pcr_ids -A 2> /dev/null <<< " ${cfg }" ; then
117
+ if jose fmt -j- -Og pcr_ids -A 2> /dev/null <<< " ${pcr_cfg }" ; then
114
118
# OK, it is an array, so let's get the items and form a string.
115
119
pcr_ids=
116
- for pcr in $( jose fmt -j- -Og pcr_ids -Af- <<< " ${cfg }" \
120
+ for pcr in $( jose fmt -j- -Og pcr_ids -Af- <<< " ${pcr_cfg }" \
117
121
| tr -d ' "' ) ; do
118
122
pcr_ids=$( printf ' %s,%s' " ${pcr_ids} " " ${pcr} " )
119
123
done
0 commit comments