@@ -163,6 +163,7 @@ clevis_luks_decode_jwe() {
163163clevis_luks_print_pin_config () {
164164 local P=" ${1} "
165165 local decoded=" ${2} "
166+ local THP=" ${3} "
166167
167168 local content
168169 if ! content=" $( jose fmt -j- -g clevis -g " ${P} " -o- <<< " ${decoded}" ) " \
@@ -175,9 +176,13 @@ clevis_luks_print_pin_config() {
175176 tang)
176177 local url adv thp
177178 url=" $( jose fmt -j- -g url -u- <<< " ${content}" ) "
178- adv=" $( jose fmt -j- -g adv -o- <<< " ${content}" ) "
179- thp=" $( jose jwk thp -i- <<< " ${adv}" | tail -n1) "
180- pin=$( printf ' {"url":"%s","thp":"%s"}' " ${url} " " ${thp} " )
179+ if [ -z " ${THP} " ]; then
180+ pin=$( printf ' {"url":"%s"}' " ${url} " )
181+ else
182+ adv=" $( jose fmt -j- -g adv -o- <<< " ${content}" ) "
183+ thp=" $( jose jwk thp -i- <<< " ${adv}" | tail -n1) "
184+ pin=$( printf ' {"url":"%s","thp":"%s"}' " ${url} " " ${thp} " )
185+ fi
181186 printf " tang '%s'" " ${pin} "
182187 ;;
183188 tpm2)
@@ -209,6 +214,7 @@ clevis_luks_print_pin_config() {
209214# from it.
210215clevis_luks_decode_pin_config () {
211216 local jwe=" ${1} "
217+ local THP=" ${2} "
212218
213219 local decoded
214220 if ! decoded=$( clevis_luks_decode_jwe " ${jwe} " ) ; then
@@ -220,7 +226,7 @@ clevis_luks_decode_pin_config() {
220226 return 1
221227 fi
222228
223- clevis_luks_print_pin_config " ${P} " " ${decoded} "
229+ clevis_luks_print_pin_config " ${P} " " ${decoded} " " ${THP} "
224230}
225231
226232# clevis_luks_join_sss_cfg() will receive a list of configurations for a given
@@ -288,14 +294,15 @@ clevis_luks_process_sss_pin() {
288294clevis_luks_read_pins_from_slot () {
289295 local DEV=" ${1} "
290296 local SLOT=" ${2} "
297+ local THP=" ${3} "
291298
292299 local jwe
293300 if ! jwe=$( clevis_luks_read_slot " ${DEV} " " ${SLOT} " 2> /dev/null) ; then
294301 return 1
295302 fi
296303
297304 local cfg
298- if ! cfg=" $( clevis_luks_decode_pin_config " ${jwe} " ) " ; then
305+ if ! cfg=" $( clevis_luks_decode_pin_config " ${jwe} " " ${THP} " ) " ; then
299306 return 1
300307 fi
301308 printf " %s: %s\n" " ${SLOT} " " ${cfg} "
0 commit comments