Upgrade Duplicate utility to the latest tss
[aaf/sshsm.git] / tpm-util / duplicate / include / util.h
1 /*
2  * Copyright 2018 Intel Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *     Unless required by applicable law or agreed to in writing, software
11  *     distributed under the License is distributed on an "AS IS" BASIS,
12  *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *     See the License for the specific language governing permissions and
14  *     limitations under the License.
15  */
16 // Author: Arun Kumar Sekar
17
18 #ifndef __UTIL_H__
19 #define __UTIL_H__
20
21 #include <tss2/tss2_sys.h>
22 #include <tss2/tss2_common.h>
23 #include <tss2/tss2_esys.h>
24 #include <tss2/tss2_tpm2_types.h>
25 #include <tss2/tpm2b.h>
26 #include <stdlib.h>
27
28 #include <stdio.h>
29 #include <string.h>
30 #include <limits.h>
31 #include <ctype.h>
32 #include <getopt.h>
33
34
35 void hex_log(UINT8 *pData, UINT32 numBytes, const char* caption);
36
37 TPM2_RC ConcatSizedByteBuffer( TPM2B_MAX_BUFFER *result, TPM2B *addBuffer );
38
39 int saveDataToFile(const char *fileName, UINT8 *buf, UINT16 size);
40
41 int loadDataFromFile(const char *fileName, UINT8 *buf, UINT16 *size);
42
43 #endif