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 | |
| 7 | #ifndef __MEMORYLIB_FP_H |
| 8 | #define __MEMORYLIB_FP_H |
| 9 | |
Vadim Bendebury | da72506 | 2015-05-31 14:41:18 -0700 | [diff] [blame] | 10 | BYTE * MemoryGetResponseBuffer( |
| 11 | TPM_CC command // Command that requires the buffer |
| 12 | ); |
Vadim Bendebury | 7b722a0 | 2015-05-29 22:40:54 -0700 | [diff] [blame] | 13 | LIB_EXPORT BOOL Memory2BEqual( |
| 14 | const TPM2B *aIn, // IN: compare value |
| 15 | const TPM2B *bIn // IN: compare value |
| 16 | ); |
Vadim Bendebury | 3743ac1 | 2015-05-29 22:44:14 -0700 | [diff] [blame] | 17 | #define MemoryCopy(destination, source, size, destSize) \ |
| 18 | MemoryMove((destination), (source), (size), (destSize)) |
Vadim Bendebury | 6bb41ff | 2015-05-29 22:43:25 -0700 | [diff] [blame] | 19 | LIB_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 Bendebury | 3743ac1 | 2015-05-29 22:44:14 -0700 | [diff] [blame] | 24 | LIB_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 Bendebury | bde479a | 2015-05-29 22:48:02 -0700 | [diff] [blame] | 30 | UINT16 MemoryRemoveTrailingZeros ( |
| 31 | TPM2B_AUTH *auth // IN/OUT: value to adjust |
| 32 | ); |
Vadim Bendebury | d881367 | 2015-05-27 17:13:38 -0700 | [diff] [blame] | 33 | LIB_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 Bendebury | c00055c | 2015-05-29 22:50:18 -0700 | [diff] [blame] | 40 | LIB_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 | ); |
| 46 | LIB_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 | ); |