tpm2: ACT: Add rest of ACT code

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2019-11-26 17:05:30 -05:00 committed by Stefan Berger
parent 46c267da85
commit 569a9e03ea
4 changed files with 33 additions and 5 deletions

View File

@ -3,7 +3,7 @@
/* Platform Power Support */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
/* $Id: PowerPlat.c 1490 2019-07-26 21:13:22Z kgoldman $ */
/* $Id: PowerPlat.c 1529 2019-11-21 23:29:01Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
@ -62,6 +62,7 @@
/* C.7 PowerPlat.c */
/* C.7.1. Includes and Function Prototypes */
#include "Platform.h"
#include "PlatformACT_fp.h" /* added kgold */
#include "_TPM_Init_fp.h"
/* C.7.2. Functions */
/* C.7.2.1. _plat__Signal_PowerOn() */
@ -121,5 +122,7 @@ _plat__Signal_PowerOff(
{
// Prepare NV memory for power off
_plat__NVDisable(0);
// Disable tick ACT tick processing
_plat__ACT_EnableTicks(FALSE);
return;
}

View File

@ -3,7 +3,7 @@
/* Process the Authorization Sessions */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
/* $Id: SessionProcess.c 1493 2019-09-04 13:31:35Z kgoldman $ */
/* $Id: SessionProcess.c 1532 2019-11-26 14:28:36Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
@ -55,7 +55,7 @@
/* arising in any way out of use or reliance upon this specification or any */
/* information herein. */
/* */
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
/* */
/********************************************************************************/
@ -67,6 +67,7 @@
session area of a response */
#define SESSION_PROCESS_C
#include "Tpm.h"
#include "ACT.h"
/* 6.4.3.1 IsDAExempted() */
/* This function indicates if a handle is exempted from DA logic. A handle is exempted if it is */
/* a) a primary seed handle, */

View File

@ -3,7 +3,7 @@
/* Startup Commands */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
/* $Id: StartupCommands.c 1490 2019-07-26 21:13:22Z kgoldman $ */
/* $Id: StartupCommands.c 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
@ -61,6 +61,7 @@
/* 9.2 _TPM_Init */
#include "Tpm.h"
#include "PlatformACT_fp.h" /* added kgold */
#include "_TPM_Init_fp.h"
#include "StateMarshal.h" /* libtpms added */
// This function is used to process a _TPM_Init indication.
@ -87,6 +88,8 @@ _TPM_Init(
// Clear the flag that forces failure on self-test
g_forceFailureMode = FALSE;
#endif
// Disable the tick processing
_plat__ACT_EnableTicks(FALSE);
// Set initialization state
TPMInit();
// Set g_DRTMHandle as unassigned
@ -223,6 +226,8 @@ TPM2_Startup(
OK = OK && PCRStartup(startup, locality);
// Restore/Initialize command audit information
OK = OK && CommandAuditStartup(startup);
// Restore the ACT
OK = OK && ActStartup(startup);
//// The following code was moved from Time.c where it made no sense
if (OK)
{
@ -303,6 +308,8 @@ TPM2_Shutdown(
gp.orderlyState = in->shutdownType;
// PCR private date state save
PCRStateSave(in->shutdownType);
// Save the ACT state
ActShutdown(in->shutdownType);
// Save RAM backed NV index data
NvUpdateIndexOrderlyData();
#if ACCUMULATE_SELF_HEAL_TIMER

View File

@ -3,7 +3,7 @@
/* Process the commands */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
/* $Id: TPMCmdp.c 1490 2019-07-26 21:13:22Z kgoldman $ */
/* $Id: TPMCmdp.c 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
@ -75,6 +75,7 @@
#include <winsock.h>
#endif
#include "Platform_fp.h"
#include "PlatformACT_fp.h"
#include "ExecCommand_fp.h"
#include "Manufacture_fp.h"
#include "_TPM_Init_fp.h"
@ -314,6 +315,22 @@ _rpc__RsaKeyCacheControl(
NOT_REFERENCED(state);
#endif
}
#define TPM_RH_ACT_0 0x40000110
/* D.4.2.15. _rpc__ACT_GetSignaled() */
/* This function is used to count the ACT second tick. */
BOOL
_rpc__ACT_GetSignaled(
UINT32 actHandle
)
{
// If TPM power is on
if (s_isPowerOn)
// Query the platform
return _plat__ACT_GetSignaled(actHandle - TPM_RH_ACT_0);
return FALSE;
}
#endif /* libtpms added */
/* libtpms added begin */