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    _TABLE_DRIVEN_MARSHAL_FP_H_
41 #define    _TABLE_DRIVEN_MARSHAL_FP_H_
42 
43 #if TABLE_DRIVEN_MARSHAL
44 
45 //***UnmarshalUnion()
46 TPM_RC
47 UnmarshalUnion(
48     UINT16               typeIndex,         // IN: the thing to unmarshal
49     void                *target,            // IN: were the data goes to
50     UINT8               **buffer,           // IN/OUT: the data source buffer
51     INT32               *size,              // IN/OUT: the remaining size
52     UINT32               selector
53 );
54 
55 //*** MarshalUnion()
56 UINT16
57 MarshalUnion(
58     UINT16               typeIndex,         // IN: the thing to marshal
59     void                *source,            // IN: were the data comes from
60     UINT8               **buffer,           // IN/OUT: the data source buffer
61     INT32               *size,              // IN/OUT: the remaining size
62     UINT32               selector           // IN: the union selector
63 );
64 
65 TPM_RC
66 UnmarshalInteger(
67     int                  iSize,             // IN: Number of bytes in the integer
68     void                *target,            // OUT: receives the integer
69     UINT8               **buffer,           // IN/OUT: source of the data
70     INT32               *size,              // IN/OUT: amount of data available
71     UINT32              *value              // OUT: optional copy of 'target'
72 );
73 
74 //*** Unmarshal()
75 // This is the function that performs unmarshaling of different numbered types. Each
76 // TPM type has a number. The number is used to lookup the address of the data
77 // structure that describes how to unmarshal that data type.
78 //
79 TPM_RC
80 Unmarshal(
81     UINT16               typeIndex,         // IN: the thing to marshal
82     void                *target,            // IN: were the data goes from
83     UINT8               **buffer,           // IN/OUT: the data source buffer
84     INT32               *size               // IN/OUT: the remaining size
85 );
86 
87 //*** Marshal()
88 // This is the function that drives marshaling of output. Because there is no
89 // validation of the output, there is a lot less code.
90 UINT16 Marshal(
91     UINT16               typeIndex,         // IN: the thing to marshal
92     void                *source,            // IN: were the data comes from
93     UINT8               **buffer,           // IN/OUT: the data source buffer
94     INT32               *size               // IN/OUT: the remaining size
95 );
96 #endif // TABLE_DRIVEN_MARSHAL
97 
98 #endif  // _TABLE_DRIVEN_MARSHAL_FP_H_
99