| 1 |
/* Microsoft Reference Implementation for TPM 2.0 |
| 2 |
* |
| 3 |
* The copyright in this software is being made available under the BSD |
| 4 |
* License, included below. This software may be subject to other third party |
| 5 |
* and contributor rights, including patent rights, and no such rights are |
| 6 |
* granted under this license. |
| 7 |
* |
| 8 |
* Copyright (c) Microsoft Corporation |
| 9 |
* |
| 10 |
* All rights reserved. |
| 11 |
* |
| 12 |
* BSD License |
| 13 |
* |
| 14 |
* Redistribution and use in source and binary forms, with or without |
| 15 |
* modification, are permitted provided that the following conditions are met: |
| 16 |
* |
| 17 |
* Redistributions of source code must retain the above copyright notice, this |
| 18 |
* list of conditions and the following disclaimer. |
| 19 |
* |
| 20 |
* Redistributions in binary form must reproduce the above copyright notice, |
| 21 |
* this list of conditions and the following disclaimer in the documentation |
| 22 |
* and/or other materials provided with the distribution. |
| 23 |
* |
| 24 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS |
| 25 |
* IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 26 |
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 27 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 28 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 29 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 30 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 31 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 32 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 33 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 34 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 35 |
*/ |
| 36 |
// External interface to the vTPM |
| 37 |
|
| 38 |
#ifndef _PLATFORM_H_ |
| 39 |
#define _PLATFORM_H_ |
| 40 |
|
| 41 |
#ifdef __cplusplus |
| 42 |
extern "C" { |
| 43 |
#endif |
| 44 |
|
| 45 |
#include <stdbool.h> |
| 46 |
#include <stdint.h> |
| 47 |
|
| 48 |
//***_plat__RunCommand() |
| 49 |
// This version of RunCommand will set up a jum_buf and call ExecuteCommand(). |
| 50 |
// If the command executes without failing, it will return and RunCommand will |
| 51 |
// return. If there is a failure in the command, then _plat__Fail() is called |
| 52 |
// and it will longjump back to RunCommand which will call ExecuteCommand again. |
| 53 |
// However, this time, the TPM will be in failure mode so ExecuteCommand will |
| 54 |
// simply build a failure response and return. |
| 55 |
void _plat__RunCommand(uint32_t requestSize, // IN: command buffer size |
| 56 |
unsigned char *request, // IN: command buffer |
| 57 |
uint32_t *responseSize, // IN/OUT: response buffer size |
| 58 |
unsigned char **response // IN/OUT: response buffer |
| 59 |
); |
| 60 |
|
| 61 |
//*** _plat_Reset() |
| 62 |
// Reset the TPM. This should always be called before _plat__RunCommand. The |
| 63 |
// first time this function is called, the TPM will be manufactured. Pass true |
| 64 |
// for forceManufacture to perfrom a manufacturer reset. |
| 65 |
void _plat__Reset(bool forceManufacture); |
| 66 |
|
| 67 |
#ifdef __cplusplus |
| 68 |
} |
| 69 |
#endif |
| 70 |
|
| 71 |
#endif // _PLATFORM_H_ |