xref: /aosp_15_r20/external/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/SessionProcess_fp.h (revision 5c591343844d1f9da7da26467c4bf7efc8a7a413)
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  7, 2020  Time: 07:17:48PM
38  */
39 
40 #ifndef    _SESSION_PROCESS_FP_H_
41 #define    _SESSION_PROCESS_FP_H_
42 
43 //*** IsDAExempted()
44 // This function indicates if a handle is exempted from DA logic.
45 // A handle is exempted if it is:
46 //  a) a primary seed handle;
47 //  b) an object with noDA bit SET;
48 //  c) an NV Index with TPMA_NV_NO_DA bit SET; or
49 //  d) a PCR handle.
50 //
51 //  Return Type: BOOL
52 //      TRUE(1)         handle is exempted from DA logic
53 //      FALSE(0)        handle is not exempted from DA logic
54 BOOL
55 IsDAExempted(
56     TPM_HANDLE       handle         // IN: entity handle
57 );
58 
59 //*** ClearCpRpHashes()
60 void
61 ClearCpRpHashes(
62     COMMAND         *command
63 );
64 
65 //*** CompareNameHash()
66 // This function computes the name hash and compares it to the nameHash in the
67 // session data.
68 BOOL
69 CompareNameHash(
70     COMMAND         *command,       // IN: main parsing structure
71     SESSION         *session        // IN: session structure with nameHash
72 );
73 
74 //*** ParseSessionBuffer()
75 // This function is the entry function for command session processing.
76 // It iterates sessions in session area and reports if the required authorization
77 // has been properly provided. It also processes audit session and passes the
78 // information of encryption sessions to parameter encryption module.
79 //
80 //  Return Type: TPM_RC
81 //        various           parsing failure or authorization failure
82 //
83 TPM_RC
84 ParseSessionBuffer(
85     COMMAND         *command        // IN: the structure that contains
86 );
87 
88 //*** CheckAuthNoSession()
89 // Function to process a command with no session associated.
90 // The function makes sure all the handles in the command require no authorization.
91 //
92 //  Return Type: TPM_RC
93 //      TPM_RC_AUTH_MISSING         failure - one or more handles require
94 //                                  authorization
95 TPM_RC
96 CheckAuthNoSession(
97     COMMAND         *command        // IN: command parsing structure
98 );
99 
100 //*** BuildResponseSession()
101 // Function to build Session buffer in a response. The authorization data is added
102 // to the end of command->responseBuffer. The size of the authorization area is
103 // accumulated in command->authSize.
104 // When this is called, command->responseBuffer is pointing at the next location
105 // in the response buffer to be filled. This is where the authorization sessions
106 // will go, if any. command->parameterSize is the number of bytes that have been
107 // marshaled as parameters in the output buffer.
108 void
109 BuildResponseSession(
110     COMMAND         *command        // IN: structure that has relevant command
111                                     //     information
112 );
113 
114 //*** SessionRemoveAssociationToHandle()
115 // This function deals with the case where an entity associated with an authorization
116 // is deleted during command processing. The primary use of this is to support
117 // UndefineSpaceSpecial().
118 void
119 SessionRemoveAssociationToHandle(
120     TPM_HANDLE       handle
121 );
122 
123 #endif  // _SESSION_PROCESS_FP_H_
124