| // This file was extracted from the TCG Published |
| // Trusted Platform Module Library |
| // Level 00 Revision 01.16 |
| #include "InternalRoutines.h" |
| Hash_In *in, // IN: input parameter list |
| Hash_Out *out // OUT: output parameter list |
| out->outHash.t.size = CryptStartHash(in->hashAlg, &hashState); |
| CryptUpdateDigest2B(&hashState, &in->data.b); |
| CryptCompleteHash2B(&hashState, &out->outHash.b); |
| out->validation.tag = TPM_ST_HASHCHECK; |
| out->validation.hierarchy = in->hierarchy; |
| if(in->hierarchy == TPM_RH_NULL) |
| // Ticket is not required |
| out->validation.hierarchy = TPM_RH_NULL; |
| out->validation.digest.t.size = 0; |
| else if( in->data.t.size >= sizeof(TPM_GENERATED) |
| && !TicketIsSafe(&in->data.b)) |
| out->validation.hierarchy = TPM_RH_NULL; |
| out->validation.digest.t.size = 0; |
| TicketComputeHashCheck(in->hierarchy, in->hashAlg, |
| &out->outHash, &out->validation); |