/
manifest_nocodegen.go
57 lines (47 loc) · 1.55 KB
/
manifest_nocodegen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2017-2021 the LinuxBoot Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !manifestcodegen
// +build !manifestcodegen
//
// To avoid errors "bpm.KeySignatureOffsetTotalSize undefined" and
// "bpm.BPMH.PrettyString undefined" we place these functions to a file
// with a build tag "!manifestcodegen"
package cbntbootpolicy
import (
"fmt"
"github.com/linuxboot/fiano/pkg/intel/metadata/common/pretty"
)
func (bpm *Manifest) rehashedBPMH() BPMH {
bpmh := bpm.BPMH
bpmh.KeySignatureOffset = uint16(bpm.PMSEOffset() + bpm.PMSE.KeySignatureOffset())
return bpmh
}
// Print prints the Manifest
func (bpm Manifest) Print() {
fmt.Printf("%v", bpm.BPMH.PrettyString(1, true))
for _, item := range bpm.SE {
fmt.Printf("%v", item.PrettyString(1, true))
}
if bpm.TXTE != nil {
fmt.Printf("%v\n", bpm.TXTE.PrettyString(1, true))
} else {
fmt.Printf(" --TXTE--\n\t not set!(optional)\n")
}
if bpm.PCDE != nil {
fmt.Printf("%v\n", bpm.PCDE.PrettyString(1, true))
} else {
fmt.Println(" --PCDE-- \n\tnot set!(optional)")
}
if bpm.PME != nil {
fmt.Printf("%v\n", bpm.PME.PrettyString(1, true))
} else {
fmt.Println(" --PME--\n\tnot set!(optional)")
}
if bpm.PMSE.Signature.DataTotalSize() < 1 {
fmt.Printf("%v\n", bpm.PMSE.PrettyString(1, true, pretty.OptionOmitKeySignature(true)))
fmt.Printf(" --PMSE--\n\tBoot Policy Manifest not signed!\n\n")
} else {
fmt.Printf("%v\n", bpm.PMSE.PrettyString(1, true, pretty.OptionOmitKeySignature(false)))
}
}