Philip Tricca | 7360972 | 2017-02-10 10:50:06 -0800 | [diff] [blame] | 1 | //**********************************************************************; |
| 2 | // Copyright (c) 2015, Intel Corporation |
| 3 | // All rights reserved. |
| 4 | // |
| 5 | // Redistribution and use in source and binary forms, with or without |
| 6 | // modification, are permitted provided that the following conditions are met: |
| 7 | // |
| 8 | // 1. Redistributions of source code must retain the above copyright notice, |
| 9 | // this list of conditions and the following disclaimer. |
| 10 | // |
| 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 | // this list of conditions and the following disclaimer in the documentation |
| 13 | // and/or other materials provided with the distribution. |
| 14 | // |
| 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 25 | // THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | //**********************************************************************; |
| 27 | |
| 28 | #ifndef MARSHAL_H |
| 29 | #define MARSHAL_H |
| 30 | |
| 31 | #include <stdlib.h> |
| 32 | #include <sapi/tpm20.h> |
| 33 | |
| 34 | #define TSS2_TYPES_RC_LAYER TSS2_ERROR_LEVEL(14) |
| 35 | #define TSS2_TYPES_RC_BAD_REFERENCE \ |
| 36 | ((TSS2_RC)(TSS2_TYPES_RC_LAYER | TSS2_BASE_RC_BAD_REFERENCE)) |
| 37 | #define TSS2_TYPES_RC_INSUFFICIENT_BUFFER \ |
| 38 | ((TSS2_RC)(TSS2_TYPES_RC_LAYER | TSS2_BASE_RC_INSUFFICIENT_BUFFER)) |
| 39 | |
| 40 | #ifdef __cplusplus |
| 41 | extern "C" { |
| 42 | #endif |
| 43 | |
| 44 | TSS2_RC |
| 45 | UINT8_Marshal ( |
| 46 | UINT8 const *src, |
| 47 | uint8_t buffer [], |
| 48 | size_t buffer_size, |
| 49 | size_t *offset |
| 50 | ); |
| 51 | |
| 52 | TSS2_RC |
| 53 | UINT8_Unmarshal ( |
| 54 | uint8_t const buffer[], |
| 55 | size_t buffer_size, |
| 56 | size_t *offset, |
| 57 | UINT8 *dest |
| 58 | ); |
| 59 | |
Philip Tricca | 689c090 | 2017-02-03 21:10:53 -0800 | [diff] [blame] | 60 | TSS2_RC |
| 61 | UINT16_Marshal ( |
| 62 | UINT16 const *src, |
| 63 | uint8_t buffer [], |
| 64 | size_t buffer_size, |
| 65 | size_t *offset |
| 66 | ); |
| 67 | |
| 68 | TSS2_RC |
| 69 | UINT16_Unmarshal ( |
| 70 | uint8_t const buffer[], |
| 71 | size_t buffer_size, |
| 72 | size_t *offset, |
| 73 | UINT16 *dest |
| 74 | ); |
| 75 | |
Philip Tricca | bff7212 | 2017-02-04 07:53:07 -0800 | [diff] [blame^] | 76 | TSS2_RC |
| 77 | UINT32_Marshal ( |
| 78 | UINT32 const *src, |
| 79 | uint8_t buffer [], |
| 80 | size_t buffer_size, |
| 81 | size_t *offset |
| 82 | ); |
| 83 | |
| 84 | TSS2_RC |
| 85 | UINT32_Unmarshal ( |
| 86 | uint8_t const buffer[], |
| 87 | size_t buffer_size, |
| 88 | size_t *offset, |
| 89 | UINT32 *dest |
| 90 | ); |
| 91 | |
Philip Tricca | 7360972 | 2017-02-10 10:50:06 -0800 | [diff] [blame] | 92 | #ifdef __cplusplus |
| 93 | } |
| 94 | #endif |
| 95 | |
| 96 | #endif /* MARSHAL_H */ |