github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/bg/bgbootpolicy/manifest_nocodegen.go (about)

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