1 // Copyright 2015 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // THIS CODE IS GENERATED - DO NOT MODIFY!
6 
7 #ifndef TPM2_ENCRYPTDECRYPT_FP_H_
8 #define TPM2_ENCRYPTDECRYPT_FP_H_
9 
10 #include "tpm_generated.h"
11 
12 typedef struct {
13   TPMI_DH_OBJECT keyHandle;
14   TPMI_YES_NO decrypt;
15   TPMI_ALG_SYM_MODE mode;
16   TPM2B_IV ivIn;
17   TPM2B_MAX_BUFFER inData;
18 } EncryptDecrypt_In;
19 
20 typedef struct {
21   TPM2B_MAX_BUFFER outData;
22   TPM2B_IV ivOut;
23 } EncryptDecrypt_Out;
24 
25 // Executes EncryptDecrypt with request handles and parameters from
26 // |in| and computes response handles and parameters to |out|.
27 TPM_RC TPM2_EncryptDecrypt(EncryptDecrypt_In* in, EncryptDecrypt_Out* out);
28 
29 // Initializes handle fields in |target| from |request_handles|. Unmarshals
30 // parameter fields in |target| from |buffer|.
31 TPM_RC EncryptDecrypt_In_Unmarshal(EncryptDecrypt_In* target,
32                                    TPM_HANDLE request_handles[],
33                                    BYTE** buffer,
34                                    INT32* size);
35 
36 // Marshals response handles and parameters from |source| to |buffer|. Computes
37 // and marshals the size of the parameter area (parameter_size) if |tag| ==
38 // TPM_ST_SESSIONS. Returns size of (parameter area + handle area) in bytes.
39 // Return value does not include parameter_size field.
40 UINT16 EncryptDecrypt_Out_Marshal(EncryptDecrypt_Out* source,
41                                   TPMI_ST_COMMAND_TAG tag,
42                                   BYTE** buffer,
43                                   INT32* size);
44 
45 // Unmarshals any request parameters starting at |request_parameter_buffer|.
46 // Executes command. Marshals any response handles and parameters to the
47 // global response buffer and computes |*response_handle_buffer_size| and
48 // |*response_parameter_buffer_size|. If |tag| == TPM_ST_SESSIONS, marshals
49 // parameter_size indicating the size of the parameter area. parameter_size
50 // field is located between the handle area and parameter area.
51 TPM_RC Exec_EncryptDecrypt(TPMI_ST_COMMAND_TAG tag,
52                            BYTE** request_parameter_buffer,
53                            INT32* request_parameter_buffer_size,
54                            TPM_HANDLE request_handles[],
55                            UINT32* response_handle_buffer_size,
56                            UINT32* response_parameter_buffer_size);
57 
58 #endif  // TPM2_ENCRYPTDECRYPT_FP_H
59