Skip to content

Commit

Permalink
secboot,fdestate,snap-bootstrap: use boot mode for FDE hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
valentindavid committed Feb 10, 2025
1 parent 8b4ccc9 commit 08d8191
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 20 deletions.
14 changes: 11 additions & 3 deletions cmd/snap-bootstrap/cmd_initramfs_mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,9 @@ type recoverModeStateMachine struct {
// device model
model *asserts.Model

// boot mode (factory-reset or recover)
mode string

// the disk we have all our partitions on
disk disks.Disk

Expand Down Expand Up @@ -1125,9 +1128,10 @@ func (m *recoverModeStateMachine) setUnlockStateWithFallbackKey(partName string,
return nil
}

func newRecoverModeStateMachine(model *asserts.Model, disk disks.Disk, allowFallback bool) *recoverModeStateMachine {
func newRecoverModeStateMachine(model *asserts.Model, bootMode string, disk disks.Disk, allowFallback bool) *recoverModeStateMachine {
m := &recoverModeStateMachine{
model: model,
mode: bootMode,
disk: disk,
degradedState: &recoverDegradedState{
ErrorLog: []string{},
Expand Down Expand Up @@ -1267,6 +1271,7 @@ func (m *recoverModeStateMachine) unlockDataRunKey() (stateFunc, error) {
// recovery key after we first try the fallback object
AllowRecoveryKey: false,
WhichModel: m.whichModel,
BootMode: m.mode,
}
unlockRes, unlockErr := secbootUnlockVolumeUsingSealedKeyIfEncrypted(m.disk, "ubuntu-data", runModeKey, unlockOpts)
if err := m.setUnlockStateWithRunKey("ubuntu-data", unlockRes, unlockErr); err != nil {
Expand Down Expand Up @@ -1307,6 +1312,7 @@ func (m *recoverModeStateMachine) unlockDataFallbackKey() (stateFunc, error) {
// to unlock data
AllowRecoveryKey: true,
WhichModel: m.whichModel,
BootMode: m.mode,
}
// TODO: this prompts for a recovery key
// TODO: we should somehow customize the prompt to mention what key we need
Expand Down Expand Up @@ -1441,6 +1447,7 @@ func (m *recoverModeStateMachine) unlockEncryptedSaveFallbackKey() (stateFunc, e
// to unlock save
AllowRecoveryKey: true,
WhichModel: m.whichModel,
BootMode: m.mode,
}
saveFallbackKey := device.FallbackSaveSealedKeyUnder(boot.InitramfsSeedEncryptionKeyDir)
// TODO: this prompts again for a recover key, but really this is the
Expand Down Expand Up @@ -1526,7 +1533,7 @@ func generateMountsModeRecover(mst *initramfsMountsState) error {

machine, err := func() (machine *recoverModeStateMachine, err error) {
// first state to execute is to unlock ubuntu-data with the run key
machine = newRecoverModeStateMachine(model, disk, allowFallback)
machine = newRecoverModeStateMachine(model, "recover", disk, allowFallback)
for {
finished, err := machine.execute()
// TODO: consider whether certain errors are fatal or not
Expand Down Expand Up @@ -1669,7 +1676,7 @@ func generateMountsModeFactoryReset(mst *initramfsMountsState) error {
// invoked)
machine, err := func() (machine *recoverModeStateMachine, err error) {
allowFallback := true
machine = newRecoverModeStateMachine(model, disk, allowFallback)
machine = newRecoverModeStateMachine(model, "factory-reset", disk, allowFallback)
// start from looking up encrypted ubuntu-save and unlocking with the fallback key
machine.current = machine.unlockMaybeEncryptedAloneSaveFallbackKey
for {
Expand Down Expand Up @@ -2246,6 +2253,7 @@ func generateMountsModeRun(mst *initramfsMountsState) error {
opts := &secboot.UnlockVolumeUsingSealedKeyOptions{
AllowRecoveryKey: true,
WhichModel: mst.UnverifiedBootModel,
BootMode: mst.mode,
}
unlockRes, err := secbootUnlockVolumeUsingSealedKeyIfEncrypted(disk, "ubuntu-data", runModeKey, opts)
if err != nil {
Expand Down
23 changes: 23 additions & 0 deletions cmd/snap-bootstrap/cmd_initramfs_mounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2702,6 +2702,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRunModeEncryptedDataHappy(c *C
mod, err := opts.WhichModel()
c.Assert(err, IsNil)
c.Check(mod.Model(), Equals, "my-model")
c.Check(opts.BootMode, Equals, "run")

dataActivated = true
// return true because we are using an encrypted device
Expand Down Expand Up @@ -3921,6 +3922,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeHappyEncrypted(c *C
mod, err := opts.WhichModel()
c.Assert(err, IsNil)
c.Check(mod.Model(), Equals, "my-model")
c.Check(opts.BootMode, Equals, "recover")

dataActivated = true
return happyUnlocked("ubuntu-data", secboot.UnlockedWithSealedKey), nil
Expand Down Expand Up @@ -4063,6 +4065,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedDa
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
return foundEncrypted("ubuntu-data"), fmt.Errorf("failed to unlock ubuntu-data")

case 2:
Expand All @@ -4077,6 +4080,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedDa
mod, err := opts.WhichModel()
c.Assert(err, IsNil)
c.Check(mod.Model(), Equals, "my-model")
c.Check(opts.BootMode, Equals, "recover")

dataActivated = true
return happyUnlocked("ubuntu-data", secboot.UnlockedWithSealedKey), nil
Expand Down Expand Up @@ -4238,6 +4242,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedSa
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivated = true
return happyUnlocked("ubuntu-data", secboot.UnlockedWithSealedKey), nil

Expand All @@ -4256,6 +4261,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedSa
mod, err := opts.WhichModel()
c.Assert(err, IsNil)
c.Check(mod.Model(), Equals, "my-model")
c.Check(opts.BootMode, Equals, "recover")
dataActivated = true
return happyUnlocked("ubuntu-save", secboot.UnlockedWithSealedKey), nil
default:
Expand Down Expand Up @@ -4427,6 +4433,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedAb
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, true)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivated = true
return happyUnlocked("ubuntu-data", secboot.UnlockedWithSealedKey), nil
default:
Expand Down Expand Up @@ -4588,6 +4595,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedAb
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, true)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivated = true
// it was unlocked with a recovery key

Expand Down Expand Up @@ -4739,6 +4747,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedDa
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivationAttempts++
return foundEncrypted("ubuntu-data"), fmt.Errorf("failed to unlock ubuntu-data with run object")

Expand All @@ -4751,6 +4760,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedDa
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, true)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivationAttempts++
return foundEncrypted("ubuntu-data"), fmt.Errorf("failed to unlock ubuntu-data with fallback object")

Expand All @@ -4763,6 +4773,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedDa
c.Assert(encDevPartUUID, Equals, "ubuntu-save-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, true)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
saveActivated = true
return happyUnlocked("ubuntu-save", secboot.UnlockedWithSealedKey), nil
default:
Expand Down Expand Up @@ -4949,6 +4960,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeDegradedAbsentDataU
c.Assert(err, FitsTypeOf, disks.PartitionNotFoundError{})
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
// validity check that we can't find a normal ubuntu-data either
_, err = disk.FindMatchingPartitionUUIDWithFsLabel(name)
c.Assert(err, FitsTypeOf, disks.PartitionNotFoundError{})
Expand Down Expand Up @@ -5138,6 +5150,8 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeDegradedUnencrypted
c.Assert(err, FitsTypeOf, disks.PartitionNotFoundError{})
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")

// validity check that we can't find a normal ubuntu-data either
partUUID, err := disk.FindMatchingPartitionUUIDWithFsLabel(name)
c.Assert(err, IsNil)
Expand Down Expand Up @@ -5540,6 +5554,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedAb
c.Assert(err, FitsTypeOf, disks.PartitionNotFoundError{})
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivated = true
// data not found at all
return notFoundPart(), fmt.Errorf("error enumerating to find ubuntu-data")
Expand All @@ -5553,6 +5568,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedAb
c.Assert(encDevPartUUID, Equals, "ubuntu-save-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, true)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
saveActivated = true
return happyUnlocked("ubuntu-save", secboot.UnlockedWithSealedKey), nil
default:
Expand Down Expand Up @@ -5732,6 +5748,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedDa
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivationAttempts++
return foundEncrypted("ubuntu-data"), fmt.Errorf("failed to unlock ubuntu-data with run object")

Expand All @@ -5744,6 +5761,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedDa
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, true)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivationAttempts++
return foundEncrypted("ubuntu-data"), fmt.Errorf("failed to unlock ubuntu-data with fallback object")

Expand All @@ -5758,6 +5776,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedDegradedDa
c.Assert(encDevPartUUID, Equals, "ubuntu-save-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, true)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
saveUnsealActivationAttempted = true
return foundEncrypted("ubuntu-save"), fmt.Errorf("failed to unlock ubuntu-save with fallback object")

Expand Down Expand Up @@ -5926,6 +5945,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedMismatched
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
dataActivated = true
return happyUnlocked("ubuntu-data", secboot.UnlockedWithSealedKey), nil
})
Expand Down Expand Up @@ -6141,6 +6161,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsRecoverModeEncryptedAttackerFS
c.Assert(encDevPartUUID, Equals, "ubuntu-data-enc-partuuid")
c.Assert(opts.AllowRecoveryKey, Equals, false)
c.Assert(opts.WhichModel, NotNil)
c.Check(opts.BootMode, Equals, "recover")
activated = true
return happyUnlocked("ubuntu-data", secboot.UnlockedWithSealedKey), nil
})
Expand Down Expand Up @@ -6993,6 +7014,7 @@ func (s *initramfsMountsSuite) TestInitramfsMountsFactoryResetModeHappyEncrypted
mod, err := opts.WhichModel()
c.Assert(err, IsNil)
c.Check(mod.Model(), Equals, "my-model")
c.Check(opts.BootMode, Equals, "factory-reset")

saveActivated = true
return happyUnlocked("ubuntu-save", secboot.UnlockedWithSealedKey), nil
Expand Down Expand Up @@ -7866,6 +7888,7 @@ func (s *initramfsClassicMountsSuite) TestInitramfsMountsRunModeEncryptedDataHap
mod, err := opts.WhichModel()
c.Assert(err, IsNil)
c.Check(mod.Model(), Equals, "my-model")
c.Check(opts.BootMode, Equals, "run")

dataActivated = true
// return true because we are using an encrypted device
Expand Down
2 changes: 1 addition & 1 deletion overlord/fdestate/backend/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/snapcore/snapd/secboot"
)

func MockSecbootResealKeysWithFDESetupHook(f func(keys []secboot.KeyDataLocation, primaryKeyFile string, models []secboot.ModelForSealing) error) (restore func()) {
func MockSecbootResealKeysWithFDESetupHook(f func(keys []secboot.KeyDataLocation, primaryKeyFile string, models []secboot.ModelForSealing, bootModes []string) error) (restore func()) {
old := secbootResealKeysWithFDESetupHook
secbootResealKeysWithFDESetupHook = f
return func() {
Expand Down
4 changes: 2 additions & 2 deletions overlord/fdestate/backend/reseal.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ func doReseal(manager FDEStateManager, method device.SealingMethod, rootdir stri
case device.SealingMethodFDESetupHook:
primaryKeyFile := filepath.Join(boot.InstallHostFDESaveDir, "aux-key")
if runParams != nil {
if err := secbootResealKeysWithFDESetupHook(runKeys, primaryKeyFile, runParams.Models); err != nil {
if err := secbootResealKeysWithFDESetupHook(runKeys, primaryKeyFile, runParams.Models, runParams.BootModes); err != nil {
return err
}
}
if recoveryParams != nil {
if err := secbootResealKeysWithFDESetupHook(recoveryKeys, primaryKeyFile, recoveryParams.Models); err != nil {
if err := secbootResealKeysWithFDESetupHook(recoveryKeys, primaryKeyFile, recoveryParams.Models, recoveryParams.BootModes); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion overlord/fdestate/backend/reseal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ func (s *resealTestSuite) TestHooksResealHappy(c *C) {
}

resealCalls := 0
restore := fdeBackend.MockSecbootResealKeysWithFDESetupHook(func(keys []secboot.KeyDataLocation, primaryKeyFile string, models []secboot.ModelForSealing) error {
restore := fdeBackend.MockSecbootResealKeysWithFDESetupHook(func(keys []secboot.KeyDataLocation, primaryKeyFile string, models []secboot.ModelForSealing, bootModes []string) error {
resealCalls++

switch resealCalls {
Expand Down
5 changes: 5 additions & 0 deletions overlord/fdestate/backend/seal.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func runKeySealRequests(key secboot.BootstrappedContainer, useTokens bool) []sec
KeyName: "ubuntu-data",
SlotName: "default",
KeyFile: keyFile,
BootModes: []string{"run", "recover"},
},
}
}
Expand All @@ -83,12 +84,16 @@ func fallbackKeySealRequests(key, saveKey secboot.BootstrappedContainer, factory
KeyName: "ubuntu-data",
SlotName: "default-fallback",
KeyFile: dataFallbackKey,
// TODO:FDEM:FIX we should not not have "factory-reset" here, but for now
// we want to have the same as the pcr profile
BootModes: []string{"recover", "factory-reset"},
},
{
BootstrappedContainer: saveKey,
KeyName: "ubuntu-save",
SlotName: "default-fallback",
KeyFile: saveFallbackKey,
BootModes: []string{"recover", "factory-reset"},
},
}
}
Expand Down
6 changes: 3 additions & 3 deletions overlord/fdestate/backend/seal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (s *sealSuite) TestSealKeyForBootChains(c *C) {
// the run object seals only the ubuntu-data key
c.Check(params.TPMPolicyAuthKeyFile, Equals, filepath.Join(boot.InstallHostFDESaveDir, "tpm-policy-auth-key"))

expectedSKR := secboot.SealKeyRequest{BootstrappedContainer: myKey, KeyName: "ubuntu-data", SlotName: "default"}
expectedSKR := secboot.SealKeyRequest{BootstrappedContainer: myKey, KeyName: "ubuntu-data", SlotName: "default", BootModes: []string{"run", "recover"}}
if tc.disableTokens {
expectedSKR.KeyFile = filepath.Join(rootdir, "run/mnt/ubuntu-boot/device/fde/ubuntu-data.sealed-key")
}
Expand All @@ -179,8 +179,8 @@ func (s *sealSuite) TestSealKeyForBootChains(c *C) {
// the fallback object seals the ubuntu-data and the ubuntu-save keys
c.Check(params.TPMPolicyAuthKeyFile, Equals, "")

expectedDataSKR := secboot.SealKeyRequest{BootstrappedContainer: myKey, KeyName: "ubuntu-data", SlotName: "default-fallback"}
expectedSaveSKR := secboot.SealKeyRequest{BootstrappedContainer: myKey2, KeyName: "ubuntu-save", SlotName: "default-fallback"}
expectedDataSKR := secboot.SealKeyRequest{BootstrappedContainer: myKey, KeyName: "ubuntu-data", SlotName: "default-fallback", BootModes: []string{"recover", "factory-reset"}}
expectedSaveSKR := secboot.SealKeyRequest{BootstrappedContainer: myKey2, KeyName: "ubuntu-save", SlotName: "default-fallback", BootModes: []string{"recover", "factory-reset"}}
if tc.disableTokens {
expectedDataSKR.KeyFile = filepath.Join(rootdir, "run/mnt/ubuntu-seed/device/fde/ubuntu-data.recovery.sealed-key")
if tc.factoryReset {
Expand Down
4 changes: 4 additions & 0 deletions secboot/secboot.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ type SealKeyRequest struct {
// The file to store the key data. If empty, the key data will
// be saved to the token.
KeyFile string
// The boot modes allow (i.e. snapd_recovery_mode kernel parameter)
BootModes []string
}

// ModelForSealing provides information about the model for use in the context
Expand Down Expand Up @@ -193,6 +195,8 @@ type UnlockVolumeUsingSealedKeyOptions struct {
// WhichModel if invoked should return the device model
// assertion for which the disk is being unlocked.
WhichModel func() (*asserts.Model, error)
// BootMode is the current boot mode (i.e. snapd_recovery_mode kernel parameter)
BootMode string
}

// UnlockMethod is the method that was used to unlock a volume.
Expand Down
2 changes: 1 addition & 1 deletion secboot/secboot_dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func VerifyPrimaryKeyDigest(devicePath string, alg crypto.Hash, salt []byte, dig
return false, errBuildWithoutSecboot
}

func ResealKeysWithFDESetupHook(keys []KeyDataLocation, primaryKeyFile string, models []ModelForSealing) error {
func ResealKeysWithFDESetupHook(keys []KeyDataLocation, primaryKeyFile string, models []ModelForSealing, bootModes []string) error {
return errBuildWithoutSecboot
}

Expand Down
13 changes: 11 additions & 2 deletions secboot/secboot_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func SealKeysWithFDESetupHook(runHook fde.RunSetupHookFunc, keys []SealKeyReques
AuthorizedSnapModels: []sb.SnapModel{
params.Model,
},
// TODO:FDEM:FIX: add boot modes
AuthorizedBootModes: skr.BootModes,
}

protectedKey, primaryKeyOut, unlockKey, err := sb_hooks.NewProtectedKey(rand.Reader, params)
Expand Down Expand Up @@ -132,9 +132,15 @@ func setAuthorizedSnapModelsOnHooksKeydataImpl(kd *sb_hooks.KeyData, rand io.Rea

var setAuthorizedSnapModelsOnHooksKeydata = setAuthorizedSnapModelsOnHooksKeydataImpl

func setAuthorizedBootModesOnHooksKeydataImpl(kd *sb_hooks.KeyData, rand io.Reader, key sb.PrimaryKey, bootmodes ...string) error {
return kd.SetAuthorizedBootModes(rand, key, bootmodes...)
}

var setAuthorizedBootModesOnHooksKeydata = setAuthorizedBootModesOnHooksKeydataImpl

// ResealKeysWithFDESetupHook updates hook based keydatas for given
// files with a specific list of models
func ResealKeysWithFDESetupHook(keys []KeyDataLocation, primaryKeyFile string, models []ModelForSealing) error {
func ResealKeysWithFDESetupHook(keys []KeyDataLocation, primaryKeyFile string, models []ModelForSealing, bootModes []string) error {
// TODO:FDEM:FIX: load primary key from keyring when available
primaryKeyBuf, err := os.ReadFile(primaryKeyFile)
if err != nil {
Expand Down Expand Up @@ -187,6 +193,9 @@ func ResealKeysWithFDESetupHook(keys []KeyDataLocation, primaryKeyFile string, m
if err := setAuthorizedSnapModelsOnHooksKeydata(hooksKeyData, rand.Reader, primaryKey, sbModels...); err != nil {
return err
}
if err := setAuthorizedBootModesOnHooksKeydata(hooksKeyData, rand.Reader, primaryKey, bootModes...); err != nil {
return err
}
}

if err := keyData.WriteAtomic(keyDataWriter); err != nil {
Expand Down
Loading

0 comments on commit 08d8191

Please sign in to comment.