Disable ACT via the TpmProfile.h's RH_ACT_{0,1,A) settings of NO.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
libtpms_tpm2_la_CFLAGS += -DTPM_LIBTPMS_CALLBACKS
libtpms_tpm2_la_SOURCES = \
+ tpm2/ACTCommands.c \
tpm2/AlgorithmCap.c \
tpm2/AlgorithmTests.c \
tpm2/AsymmetricCommands.c \
tpm2/crypto/CryptSym_fp.h \
tpm2/crypto/CryptTest.h \
tpm2/crypto/CryptUtil_fp.h \
+ tpm2/ACT.h \
+ tpm2/ACT_spt_fp.h \
+ tpm2/ACT_SetTimeout_fp.h \
tpm2/ActivateCredential_fp.h \
tpm2/AlgorithmCap_fp.h \
tpm2/AlgorithmTests_fp.h \
tpm2/PCR_SetAuthPolicy_fp.h \
tpm2/PCR_SetAuthValue_fp.h \
tpm2/Platform.h \
+ tpm2/PlatformACT.h \
+ tpm2/PlatformACT_fp.h \
tpm2/PlatformClock.h \
tpm2/PlatformData.h \
tpm2/Platform_fp.h \
--- /dev/null
+/********************************************************************************/
+/* */
+/* Authenticated Countdown Timer */
+/* Written by Ken Goldman */
+/* IBM Thomas J. Watson Research Center */
+/* $Id$ */
+/* */
+/* Licenses and Notices */
+/* */
+/* 1. Copyright Licenses: */
+/* */
+/* - Trusted Computing Group (TCG) grants to the user of the source code in */
+/* this specification (the "Source Code") a worldwide, irrevocable, */
+/* nonexclusive, royalty free, copyright license to reproduce, create */
+/* derivative works, distribute, display and perform the Source Code and */
+/* derivative works thereof, and to grant others the rights granted herein. */
+/* */
+/* - The TCG grants to the user of the other parts of the specification */
+/* (other than the Source Code) the rights to reproduce, distribute, */
+/* display, and perform the specification solely for the purpose of */
+/* developing products based on such documents. */
+/* */
+/* 2. Source Code Distribution Conditions: */
+/* */
+/* - Redistributions of Source Code must retain the above copyright licenses, */
+/* this list of conditions and the following disclaimers. */
+/* */
+/* - Redistributions in binary form must reproduce the above copyright */
+/* licenses, this list of conditions and the following disclaimers in the */
+/* documentation and/or other materials provided with the distribution. */
+/* */
+/* 3. Disclaimers: */
+/* */
+/* - THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF */
+/* LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH */
+/* RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES) */
+/* THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE. */
+/* Contact TCG Administration (admin@trustedcomputinggroup.org) for */
+/* information on specification licensing rights available through TCG */
+/* membership agreements. */
+/* */
+/* - THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED */
+/* WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR */
+/* FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR */
+/* NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY */
+/* OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. */
+/* */
+/* - Without limitation, TCG and its members and licensors disclaim all */
+/* liability, including liability for infringement of any proprietary */
+/* rights, relating to use of information in this specification and to the */
+/* implementation of this specification, and TCG disclaims all liability for */
+/* cost of procurement of substitute goods or services, lost profits, loss */
+/* of use, loss of data or any incidental, consequential, direct, indirect, */
+/* or special damages, whether under contract, tort, warranty or otherwise, */
+/* arising in any way out of use or reliance upon this specification or any */
+/* information herein. */
+/* */
+/* (c) Copyright IBM Corp. and others, 2019 */
+/* */
+/********************************************************************************/
+
+// 5.24 ACT.h
+
+#ifndef _ACT_H_
+#define _ACT_H_
+#include "TpmProfile.h"
+#if !(defined RH_ACT_0) || (RH_ACT_0 != YES)
+# undef RH_ACT_0
+# define RH_ACT_0 NO
+# define IF_ACT_0_IMPLEMENTED(op)
+#else
+# define IF_ACT_0_IMPLEMENTED(op) op(0)
+#endif
+#if !(defined RH_ACT_1) || (RH_ACT_1 != YES)
+# undef RH_ACT_1
+# define RH_ACT_1 NO
+# define IF_ACT_1_IMPLEMENTED(op)
+#else
+# define IF_ACT_1_IMPLEMENTED(op) op(1)
+#endif
+#if !(defined RH_ACT_2) || (RH_ACT_2 != YES)
+# undef RH_ACT_2
+# define RH_ACT_2 NO
+# define IF_ACT_2_IMPLEMENTED(op)
+#else
+# define IF_ACT_2_IMPLEMENTED(op) op(2)
+#endif
+#if !(defined RH_ACT_3) || (RH_ACT_3 != YES)
+# undef RH_ACT_3
+# define RH_ACT_3 NO
+# define IF_ACT_3_IMPLEMENTED(op)
+#else
+# define IF_ACT_3_IMPLEMENTED(op) op(3)
+#endif
+#if !(defined RH_ACT_4) || (RH_ACT_4 != YES)
+# undef RH_ACT_4
+# define RH_ACT_4 NO
+# define IF_ACT_4_IMPLEMENTED(op)
+#else
+# define IF_ACT_4_IMPLEMENTED(op) op(4)
+#endif
+#if !(defined RH_ACT_5) || (RH_ACT_5 != YES)
+# undef RH_ACT_5
+# define RH_ACT_5 NO
+# define IF_ACT_5_IMPLEMENTED(op)
+#else
+# define IF_ACT_5_IMPLEMENTED(op) op(5)
+#endif
+#if !(defined RH_ACT_6) || (RH_ACT_6 != YES)
+# undef RH_ACT_6
+# define RH_ACT_6 NO
+# define IF_ACT_6_IMPLEMENTED(op)
+#else
+# define IF_ACT_6_IMPLEMENTED(op) op(6)
+#endif
+#if !(defined RH_ACT_7) || (RH_ACT_7 != YES)
+# undef RH_ACT_7
+# define RH_ACT_7 NO
+# define IF_ACT_7_IMPLEMENTED(op)
+#else
+# define IF_ACT_7_IMPLEMENTED(op) op(7)
+#endif
+#if !(defined RH_ACT_8) || (RH_ACT_8 != YES)
+# undef RH_ACT_8
+# define RH_ACT_8 NO
+# define IF_ACT_8_IMPLEMENTED(op)
+#else
+# define IF_ACT_8_IMPLEMENTED(op) op(8)
+#endif
+#if !(defined RH_ACT_9) || (RH_ACT_9 != YES)
+# undef RH_ACT_9
+# define RH_ACT_9 NO
+# define IF_ACT_9_IMPLEMENTED(op)
+#else
+# define IF_ACT_9_IMPLEMENTED(op) op(9)
+#endif
+#if !(defined RH_ACT_A) || (RH_ACT_A != YES)
+# undef RH_ACT_A
+# define RH_ACT_A NO
+# define IF_ACT_A_IMPLEMENTED(op)
+#else
+# define IF_ACT_A_IMPLEMENTED(op) op(A)
+#endif
+#if !(defined RH_ACT_B) || (RH_ACT_B != YES)
+# undef RH_ACT_B
+# define RH_ACT_B NO
+# define IF_ACT_B_IMPLEMENTED(op)
+#else
+# define IF_ACT_B_IMPLEMENTED(op) op(B)
+#endif
+#if !(defined RH_ACT_C) || (RH_ACT_C != YES)
+# undef RH_ACT_C
+# define RH_ACT_C NO
+# define IF_ACT_C_IMPLEMENTED(op)
+#else
+# define IF_ACT_C_IMPLEMENTED(op) op(C)
+#endif
+#if !(defined RH_ACT_D) || (RH_ACT_D != YES)
+# undef RH_ACT_D
+# define RH_ACT_D NO
+# define IF_ACT_D_IMPLEMENTED(op)
+#else
+# define IF_ACT_D_IMPLEMENTED(op) op(D)
+#endif
+#if !(defined RH_ACT_E) || (RH_ACT_E != YES)
+# undef RH_ACT_E
+# define RH_ACT_E NO
+# define IF_ACT_E_IMPLEMENTED(op)
+#else
+# define IF_ACT_E_IMPLEMENTED(op) op(E)
+#endif
+#if !(defined RH_ACT_F) || (RH_ACT_F != YES)
+# undef RH_ACT_F
+# define RH_ACT_F NO
+# define IF_ACT_F_IMPLEMENTED(op)
+#else
+# define IF_ACT_F_IMPLEMENTED(op) op(F)
+#endif
+#ifndef TPM_RH_ACT_0
+#error Need numeric definition for TPM_RH_ACT_0
+#endif
+#ifndef TPM_RH_ACT_1
+# define TPM_RH_ACT_1 (TPM_RH_ACT_0 + 1)
+#endif
+#ifndef TPM_RH_ACT_2
+# define TPM_RH_ACT_2 (TPM_RH_ACT_0 + 2)
+#endif
+#ifndef TPM_RH_ACT_3
+# define TPM_RH_ACT_3 (TPM_RH_ACT_0 + 3)
+#endif
+#ifndef TPM_RH_ACT_4
+# define TPM_RH_ACT_4 (TPM_RH_ACT_0 + 4)
+#endif
+#ifndef TPM_RH_ACT_5
+# define TPM_RH_ACT_5 (TPM_RH_ACT_0 + 5)
+#endif
+#ifndef TPM_RH_ACT_6
+# define TPM_RH_ACT_6 (TPM_RH_ACT_0 + 6)
+#endif
+#ifndef TPM_RH_ACT_7
+# define TPM_RH_ACT_7 (TPM_RH_ACT_0 + 7)
+#endif
+#ifndef TPM_RH_ACT_8
+# define TPM_RH_ACT_8 (TPM_RH_ACT_0 + 8)
+#endif
+#ifndef TPM_RH_ACT_9
+# define TPM_RH_ACT_9 (TPM_RH_ACT_0 + 9)
+#endif
+#ifndef TPM_RH_ACT_A
+# define TPM_RH_ACT_A (TPM_RH_ACT_0 + 0xA)
+#endif
+#ifndef TPM_RH_ACT_B
+# define TPM_RH_ACT_B (TPM_RH_ACT_0 + 0xB)
+#endif
+#ifndef TPM_RH_ACT_C
+# define TPM_RH_ACT_C (TPM_RH_ACT_0 + 0xC)
+#endif
+#ifndef TPM_RH_ACT_D
+# define TPM_RH_ACT_D (TPM_RH_ACT_0 + 0xD)
+#endif
+#ifndef TPM_RH_ACT_E
+# define TPM_RH_ACT_E (TPM_RH_ACT_0 + 0xE)
+#endif
+#ifndef TPM_RH_ACT_F
+# define TPM_RH_ACT_F (TPM_RH_ACT_0 + 0xF)
+#endif
+#define FOR_EACH_ACT(op) \
+ IF_ACT_0_IMPLEMENTED(op) \
+ IF_ACT_1_IMPLEMENTED(op) \
+ IF_ACT_2_IMPLEMENTED(op) \
+ IF_ACT_3_IMPLEMENTED(op) \
+ IF_ACT_4_IMPLEMENTED(op) \
+ IF_ACT_5_IMPLEMENTED(op) \
+ IF_ACT_6_IMPLEMENTED(op) \
+ IF_ACT_7_IMPLEMENTED(op) \
+ IF_ACT_8_IMPLEMENTED(op) \
+ IF_ACT_9_IMPLEMENTED(op) \
+ IF_ACT_A_IMPLEMENTED(op) \
+ IF_ACT_B_IMPLEMENTED(op) \
+ IF_ACT_C_IMPLEMENTED(op) \
+ IF_ACT_D_IMPLEMENTED(op) \
+ IF_ACT_E_IMPLEMENTED(op) \
+ IF_ACT_F_IMPLEMENTED(op)
+
+// This is the mask for ACT that are implemented
+
+//#define ACT_MASK(N) | (1 << 0x##N)
+//#define ACT_IMPLEMENTED_MASK (0 FOR_EACH_ACT(ACT_MASK))
+#define CASE_ACT_HANDLE(N) case TPM_RH_ACT_##N:
+#define CASE_ACT_NUMBER(N) case 0x##N:
+typedef struct ACT_STATE
+{
+ UINT32 remaining;
+ TPM_ALG_ID hashAlg;
+ TPM2B_DIGEST authPolicy;
+} ACT_STATE, *P_ACT_STATE;
+#endif // _ACT_H_
--- /dev/null
+/********************************************************************************/
+/* */
+/* Authenticated COuntdown Timer Commands */
+/* Written by Ken Goldman */
+/* IBM Thomas J. Watson Research Center */
+/* $Id$ */
+/* */
+/* Licenses and Notices */
+/* */
+/* 1. Copyright Licenses: */
+/* */
+/* - Trusted Computing Group (TCG) grants to the user of the source code in */
+/* this specification (the "Source Code") a worldwide, irrevocable, */
+/* nonexclusive, royalty free, copyright license to reproduce, create */
+/* derivative works, distribute, display and perform the Source Code and */
+/* derivative works thereof, and to grant others the rights granted herein. */
+/* */
+/* - The TCG grants to the user of the other parts of the specification */
+/* (other than the Source Code) the rights to reproduce, distribute, */
+/* display, and perform the specification solely for the purpose of */
+/* developing products based on such documents. */
+/* */
+/* 2. Source Code Distribution Conditions: */
+/* */
+/* - Redistributions of Source Code must retain the above copyright licenses, */
+/* this list of conditions and the following disclaimers. */
+/* */
+/* - Redistributions in binary form must reproduce the above copyright */
+/* licenses, this list of conditions and the following disclaimers in the */
+/* documentation and/or other materials provided with the distribution. */
+/* */
+/* 3. Disclaimers: */
+/* */
+/* - THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF */
+/* LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH */
+/* RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES) */
+/* THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE. */
+/* Contact TCG Administration (admin@trustedcomputinggroup.org) for */
+/* information on specification licensing rights available through TCG */
+/* membership agreements. */
+/* */
+/* - THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED */
+/* WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR */
+/* FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR */
+/* NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY */
+/* OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. */
+/* */
+/* - Without limitation, TCG and its members and licensors disclaim all */
+/* liability, including liability for infringement of any proprietary */
+/* rights, relating to use of information in this specification and to the */
+/* implementation of this specification, and TCG disclaims all liability for */
+/* cost of procurement of substitute goods or services, lost profits, loss */
+/* of use, loss of data or any incidental, consequential, direct, indirect, */
+/* or special damages, whether under contract, tort, warranty or otherwise, */
+/* arising in any way out of use or reliance upon this specification or any */
+/* information herein. */
+/* */
+/* (c) Copyright IBM Corp. and others, 2019 */
+/* */
+/********************************************************************************/
+
+#include "Tpm.h"
+#include "ACT_SetTimeout_fp.h"
+#if CC_ACT_SetTimeout // Conditional expansion of this file
+
+/* Error Returns Meaning */
+/* TPM_RC_RETRY returned when an update for the selected ACT is already pending */
+/* TPM_RC_VALUE attempt to disable signaling from an ACT that has not expired */
+TPM_RC
+TPM2_ACT_SetTimeout(
+ ACT_SetTimeout_In *in // IN: input parameter list
+ )
+{
+ // If 'startTimeout' is UINT32_MAX, then this is an attempt to disable the ACT
+ // and turn off the signaling for the ACT. This is only valid if the ACT
+ // is signaling.
+ if((in->startTimeout == UINT32_MAX) && !ActGetSignaled(in->actHandle))
+ return TPM_RC_VALUE + RC_ACT_SetTimeout_startTimeout;
+ return ActCounterUpdate(in->actHandle, in->startTimeout);
+}
+#endif // CC_ACT_SetTimeout
--- /dev/null
+/********************************************************************************/\r
+/* */\r
+/* TPM2_ACT_SetTimeout Header */\r
+/* Written by Ken Goldman */\r
+/* IBM Thomas J. Watson Research Center */\r
+/* $Id$ */\r
+/* */\r
+/* Licenses and Notices */\r
+/* */\r
+/* 1. Copyright Licenses: */\r
+/* */\r
+/* - Trusted Computing Group (TCG) grants to the user of the source code in */\r
+/* this specification (the "Source Code") a worldwide, irrevocable, */\r
+/* nonexclusive, royalty free, copyright license to reproduce, create */\r
+/* derivative works, distribute, display and perform the Source Code and */\r
+/* derivative works thereof, and to grant others the rights granted herein. */\r
+/* */\r
+/* - The TCG grants to the user of the other parts of the specification */\r
+/* (other than the Source Code) the rights to reproduce, distribute, */\r
+/* display, and perform the specification solely for the purpose of */\r
+/* developing products based on such documents. */\r
+/* */\r
+/* 2. Source Code Distribution Conditions: */\r
+/* */\r
+/* - Redistributions of Source Code must retain the above copyright licenses, */\r
+/* this list of conditions and the following disclaimers. */\r
+/* */\r
+/* - Redistributions in binary form must reproduce the above copyright */\r
+/* licenses, this list of conditions and the following disclaimers in the */\r
+/* documentation and/or other materials provided with the distribution. */\r
+/* */\r
+/* 3. Disclaimers: */\r
+/* */\r
+/* - THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF */\r
+/* LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH */\r
+/* RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES) */\r
+/* THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE. */\r
+/* Contact TCG Administration (admin@trustedcomputinggroup.org) for */\r
+/* information on specification licensing rights available through TCG */\r
+/* membership agreements. */\r
+/* */\r
+/* - THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED */\r
+/* WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR */\r
+/* FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR */\r
+/* NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY */\r
+/* OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. */\r
+/* */\r
+/* - Without limitation, TCG and its members and licensors disclaim all */\r
+/* liability, including liability for infringement of any proprietary */\r
+/* rights, relating to use of information in this specification and to the */\r
+/* implementation of this specification, and TCG disclaims all liability for */\r
+/* cost of procurement of substitute goods or services, lost profits, loss */\r
+/* of use, loss of data or any incidental, consequential, direct, indirect, */\r
+/* or special damages, whether under contract, tort, warranty or otherwise, */\r
+/* arising in any way out of use or reliance upon this specification or any */\r
+/* information herein. */\r
+/* */\r
+/* (c) Copyright IBM Corp. and others, 2019 */\r
+/* */\r
+/********************************************************************************/\r
+\r
+#ifndef ACT_SETTIMEOUT_FP_H\r
+#define ACT_SETTIMEOUT_FP_H\r
+\r
+typedef struct {\r
+ TPMI_RH_ACT actHandle;\r
+ UINT32 startTimeout;\r
+} ACT_SetTimeout_In;\r
+\r
+#define RC_ACT_SetTimeout_actHandle (TPM_RC_H + TPM_RC_1)\r
+#define RC_ACT_SetTimeout_startTimeout (TPM_RC_H + TPM_RC_2)\r
+\r
+TPM_RC\r
+TPM2_ACT_SetTimeout(\r
+ ACT_SetTimeout_In *in // IN: input parameter list\r
+ );\r
+\r
+\r
+#endif\r
--- /dev/null
+/********************************************************************************/
+/* */
+/* ACT Command Support */
+/* Written by Ken Goldman */
+/* IBM Thomas J. Watson Research Center */
+/* $Id$ */
+/* */
+/* Licenses and Notices */
+/* */
+/* 1. Copyright Licenses: */
+/* */
+/* - Trusted Computing Group (TCG) grants to the user of the source code in */
+/* this specification (the "Source Code") a worldwide, irrevocable, */
+/* nonexclusive, royalty free, copyright license to reproduce, create */
+/* derivative works, distribute, display and perform the Source Code and */
+/* derivative works thereof, and to grant others the rights granted herein. */
+/* */
+/* - The TCG grants to the user of the other parts of the specification */
+/* (other than the Source Code) the rights to reproduce, distribute, */
+/* display, and perform the specification solely for the purpose of */
+/* developing products based on such documents. */
+/* */
+/* 2. Source Code Distribution Conditions: */
+/* */
+/* - Redistributions of Source Code must retain the above copyright licenses, */
+/* this list of conditions and the following disclaimers. */
+/* */
+/* - Redistributions in binary form must reproduce the above copyright */
+/* licenses, this list of conditions and the following disclaimers in the */
+/* documentation and/or other materials provided with the distribution. */
+/* */
+/* 3. Disclaimers: */
+/* */
+/* - THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF */
+/* LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH */
+/* RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES) */
+/* THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE. */
+/* Contact TCG Administration (admin@trustedcomputinggroup.org) for */
+/* information on specification licensing rights available through TCG */
+/* membership agreements. */
+/* */
+/* - THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED */
+/* WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR */
+/* FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR */
+/* NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY */
+/* OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. */
+/* */
+/* - Without limitation, TCG and its members and licensors disclaim all */
+/* liability, including liability for infringement of any proprietary */
+/* rights, relating to use of information in this specification and to the */
+/* implementation of this specification, and TCG disclaims all liability for */
+/* cost of procurement of substitute goods or services, lost profits, loss */
+/* of use, loss of data or any incidental, consequential, direct, indirect, */
+/* or special damages, whether under contract, tort, warranty or otherwise, */
+/* arising in any way out of use or reliance upon this specification or any */
+/* information herein. */
+/* */
+/* (c) Copyright IBM Corp. and others, 2019 */
+/* */
+/********************************************************************************/
+
+#ifndef ACT_SPT_FP_H
+#define ACT_SPT_FP_H
+
+BOOL
+ActStartup(
+ STARTUP_TYPE type
+ );
+BOOL
+ActGetSignaled(
+ TPM_RH actHandle
+ );
+BOOL
+ActShutdown(
+ TPM_SU state //IN: the type of the shutdown.
+ );
+BOOL
+ActIsImplemented(
+ UINT32 act
+ );
+TPM_RC
+ActCounterUpdate(
+ TPM_RH handle, //IN: the handle of the act
+ UINT32 newValue //IN: the value to set in the ACT
+ );
+TPMI_YES_NO
+ActGetCapabilityData(
+ TPM_HANDLE actHandle, // IN: the handle for the starting ACT
+ UINT32 maxCount, // IN: maximum allowed return values
+ TPML_ACT_DATA *actList // OUT: ACT data list
+ );
+
+
+
+#endif
/* Number of capability values that will fit into the largest data buffer */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: Capabilities.h 1490 2019-07-26 21:13:22Z kgoldman $ */
+/* $Id: Capabilities.h 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* arising in any way out of use or reliance upon this specification or any */
/* information herein. */
/* */
-/* (c) Copyright IBM Corp. and others, 2016, 2017 */
+/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
/* */
/********************************************************************************/
#define MAX_PCR_PROPERTIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_PCR_SELECT))
#define MAX_ECC_CURVES (MAX_CAP_DATA / sizeof(TPM_ECC_CURVE))
#define MAX_TAGGED_POLICIES (MAX_CAP_DATA / sizeof(TPMS_TAGGED_POLICY))
+#define MAX_ACT_DATA (MAX_CAP_DATA / sizeof(TPMS_ACT_DATA))
#define MAX_AC_CAPABILITIES (MAX_CAP_DATA / sizeof(TPMS_AC_OUTPUT))
#endif
/* Command code attribute array for GetCapability */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: CommandAttributeData.h 1477 2019-06-10 19:45:40Z kgoldman $ */
+/* $Id: CommandAttributeData.h 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* 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 */
/* */
/********************************************************************************/
#if (PAD_LIST || CC_CertifyX509)
TPMA_CC_INITIALIZER(0x0197, 0, 0, 0, 0, 2, 0, 0, 0),
#endif
+#if (PAD_LIST || CC_ACT_SetTimeout)
+ TPMA_CC_INITIALIZER(0x0198, 0, 0, 0, 0, 1, 0, 0, 0),
+#endif
#if (PAD_LIST || CC_Vendor_TCG_Test)
TPMA_CC_INITIALIZER(0x0000, 0, 0, 0, 0, 0, 0, 1, 0),
#endif
(COMMAND_ATTRIBUTES)(CC_CertifyX509 * // 0x0197
(IS_IMPLEMENTED+DECRYPT_2+HANDLE_1_ADMIN+HANDLE_2_USER+ENCRYPT_2)),
#endif
+#if (PAD_LIST || CC_ACT_SetTimeout)
+ (COMMAND_ATTRIBUTES)(CC_ACT_SetTimeout * // 0x0198
+ (IS_IMPLEMENTED+HANDLE_1_USER)),
+#endif
#if (PAD_LIST || CC_Vendor_TCG_Test)
(COMMAND_ATTRIBUTES)(CC_Vendor_TCG_Test * // 0x0000
(IS_IMPLEMENTED+DECRYPT_2+ENCRYPT_2)),
#include "CryptTest.h"
#include "TpmError.h"
#include "NV.h"
+#include "ACT.h"
#include "Utils.h" // libtpms added
+
//** Defines and Types
//*** Size Types
EXTERN FailFunction *LibFailCallback;
#endif // TPM_FAIL_C
+//*****************************************************************************
+//*** From ACT_spt.c
+//*****************************************************************************
+// This value is used to indicate if an ACT has been updated since the last
+// TPM2_Startup() (one bit for each ACT). If the ACT is not updated
+// (TPM2_ACT_SetTimeout()) after a startup, then on each TPM2_Shutdown() the TPM will
+// save 1/2 of the current timer value. This prevents an attack on the ACT by saving
+// the counter and then running for a long period of time before doing a TPM Restart.
+// A quick TPM2_Shutdown() after each
+EXTERN UINT16 s_ActUpdated;
+
/* 5.9.16.9 From CommandCodeAttributes.c */
extern const TPMA_CC s_ccAttr[];
/* Include Headers for Internal Routines */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: InternalRoutines.h 1490 2019-07-26 21:13:22Z kgoldman $ */
+/* $Id: InternalRoutines.h 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* 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 */
/* */
/********************************************************************************/
#include "NVReserved_fp.h"
#include "NVDynamic_fp.h"
#include "NV_spt_fp.h"
+#include "ACT_spt_fp.h"
#include "PCR_fp.h"
#include "DA_fp.h"
#include "TpmFail_fp.h"
/* Parameter Marshaling */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: Marshal.c 1490 2019-07-26 21:13:22Z kgoldman $ */
+/* $Id: Marshal.c 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* 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 */
/* */
/********************************************************************************/
return written;
}
+/* Table 225 - Definition of (UINT32) TPM_AT Constants */
+
+UINT16
+TPM_AT_Marshal(TPM_AT *source, BYTE **buffer, INT32 *size)
+{
+ UINT16 written = 0;
+ written += UINT32_Marshal(source, buffer, size);
+ return written;
+}
+
+/* Table 227 - Definition of TPMS_AC_OUTPUT Structure <OUT> */
+
+UINT16
+TPMS_AC_OUTPUT_Marshal(TPMS_AC_OUTPUT *source, BYTE **buffer, INT32 *size)
+{
+ UINT16 written = 0;
+
+ written += TPM_AT_Marshal(&source->tag, buffer, size);
+ written += UINT32_Marshal(&source->data, buffer, size);
+ return written;
+}
+
+/* Table 228 - Definition of TPML_AC_CAPABILITIES Structure <OUT> */
+
+UINT16
+TPML_AC_CAPABILITIES_Marshal(TPML_AC_CAPABILITIES *source, BYTE **buffer, INT32 *size)
+{
+ UINT16 written = 0;
+ UINT32 i;
+
+ written += UINT32_Marshal(&source->count, buffer, size);
+ for (i = 0 ; i < source->count ; i++) {
+ written += TPMS_AC_OUTPUT_Marshal(&source->acCapabilities[i], buffer, size);
+ }
+ return written;
+}
+
/* Parameter Marshaling */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: Marshal_fp.h 1490 2019-07-26 21:13:22Z kgoldman $ */
+/* $Id: Marshal_fp.h 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* 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 */
/* */
/********************************************************************************/
TPMS_CREATION_DATA_Marshal(TPMS_CREATION_DATA *source, BYTE **buffer, INT32 *size);
UINT16
TPM2B_CREATION_DATA_Marshal(TPM2B_CREATION_DATA *source, BYTE **buffer, INT32 *size);
+ UINT16
+ TPM_AT_Marshal(TPM_AT *source, BYTE **buffer, INT32 *size);
+ UINT16
+ TPMS_AC_OUTPUT_Marshal(TPMS_AC_OUTPUT *source, BYTE **buffer, INT32 *size);
+ UINT16
+ TPML_AC_CAPABILITIES_Marshal(TPML_AC_CAPABILITIES *source, BYTE **buffer, INT32 *size);
#ifdef __cplusplus
}
/* */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: Platform.h 1490 2019-07-26 21:13:22Z kgoldman $ */
+/* $Id: Platform.h 1521 2019-11-15 21:00:47Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
#include "TPMB.h"
#include "MinMax.h"
#include "TpmProfile.h"
+#include "PlatformACT.h"
#include "PlatformClock.h"
#include "PlatformData.h"
#include "Platform_fp.h"
--- /dev/null
+/********************************************************************************/
+/* */
+/* Platform Authenticated Countdown Timer */
+/* Written by Ken Goldman */
+/* IBM Thomas J. Watson Research Center */
+/* $Id: PlatformACT.h 1531 2019-11-21 23:54:38Z kgoldman $ */
+/* */
+/* Licenses and Notices */
+/* */
+/* 1. Copyright Licenses: */
+/* */
+/* - Trusted Computing Group (TCG) grants to the user of the source code in */
+/* this specification (the "Source Code") a worldwide, irrevocable, */
+/* nonexclusive, royalty free, copyright license to reproduce, create */
+/* derivative works, distribute, display and perform the Source Code and */
+/* derivative works thereof, and to grant others the rights granted herein. */
+/* */
+/* - The TCG grants to the user of the other parts of the specification */
+/* (other than the Source Code) the rights to reproduce, distribute, */
+/* display, and perform the specification solely for the purpose of */
+/* developing products based on such documents. */
+/* */
+/* 2. Source Code Distribution Conditions: */
+/* */
+/* - Redistributions of Source Code must retain the above copyright licenses, */
+/* this list of conditions and the following disclaimers. */
+/* */
+/* - Redistributions in binary form must reproduce the above copyright */
+/* licenses, this list of conditions and the following disclaimers in the */
+/* documentation and/or other materials provided with the distribution. */
+/* */
+/* 3. Disclaimers: */
+/* */
+/* - THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF */
+/* LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH */
+/* RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES) */
+/* THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE. */
+/* Contact TCG Administration (admin@trustedcomputinggroup.org) for */
+/* information on specification licensing rights available through TCG */
+/* membership agreements. */
+/* */
+/* - THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED */
+/* WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR */
+/* FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR */
+/* NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY */
+/* OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. */
+/* */
+/* - Without limitation, TCG and its members and licensors disclaim all */
+/* liability, including liability for infringement of any proprietary */
+/* rights, relating to use of information in this specification and to the */
+/* implementation of this specification, and TCG disclaims all liability for */
+/* cost of procurement of substitute goods or services, lost profits, loss */
+/* of use, loss of data or any incidental, consequential, direct, indirect, */
+/* or special damages, whether under contract, tort, warranty or otherwise, */
+/* arising in any way out of use or reliance upon this specification or any */
+/* information herein. */
+/* */
+/* (c) Copyright IBM Corp. and others, 2019. */
+/* */
+/********************************************************************************/
+
+/* C.15 PlatformACT.h */
+
+// This file contains the definitions for the ACT macros and data types used in the ACT
+// implementation.
+
+#ifndef PLATFORMACT_H
+#define PLATFORMACT_H
+
+typedef struct ACT_DATA
+{
+ uint32_t remaining;
+ uint32_t newValue;
+ uint8_t signaled;
+ uint8_t pending;
+ uint8_t number;
+} ACT_DATA, *P_ACT_DATA;
+
+#if !(defined RH_ACT_0) || (RH_ACT_0 != YES)
+# undef RH_ACT_0
+# define RH_ACT_0 NO
+# define IF_ACT_0_IMPLEMENTED(op)
+#else
+# define IF_ACT_0_IMPLEMENTED(op) op(0)
+#endif
+#if !(defined RH_ACT_1) || (RH_ACT_1 != YES)
+# undef RH_ACT_1
+# define RH_ACT_1 NO
+# define IF_ACT_1_IMPLEMENTED(op)
+#else
+# define IF_ACT_1_IMPLEMENTED(op) op(1)
+#endif
+#if !(defined RH_ACT_2) || (RH_ACT_2 != YES)
+# undef RH_ACT_2
+# define RH_ACT_2 NO
+# define IF_ACT_2_IMPLEMENTED(op)
+#else
+# define IF_ACT_2_IMPLEMENTED(op) op(2)
+#endif
+#if !(defined RH_ACT_3) || (RH_ACT_3 != YES)
+# undef RH_ACT_3
+# define RH_ACT_3 NO
+# define IF_ACT_3_IMPLEMENTED(op)
+#else
+# define IF_ACT_3_IMPLEMENTED(op) op(3)
+#endif
+#if !(defined RH_ACT_4) || (RH_ACT_4 != YES)
+# undef RH_ACT_4
+# define RH_ACT_4 NO
+# define IF_ACT_4_IMPLEMENTED(op)
+#else
+# define IF_ACT_4_IMPLEMENTED(op) op(4)
+#endif
+#if !(defined RH_ACT_5) || (RH_ACT_5 != YES)
+# undef RH_ACT_5
+# define RH_ACT_5 NO
+# define IF_ACT_5_IMPLEMENTED(op)
+#else
+# define IF_ACT_5_IMPLEMENTED(op) op(5)
+#endif
+#if !(defined RH_ACT_6) || (RH_ACT_6 != YES)
+# undef RH_ACT_6
+# define RH_ACT_6 NO
+# define IF_ACT_6_IMPLEMENTED(op)
+#else
+# define IF_ACT_6_IMPLEMENTED(op) op(6)
+#endif
+#if !(defined RH_ACT_7) || (RH_ACT_7 != YES)
+# undef RH_ACT_7
+# define RH_ACT_7 NO
+# define IF_ACT_7_IMPLEMENTED(op)
+#else
+# define IF_ACT_7_IMPLEMENTED(op) op(7)
+#endif
+#if !(defined RH_ACT_8) || (RH_ACT_8 != YES)
+# undef RH_ACT_8
+# define RH_ACT_8 NO
+# define IF_ACT_8_IMPLEMENTED(op)
+#else
+# define IF_ACT_8_IMPLEMENTED(op) op(8)
+#endif
+#if !(defined RH_ACT_9) || (RH_ACT_9 != YES)
+# undef RH_ACT_9
+# define RH_ACT_9 NO
+# define IF_ACT_9_IMPLEMENTED(op)
+#else
+# define IF_ACT_9_IMPLEMENTED(op) op(9)
+#endif
+#if !(defined RH_ACT_A) || (RH_ACT_A != YES)
+# undef RH_ACT_A
+# define RH_ACT_A NO
+# define IF_ACT_A_IMPLEMENTED(op)
+#else
+# define IF_ACT_A_IMPLEMENTED(op) op(A)
+#endif
+#if !(defined RH_ACT_B) || (RH_ACT_B != YES)
+# undef RH_ACT_B
+# define RH_ACT_B NO
+# define IF_ACT_B_IMPLEMENTED(op)
+#else
+# define IF_ACT_B_IMPLEMENTED(op) op(B)
+#endif
+#if !(defined RH_ACT_C) || (RH_ACT_C != YES)
+# undef RH_ACT_C
+# define RH_ACT_C NO
+# define IF_ACT_C_IMPLEMENTED(op)
+#else
+# define IF_ACT_C_IMPLEMENTED(op) op(C)
+#endif
+#if !(defined RH_ACT_D) || (RH_ACT_D != YES)
+# undef RH_ACT_D
+# define RH_ACT_D NO
+# define IF_ACT_D_IMPLEMENTED(op)
+#else
+# define IF_ACT_D_IMPLEMENTED(op) op(D)
+#endif
+#if !(defined RH_ACT_E) || (RH_ACT_E != YES)
+# undef RH_ACT_E
+# define RH_ACT_E NO
+# define IF_ACT_E_IMPLEMENTED(op)
+#else
+# define IF_ACT_E_IMPLEMENTED(op) op(E)
+#endif
+#if !(defined RH_ACT_F) || (RH_ACT_F != YES)
+# undef RH_ACT_F
+# define RH_ACT_F NO
+# define IF_ACT_F_IMPLEMENTED(op)
+#else
+# define IF_ACT_F_IMPLEMENTED(op) op(F)
+#endif
+
+#define FOR_EACH_ACT(op) \
+ IF_ACT_0_IMPLEMENTED(op) \
+ IF_ACT_1_IMPLEMENTED(op) \
+ IF_ACT_2_IMPLEMENTED(op) \
+ IF_ACT_3_IMPLEMENTED(op) \
+ IF_ACT_4_IMPLEMENTED(op) \
+ IF_ACT_5_IMPLEMENTED(op) \
+ IF_ACT_6_IMPLEMENTED(op) \
+ IF_ACT_7_IMPLEMENTED(op) \
+ IF_ACT_8_IMPLEMENTED(op) \
+ IF_ACT_9_IMPLEMENTED(op) \
+ IF_ACT_A_IMPLEMENTED(op) \
+ IF_ACT_B_IMPLEMENTED(op) \
+ IF_ACT_C_IMPLEMENTED(op) \
+ IF_ACT_D_IMPLEMENTED(op) \
+ IF_ACT_E_IMPLEMENTED(op) \
+ IF_ACT_F_IMPLEMENTED(op)
+
+#endif // _PLATFORM_ACT_H_
--- /dev/null
+/********************************************************************************/
+/* */
+/* Platform Authenticated Countdown Timer */
+/* Written by Ken Goldman */
+/* IBM Thomas J. Watson Research Center */
+/* $Id: PlatformACT_fp.h 1531 2019-11-21 23:54:38Z kgoldman $ */
+/* */
+/* Licenses and Notices */
+/* */
+/* 1. Copyright Licenses: */
+/* */
+/* - Trusted Computing Group (TCG) grants to the user of the source code in */
+/* this specification (the "Source Code") a worldwide, irrevocable, */
+/* nonexclusive, royalty free, copyright license to reproduce, create */
+/* derivative works, distribute, display and perform the Source Code and */
+/* derivative works thereof, and to grant others the rights granted herein. */
+/* */
+/* - The TCG grants to the user of the other parts of the specification */
+/* (other than the Source Code) the rights to reproduce, distribute, */
+/* display, and perform the specification solely for the purpose of */
+/* developing products based on such documents. */
+/* */
+/* 2. Source Code Distribution Conditions: */
+/* */
+/* - Redistributions of Source Code must retain the above copyright licenses, */
+/* this list of conditions and the following disclaimers. */
+/* */
+/* - Redistributions in binary form must reproduce the above copyright */
+/* licenses, this list of conditions and the following disclaimers in the */
+/* documentation and/or other materials provided with the distribution. */
+/* */
+/* 3. Disclaimers: */
+/* */
+/* - THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF */
+/* LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH */
+/* RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES) */
+/* THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE. */
+/* Contact TCG Administration (admin@trustedcomputinggroup.org) for */
+/* information on specification licensing rights available through TCG */
+/* membership agreements. */
+/* */
+/* - THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED */
+/* WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR */
+/* FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR */
+/* NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY */
+/* OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. */
+/* */
+/* - Without limitation, TCG and its members and licensors disclaim all */
+/* liability, including liability for infringement of any proprietary */
+/* rights, relating to use of information in this specification and to the */
+/* implementation of this specification, and TCG disclaims all liability for */
+/* cost of procurement of substitute goods or services, lost profits, loss */
+/* of use, loss of data or any incidental, consequential, direct, indirect, */
+/* or special damages, whether under contract, tort, warranty or otherwise, */
+/* arising in any way out of use or reliance upon this specification or any */
+/* information herein. */
+/* */
+/* (c) Copyright IBM Corp. and others, 2019 */
+/* */
+/********************************************************************************/
+
+#ifndef PLATFORMACT_FP_H
+#define PLATFORMACT_FP_H
+
+LIB_EXPORT int
+_plat__ACT_GetImplemented(
+ uint32_t act
+ );
+LIB_EXPORT uint32_t
+_plat__ACT_GetRemaining(
+ uint32_t act //IN: the ACT selector
+ );
+LIB_EXPORT int
+_plat__ACT_GetSignaled(
+ uint32_t act //IN: number of ACT to check
+ );
+LIB_EXPORT void
+_plat__ACT_SetSignaled(
+ uint32_t act,
+ int on
+ );
+LIB_EXPORT int
+_plat__ACT_GetPending(
+ uint32_t act //IN: number of ACT to check
+ );
+LIB_EXPORT int
+_plat__ACT_UpdateCounter(
+ uint32_t act, // IN: ACT to update
+ uint32_t newValue // IN: the value to post
+ );
+LIB_EXPORT void
+_plat__ACT_EnableTicks(
+ int enable
+ );
+LIB_EXPORT void
+_plat__ACT_Tick(
+ void
+ );
+LIB_EXPORT int
+_plat__ACT_Initialize(
+ void
+ );
+
+#endif
EXTERN BOOL s_powerLost;
/* From Entropy.c */
EXTERN uint32_t lastEntropy;
+
+#define DEFINE_ACT(N) EXTERN ACT_DATA ACT_##N;
+FOR_EACH_ACT(DEFINE_ACT)
+EXTERN int actTicksAllowed;
+
#endif // _PLATFORM_DATA_H_
/* */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: Simulator_fp.h 1259 2018-07-10 19:11:09Z kgoldman $ */
+/* $Id: Simulator_fp.h 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* 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 */
/* */
/********************************************************************************/
_rpc__RsaKeyCacheControl(
int state
);
+/* D.4.2.15. _rpc__ACT_GetSignaled() */
+BOOL
+_rpc__ACT_GetSignaled(
+ UINT32 actHandle
+ );
+
/* D.2.3. From TPMCmds.c */
/* D.2.3.1. main() */
/* This is the main entry point for the simulator. */
#define MAX_TDES_BLOCK_SIZE_BYTES TDES_MAX_BLOCK_SIZE
// Additional values for benefit of code
#define TPM_CC_FIRST 0x0000011F
-#define TPM_CC_LAST 0x00000197
+#define TPM_CC_LAST 0x00000198
#if COMPRESSED_LISTS
#define ADD_FILL 0
#else
+ (ADD_FILL || CC_AC_Send) /* 0x00000195 */ \
+ (ADD_FILL || CC_Policy_AC_SendSelect) /* 0x00000196 */ \
+ (ADD_FILL || CC_CertifyX509) /* 0x00000197 */ \
+ + (ADD_FILL || CC_ACT_SetTimeout) /* 0x00000198 */ \
)
#define VENDOR_COMMAND_ARRAY_SIZE (0 + CC_Vendor_TCG_Test)
/* Constants Reflecting a Particular TPM Implementation (e.g. PC Client) */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: TpmProfile.h 1490 2019-07-26 21:13:22Z kgoldman $ */
+/* $Id: TpmProfile.h 1529 2019-11-21 23:29:01Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
#ifndef ECC_SM2_P256
#define ECC_SM2_P256 YES /* libtpms enabled */
#endif
+
+/* Table 0:6 - Defines for Implemented ACT */
+
+#ifndef RH_ACT_0
+#define RH_ACT_0 NO /* libtpms: no */
+#endif
+#ifndef RH_ACT_1
+#define RH_ACT_1 NO
+#endif
+#ifndef RH_ACT_A
+#define RH_ACT_A NO /* libtpms: no */
+#endif
+
// Table 0:7 - Defines for Implementation Values
#ifndef FIELD_UPGRADE_IMPLEMENTED
#define FIELD_UPGRADE_IMPLEMENTED NO
#define TDES_192 (ALG_TDES && YES)
#endif
// Table 0:5 - Defines for Implemented Commands
+#ifndef CC_ACT_SetTimeout
+#define CC_ACT_SetTimeout CC_NO /* libtpms: NO */
+#endif
#ifndef CC_AC_GetCapability
#define CC_AC_GetCapability CC_NO /* kgold */
#endif
/* TPM Size Checks */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: TpmSizeChecks.c 1519 2019-11-15 20:43:51Z kgoldman $ */
+/* $Id: TpmSizeChecks.c 1529 2019-11-21 23:29:01Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
//** Includes, Defines, and Types
#include "Tpm.h"
+#include "PlatformACT_fp.h" /* kgold */
#include "TpmSizeChecks_fp.h"
#include <stdio.h>
#include <assert.h>
/* TPM commands are communicated as BYTE streams on a TCP connection */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: TpmTcpProtocol.h 1490 2019-07-26 21:13:22Z kgoldman $ */
+/* $Id: TpmTcpProtocol.h 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* arising in any way out of use or reliance upon this specification or any */
/* information herein. */
/* */
-/* (c) Copyright IBM Corp. and others, 2016, 2017 */
+/* (c) Copyright IBM Corp. and others, 2016 - 2019 */
/* */
/********************************************************************************/
#define TPM_SESSION_END 20
#define TPM_STOP 21
#define TPM_GET_COMMAND_RESPONSE_SIZES 25
+#define TPM_ACT_GET_SIGNALED 26
#define TPM_TEST_FAILURE_MODE 30
// D.3.4. Enumerations and Structures
tpmInRawMode = 0x04,
tpmSupportsPP = 0x08
};
+
+#ifdef _MSC_VER
+# pragma warning(push, 3)
+#endif
+
// Existing RPC interface type definitions retained so that the implementation
// can be re-used
typedef struct in_buffer
uint32_t BufferSize;
_OUTPUT_BUFFER Buffer;
} _OUT_BUFFER;
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
#ifndef WIN32
typedef unsigned long DWORD;
typedef void *LPVOID;
#define TPM_CC_AC_Send (TPM_CC)(0x00000195)
#define TPM_CC_Policy_AC_SendSelect (TPM_CC)(0x00000196)
#define TPM_CC_CertifyX509 (TPM_CC)(0x00000197)
+#define TPM_CC_ACT_SetTimeout (TPM_CC)(0x00000198)
#define CC_VEND 0x20000000
#define TPM_CC_Vendor_TCG_Test (TPM_CC)(0x20000000)
#define TPM_CAP_PCR_PROPERTIES (TPM_CAP)(0x00000007)
#define TPM_CAP_ECC_CURVES (TPM_CAP)(0x00000008)
#define TPM_CAP_AUTH_POLICIES (TPM_CAP)(0x00000009)
-#define TPM_CAP_LAST (TPM_CAP)(0x00000009)
+#define TPM_CAP_ACT (TPM_CAP)(0x0000000a)
+#define TPM_CAP_LAST (TPM_CAP)(0x0000000a)
#define TPM_CAP_VENDOR_PROPERTY (TPM_CAP)(0x00000100)
/* Table 2:23 - Definition of TPM_PT Constants */
(digitalsignature << 31))
#endif // USE_BIT_FIELD_STRUCTURES
+#define TYPE_OF_TPMA_ACT UINT32
+#define TPMA_ACT_TO_UINT32(a) (*((UINT32 *)&(a)))
+#define UINT32_TO_TPMA_ACT(a) (*((TPMA_ACT *)&(a)))
+#define TPMA_ACT_TO_BYTE_ARRAY(i, a) \
+ UINT32_TO_BYTE_ARRAY((TPMA_ACT_TO_UINT32(i)), (a))
+#define BYTE_ARRAY_TO_TPMA_ACT(i, a) \
+ { UINT32 x = BYTE_ARRAY_TO_UINT32(a); i = UINT32_TO_TPMA_ACT(x); }
+#if USE_BIT_FIELD_STRUCTURES
+typedef struct TPMA_ACT { // Table 2:40
+ unsigned signaled : 1;
+ unsigned preserveSignaled : 1;
+ unsigned Reserved_bits_at_2 : 30;
+} TPMA_ACT; /* Bits */
+// This is the initializer for a TPMA_ACT structure
+#define TPMA_ACT_INITIALIZER(signaled, preservesignaled, bits_at_2) \
+ {signaled, preservesignaled, bits_at_2}
+#else // USE_BIT_FIELD_STRUCTURES
+// This implements Table 2:40 TPMA_ACT using bit masking
+typedef UINT32 TPMA_ACT;
+#define TYPE_OF_TPMA_ACT UINT32
+#define TPMA_ACT_signaled ((TPMA_ACT)1 << 0)
+#define TPMA_ACT_preserveSignaled ((TPMA_ACT)1 << 1)
+// This is the initializer for a TPMA_ACT bit array.
+#define TPMA_ACT_INITIALIZER(signaled, preservesignaled, bits_at_2) \
+ {(signaled << 0) + (preservesignaled << 1)}
+#endif // USE_BIT_FIELD_STRUCTURES
+
/* Table 2:39 - Definition of TPMI_YES_NO Type */
typedef BYTE TPMI_YES_NO;
/* Table 2:40 - Definition of TPMI_DH_OBJECT Type */
typedef TPM_HANDLE TPMI_RH_NV_INDEX;
/* Table 2:60 - Definition of TPMI_RH_AC Type */
typedef TPM_HANDLE TPMI_RH_AC;
+/* Table 2:65 - Definition of TPMI_RH_ACT Type */
+typedef TPM_HANDLE TPMI_RH_ACT;
/* Table 2:61 - Definition of TPMI_ALG_HASH Type */
typedef TPM_ALG_ID TPMI_ALG_HASH;
/* Table 2:62 - Definition of TPMI_ALG_ASYM Type */
TPM_HANDLE handle;
TPMT_HA policyHash;
} TPMS_TAGGED_POLICY;
+/* Table 105 - Definition of TPMS_ACT_DATA Structure <OUT> */
+typedef struct {
+ TPM_HANDLE handle;
+ UINT32 timeout;
+ TPMA_ACT attributes;
+} TPMS_ACT_DATA;
/* Table 2:97 - Definition of TPML_CC Structure */
typedef struct {
UINT32 count;
UINT32 count;
TPMS_TAGGED_POLICY policies[MAX_TAGGED_POLICIES];
} TPML_TAGGED_POLICY;
+/* Table 2:118 - Definition of TPML_ACT_DATA Structure <OUT> */
+typedef struct {
+ UINT32 count;
+ TPMS_ACT_DATA actData[MAX_ACT_DATA];
+} TPML_ACT_DATA;
/* Table 2:110 - Definition of TPMU_CAPABILITIES Union */
typedef union {
TPML_ALG_PROPERTY algorithms;
TPML_ECC_CURVE eccCurves;
#endif // ALG_ECC
TPML_TAGGED_POLICY authPolicies;
+ TPML_ACT_DATA actData;
} TPMU_CAPABILITIES;
/* Table 2:111 - Definition of TPMS_CAPABILITY_DATA Structure */
typedef struct {
/* Parameter Unmarshaling */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: Unmarshal.c 1490 2019-07-26 21:13:22Z kgoldman $ */
+/* $Id: Unmarshal.c 1519 2019-11-15 20:43:51Z kgoldman $ */
/* */
/* (c) Copyright IBM Corporation 2015 - 2018 */
/* */
return rc;
}
+/* Table 64 - Definition of (TPM_HANDLE) TPMI_RH_AC Type <IN> */
+
+TPM_RC
+TPMI_RH_AC_Unmarshal(TPMI_RH_AC *target, BYTE **buffer, INT32 *size)
+{
+ TPM_RC rc = TPM_RC_SUCCESS;
+
+ if (rc == TPM_RC_SUCCESS) {
+ rc = TPM_HANDLE_Unmarshal(target, buffer, size);
+ }
+ if (rc == TPM_RC_SUCCESS) {
+ BOOL isNotAC = (*target < AC_FIRST) || (*target > AC_LAST);
+ if (isNotAC) {
+ rc = TPM_RC_VALUE;
+ }
+ }
+ return rc;
+}
+
+/* Table 65 - Definition of (TPM_HANDLE) TPMI_RH_ACT Type <IN> */
+
+TPM_RC
+TPMI_RH_ACT_Unmarshal( TPMI_RH_ACT *target, BYTE **buffer, INT32 *size)
+{
+ TPM_RC rc = TPM_RC_SUCCESS;
+
+ if (rc == TPM_RC_SUCCESS) {
+ rc = TPM_HANDLE_Unmarshal(target, buffer, size);
+ }
+ if (rc == TPM_RC_SUCCESS) {
+ BOOL isNotACT = (*target < TPM_RH_ACT_0) || (*target > TPM_RH_ACT_F);
+ if (isNotACT) {
+ rc = TPM_RC_VALUE;
+ }
+ }
+ return rc;
+}
+
/* Table 59 - Definition of (TPM_ALG_ID) TPMI_ALG_HASH Type */
TPM_RC
return rc;
}
+/* Table 225 - Definition of (UINT32) TPM_AT Constants */
+
+TPM_RC
+TPM_AT_Unmarshal(TPM_AT *target, BYTE **buffer, INT32 *size)
+{
+ TPM_RC rc = TPM_RC_SUCCESS;
+
+ if (rc == TPM_RC_SUCCESS) {
+ rc = UINT32_Unmarshal(target, buffer, size);
+ }
+ return rc;
+}
/********************************************************************************/
/* */
-/* */
+/* Unmarshal Prototypes */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
-/* $Id: Unmarshal_fp.h 1476 2019-06-10 19:32:03Z kgoldman $ */
+/* $Id: Unmarshal_fp.h 1526 2019-11-18 20:25:45Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
/* arising in any way out of use or reliance upon this specification or any */
/* information herein. */
/* */
-/* (c) Copyright IBM Corp. and others, 2012-2018 */
+/* (c) Copyright IBM Corp. and others, 2012 - 2019 */
/* */
/********************************************************************************/
LIB_EXPORT TPM_RC
TPMI_RH_NV_INDEX_Unmarshal(TPMI_RH_NV_INDEX *target, BYTE **buffer, INT32 *size);
LIB_EXPORT TPM_RC
+ TPMI_RH_AC_Unmarshal(TPMI_RH_AC *target, BYTE **buffer, INT32 *size);
+ LIB_EXPORT TPM_RC
+ TPMI_RH_ACT_Unmarshal(TPMI_RH_ACT *target, BYTE **buffer, INT32 *size);
+ LIB_EXPORT TPM_RC
TPMI_ALG_HASH_Unmarshal(TPMI_ALG_HASH *target, BYTE **buffer, INT32 *size, BOOL allowNull);
LIB_EXPORT TPM_RC
TPMI_ALG_SYM_Unmarshal(TPMI_ALG_SYM *target, BYTE **buffer, INT32 *size, BOOL allowNull);
TPM2B_CONTEXT_DATA_Unmarshal(TPM2B_CONTEXT_DATA *target, BYTE **buffer, INT32 *size);
LIB_EXPORT TPM_RC
TPMS_CONTEXT_Unmarshal(TPMS_CONTEXT *target, BYTE **buffer, INT32 *size);
+ LIB_EXPORT TPM_RC
+ TPM_AT_Unmarshal(TPM_AT *target, BYTE **buffer, INT32 *size);
#ifdef __cplusplus
}
#include "tpm2/_TPM_Hash_Data_fp.h"
#include "tpm2/_TPM_Init_fp.h"
#include "tpm2/StateMarshal.h"
+#include "tpm2/PlatformACT.h"
#include "tpm2/PlatformData.h"
#include "tpm2/Volatile.h"