ZeroHash() public static method

Return a TpmHash of specified algorithm set to all zeroes
public static ZeroHash ( TpmAlgId alg ) : TpmHash
alg TpmAlgId
return TpmHash
Ejemplo n.º 1
0
        internal TpmHash GetNextAcePolicyDigest(TpmAlgId hashAlg)
        {
            if (NextAce == null)
            {
                if (String.IsNullOrEmpty(BranchID))
                {
                    Globs.Throw("GetNextAcePolicyDigest: Policy tree leaf must have a " +
                                "BranchIdentifier set to allow the policy to be evaluated");
                }
                return(TpmHash.ZeroHash(hashAlg));
            }

            return(NextAce.GetPolicyDigest(hashAlg));
        }
Ejemplo n.º 2
0
        internal override TpmHash GetPolicyDigest(TpmAlgId hashAlg)
        {
            int numBranches = PolicyBranches.Count;

            if (numBranches < 2 || numBranches > 8)
            {
                Globs.Throw("GetPolicyDigest: Must have between 2 and 8 branches in a PolicyOr");
            }

            var m = new Marshaller();

            m.Put(TpmHash.ZeroHash(hashAlg).HashData, "zero");
            m.Put(TpmCc.PolicyOR, "ordinal");
            foreach (PolicyAce branch in PolicyBranches)
            {
                TpmHash branchPolicyHash = branch.GetPolicyDigest(hashAlg);
                m.Put(branchPolicyHash.HashData, "h");
            }

            return(TpmHash.FromData(hashAlg, m.GetBytes()));
        }
Ejemplo n.º 3
0
 internal override TpmHash GetPolicyDigest(TpmAlgId hashAlg)
 {
     // Authorize NV results in a REPLACEMENT not an extend of the previous policy.
     return(PolicyUpdate1(TpmHash.ZeroHash(hashAlg),
                          TpmCc.PolicyAuthorizeNV, NvIndexName));
 }
Ejemplo n.º 4
0
 internal override TpmHash GetPolicyDigest(TpmAlgId hashAlg)
 {
     // Authorize results in a REPLACEMENT not an extend of the previous policy.
     return(PolicyUpdate(TpmHash.ZeroHash(hashAlg),
                         TpmCc.PolicyAuthorize, SigKeyName, PolicyRef));
 }