Skip to content

Commit

Permalink
chore: rename tpm2.PCRExtent -> tpm2.PCRExtend
Browse files Browse the repository at this point in the history
Fixes typo

Signed-off-by: Joakim Nohlgård <joakim@nohlgard.se>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
jnohlgard authored and smira committed Oct 21, 2024
1 parent 867c4b8 commit ead4699
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/app/init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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"
}

Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/mount/switchroot/switchroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/secureboot/tpm2/pcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ead4699

Please sign in to comment.