コード例 #1
0
ファイル: TpmConfig.cs プロジェクト: siyingpoof/TSS.MSR
 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));
 }
コード例 #2
0
ファイル: TpmConfig.cs プロジェクト: siyingpoof/TSS.MSR
 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));
 }