@@ -54,10 +54,19 @@ func getLeakedKeys() ([10][]byte, error) {
5454
5555type Manifest interface {}
5656
57+ type FEntry struct {
58+ Type string
59+ Address fit.Address64
60+ Offset uint64
61+ Size uint32
62+ Version fit.EntryVersion
63+ }
64+
5765type Meta struct {
5866 Keym Manifest
5967 Polm Manifest
6068 Fit []fit.Entry
69+ Entries []FEntry
6170 LeakedKey string
6271}
6372
@@ -77,8 +86,13 @@ func main() {
7786 log .Fatalf ("cannot parse input file: %v" , err )
7887 }
7988
89+ var meta Meta
90+ // TODO: the whole FIT is too verbose
91+ // meta.Fit = entries
92+
8093 var bme fit.Entry
8194 var kme fit.Entry
95+ var txte fit.Entry
8296 for idx , entry := range entries {
8397 // if entry.GetEntryBase().Headers.Type() == fit.EntryTypeStartupACModuleEntry {
8498 if entry .GetEntryBase ().Headers .Type () == fit .EntryTypeKeyManifestRecord {
@@ -89,11 +103,19 @@ func main() {
89103 bme = entry
90104 fmt .Fprintf (os .Stderr , "boot policy manifest @ %v\n " , idx )
91105 }
106+ if entry .GetEntryBase ().Headers .Type () == fit .EntryTypeTXTPolicyRecord {
107+ txte = entry
108+ fmt .Fprintf (os .Stderr , "TXT policy manifest @ %v\n " , idx )
109+ }
110+ meta .Entries = append (meta .Entries , FEntry {
111+ Type : entry .GetEntryBase ().Headers .Type ().String (),
112+ Address : entry .GetEntryBase ().Headers .Address ,
113+ Offset : entry .GetEntryBase ().Headers .Address .Offset (uint64 (len (data ))),
114+ Size : entry .GetEntryBase ().Headers .Size .Uint32 (),
115+ Version : entry .GetEntryBase ().Headers .Version ,
116+ })
92117 }
93118
94- var meta Meta
95- meta .Fit = entries
96-
97119 if bme == nil {
98120 fmt .Fprintf (os .Stderr , "no boot manifest entry\n " )
99121 } else {
@@ -184,4 +206,5 @@ func main() {
184206 if meta .LeakedKey != "" {
185207 fmt .Fprintf (os .Stderr , "LEAKED BG KEY USED: %x\n " , meta .LeakedKey )
186208 }
209+ fmt .Fprintf (os .Stderr , "TXT policy manifest @ %v\n " , txte )
187210}
0 commit comments