github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/cbnt/tpm_info_list.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 cbnt
     8  
     9  // TPM2PCRExtendPolicySupport defined TPM2 PCR Extend policy support.
    10  type TPM2PCRExtendPolicySupport uint8
    11  
    12  // Possible values of TPM2PCRExtendPolicySupport
    13  const (
    14  	TPM2PCRExtendIllegal                  TPM2PCRExtendPolicySupport = 0
    15  	TPM2PCRExtendMaximumAgilityPolicy     TPM2PCRExtendPolicySupport = 1
    16  	TPM2PCRExtendMaximumPerformancePolicy TPM2PCRExtendPolicySupport = 2
    17  	TPM2PCRExtendBothPolicies             TPM2PCRExtendPolicySupport = 3
    18  )
    19  
    20  // TPMFamilySupport defines TPM family support
    21  type TPMFamilySupport uint8
    22  
    23  // IsDiscreteTPM12Supported returns true if discrete TPM1.2 is supported.
    24  // PrettyString-true:  Discrete TPM1.2 is supported
    25  // PrettyString-false: Discrete TPM1.2 is not supported
    26  func (familySupport TPMFamilySupport) IsDiscreteTPM12Supported() bool {
    27  	return familySupport&1 != 0
    28  }
    29  
    30  // IsDiscreteTPM20Supported returns true if discrete TPM2.0 is supported.
    31  // PrettyString-true:  Discrete TPM2.0 is supported
    32  // PrettyString-false: Discrete TPM2.0 is not supported
    33  func (familySupport TPMFamilySupport) IsDiscreteTPM20Supported() bool {
    34  	return familySupport&2 != 0
    35  }
    36  
    37  // IsFirmwareTPM20Supported returns true if firmware TPM2.0 is supported.
    38  // PrettyString-true:  Firmware TPM2.0 is supported
    39  // PrettyString-false: Firmware TPM2.0 is not supported
    40  func (familySupport TPMFamilySupport) IsFirmwareTPM20Supported() bool {
    41  	return familySupport&(1<<3) != 0
    42  }
    43  
    44  // TPMCapabilities defines TPM capabilities
    45  type TPMCapabilities uint32
    46  
    47  // TPM2PCRExtendPolicySupport returns TPM2PCRExtendPolicySupport
    48  func (cap TPMCapabilities) TPM2PCRExtendPolicySupport() TPM2PCRExtendPolicySupport {
    49  	return TPM2PCRExtendPolicySupport(cap & 3)
    50  }
    51  
    52  // TPMFamilySupport returns TPMFamilySupport
    53  func (cap TPMCapabilities) TPMFamilySupport() TPMFamilySupport {
    54  	return TPMFamilySupport((cap >> 2) & 15)
    55  }
    56  
    57  // TPMInfoList represents TPM capabilities supported by ACM
    58  type TPMInfoList struct {
    59  	Capabilities TPMCapabilities
    60  	Algorithms   []Algorithm
    61  }