blob: de85708bce0f996f99b4822d60729c82ed32b9b7 [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
7#ifndef __MEMORYLIB_FP_H
8#define __MEMORYLIB_FP_H
9
Vadim Bendeburyda725062015-05-31 14:41:18 -070010BYTE * MemoryGetResponseBuffer(
11 TPM_CC command // Command that requires the buffer
12 );
Vadim Bendebury7b722a02015-05-29 22:40:54 -070013LIB_EXPORT BOOL Memory2BEqual(
14 const TPM2B *aIn, // IN: compare value
15 const TPM2B *bIn // IN: compare value
16);
Vadim Bendebury3743ac12015-05-29 22:44:14 -070017#define MemoryCopy(destination, source, size, destSize) \
18 MemoryMove((destination), (source), (size), (destSize))
Vadim Bendebury6bb41ff2015-05-29 22:43:25 -070019LIB_EXPORT INT16 MemoryCopy2B(
20 TPM2B *dest, // OUT: receiving TPM2B
21 const TPM2B *source, // IN: source TPM2B
22 UINT16 dSize // IN: size of the receiving buffer
23);
Vadim Bendebury3743ac12015-05-29 22:44:14 -070024LIB_EXPORT void MemoryMove(
25 void *destination, // OUT: move destination
26 const void *source, // IN: move source
27 UINT32 size, // IN: number of octets to moved
28 UINT32 dSize // IN: size of the receive buffer
29 );
Vadim Bendeburybde479a2015-05-29 22:48:02 -070030UINT16 MemoryRemoveTrailingZeros (
31 TPM2B_AUTH *auth // IN/OUT: value to adjust
32);
Vadim Bendeburyd8813672015-05-27 17:13:38 -070033LIB_EXPORT void MemorySet(
34 void *destination, // OUT: memory destination
35 char value, // IN: fill value
36 UINT32 size // IN: number of octets to fill
37 );
38
39#endif
Vadim Bendeburyc00055c2015-05-29 22:50:18 -070040LIB_EXPORT void MemoryConcat2B(
41 TPM2B *aInOut, // IN/OUT: destination 2B
42 TPM2B *bIn, // IN: second 2B
43 UINT16 aSize // IN: The size of aInOut.buffer (max values for
44 // aInOut.size)
45 );
46LIB_EXPORT BOOL MemoryEqual(
47 const void *buffer1, // IN: compare buffer1
48 const void *buffer2, // IN: compare buffer2
49 UINT32 size // IN: size of bytes being compared
50 );