blob: a9bb16908f981497a594512d6793448e751d1c9e [file] [log] [blame]
Vadim Bendebury56797522015-05-20 10:32:25 -07001// 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 "PCR_Reset_fp.h"
10//
11//
12// Error Returns Meaning
13//
14// TPM_RC_LOCALITY current command locality is not allowed to reset the PCR referenced
15// by pcrHandle
16//
17TPM_RC
18TPM2_PCR_Reset(
19 PCR_Reset_In *in // IN: input parameter list
20 )
21{
22 TPM_RC result;
23
24// Input Validation
25
26 // Check if the reset operation is allowed by the current command locality
27 if(!PCRIsResetAllowed(in->pcrHandle))
28 return TPM_RC_LOCALITY;
29
30 // If PCR is state saved and we need to update orderlyState, check NV
31 // availability
32 if(PCRIsStateSaved(in->pcrHandle) && gp.orderlyState != SHUTDOWN_NONE)
33 {
34 result = NvIsAvailable();
35 if(result != TPM_RC_SUCCESS)
36 return result;
37 g_clearOrderly = TRUE;
38 }
39
40// Internal Data Update
41
42 // Reset selected PCR in all banks to 0
43 PCRSetValue(in->pcrHandle, 0);
44
45 // Indicate that the PCR changed so that pcrCounter will be incremented if
46 // necessary.
47 PCRChanged(in->pcrHandle);
48
49 return TPM_RC_SUCCESS;
50}