]> git.proxmox.com Git - swtpm.git/commitdiff
swtpm: Also advertise the flags-opt-startup option for the CUSE interface
authorStefan Berger <stefanb@linux.ibm.com>
Wed, 13 Jul 2022 20:43:40 +0000 (16:43 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Thu, 14 Jul 2022 12:07:27 +0000 (08:07 -0400)
Commit 6559a902 implemented support for the startup-xyz flags for the CUSE
interface but the capability has not been advertised.

Adjust test cases to reflect the new verb being shown for
--print-capabilities.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
src/swtpm/capabilities.c
tests/_test_print_capabilities
tests/_test_tpm2_print_capabilities

index c528a8c5959bbdf09d469e1f1531f760e3ed2c17..685630a0a456d1501b603714e35cb0f38a381088 100644 (file)
@@ -150,7 +150,7 @@ int capabilities_print_json(bool cusetpm)
          with_tpm1,
          with_tpm2,
          !cusetpm     ? "\"tpm-send-command-header\", ": "",
-         !cusetpm     ? "\"flags-opt-startup\", "      : "",
+         true         ? "\"flags-opt-startup\", "      : "",
          cmdarg_seccomp,
          true         ? "\"cmdarg-key-fd\", "          : "",
          true         ? "\"cmdarg-pwd-fd\", "          : "",
index 794b5edd02899e2bc694522da40552f684feb070..92073e3f8c1c6b515e38504ff95e899ec67056d3 100755 (executable)
@@ -22,10 +22,10 @@ if has_seccomp_support "${SWTPM_EXE}"; then
        seccomp='"cmdarg-seccomp", '
 fi
 if [ "${SWTPM_IFACE}" != "cuse" ]; then
-       noncuse='"tpm-send-command-header", "flags-opt-startup", '
+       noncuse='"tpm-send-command-header", '
 fi
 
-exp='\{ "type": "swtpm", "features": \[ "tpm-1.2",( "tpm-2.0",)? '${noncuse}${seccomp}'"cmdarg-key-fd", "cmdarg-pwd-fd", "cmdarg-print-states", "nvram-backend-dir", "nvram-backend-file" \], "version": "[^"]*" \}'
+exp='\{ "type": "swtpm", "features": \[ "tpm-1.2",( "tpm-2.0",)? '${noncuse}'"flags-opt-startup", '${seccomp}'"cmdarg-key-fd", "cmdarg-pwd-fd", "cmdarg-print-states", "nvram-backend-dir", "nvram-backend-file" \], "version": "[^"]*" \}'
 if ! [[ ${msg} =~ ${exp} ]]; then
        echo "Unexpected response from ${SWTPM_IFACE} TPM to --print-capabilities:"
        echo "Actual   : ${msg}"
index 02986f338a2a2d98255fb6c48b59a87ea3dbc280..2e54587c5d7238172cd227f343aedb0faaeafc17 100755 (executable)
@@ -22,11 +22,11 @@ if has_seccomp_support "${SWTPM_EXE}"; then
        seccomp='"cmdarg-seccomp", '
 fi
 if [ "${SWTPM_IFACE}" != "cuse" ]; then
-       noncuse='"tpm-send-command-header", "flags-opt-startup", '
+       noncuse='"tpm-send-command-header", '
 fi
 
 # The rsa key size reporting is variable, so use a regex
-exp='\{ "type": "swtpm", "features": \[( "tpm-1.2",)? "tpm-2.0", '${noncuse}${seccomp}'"cmdarg-key-fd", "cmdarg-pwd-fd", "cmdarg-print-states", "nvram-backend-dir", "nvram-backend-file"(, "rsa-keysize-1024")?(, "rsa-keysize-2048")?(, "rsa-keysize-3072")? \], "version": "[^"]*" \}'
+exp='\{ "type": "swtpm", "features": \[( "tpm-1.2",)? "tpm-2.0", '${noncuse}'"flags-opt-startup", '${seccomp}'"cmdarg-key-fd", "cmdarg-pwd-fd", "cmdarg-print-states", "nvram-backend-dir", "nvram-backend-file"(, "rsa-keysize-1024")?(, "rsa-keysize-2048")?(, "rsa-keysize-3072")? \], "version": "[^"]*" \}'
 if ! [[ ${msg} =~ ${exp} ]]; then
        echo "Unexpected response from ${SWTPM_IFACE} TPM to --print-capabilities:"
        echo "Actual   : ${msg}"