1 // This file was extracted from the TCG Published 2 // Trusted Platform Module Library 3 // Part 3: Commands 4 // Family "2.0" 5 // Level 00 Revision 01.16 6 // October 30, 2014 7 8 #include "InternalRoutines.h" 9 #include "PolicyPhysicalPresence_fp.h" 10 TPM_RC TPM2_PolicyPhysicalPresence(PolicyPhysicalPresence_In * in)11TPM2_PolicyPhysicalPresence( 12 PolicyPhysicalPresence_In *in // IN: input parameter list 13 ) 14 { 15 SESSION *session; 16 TPM_CC commandCode = TPM_CC_PolicyPhysicalPresence; 17 HASH_STATE hashState; 18 19 // Internal Data Update 20 21 // Get pointer to the session structure 22 session = SessionGet(in->policySession); 23 24 // Update policy hash 25 // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyPhysicalPresence) 26 // Start hash 27 CryptStartHash(session->authHashAlg, &hashState); 28 29 // add old digest 30 CryptUpdateDigest2B(&hashState, &session->u2.policyDigest.b); 31 32 // add commandCode 33 CryptUpdateDigestInt(&hashState, sizeof(TPM_CC), &commandCode); 34 35 // complete the digest 36 CryptCompleteHash2B(&hashState, &session->u2.policyDigest.b); 37 38 // update session attribute 39 session->attributes.isPPRequired = SET; 40 41 return TPM_RC_SUCCESS; 42 } 43