Coverage Report

Created: 2025-07-18 06:04

/src/tpm2/PolicyAuthValue.c
Line
Count
Source (jump to first uncovered line)
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 "PolicyAuthValue_fp.h"
10
#include "Policy_spt_fp.h"
11
TPM_RC
12
TPM2_PolicyAuthValue(
13
   PolicyAuthValue_In    *in            // IN: input parameter list
14
   )
15
0
{
16
0
   SESSION               *session;
17
0
   TPM_CC                 commandCode = TPM_CC_PolicyAuthValue;
18
0
   HASH_STATE             hashState;
19
20
// Internal Data Update
21
22
   // Get pointer to the session structure
23
0
   session = SessionGet(in->policySession);
24
25
   // Update policy hash
26
   // policyDigestnew = hash(policyDigestold || TPM_CC_PolicyAuthValue)
27
   //   Start hash
28
0
   CryptStartHash(session->authHashAlg, &hashState);
29
30
   // add old digest
31
0
   CryptUpdateDigest2B(&hashState, &session->u2.policyDigest.b);
32
33
   // add commandCode
34
0
   CryptUpdateDigestInt(&hashState, sizeof(TPM_CC), &commandCode);
35
36
   // complete the hash and get the results
37
0
   CryptCompleteHash2B(&hashState, &session->u2.policyDigest.b);
38
39
   // update isAuthValueNeeded bit in the session context
40
0
   session->attributes.isAuthValueNeeded = SET;
41
0
   session->attributes.isPasswordNeeded = CLEAR;
42
43
0
   return TPM_RC_SUCCESS;
44
0
}