Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions efi/preinstall/check_host_security.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package preinstall

import (
"bytes"
"fmt"

"github.com/canonical/tcglog-parser"
"github.com/pilebones/go-udev/netlink"
Expand Down Expand Up @@ -115,17 +114,9 @@ Loop:
// as the TCG PC Client Platform Firmware Profile spec says that the event
// data in EV_EFI_ACTION events should not be NULL terminated.
errs = append(errs, ErrInsufficientDMAProtection)
default:
// Unexpected data
return fmt.Errorf("unexpected EV_EFI_ACTION event data in PCR7 event: %q", event.Data)
}
case tcglog.EventTypeEFIVariableDriverConfig, tcglog.EventTypeSeparator:
// ok
case tcglog.EventTypeEFIVariableAuthority:
break Loop
default:
// Unexpected event type
return fmt.Errorf("unexpected event type (%v) in PCR7", event.EventType)
}
}

Expand Down
29 changes: 0 additions & 29 deletions efi/preinstall/check_host_security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ package preinstall_test
import (
. "gopkg.in/check.v1"

"github.com/canonical/tcglog-parser"
. "github.com/snapcore/secboot/efi/preinstall"
internal_efi "github.com/snapcore/secboot/internal/efi"
"github.com/snapcore/secboot/internal/efitest"
)

Expand Down Expand Up @@ -127,30 +125,3 @@ func (s *hostSecuritySuite) TestCheckSecureBootPolicyPCRForDegradedSettingsFirmw
c.Assert(err, Implements, &tmpl)
c.Check(err.(CompoundError).Unwrap(), DeepEquals, []error{ErrUEFIDebuggingEnabled, ErrInsufficientDMAProtection})
}

func (s *hostSecuritySuite) TestCheckSecureBootPolicyPCRForDegradedSettingsErrUnexpectedData(c *C) {
log := efitest.NewLog(c, &efitest.LogOptions{FirmwareDebugger: true})
for _, ev := range log.Events {
if ev.PCRIndex != internal_efi.SecureBootPolicyPCR {
continue
}
ev.Data = tcglog.EFICallingEFIApplicationEvent
break
}
err := CheckSecureBootPolicyPCRForDegradedFirmwareSettings(log)
c.Check(err, ErrorMatches, `unexpected EV_EFI_ACTION event data in PCR7 event: \"Calling EFI Application from Boot Option\"`)
}

func (s *hostSecuritySuite) TestCheckSecureBootPolicyPCRForDegradedSettingsErrUnexpectedType(c *C) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have an equivalent test for the higher level?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are tests in check_pcr7_test.go that check unexpected event types are caught.

log := efitest.NewLog(c, &efitest.LogOptions{FirmwareDebugger: true})
for _, ev := range log.Events {
if ev.PCRIndex != internal_efi.SecureBootPolicyPCR {
continue
}
ev.EventType = tcglog.EventTypeAction
break
}
c.Check(CheckSecureBootPolicyPCRForDegradedFirmwareSettings(log), ErrorMatches, `unexpected event type \(EV_ACTION\) in PCR7`)
err := CheckSecureBootPolicyPCRForDegradedFirmwareSettings(log)
c.Check(err, ErrorMatches, `unexpected event type \(EV_ACTION\) in PCR7`)
}
Loading