diff options
| author | Andrew Lytvynov <awly@tailscale.com> | 2025-06-17 14:39:15 -0700 |
|---|---|---|
| committer | Andrew Lytvynov <awly@tailscale.com> | 2025-06-17 15:57:24 -0700 |
| commit | 3c7fce72b2af7e565dc84c1c87ed89dc7654f57b (patch) | |
| tree | 9e6ba11d4ade8492bf0d16714df90b12490c5d52 | |
| parent | 939355f66727bb86819f90e74b25a6ed11ff5ad7 (diff) | |
| download | tailscale-awly/tpm-command-caps.tar.xz tailscale-awly/tpm-command-caps.zip | |
WIP: print supported tpm commandsawly/tpm-command-caps
| -rw-r--r-- | feature/tpm/tpm.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/feature/tpm/tpm.go b/feature/tpm/tpm.go index 18e56ae89..f571524b0 100644 --- a/feature/tpm/tpm.go +++ b/feature/tpm/tpm.go @@ -5,6 +5,7 @@ package tpm import ( + "log" "slices" "sync" @@ -63,6 +64,44 @@ func infoFromCapabilities(tpm transport.TPM) *tailcfg.TPMInfo { } cap.apply(info, props.TPMProperty[0].Value) } + { + resp, err := tpm2.GetCapability{ + Capability: tpm2.TPMCapCommands, + Property: 0, + PropertyCount: (1024 - 4 - 4) / 4, + }.Execute(tpm) + if err != nil { + log.Printf("GetCapability: %v", err) + return info + } + cmd, err := resp.CapabilityData.Data.Command() + if err != nil { + log.Printf("Data.Command: %v", err) + return info + } + for _, cc := range cmd.CommandAttributes { + log.Printf("supported command 0x%x", cc.CommandIndex) + } + } + { + resp, err := tpm2.GetCapability{ + Capability: tpm2.TPMCapAlgs, + Property: 0, + PropertyCount: (1024 - 4 - 4) / 4, + }.Execute(tpm) + if err != nil { + log.Printf("GetCapability: %v", err) + return info + } + alg, err := resp.CapabilityData.Data.Algorithms() + if err != nil { + log.Printf("Data.Command: %v", err) + return info + } + for _, a := range alg.AlgProperties { + log.Printf("supported algorithm 0x%x", a.Alg) + } + } return info } |
