blob: f10416095f904272f1324bb3ae8725fd6fec6759 [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
Jocelyn Bohra4ed3aa2015-07-30 10:44:16 -070010#include "InternalRoutines.h"
11
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070012BYTE *MemoryGetResponseBuffer(
13 TPM_CC command // Command that requires the buffer
14 );
15LIB_EXPORT BOOL Memory2BEqual(const TPM2B *aIn, // IN: compare value
16 const TPM2B *bIn // IN: compare value
17 );
18#define MemoryCopy(destination, source, size, destSize) \
19 MemoryMove((destination), (source), (size), (destSize))
20LIB_EXPORT INT16 MemoryCopy2B(TPM2B *dest, // OUT: receiving TPM2B
21 const TPM2B *source, // IN: source TPM2B
22 UINT16 dSize // IN: size of the receiving buffer
23 );
24LIB_EXPORT void MemoryMove(void *destination, // OUT: move destination
25 const void *source, // IN: move source
26 UINT32 size, // IN: number of octets to moved
27 UINT32 dSize // IN: size of the receive buffer
Vadim Bendebury3743ac12015-05-29 22:44:14 -070028 );
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070029UINT16 MemoryRemoveTrailingZeros(TPM2B_AUTH *auth // IN/OUT: value to adjust
30 );
31LIB_EXPORT void MemorySet(void *destination, // OUT: memory destination
32 char value, // IN: fill value
33 UINT32 size // IN: number of octets to fill
Vadim Bendeburyd8813672015-05-27 17:13:38 -070034 );
Vadim Bendeburyc00055c2015-05-29 22:50:18 -070035LIB_EXPORT void MemoryConcat2B(
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070036 TPM2B *aInOut, // IN/OUT: destination 2B
37 TPM2B *bIn, // IN: second 2B
38 UINT16 aSize // IN: The size of aInOut.buffer (max values for aInOut.size)
39 );
40LIB_EXPORT BOOL MemoryEqual(const void *buffer1, // IN: compare buffer1
41 const void *buffer2, // IN: compare buffer2
42 UINT32 size // IN: size of bytes being compared
43 );
44
45#endif // __TPM2_MEMORYLIB_FP_H