Skip to content

Commit

Permalink
fixup! many: propagate the primary key from when we set encrypted con…
Browse files Browse the repository at this point in the history
…tainers
  • Loading branch information
valentindavid committed Dec 12, 2024
1 parent 0dad224 commit 6b5d83e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions overlord/fdestate/backend/seal.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ func fallbackKeySealRequests(key, saveKey secboot.BootstrappedContainer, factory
}
}

func sealRunObjectKeys(key secboot.BootstrappedContainer, pbc boot.PredictableBootChains, primaryKey []byte, roleToBlName map[bootloader.Role]string, pcrHandle uint32, useTokens bool) ([]byte, error) {
func sealRunObjectKeys(key secboot.BootstrappedContainer, pbc boot.PredictableBootChains, maybePrimaryKey []byte, roleToBlName map[bootloader.Role]string, pcrHandle uint32, useTokens bool) ([]byte, error) {
modelParams, err := boot.SealKeyModelParams(pbc, roleToBlName)
if err != nil {
return nil, fmt.Errorf("cannot prepare for key sealing: %v", err)
}

sealKeyParams := &secboot.SealKeysParams{
ModelParams: modelParams,
PrimaryKey: primaryKey,
PrimaryKey: maybePrimaryKey,
TPMPolicyAuthKeyFile: filepath.Join(boot.InstallHostFDESaveDir, "tpm-policy-auth-key"),
PCRPolicyCounterHandle: pcrHandle,
}
Expand All @@ -112,12 +112,12 @@ func sealRunObjectKeys(key secboot.BootstrappedContainer, pbc boot.PredictableBo
// path only unseals one object because unsealing is expensive.
// Furthermore, the run object key is stored on ubuntu-boot so that we do not
// need to continually write/read keys from ubuntu-seed.
createdPrimaryKey, err := secbootSealKeys(runKeySealRequests(key, useTokens), sealKeyParams)
primaryKey, err := secbootSealKeys(runKeySealRequests(key, useTokens), sealKeyParams)
if err != nil {
return nil, fmt.Errorf("cannot seal the encryption keys: %v", err)
}

return createdPrimaryKey, nil
return primaryKey, nil
}

func sealFallbackObjectKeys(key, saveKey secboot.BootstrappedContainer, pbc boot.PredictableBootChains, primaryKey []byte, roleToBlName map[bootloader.Role]string, factoryReset bool, pcrHandle uint32, useTokens bool) error {
Expand Down

0 comments on commit 6b5d83e

Please sign in to comment.