mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-29 15:23:45 +00:00
WIP: print supported tpm commands
This commit is contained in:
parent
939355f667
commit
3c7fce72b2
@ -5,6 +5,7 @@
|
|||||||
package tpm
|
package tpm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"slices"
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -63,6 +64,44 @@ func infoFromCapabilities(tpm transport.TPM) *tailcfg.TPMInfo {
|
|||||||
}
|
}
|
||||||
cap.apply(info, props.TPMProperty[0].Value)
|
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
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user