github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/cbnt/cbntbootpolicy/bpmh.go (about)

     1  // Copyright 2017-2021 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:generate manifestcodegen
     6  
     7  package cbntbootpolicy
     8  
     9  import (
    10  	"github.com/linuxboot/fiano/pkg/intel/metadata/cbnt"
    11  )
    12  
    13  // BPMH is the header of boot policy manifest
    14  type BPMH struct {
    15  	StructInfo `id:"__ACBP__" version:"0x23" var0:"0x20" var1:"uint16(s.TotalSize())"`
    16  
    17  	KeySignatureOffset uint16 `json:"bpmhKeySignatureOffset"`
    18  
    19  	BPMRevision uint8 `json:"bpmhRevision"`
    20  
    21  	// BPMSVN is BPM security version number
    22  	//
    23  	// PrettyString: BPM SVN
    24  	BPMSVN cbnt.SVN `json:"bpmhSNV"`
    25  
    26  	// ACMSVNAuth is authorized ACM security version number
    27  	//
    28  	// PrettyString: ACM SVN Auth
    29  	ACMSVNAuth cbnt.SVN `json:"bpmhACMSVN"`
    30  
    31  	Reserved0 [1]byte `require:"0" json:"bpmhReserved0,omitempty"`
    32  
    33  	NEMDataStack Size4K `json:"bpmhNEMStackSize"`
    34  }
    35  
    36  // Size4K is a size in units of 4096 bytes.
    37  type Size4K uint16
    38  
    39  // InBytes returns the size in bytes.
    40  func (s Size4K) InBytes() uint32 {
    41  	return uint32(s) * 4096
    42  }
    43  
    44  // NewSize4K returns the given size as multiple of 4K
    45  func NewSize4K(size uint32) Size4K {
    46  	return Size4K(size / 4096)
    47  }