summaryrefslogtreecommitdiffstats
path: root/src/usr/secureboot/trusted/trustedbootUtils.H
blob: 78ae7e053f5765c8b1c65d685153e7e1a9525fc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/secureboot/trusted/trustedbootUtils.H $               */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,2017                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/**
 * @file trustedbootUtils.H
 *
 * @brief Trustedboot TPM utilities that must be implemented for each
 *  unique implementation
 *
 */

/////////////////////////////////////////////////////////////////
// NOTE: This file is exportable as TSS-Lite for skiboot/PHYP  //
/////////////////////////////////////////////////////////////////

#ifndef __TRUSTEDBOOTUTILS_H
#define __TRUSTEDBOOTUTILS_H
// -----------------------------------------------
// Includes
// -----------------------------------------------
#ifdef __HOSTBOOT_MODULE
#include <i2c/tpmddif.H>
using namespace TPMDD;
#endif
#include "trustedTypes.H"

#ifdef __cplusplus
namespace TRUSTEDBOOT
{
#endif

/**
 * @brief Transmit the command to the TPM
 * @param[in/out] io_target Current TPM target structure
 * @param[in/out] io_buffer Input the command buffer to send, response on exit
 * @param[in] i_cmdSize Size of provided command in bytes
 * @param[in] i_bufsize Size of io_buffer in bytes
 * @param[in] i_locality TPM locality to use
 * @return errlHndl_t NULL if successful, otherwise a pointer to the
 *       error log.
 */
errlHndl_t tpmTransmit(TpmTarget * io_target,
                       uint8_t* io_buffer,
                       size_t i_cmdSize,
                       size_t i_bufsize,
                       tpm_locality_t i_locality);

/**
 * @brief Create an error log entry for potential logging
 * @param[in] i_modId Code Module ID
 * @param[in] i_reasonCode Error Reason Code
 * @param[in] i_user1 User data 1
 * @param[in] i_user2 User data 2
 */
errlHndl_t tpmCreateErrorLog(const uint8_t i_modId,
                             const uint16_t i_reasonCode,
                             const uint64_t i_user1,
                             const uint64_t i_user2);

/**
 * @brief Mark the TPM as non-functional and take required steps
 * @param[in/out] io_target Current TPM target structure
 */
void tpmMarkFailed(TpmTarget * io_target);

#ifdef __cplusplus
} // end TRUSTEDBOOT namespace
#endif

#endif
OpenPOWER on IntegriCloud