github.com/linuxboot/fiano@v1.2.0/pkg/intel/metadata/cbnt/cbntbootpolicy/txt_control_flags.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 "fmt" 11 ) 12 13 type TXTControlFlags uint32 14 15 func (flags TXTControlFlags) ExecutionProfile() ExecutionProfile { 16 return ExecutionProfile(flags & 0x1f) 17 } 18 19 type ExecutionProfile uint8 20 21 const ( 22 ExecutionProfileA = ExecutionProfile(iota) 23 ExecutionProfileB 24 ExecutionProfileC 25 ) 26 27 // String just implements fmt.Stringer. 28 func (p ExecutionProfile) String() string { 29 switch p { 30 case ExecutionProfileA: 31 return `A (use default selection based on differentation between clients, UP, and MP servers)` 32 case ExecutionProfileB: 33 return `B (use "Server model": rely on BIOS to configure topoligy; do not use ACHECK)` 34 case ExecutionProfileC: 35 return `C (use "Client model": do not measure BIOS into D-PCRs; use ACHECK-based alias check)` 36 } 37 return fmt.Sprintf("unexpected_execution_profile_value_0x%02X", uint8(p)) 38 } 39 40 func (flags TXTControlFlags) MemoryScrubbingPolicy() MemoryScrubbingPolicy { 41 return MemoryScrubbingPolicy((flags >> 5) & 0x3) 42 } 43 44 type MemoryScrubbingPolicy uint8 45 46 const ( 47 MemoryScrubbingPolicyDefault = MemoryScrubbingPolicy(iota) 48 MemoryScrubbingPolicyBIOS 49 MemoryScrubbingPolicySACM 50 ) 51 52 // String implements fmt.Stringer. 53 func (policy MemoryScrubbingPolicy) String() string { 54 switch policy { 55 case MemoryScrubbingPolicyDefault: 56 return "BIOS if verified or backup action othersize" 57 case MemoryScrubbingPolicyBIOS: 58 return "BIOS" 59 case MemoryScrubbingPolicySACM: 60 return "S-ACM" 61 } 62 return fmt.Sprintf("unexpected_value_0x%02X", uint8(policy)) 63 } 64 65 func (flags TXTControlFlags) BackupActionPolicy() BackupActionPolicy { 66 return BackupActionPolicy((flags >> 7) & 0x3) 67 } 68 69 type BackupActionPolicy uint8 70 71 const ( 72 BackupActionPolicyDefault = BackupActionPolicy(iota) 73 BackupActionPolicyForceMemoryPowerDown 74 BackupActionPolicyForceBtGUnbreakableShutdown 75 ) 76 77 // String implements fmt.Stringer. 78 func (policy BackupActionPolicy) String() string { 79 switch policy { 80 case BackupActionPolicyDefault: 81 return "memory power down if profile D or BtG unbreakable shutdown otherwise" 82 case BackupActionPolicyForceMemoryPowerDown: 83 return "memory power down" 84 case BackupActionPolicyForceBtGUnbreakableShutdown: 85 return "BtG unbreakable shutdown" 86 } 87 return fmt.Sprintf("unexpected_value_0x%02X", uint8(policy)) 88 } 89 90 // PrettyString-true: Default setting. S-ACM is requested to extend static PCRs 91 // PrettyString-false: S-ACM is not requested to extend static PCRs 92 func (flags TXTControlFlags) IsSACMRequestedToExtendStaticPCRs() bool { 93 return (flags>>9)&0x01 == 0 94 } 95 96 func (flags TXTControlFlags) ResetAUXControl() ResetAUXControl { 97 return ResetAUXControl((flags >> 31) & 0x01) 98 } 99 100 type ResetAUXControl uint8 101 102 const ( 103 ResetAUXControlResetAUXIndex = ResetAUXControl(iota) 104 ResetAUXControlDeleteAUXIndex 105 ) 106 107 // String implements fmt.Stringer. 108 func (c ResetAUXControl) String() string { 109 switch c { 110 case ResetAUXControlResetAUXIndex: 111 return "AUX reset leaf will reset AUX index" 112 case ResetAUXControlDeleteAUXIndex: 113 return "AUX reset leaf will delete AUX index" 114 } 115 return fmt.Sprintf("unexpected_value_0x%02X", uint8(c)) 116 }