blob: aee0b545e9a925a30b32910e968b0408b202b4ae [file] [log] [blame]
Vadim Bendeburyd8813672015-05-27 17:13:38 -07001/*
2 * Copyright 2015 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -07007#ifndef __TPM2_MEMORYLIB_FP_H
8#define __TPM2_MEMORYLIB_FP_H
Vadim Bendeburyd8813672015-05-27 17:13:38 -07009
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070010BYTE *MemoryGetResponseBuffer(
11 TPM_CC command // Command that requires the buffer
12 );
13LIB_EXPORT BOOL Memory2BEqual(const TPM2B *aIn, // IN: compare value
14 const TPM2B *bIn // IN: compare value
15 );
16#define MemoryCopy(destination, source, size, destSize) \
17 MemoryMove((destination), (source), (size), (destSize))
18LIB_EXPORT INT16 MemoryCopy2B(TPM2B *dest, // OUT: receiving TPM2B
19 const TPM2B *source, // IN: source TPM2B
20 UINT16 dSize // IN: size of the receiving buffer
21 );
22LIB_EXPORT void MemoryMove(void *destination, // OUT: move destination
23 const void *source, // IN: move source
24 UINT32 size, // IN: number of octets to moved
25 UINT32 dSize // IN: size of the receive buffer
Vadim Bendebury3743ac12015-05-29 22:44:14 -070026 );
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070027UINT16 MemoryRemoveTrailingZeros(TPM2B_AUTH *auth // IN/OUT: value to adjust
28 );
29LIB_EXPORT void MemorySet(void *destination, // OUT: memory destination
30 char value, // IN: fill value
31 UINT32 size // IN: number of octets to fill
Vadim Bendeburyd8813672015-05-27 17:13:38 -070032 );
Vadim Bendeburyc00055c2015-05-29 22:50:18 -070033LIB_EXPORT void MemoryConcat2B(
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070034 TPM2B *aInOut, // IN/OUT: destination 2B
35 TPM2B *bIn, // IN: second 2B
36 UINT16 aSize // IN: The size of aInOut.buffer (max values for aInOut.size)
37 );
38LIB_EXPORT BOOL MemoryEqual(const void *buffer1, // IN: compare buffer1
39 const void *buffer2, // IN: compare buffer2
40 UINT32 size // IN: size of bytes being compared
41 );
42
43#endif // __TPM2_MEMORYLIB_FP_H