Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ifapi_json_TPM2_CC_serialize Undefined constant when parsing PP_commands #2874

Open
freedge opened this issue Jul 25, 2024 · 0 comments
Open

Comments

@freedge
Copy link

freedge commented Jul 25, 2024

I'm running a VM on Hyper-V with a virtual TPM.

With tpm2-tss-4.1.3-1.fc41.x86_64 I get an error running tss2_getinfo:

# tss2_getinfo -o -
ERROR:fapijson:src/tss2-fapi/tpm_json_serialize.c:598:ifapi_json_TPM2_CC_serialize() Undefined constant. ErrorCode (0x0006000b)
ERROR:fapijson:src/tss2-fapi/tpm_json_serialize.c:1705:ifapi_json_TPML_CC_serialize() Serialize TPM2_CC ErrorCode (0x0006000b)
ERROR:fapijson:src/tss2-fapi/tpm_json_serialize.c:2135:ifapi_json_TPMS_CAPABILITY_DATA_serialize() Serialize TPMU_CAPABILITIES ErrorCode (0x0006000b)
ERROR:fapijson:src/tss2-fapi/ifapi_json_serialize.c:702:ifapi_json_IFAPI_CAP_INFO_serialize() Serialize TPMS_CAPABILITY_DATA ErrorCode (0x0006000b)
ERROR:fapijson:src/tss2-fapi/ifapi_json_serialize.c:751:ifapi_json_IFAPI_INFO_serialize() Serialize TPMS_CAPABILITY_DATA ErrorCode (0x0006000b)
ERROR:fapi:src/tss2-fapi/api/Fapi_GetInfo.c:273:Fapi_GetInfo_Finish() Error serialize info object ErrorCode (0x0006000b)
ERROR:fapi:src/tss2-fapi/api/Fapi_GetInfo.c:123:Fapi_GetInfo() ErrorCode (0x0006000b) GetTPMInfo
Fapi_GetInfo(0x6000B) - fapi:A parameter has a bad value

this seems to come from PP_Commands that is received with constant 0xD.

After trying this patch:

diff --git a/src/tss2-fapi/tpm_json_serialize.c b/src/tss2-fapi/tpm_json_serialize.c
index 8e1e4e4..add7f2f 100644
--- a/src/tss2-fapi/tpm_json_serialize.c
+++ b/src/tss2-fapi/tpm_json_serialize.c
@@ -583,6 +583,7 @@ ifapi_json_TPM2_CC_serialize(const TPM2_CC in, json_object **jso)
         { TPM2_CC_CreateLoaded, "CreateLoaded" },
         { TPM2_CC_PolicyAuthorizeNV, "PolicyAuthorizeNV" },
         { TPM2_CC_EncryptDecrypt2, "EncryptDecrypt2" },
+        { 13, "Thirteen" },
         /* We don't want to return LAST but the actual value */
         /* { TPM2_CC_LAST, "LAST" }, */
         { TPM2_CC_Vendor_TCG_Test, "Vendor_TCG_Test" },

getinfo works and output

...
    {
      "description":"pp-commands",
      "info":{
        "capability":"PP_COMMANDS",
        "data":[
          "Thirteen"
        ]
      }
    },

tpm2_getcap has no issue displaying the PP_Commands:

# tpm2_getcap commands | grep -A 10 PP_Commands
TPM2_CC_PP_Commands:
  value: 0x240012D
  commandIndex: 0x12d
  reserved1:    0x0
  nv:           1
  extensive:    0
  flushed:      0
  cHandles:     0x1
  rHandle:      0
  V:            0
  Res:          0x0

I'm opening this issue out of curiosity. Is this the TPM misbehaving?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant