-
Notifications
You must be signed in to change notification settings - Fork 292
Expand file tree
/
Copy pathAsaNvIndex.cs
More file actions
229 lines (191 loc) · 7 KB
/
AsaNvIndex.cs
File metadata and controls
229 lines (191 loc) · 7 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
using ProtoBuf;
using System.Collections.Generic;
using Tpm2Lib;
namespace Microsoft.CST.AttackSurfaceAnalyzer.Objects
{
[ProtoContract]
public class AsaNvIndex
{
[ProtoMember(1)]
public NvAttr Attributes { get; set; }
// These are all derived properties of the NvAttr flags. Separating them like this allows analysis
// rules to be written against them
public bool AuthRead { get { return Attributes.HasFlag(NvAttr.Authread); } }
public bool AuthWrite { get { return Attributes.HasFlag(NvAttr.Authwrite); } }
public bool Bits { get { return Attributes.HasFlag(NvAttr.Bits); } }
public bool ClearStClear { get { return Attributes.HasFlag(NvAttr.ClearStclear); } }
public bool Counter { get { return Attributes.HasFlag(NvAttr.Counter); } }
public bool Extend { get { return Attributes.HasFlag(NvAttr.Extend); } }
public bool GlobalLock { get { return Attributes.HasFlag(NvAttr.Globallock); } }
[ProtoMember(2)]
public uint Index { get; set; }
public bool NoDa { get { return Attributes.HasFlag(NvAttr.NoDa); } }
public bool None { get { return Attributes.HasFlag(NvAttr.None); } }
public bool Orderly { get { return Attributes.HasFlag(NvAttr.Orderly); } }
public bool Ordinary { get { return Attributes.HasFlag(NvAttr.Ordinary); } }
public bool OwnerRead { get { return Attributes.HasFlag(NvAttr.Ownerread); } }
public bool OwnerWrite { get { return Attributes.HasFlag(NvAttr.Ownerwrite); } }
public bool PinFail { get { return Attributes.HasFlag(NvAttr.PinFail); } }
public bool PinPass { get { return Attributes.HasFlag(NvAttr.PinPass); } }
public bool PlatformCreate { get { return Attributes.HasFlag(NvAttr.Platformcreate); } }
public bool PolicyDelete { get { return Attributes.HasFlag(NvAttr.PolicyDelete); } }
public bool PolicyRead { get { return Attributes.HasFlag(NvAttr.Policyread); } }
public bool PolicyWrite { get { return Attributes.HasFlag(NvAttr.Policywrite); } }
public bool Ppread { get { return Attributes.HasFlag(NvAttr.Ppread); } }
public bool Ppwrite { get { return Attributes.HasFlag(NvAttr.Ppwrite); } }
public bool ReadLocked { get { return Attributes.HasFlag(NvAttr.Readlocked); } }
public bool ReadStClear { get { return Attributes.HasFlag(NvAttr.ReadStclear); } }
public bool TpmNtBit0 { get { return Attributes.HasFlag(NvAttr.TpmNtBit0); } }
public bool TpmNtBit1 { get { return Attributes.HasFlag(NvAttr.TpmNtBit1); } }
public bool TpmNtBit2 { get { return Attributes.HasFlag(NvAttr.TpmNtBit2); } }
public bool TpmNtBit3 { get { return Attributes.HasFlag(NvAttr.TpmNtBit3); } }
public bool TpmNtBitLength { get { return Attributes.HasFlag(NvAttr.TpmNtBitLength); } }
public bool TpmNtBitMask { get { return Attributes.HasFlag(NvAttr.TpmNtBitMask); } }
public bool TpmNtBitOffset { get { return Attributes.HasFlag(NvAttr.TpmNtBitOffset); } }
[ProtoMember(3)]
public List<byte>? value { get; set; }
public bool Writeall { get { return Attributes.HasFlag(NvAttr.Writeall); } }
public bool Writedefine { get { return Attributes.HasFlag(NvAttr.Writedefine); } }
public bool Writelocked { get { return Attributes.HasFlag(NvAttr.Writelocked); } }
public bool WriteStclear { get { return Attributes.HasFlag(NvAttr.WriteStclear); } }
public bool Written { get { return Attributes.HasFlag(NvAttr.Written); } }
// Don't serialize any of these derived properties
public static bool ShouldSerializeAuthRead() { return false; }
public static bool ShouldSerializeAuthWrite()
{
return false;
}
public static bool ShouldSerializeBits()
{
return false;
}
public static bool ShouldSerializeClearStClear()
{
return false;
}
public static bool ShouldSerializeCounter()
{
return false;
}
public static bool ShouldSerializeExtend()
{
return false;
}
public static bool ShouldSerializeGlobalLock()
{
return false;
}
public static bool ShouldSerializeNoDa()
{
return false;
}
public static bool ShouldSerializeNone()
{
return false;
}
public static bool ShouldSerializeOrderly()
{
return false;
}
public static bool ShouldSerializeOrdinary()
{
return false;
}
public static bool ShouldSerializeOwnerRead()
{
return false;
}
public static bool ShouldSerializeOwnerWrite()
{
return false;
}
public static bool ShouldSerializePinFail()
{
return false;
}
public static bool ShouldSerializePinPass()
{
return false;
}
public static bool ShouldSerializePlatformCreate()
{
return false;
}
public static bool ShouldSerializePolicyDelete()
{
return false;
}
public static bool ShouldSerializePolicyRead()
{
return false;
}
public static bool ShouldSerializePolicyWrite()
{
return false;
}
public static bool ShouldSerializePpread()
{
return false;
}
public static bool ShouldSerializePpwrite()
{
return false;
}
public static bool ShouldSerializeReadLocked()
{
return false;
}
public static bool ShouldSerializeReadStClear()
{
return false;
}
public static bool ShouldSerializeTpmNtBit0()
{
return false;
}
public static bool ShouldSerializeTpmNtBit1()
{
return false;
}
public static bool ShouldSerializeTpmNtBit2()
{
return false;
}
public static bool ShouldSerializeTpmNtBit3()
{
return false;
}
public static bool ShouldSerializeTpmNtBitLength()
{
return false;
}
public static bool ShouldSerializeTpmNtBitMask()
{
return false;
}
public static bool ShouldSerializeTpmNtBitOffset()
{
return false;
}
public static bool ShouldSerializeWriteall()
{
return false;
}
public static bool ShouldSerializeWritedefine()
{
return false;
}
public static bool ShouldSerializeWritelocked()
{
return false;
}
public static bool ShouldSerializeWriteStclear()
{
return false;
}
public static bool ShouldSerializeWritten()
{
return false;
}
}
}