blob: 9495cf63a1656436ace278d5b635bcd06fd7e544 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// This file was extracted from the TCG Published
// Trusted Platform Module Library
// Part 3: Commands
// Family "2.0"
// Level 00 Revision 01.16
// October 30, 2014
#include "InternalRoutines.h"
#include "ChangePPS_fp.h"
TPM_RC
TPM2_ChangePPS(
ChangePPS_In *in // IN: input parameter list
)
{
UINT32 i;
TPM_RC result;
// Check if NV is available. A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE
// error may be returned at this point
result = NvIsAvailable();
if(result != TPM_RC_SUCCESS) return result;
// Input parameter is not reference in command action
in = NULL;
// Internal Data Update
// Reset platform hierarchy seed from RNG
CryptGenerateRandom(PRIMARY_SEED_SIZE, gp.PPSeed.t.buffer);
// Create a new phProof value from RNG to prevent the saved platform
// hierarchy contexts being loaded
CryptGenerateRandom(PROOF_SIZE, gp.phProof.t.buffer);
// Set platform authPolicy to null
gc.platformAlg = TPM_ALG_NULL;
gc.platformPolicy.t.size = 0;
// Flush loaded object in platform hierarchy
ObjectFlushHierarchy(TPM_RH_PLATFORM);
// Flush platform evict object and index in NV
NvFlushHierarchy(TPM_RH_PLATFORM);
// Save hierarchy changes to NV
NvWriteReserved(NV_PP_SEED, &gp.PPSeed);
NvWriteReserved(NV_PH_PROOF, &gp.phProof);
// Re-initialize PCR policies
for(i = 0; i < NUM_POLICY_PCR_GROUP; i++)
{
gp.pcrPolicies.hashAlg[i] = TPM_ALG_NULL;
gp.pcrPolicies.policy[i].t.size = 0;
}
NvWriteReserved(NV_PCR_POLICIES, &gp.pcrPolicies);
// orderly state should be cleared because of the update to state clear data
g_clearOrderly = TRUE;
return TPM_RC_SUCCESS;
}
|