diff --git a/internal/app/init/main.go b/internal/app/init/main.go index 579c650ca..60ee28542 100644 --- a/internal/app/init/main.go +++ b/internal/app/init/main.go @@ -62,7 +62,7 @@ func run() (err error) { } // extend PCR 11 with enter-initrd - if err = tpm2.PCRExtent(secureboot.UKIPCR, []byte(secureboot.EnterInitrd)); err != nil { + if err = tpm2.PCRExtend(secureboot.UKIPCR, []byte(secureboot.EnterInitrd)); err != nil { return fmt.Errorf("failed to extend PCR %d with enter-initrd: %v", secureboot.UKIPCR, err) } diff --git a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go index 1b9468260..6b33c2601 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer_tasks.go @@ -672,7 +672,7 @@ func WriteUdevRules(runtime.Sequence, any) (runtime.TaskExecutionFunc, string) { // StartMachined represents the task to start machined. func StartMachined(_ runtime.Sequence, _ any) (runtime.TaskExecutionFunc, string) { return func(ctx context.Context, logger *log.Logger, r runtime.Runtime) error { - if err := tpm2.PCRExtent(secureboot.UKIPCR, []byte(secureboot.EnterMachined)); err != nil { + if err := tpm2.PCRExtend(secureboot.UKIPCR, []byte(secureboot.EnterMachined)); err != nil { return err } @@ -748,7 +748,7 @@ func StartUdevd(runtime.Sequence, any) (runtime.TaskExecutionFunc, string) { // ExtendPCRStartAll represents the task to extend the PCR with the StartTheWorld PCR phase. func ExtendPCRStartAll(runtime.Sequence, any) (runtime.TaskExecutionFunc, string) { return func(ctx context.Context, logger *log.Logger, r runtime.Runtime) (err error) { - return tpm2.PCRExtent(secureboot.UKIPCR, []byte(secureboot.StartTheWorld)) + return tpm2.PCRExtend(secureboot.UKIPCR, []byte(secureboot.StartTheWorld)) }, "extendPCRStartAll" } diff --git a/internal/pkg/mount/switchroot/switchroot.go b/internal/pkg/mount/switchroot/switchroot.go index 61ba10377..1be2458b3 100644 --- a/internal/pkg/mount/switchroot/switchroot.go +++ b/internal/pkg/mount/switchroot/switchroot.go @@ -72,7 +72,7 @@ func Switch(prefix string, mountpoints *mount.Points) (err error) { } // extend PCR 11 with leave-initrd - if err = tpm2.PCRExtent(secureboot.UKIPCR, []byte(secureboot.LeaveInitrd)); err != nil { + if err = tpm2.PCRExtend(secureboot.UKIPCR, []byte(secureboot.LeaveInitrd)); err != nil { return fmt.Errorf("failed to extend PCR %d with leave-initrd: %v", secureboot.UKIPCR, err) } diff --git a/internal/pkg/secureboot/tpm2/pcr.go b/internal/pkg/secureboot/tpm2/pcr.go index f76ee035b..657204502 100644 --- a/internal/pkg/secureboot/tpm2/pcr.go +++ b/internal/pkg/secureboot/tpm2/pcr.go @@ -62,8 +62,8 @@ func ReadPCR(t transport.TPM, pcr int) ([]byte, error) { return pcrValue.PCRValues.Digests[0].Buffer, nil } -// PCRExtent hashes the input and extends the PCR with the hash. -func PCRExtent(pcr int, data []byte) error { +// PCRExtend hashes the input and extends the PCR with the hash. +func PCRExtend(pcr int, data []byte) error { t, err := transport.OpenTPM() if err != nil { // if the TPM is not available or not a TPM 2.0, we can skip the PCR extension