chore: rename tpm2.PCRExtent -> tpm2.PCRExtend

Fixes typo

Signed-off-by: Joakim Nohlgård <joakim@nohlgard.se>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Joakim Nohlgård
2024-09-23 13:22:29 +02:00
committed by Andrey Smirnov
parent 867c4b8125
commit ead46997c9
4 changed files with 6 additions and 6 deletions

View File

@@ -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)
}

View File

@@ -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"
}

View File

@@ -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)
}

View File

@@ -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