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

unsupported hash algorithm: 18 #7810

Closed
uhthomas opened this issue Sep 29, 2023 · 13 comments · Fixed by #7811
Closed

unsupported hash algorithm: 18 #7810

uhthomas opened this issue Sep 29, 2023 · 13 comments · Fixed by #7811

Comments

@uhthomas
Copy link
Contributor

Bug Report

Description

I'm trying to install Talos fresh with system disk encryption and seeing the error unsupported hash algorithm: 18.

  systemDiskEncryption:
    ephemeral:
      keys:
        - tpm: {}
          slot: 0
    state:
      keys:
        - tpm: {}
          slot: 0

Logs

Environment

  • Talos version: v1.5.3
  • Kubernetes version: N/A
  • Platform: bare metal
@frezbo
Copy link
Member

frezbo commented Sep 29, 2023

it seems the tpm doesn;t support sha256?

Could you provide the dmesg?

@uhthomas
Copy link
Contributor Author

uhthomas commented Sep 29, 2023

It's a modern motherboard with a 13600K, the TPM definitely supports SHA256. I am not sure I can get the full dmesg output as there doesn't seem to be an --insecure flag for it.

❯ talosctl -e 192.168.1.78 -n 192.168.1.78 dmesg
error getting dmesg: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 192.168.1.78:50000: connect: connection refused"

image

@uhthomas
Copy link
Contributor Author

18 seems to be BLAKE2b-384?

https://go.dev/play/p/zXQHvXE22p2

@frezbo
Copy link
Member

frezbo commented Sep 29, 2023

it seems the tpm supports BLAKE2b-384 as a has alg, and the tpm library used doesn't support that

@frezbo
Copy link
Member

frezbo commented Sep 29, 2023

i'll think of a fix for next week

@uhthomas
Copy link
Contributor Author

@frezbo I am confused as to where the value is coming from, as the TPM package does not seem to even recognise blake2b-384 at all and should have returned an error, which should have been handled correctly.

https://github.com/google/go-tpm/blob/5a514e64d1ed5d986ccfd38b958d2d5c038dcccd/tpm2/structures.go#L431

return fmt.Errorf("failed to parse hash algorithm: %v", err)

@frezbo
Copy link
Member

frezbo commented Sep 29, 2023

@frezbo I am confused as to where the value is coming from, as the TPM package does not seem to even recognise blake2b-384 at all and should have returned an error, which should have been handled correctly.

https://github.com/google/go-tpm/blob/5a514e64d1ed5d986ccfd38b958d2d5c038dcccd/tpm2/structures.go#L431

return fmt.Errorf("failed to parse hash algorithm: %v", err)

yes, we reutrn the error as is since we don;t support BLAKE at all

@uhthomas
Copy link
Contributor Author

You're right, I misread the error. Thank you, it looks like that is the issue.

Any suggestions for how to work around this? I guess I may be able to disable blake in the bios. Let me check.

@frezbo
Copy link
Member

frezbo commented Sep 29, 2023

Any suggestions for how to work around this?

I hate parsing error messages, since it's flaky, probably can maybe the code in pcr to be a little different

@uhthomas
Copy link
Contributor Author

I don't see an obvious way to disable that - it's telling me there are only sha256 banks.

image

@uhthomas
Copy link
Contributor Author

Also apologies @frezbo, the value of 18 (0x0012) is actually TPMAlgSM3256.

uhthomas added a commit to uhthomas/talos that referenced this issue Sep 29, 2023
The conversion from TPM 2 hash algorithm to Go crypto algorithm will fail for
uncommon algorithms like SM3256. This can be avoided by checking the constants
directly, rather than converting them. It should also be fine to allow some non
SHA-256 PCRs.

Fixes: siderolabs#7810
@uhthomas
Copy link
Contributor Author

@frezbo What do you think of #7811?

uhthomas added a commit to uhthomas/talos that referenced this issue Sep 29, 2023
The conversion from TPM 2 hash algorithm to Go crypto algorithm will fail for
uncommon algorithms like SM3256. This can be avoided by checking the constants
directly, rather than converting them. It should also be fine to allow some non
SHA-256 PCRs.

Fixes: siderolabs#7810

Signed-off-by: Thomas Way <thomas@6f.io>
@frezbo
Copy link
Member

frezbo commented Sep 29, 2023

that looks good, thank you 👍

frezbo pushed a commit to uhthomas/talos that referenced this issue Oct 2, 2023
The conversion from TPM 2 hash algorithm to Go crypto algorithm will fail for
uncommon algorithms like SM3256. This can be avoided by checking the constants
directly, rather than converting them. It should also be fine to allow some non
SHA-256 PCRs.

Fixes: siderolabs#7810

Signed-off-by: Thomas Way <thomas@6f.io>
Signed-off-by: Noel Georgi <git@frezbo.dev>
frezbo pushed a commit to uhthomas/talos that referenced this issue Oct 3, 2023
The conversion from TPM 2 hash algorithm to Go crypto algorithm will fail for
uncommon algorithms like SM3256. This can be avoided by checking the constants
directly, rather than converting them. It should also be fine to allow some non
SHA-256 PCRs.

Fixes: siderolabs#7810

Signed-off-by: Thomas Way <thomas@6f.io>
Signed-off-by: Noel Georgi <git@frezbo.dev>
smira pushed a commit to smira/talos that referenced this issue Oct 17, 2023
The conversion from TPM 2 hash algorithm to Go crypto algorithm will fail for
uncommon algorithms like SM3256. This can be avoided by checking the constants
directly, rather than converting them. It should also be fine to allow some non
SHA-256 PCRs.

Fixes: siderolabs#7810

Signed-off-by: Thomas Way <thomas@6f.io>
Signed-off-by: Noel Georgi <git@frezbo.dev>
(cherry picked from commit 336aee0)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants