Vadim Bendebury | d881367 | 2015-05-27 17:13:38 -0700 | [diff] [blame] | 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 | |
Vadim Bendebury | f788ffb | 2015-06-05 12:57:27 -0700 | [diff] [blame] | 7 | #ifndef __TPM2_MEMORYLIB_FP_H |
| 8 | #define __TPM2_MEMORYLIB_FP_H |
Vadim Bendebury | d881367 | 2015-05-27 17:13:38 -0700 | [diff] [blame] | 9 | |
Jocelyn Bohr | a4ed3aa | 2015-07-30 10:44:16 -0700 | [diff] [blame] | 10 | #include "InternalRoutines.h" |
| 11 | |
Vadim Bendebury | f788ffb | 2015-06-05 12:57:27 -0700 | [diff] [blame] | 12 | BYTE *MemoryGetResponseBuffer( |
| 13 | TPM_CC command // Command that requires the buffer |
| 14 | ); |
| 15 | LIB_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)) |
| 20 | LIB_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 | ); |
| 24 | LIB_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 Bendebury | 3743ac1 | 2015-05-29 22:44:14 -0700 | [diff] [blame] | 28 | ); |
Vadim Bendebury | f788ffb | 2015-06-05 12:57:27 -0700 | [diff] [blame] | 29 | UINT16 MemoryRemoveTrailingZeros(TPM2B_AUTH *auth // IN/OUT: value to adjust |
| 30 | ); |
| 31 | LIB_EXPORT void MemorySet(void *destination, // OUT: memory destination |
| 32 | char value, // IN: fill value |
| 33 | UINT32 size // IN: number of octets to fill |
Vadim Bendebury | d881367 | 2015-05-27 17:13:38 -0700 | [diff] [blame] | 34 | ); |
Vadim Bendebury | c00055c | 2015-05-29 22:50:18 -0700 | [diff] [blame] | 35 | LIB_EXPORT void MemoryConcat2B( |
Vadim Bendebury | f788ffb | 2015-06-05 12:57:27 -0700 | [diff] [blame] | 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 | ); |
| 40 | LIB_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 |