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