Skip to content

Commit 5e29741

Browse files
authored
[launcher] update base cos image to 125 (google#629)
Change rtmr interface to sysfs.
1 parent aab1fef commit 5e29741

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

cel/canonical_eventlog.go

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ func generateDigestMap(hashAlgos []crypto.Hash, event Content) (map[crypto.Hash]
139139
return digestsMap, nil
140140
}
141141

142-
// AppendEventRTMR appends a new RTMR record to the CEL. rtmrIndex indicates the RTMR to extend.
143-
// The index showing up in the record will be rtmrIndex + 1.
144-
func (c *CEL) AppendEventRTMR(client configfsi.Client, rtmrIndex int, event Content) error {
142+
func (c *CEL) appendEventRTMR(rtmrIndex int, event Content, extendFunc func([]byte) error) error {
145143
digestsMap, err := generateDigestMap([]crypto.Hash{crypto.SHA384}, event)
146144
if err != nil {
147145
return err
@@ -152,8 +150,7 @@ func (c *CEL) AppendEventRTMR(client configfsi.Client, rtmrIndex int, event Cont
152150
return err
153151
}
154152

155-
err = rtmr.ExtendDigestClient(client, rtmrIndex, digestsMap[crypto.SHA384])
156-
if err != nil {
153+
if err := extendFunc(digestsMap[crypto.SHA384]); err != nil {
157154
return err
158155
}
159156

@@ -169,9 +166,28 @@ func (c *CEL) AppendEventRTMR(client configfsi.Client, rtmrIndex int, event Cont
169166
return nil
170167
}
171168

169+
// AppendEventRTMRSysfs appends a new RTMR record to the CEL. rtmrIndex indicates the RTMR to extend.
170+
// The index showing up in the record will be rtmrIndex + 1.
171+
// This function uses thesysfs interface to extend the RTMR.
172+
func (c *CEL) AppendEventRTMRSysfs(rtmrIndex int, event Content) error {
173+
return c.appendEventRTMR(rtmrIndex, event, func(digest []byte) error {
174+
return rtmr.ExtendDigestSysfs(rtmrIndex, digest)
175+
})
176+
}
177+
178+
// AppendEventRTMR appends a new RTMR record to the CEL. rtmrIndex indicates the RTMR to extend.
179+
// The index showing up in the record will be rtmrIndex + 1.
180+
// This function uses the configfs interface to extend the RTMR.
181+
// Use AppendEventRTMRSysfs as the sysfs interface is available in later kernels.
182+
func (c *CEL) AppendEventRTMR(client configfsi.Client, rtmrIndex int, event Content) error {
183+
return c.appendEventRTMR(rtmrIndex, event, func(digest []byte) error {
184+
return rtmr.ExtendDigestClient(client, rtmrIndex, digest)
185+
})
186+
}
187+
172188
// AppendEvent appends a new PCR record to the CEL.
173189
//
174-
// Deprecated: Use AppendEventPCR or AppendEventRTMR directly.
190+
// Deprecated: Use AppendEventPCR or AppendEventRTMRSysfs/AppendEventRTMR directly.
175191
func (c *CEL) AppendEvent(tpm io.ReadWriteCloser, pcr int, event Content) error {
176192
return c.AppendEventPCR(tpm, pcr, event)
177193
}

launcher/agent/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func (t *tdxAttestRoot) GetCEL() *cel.CEL {
325325
}
326326

327327
func (t *tdxAttestRoot) Extend(c cel.Content) error {
328-
return t.cosCel.AppendEventRTMR(t.tsmClient, cel.CosRTMR, c)
328+
return t.cosCel.AppendEventRTMRSysfs(cel.CosRTMR, c)
329329
}
330330

331331
func (t *tdxAttestRoot) Attest(nonce []byte) (any, error) {

launcher/cloudbuild.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
substitutions:
22
'_BASE_IMAGE': '' # If left empty, will use the latest image in _BASE_IMAGE_FAMILY of _BASE_IMAGE_PROJECT
3-
'_BASE_IMAGE_FAMILY': 'cos-tdx-113-lts'
4-
'_BASE_IMAGE_PROJECT': 'confidential-vm-images'
3+
'_BASE_IMAGE_FAMILY': 'cos-125-lts'
4+
'_BASE_IMAGE_PROJECT': 'cos-cloud'
55
'_OUTPUT_IMAGE_PREFIX': 'confidential-space'
66
'_OUTPUT_IMAGE_SUFFIX': ''
77
'_OUTPUT_IMAGE_FAMILY': ''

0 commit comments

Comments
 (0)