diff options
author | Claudio Carvalho <cclaudio@linux.vnet.ibm.com> | 2016-09-28 05:01:22 -0300 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-10-10 15:29:35 +1100 |
commit | 046a682f1e967a19227240f48d4036ee157ac7fb (patch) | |
tree | ce0da3c84a917805f54f3e2c964c97ff3dab8567 /libstb | |
parent | 984476937057bb2990a1f976664790d0e16cfb0a (diff) | |
download | skiboot-046a682f1e967a19227240f48d4036ee157ac7fb.zip skiboot-046a682f1e967a19227240f48d4036ee157ac7fb.tar.gz skiboot-046a682f1e967a19227240f48d4036ee157ac7fb.tar.bz2 |
libstb/tss: implement TSS required functions
Hostboot shares the TSS code with phyp and skiboot, but the functions
declared in trustedbootUtils.H are hostboot specific and must be implemented
by the TSS downstream consumers.
This implements the trustedbootUtils.H functions.
Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libstb')
-rw-r--r-- | libstb/tss/trustedbootUtils.C | 115 | ||||
-rw-r--r-- | libstb/tss/trustedbootUtils.H | 1 |
2 files changed, 32 insertions, 84 deletions
diff --git a/libstb/tss/trustedbootUtils.C b/libstb/tss/trustedbootUtils.C index 9091503..ba6667f 100644 --- a/libstb/tss/trustedbootUtils.C +++ b/libstb/tss/trustedbootUtils.C @@ -1,97 +1,44 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/secureboot/trusted/trustedbootUtils.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ -/* [+] 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.C +/* Copyright 2013-2016 IBM Corp. * - * @brief Trusted boot utility functions + * 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. */ -// ---------------------------------------------- -// Includes -// ---------------------------------------------- -#include <string.h> -#include <sys/time.h> -#include <trace/interface.H> -#include <errl/errlentry.H> -#include <errl/errlmanager.H> -#include <errl/errludtarget.H> -#include <errl/errludstring.H> -#include <targeting/common/targetservice.H> -#include <devicefw/driverif.H> -#include <i2c/tpmddif.H> -#include <secureboot/trustedbootif.H> -#include <i2c/tpmddreasoncodes.H> -#include <secureboot/trustedboot_reasoncodes.H> #include "trustedbootUtils.H" -#include "trustedbootCmds.H" #include "trustedboot.H" -#include "trustedTypes.H" - +#include <skiboot.h> +#include <stdlib.h> -namespace TRUSTEDBOOT +errlHndl_t tpmTransmit(TpmTarget * io_target, uint8_t* io_buffer, + size_t i_cmdSize, size_t i_bufsize ) { + errlHndl_t err = NULL; + err = io_target->driver->transmit(io_target->dev, + io_buffer, + i_cmdSize, + &i_bufsize); + return err; +} -errlHndl_t tpmTransmit(TpmTarget * io_target, - uint8_t* io_buffer, - size_t i_cmdSize, - size_t i_bufsize ) +errlHndl_t tpmCreateErrorLog(const uint8_t i_modId, const uint16_t i_reasonCode, + const uint64_t i_user1, const uint64_t i_user2) { - errlHndl_t err = NULL; - - do - { - // Send to the TPM - err = deviceRead(io_target->tpmTarget, - io_buffer, - i_bufsize, - DEVICE_TPM_ADDRESS(TPMDD::TPM_OP_TRANSMIT, - i_cmdSize)); - if (NULL != err) - { - break; - } - - - } while ( 0 ); - - return err; + prlog(PR_ERR,"TSS: Error Log %d %d %d %d\n", + i_modId, i_reasonCode, (int)i_user1, (int)i_user2); + return (i_modId << 16) | i_reasonCode; } -errlHndl_t tpmCreateErrorLog(const uint8_t i_modId, - const uint16_t i_reasonCode, - const uint64_t i_user1, - const uint64_t i_user2) +void tpmMarkFailed(TpmTarget *io_target) { - errlHndl_t err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, - i_modId, - i_reasonCode, - i_user1, - i_user2, - true /*Add HB SW Callout*/ ); - err->collectTrace( SECURE_COMP_NAME ); - return err; + prlog(PR_ERR, "TSS: %s called for %d\n", __func__, io_target->id); } - -} // end TRUSTEDBOOT diff --git a/libstb/tss/trustedbootUtils.H b/libstb/tss/trustedbootUtils.H index 73bc387..7b8bb61 100644 --- a/libstb/tss/trustedbootUtils.H +++ b/libstb/tss/trustedbootUtils.H @@ -40,6 +40,7 @@ // Includes // ----------------------------------------------- #include "trustedTypes.H" +#include "../tpm_chip.h" #ifdef __cplusplus namespace TRUSTEDBOOT |