...
1
2
3
4 package hcsv2
5
6 import (
7 "bytes"
8 "fmt"
9 "os"
10
11 "github.com/Microsoft/hcsshim/pkg/amdsevsnp"
12 )
13
14
15
16 func validateHostData(hostData []byte) error {
17 report, err := amdsevsnp.FetchParsedSNPReport(nil)
18 if err != nil {
19
20 if os.IsNotExist(err) {
21 return nil
22 }
23 return err
24 }
25
26 if !bytes.Equal(hostData, report.HostData) {
27 return fmt.Errorf(
28 "security policy digest %q doesn't match HostData provided at launch %q",
29 hostData,
30 report.HostData,
31 )
32 }
33 return nil
34 }
35
View as plain text