1 /* Microsoft Reference Implementation for TPM 2.0 2 * 3 * The copyright in this software is being made available under the BSD License, 4 * included below. This software may be subject to other third party and 5 * contributor rights, including patent rights, and no such rights are granted 6 * 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 modification, 15 * are permitted provided that the following conditions are met: 16 * 17 * Redistributions of source code must retain the above copyright notice, this list 18 * of conditions and the following disclaimer. 19 * 20 * Redistributions in binary form must reproduce the above copyright notice, this 21 * list of conditions and the following disclaimer in the documentation and/or 22 * other materials provided with the distribution. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 28 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 31 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 */ 35 /*(Auto-generated) 36 * Created by TpmPrototypes; Version 3.0 July 18, 2017 37 * Date: Mar 28, 2019 Time: 08:25:19PM 38 */ 39 40 #ifndef _EXEC_COMMAND_FP_H_ 41 #define _EXEC_COMMAND_FP_H_ 42 43 //** ExecuteCommand() 44 // 45 // The function performs the following steps. 46 // 47 // a) Parses the command header from input buffer. 48 // b) Calls ParseHandleBuffer() to parse the handle area of the command. 49 // c) Validates that each of the handles references a loaded entity. 50 // d) Calls ParseSessionBuffer () to: 51 // 1) unmarshal and parse the session area; 52 // 2) check the authorizations; and 53 // 3) when necessary, decrypt a parameter. 54 // e) Calls CommandDispatcher() to: 55 // 1) unmarshal the command parameters from the command buffer; 56 // 2) call the routine that performs the command actions; and 57 // 3) marshal the responses into the response buffer. 58 // f) If any error occurs in any of the steps above create the error response 59 // and return. 60 // g) Calls BuildResponseSession() to: 61 // 1) when necessary, encrypt a parameter 62 // 2) build the response authorization sessions 63 // 3) update the audit sessions and nonces 64 // h) Calls BuildResponseHeader() to complete the construction of the response. 65 // 66 // 'responseSize' is set by the caller to the maximum number of bytes available in 67 // the output buffer. ExecuteCommand will adjust the value and return the number 68 // of bytes placed in the buffer. 69 // 70 // 'response' is also set by the caller to indicate the buffer into which 71 // ExecuteCommand is to place the response. 72 // 73 // 'request' and 'response' may point to the same buffer 74 // 75 // Note: As of February, 2016, the failure processing has been moved to the 76 // platform-specific code. When the TPM code encounters an unrecoverable failure, it 77 // will SET g_inFailureMode and call _plat__Fail(). That function should not return 78 // but may call ExecuteCommand(). 79 // 80 LIB_EXPORT void 81 ExecuteCommand( 82 uint32_t requestSize, // IN: command buffer size 83 unsigned char *request, // IN: command buffer 84 uint32_t *responseSize, // IN/OUT: response buffer size 85 unsigned char **response // IN/OUT: response buffer 86 ); 87 88 #endif // _EXEC_COMMAND_FP_H_ 89