@@ -518,7 +518,7 @@ func FetchSealedVaultKey(log *base.LogObject) ([]byte, error) {
518
518
if err != nil {
519
519
return nil , fmt .Errorf ("GetRandom failed: %w" , err )
520
520
}
521
- err = SealDiskKey (key , DiskKeySealingPCRs )
521
+ err = SealDiskKey (log , key , DiskKeySealingPCRs )
522
522
if err != nil {
523
523
return nil , fmt .Errorf ("sealing the fresh disk key failed: %w" , err )
524
524
}
@@ -545,7 +545,7 @@ func FetchSealedVaultKey(log *base.LogObject) ([]byte, error) {
545
545
546
546
log .Noticef ("try to convert the legacy key into a sealed key" )
547
547
548
- err = SealDiskKey (key , DiskKeySealingPCRs )
548
+ err = SealDiskKey (log , key , DiskKeySealingPCRs )
549
549
if err != nil {
550
550
return nil , fmt .Errorf ("sealing the legacy disk key into TPM failed: %w" , err )
551
551
}
@@ -566,7 +566,7 @@ func FetchSealedVaultKey(log *base.LogObject) ([]byte, error) {
566
566
}
567
567
568
568
// SealDiskKey seals key into TPM2.0, with provided PCRs
569
- func SealDiskKey (key []byte , pcrSel tpm2.PCRSelection ) error {
569
+ func SealDiskKey (log * base. LogObject , key []byte , pcrSel tpm2.PCRSelection ) error {
570
570
rw , err := tpm2 .OpenTPM (TpmDevicePath )
571
571
if err != nil {
572
572
return err
@@ -644,7 +644,7 @@ func SealDiskKey(key []byte, pcrSel tpm2.PCRSelection) error {
644
644
645
645
// save a snapshot of current PCR values
646
646
if err := saveDiskKeySealingPCRs (savedSealingPcrsFile ); err != nil {
647
- return fmt . Errorf ("saving snapshot of sealing PCRs failed: %w " , err )
647
+ log . Warnf ("saving snapshot of sealing PCRs failed: %s " , err )
648
648
}
649
649
650
650
// Backup the previous pair of logs if any, so at most we have two pairs of
@@ -654,17 +654,17 @@ func SealDiskKey(key []byte, pcrSel tpm2.PCRSelection) error {
654
654
// current measurement log (which is same as the content of MeasurementLogSealFail)
655
655
// and lose the ability to diff and diagnose the issue.
656
656
if err := backupCopiedMeasurementLogs (); err != nil {
657
- return fmt . Errorf ("collecting previous snapshot of TPM event log failed: %w " , err )
657
+ log . Warnf ("collecting previous snapshot of TPM event log failed: %s " , err )
658
658
}
659
659
660
660
// fresh start, remove old copies of measurement logs.
661
661
if err := removeCopiedMeasurementLogs (); err != nil {
662
- return fmt . Errorf ("removing old copies of TPM measurement log failed: %w " , err )
662
+ log . Warnf ("removing old copies of TPM measurement log failed: %s " , err )
663
663
}
664
664
665
665
// save a copy of the current measurement log
666
666
if err := copyMeasurementLog (measurementLogSealSuccess ); err != nil {
667
- return fmt . Errorf ("copying current TPM measurement log failed: %w " , err )
667
+ log . Warnf ("copying current TPM measurement log failed: %s " , err )
668
668
}
669
669
670
670
return nil
0 commit comments