mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-28 13:10:02 +00:00
feature/tpm: only register HardwareAttestationKey on linux/windows (#17293)
We can only register one key implementation per process. When running on macOS or Android, trying to register a separate key implementation from feature/tpm causes a panic. Updates #15830 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -40,10 +41,12 @@ func init() {
|
|||||||
hi.TPM = infoOnce()
|
hi.TPM = infoOnce()
|
||||||
})
|
})
|
||||||
store.Register(store.TPMPrefix, newStore)
|
store.Register(store.TPMPrefix, newStore)
|
||||||
|
if runtime.GOOS == "linux" || runtime.GOOS == "windows" {
|
||||||
key.RegisterHardwareAttestationKeyFns(
|
key.RegisterHardwareAttestationKeyFns(
|
||||||
func() key.HardwareAttestationKey { return &attestationKey{} },
|
func() key.HardwareAttestationKey { return &attestationKey{} },
|
||||||
func() (key.HardwareAttestationKey, error) { return newAttestationKey() },
|
func() (key.HardwareAttestationKey, error) { return newAttestationKey() },
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func info() *tailcfg.TPMInfo {
|
func info() *tailcfg.TPMInfo {
|
||||||
|
|||||||
Reference in New Issue
Block a user