xref: /aosp_15_r20/external/ms-tpm-20-ref/TPMCmd/tpm/include/prototypes/Entity_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:19:36PM
38  */
39 
40 #ifndef    _ENTITY_FP_H_
41 #define    _ENTITY_FP_H_
42 
43 //** Functions
44 //*** EntityGetLoadStatus()
45 // This function will check that all the handles access loaded entities.
46 //  Return Type: TPM_RC
47 //      TPM_RC_HANDLE           handle type does not match
48 //      TPM_RC_REFERENCE_Hx     entity is not present
49 //      TPM_RC_HIERARCHY        entity belongs to a disabled hierarchy
50 //      TPM_RC_OBJECT_MEMORY    handle is an evict object but there is no
51 //                               space to load it to RAM
52 TPM_RC
53 EntityGetLoadStatus(
54     COMMAND         *command        // IN/OUT: command parsing structure
55 );
56 
57 //*** EntityGetAuthValue()
58 // This function is used to access the 'authValue' associated with a handle.
59 // This function assumes that the handle references an entity that is accessible
60 // and the handle is not for a persistent objects. That is EntityGetLoadStatus()
61 // should have been called. Also, the accessibility of the authValue should have
62 // been verified by IsAuthValueAvailable().
63 //
64 // This function copies the authorization value of the entity to 'auth'.
65 // Return Type: UINT16
66 //      count           number of bytes in the authValue with 0's stripped
67 UINT16
68 EntityGetAuthValue(
69     TPMI_DH_ENTITY   handle,        // IN: handle of entity
70     TPM2B_AUTH      *auth           // OUT: authValue of the entity
71 );
72 
73 //*** EntityGetAuthPolicy()
74 // This function is used to access the 'authPolicy' associated with a handle.
75 // This function assumes that the handle references an entity that is accessible
76 // and the handle is not for a persistent objects. That is EntityGetLoadStatus()
77 // should have been called. Also, the accessibility of the authPolicy should have
78 // been verified by IsAuthPolicyAvailable().
79 //
80 // This function copies the authorization policy of the entity to 'authPolicy'.
81 //
82 //  The return value is the hash algorithm for the policy.
83 TPMI_ALG_HASH
84 EntityGetAuthPolicy(
85     TPMI_DH_ENTITY   handle,        // IN: handle of entity
86     TPM2B_DIGEST    *authPolicy     // OUT: authPolicy of the entity
87 );
88 
89 //*** EntityGetName()
90 // This function returns the Name associated with a handle.
91 TPM2B_NAME *
92 EntityGetName(
93     TPMI_DH_ENTITY   handle,        // IN: handle of entity
94     TPM2B_NAME      *name           // OUT: name of entity
95 );
96 
97 //*** EntityGetHierarchy()
98 // This function returns the hierarchy handle associated with an entity.
99 // a) A handle that is a hierarchy handle is associated with itself.
100 // b) An NV index belongs to TPM_RH_PLATFORM if TPMA_NV_PLATFORMCREATE,
101 //    is SET, otherwise it belongs to TPM_RH_OWNER
102 // c) An object handle belongs to its hierarchy.
103 TPMI_RH_HIERARCHY
104 EntityGetHierarchy(
105     TPMI_DH_ENTITY   handle         // IN :handle of entity
106 );
107 
108 #endif  // _ENTITY_FP_H_
109