public bool IsExtendablePcr(Tpm2 tpm, int pcr, int locality = 0) { byte[] extendablePcrs = ExtendablePcrs; if (locality != 0) { var props = new PtPcr[] { PtPcr.ExtendL1, PtPcr.ExtendL2, PtPcr.ExtendL3, PtPcr.ExtendL4 }; extendablePcrs = Tpm2.GetPcrProperty(tpm, props[locality - 1]); } return(Globs.IsBitSet(extendablePcrs, (int)pcr)); }
public static byte[] GetPcrProperty(Tpm2 tpm, PtPcr prop) { ICapabilitiesUnion caps; tpm.GetCapability(Cap.PcrProperties, (uint)prop, 1, out caps); TaggedPcrSelect[] props = (caps as TaggedPcrPropertyArray).pcrProperty; if (props.Length == 0) { return(null); } if (props.Length != 1) { Globs.Throw("Unexpected return from GetCapability"); } return(props[0].pcrSelect); }
public bool IsResettablePcr(Tpm2 tpm, int pcr, int locality = 0) { byte[] resettablePcrs = ResettablePcrs; if (locality == 4) { // In accordance with PTP 3.7.1: // "Note that since the hardware that performs the DRTM sequence at // Locality 4 is not capable of doing TPM2_PCR_Reset(), the TPM_PT_PCR_RESET_L4 // attribute is repurposed to indicate the initial state of the PCR(0 or - 1) // and to indicate which PCR are set to 0 by a successful DRTM Sequence. return(false); } if (locality != 0) { var props = new PtPcr[] { PtPcr.ResetL1, PtPcr.ResetL2, PtPcr.ResetL3, PtPcr.ResetL4 }; resettablePcrs = Tpm2.GetPcrProperty(tpm, props[locality - 1]); } return(Globs.IsBitSet(resettablePcrs, (int)pcr)); }
public static byte[] GetPcrProperty(Tpm2 tpm, PtPcr prop) { ICapabilitiesUnion caps; tpm.GetCapability(Cap.PcrProperties, (uint)prop, 1, out caps); TaggedPcrSelect[] props = (caps as TaggedPcrPropertyArray).pcrProperty; if (props.Length == 0) { return null; } if (props.Length != 1) { Globs.Throw("Unexpected return from GetCapability"); } return props[0].pcrSelect; }
///<param name = "the_tag">the property identifier</param> ///<param name = "the_pcrSelect">the bit map of PCR with the identified property</param> public TaggedPcrSelect( PtPcr the_tag, byte[] the_pcrSelect ) { this.tag = the_tag; this.pcrSelect = the_pcrSelect; }
public TaggedPcrSelect(TaggedPcrSelect the_TaggedPcrSelect) { if((Object) the_TaggedPcrSelect == null ) throw new ArgumentException(Globs.GetResourceString("parmError")); tag = the_TaggedPcrSelect.tag; pcrSelect = the_TaggedPcrSelect.pcrSelect; }
public TaggedPcrSelect() { tag = new PtPcr(); pcrSelect = new byte[0]; }
public TaggedPcrSelect() { tag = new PtPcr(); pcrSelect = null; }