mirror of
https://github.com/siderolabs/talos.git
synced 2026-05-05 20:36:18 +02:00
fix: panic in reading PCR values
Fix panic in reading PCR values. Fixes: #13110 Signed-off-by: Noel Georgi <git@frezbo.dev> (cherry picked from commit c81aa125c85d3886c5b9bb4d7f77ec2def104f21)
This commit is contained in:
parent
67a34a6eb3
commit
9b8c1891bb
@ -60,7 +60,11 @@ func ReadPCR(t transport.TPM, pcr int) ([]byte, error) {
|
||||
return nil, fmt.Errorf("failed to read PCR: %w", err)
|
||||
}
|
||||
|
||||
return pcrValue.PCRValues.Digests[0].Buffer, nil
|
||||
if pcrValue != nil && len(pcrValue.PCRValues.Digests) > 0 {
|
||||
return pcrValue.PCRValues.Digests[0].Buffer, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("PCR value for PCR %d is not available", pcr)
|
||||
}
|
||||
|
||||
// PCRExtend hashes the input and extends the PCR with the hash.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user