1/*
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 __TPM2_MEMORYLIB_FP_H
8#define __TPM2_MEMORYLIB_FP_H
9
10#include "InternalRoutines.h"
11
12BYTE *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
28                           );
29UINT16 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
34                          );
35LIB_EXPORT void MemoryConcat2B(
36    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
46