Skip to content

Commit 92f2c93

Browse files
committed
Don't include the version/epoch inside the subprofile
1 parent b3ff5cc commit 92f2c93

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

snapmodel_policy.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,14 @@ func AddSnapModelProfile(profile *PCRProtectionProfile, params *SnapModelProfile
101101

102102
h := params.PCRAlgorithm.NewHash()
103103
binary.Write(h, binary.LittleEndian, uint32(0))
104-
versionDigest := h.Sum(nil)
104+
profile.ExtendPCR(params.PCRAlgorithm, params.PCRIndex, h.Sum(nil))
105105

106106
var subProfiles []*PCRProtectionProfile
107107
for _, model := range params.Models {
108108
if model == nil {
109109
return errors.New("nil model")
110110
}
111111

112-
subProfile := NewPCRProtectionProfile().ExtendPCR(params.PCRAlgorithm, params.PCRIndex, versionDigest)
113-
114112
signKeyId, err := base64.RawURLEncoding.DecodeString(model.SignKeyID())
115113
if err != nil {
116114
return xerrors.Errorf("cannot decode signing key ID: %w", err)
@@ -135,7 +133,7 @@ func AddSnapModelProfile(profile *PCRProtectionProfile, params *SnapModelProfile
135133
h.Write([]byte(model.Series()))
136134
h.Write([]byte{grade})
137135

138-
subProfiles = append(subProfiles, subProfile.ExtendPCR(params.PCRAlgorithm, params.PCRIndex, h.Sum(nil)))
136+
subProfiles = append(subProfiles, NewPCRProtectionProfile().ExtendPCR(params.PCRAlgorithm, params.PCRIndex, h.Sum(nil)))
139137
}
140138

141139
profile.AddProfileOR(subProfiles...)

0 commit comments

Comments
 (0)