1 /* Microsoft Reference Implementation for TPM 2.0 2 * 3 * The copyright in this software is being made available under the BSD License, 4 * included below. This software may be subject to other third party and 5 * contributor rights, including patent rights, and no such rights are granted 6 * under this license. 7 * 8 * Copyright (c) Microsoft Corporation 9 * 10 * All rights reserved. 11 * 12 * BSD License 13 * 14 * Redistribution and use in source and binary forms, with or without modification, 15 * are permitted provided that the following conditions are met: 16 * 17 * Redistributions of source code must retain the above copyright notice, this list 18 * of conditions and the following disclaimer. 19 * 20 * Redistributions in binary form must reproduce the above copyright notice, this 21 * list of conditions and the following disclaimer in the documentation and/or 22 * other materials provided with the distribution. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 28 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 31 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 */ 35 /*(Auto-generated) 36 * Created by TpmPrototypes; Version 3.0 July 18, 2017 37 * Date: Mar 4, 2020 Time: 02:36:44PM 38 */ 39 40 #ifndef _POLICY_SPT_FP_H_ 41 #define _POLICY_SPT_FP_H_ 42 43 //** Functions 44 //*** PolicyParameterChecks() 45 // This function validates the common parameters of TPM2_PolicySiged() 46 // and TPM2_PolicySecret(). The common parameters are 'nonceTPM', 47 // 'expiration', and 'cpHashA'. 48 TPM_RC 49 PolicyParameterChecks( 50 SESSION *session, 51 UINT64 authTimeout, 52 TPM2B_DIGEST *cpHashA, 53 TPM2B_NONCE *nonce, 54 TPM_RC blameNonce, 55 TPM_RC blameCpHash, 56 TPM_RC blameExpiration 57 ); 58 59 //*** PolicyContextUpdate() 60 // Update policy hash 61 // Update the policyDigest in policy session by extending policyRef and 62 // objectName to it. This will also update the cpHash if it is present. 63 // 64 // Return Type: void 65 void 66 PolicyContextUpdate( 67 TPM_CC commandCode, // IN: command code 68 TPM2B_NAME *name, // IN: name of entity 69 TPM2B_NONCE *ref, // IN: the reference data 70 TPM2B_DIGEST *cpHash, // IN: the cpHash (optional) 71 UINT64 policyTimeout, // IN: the timeout value for the policy 72 SESSION *session // IN/OUT: policy session to be updated 73 ); 74 75 //*** ComputeAuthTimeout() 76 // This function is used to determine what the authorization timeout value for 77 // the session should be. 78 UINT64 79 ComputeAuthTimeout( 80 SESSION *session, // IN: the session containing the time 81 // values 82 INT32 expiration, // IN: either the number of seconds from 83 // the start of the session or the 84 // time in g_timer; 85 TPM2B_NONCE *nonce // IN: indicator of the time base 86 ); 87 88 //*** PolicyDigestClear() 89 // Function to reset the policyDigest of a session 90 void 91 PolicyDigestClear( 92 SESSION *session 93 ); 94 95 //*** PolicySptCheckCondition() 96 // Checks to see if the condition in the policy is satisfied. 97 BOOL 98 PolicySptCheckCondition( 99 TPM_EO operation, 100 BYTE *opA, 101 BYTE *opB, 102 UINT16 size 103 ); 104 105 #endif // _POLICY_SPT_FP_H_ 106