mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-25 02:35:22 +00:00
Add option to use mocked TPM driver
Some ARM boards, such as Seaboard, have buggy TPM chip that bricks the borad. This commit adds a option to use mocked TPM driver. R=rongchang@chromium.org,rspangler@chromium.org,wad@chromium.org BUG=chromium-os:14239 TEST=Run verified boot on Seaboard Review URL: http://codereview.chromium.org/6883040 Change-Id: Iae6133f081c2e3d9daa4e14bb711550e2658e9df
This commit is contained in:
1
Makefile
1
Makefile
@@ -3,6 +3,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
export FIRMWARE_ARCH
|
||||
export MOCK_TPM
|
||||
|
||||
export CC ?= gcc
|
||||
export CXX ?= g++
|
||||
|
||||
@@ -57,16 +57,25 @@ LIB_SRCS = \
|
||||
./lib/cryptolib/sha1.c \
|
||||
./lib/cryptolib/sha2.c \
|
||||
./lib/cryptolib/sha_utility.c \
|
||||
./lib/rollback_index.c \
|
||||
./lib/tpm_bootmode.c \
|
||||
./lib/stateful_util.c \
|
||||
./lib/tpm_lite/tlcl.c \
|
||||
./lib/utility.c \
|
||||
./lib/vboot_common.c \
|
||||
./lib/vboot_firmware.c \
|
||||
./lib/vboot_kernel.c \
|
||||
./lib/vboot_nvstorage.c
|
||||
|
||||
ifeq ($(MOCK_TPM),)
|
||||
LIB_SRCS += \
|
||||
./lib/rollback_index.c \
|
||||
./lib/tpm_bootmode.c \
|
||||
./lib/tpm_lite/tlcl.c
|
||||
else
|
||||
LIB_SRCS += \
|
||||
./lib/mocked_rollback_index.c \
|
||||
./lib/mocked_tpm_bootmode.c \
|
||||
./lib/tpm_lite/mocked_tlcl.c
|
||||
endif
|
||||
|
||||
LIB_OBJS = $(LIB_SRCS:%.c=${BUILD_ROOT}/%.o)
|
||||
|
||||
STUB_SRCS = \
|
||||
|
||||
70
firmware/lib/mocked_rollback_index.c
Normal file
70
firmware/lib/mocked_rollback_index.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (c) 2010-2011 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* Functions for querying, manipulating and locking rollback indices
|
||||
* stored in the TPM NVRAM.
|
||||
*/
|
||||
|
||||
#include "rollback_index.h"
|
||||
|
||||
#include "tss_constants.h"
|
||||
|
||||
|
||||
uint32_t TPMClearAndReenable(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t SetupTPM(int recovery_mode, int developer_mode,
|
||||
RollbackSpaceFirmware* rsf) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackS3Resume(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackFirmwareSetup(int developer_mode, uint32_t* version) {
|
||||
*version = 0;
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackFirmwareRead(uint32_t* version) {
|
||||
*version = 0;
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackFirmwareWrite(uint32_t version) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackFirmwareLock(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackKernelRecovery(int developer_mode) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackKernelRead(uint32_t* version) {
|
||||
*version = 0;
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackKernelWrite(uint32_t version) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
uint32_t RollbackKernelLock(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
16
firmware/lib/mocked_tpm_bootmode.c
Normal file
16
firmware/lib/mocked_tpm_bootmode.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* Functions for updating the TPM state with the status of boot path.
|
||||
*/
|
||||
|
||||
#include "tpm_bootmode.h"
|
||||
|
||||
#include "tss_constants.h"
|
||||
|
||||
|
||||
uint32_t SetTPMBootModeState(int developer_mode, int recovery_mode,
|
||||
int fw_keyblock_flags) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
130
firmware/lib/tpm_lite/mocked_tlcl.c
Normal file
130
firmware/lib/tpm_lite/mocked_tlcl.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/* Copyright (c) 2010-2011 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "tlcl.h"
|
||||
#include "tlcl_internal.h"
|
||||
|
||||
uint32_t TlclLibInit(void) {
|
||||
return TlclStubInit();
|
||||
}
|
||||
|
||||
uint32_t TlclStartup(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclSaveState(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclResume(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclSelfTestFull(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclContinueSelfTest(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclDefineSpace(uint32_t index, uint32_t perm, uint32_t size) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclWrite(uint32_t index, const void* data, uint32_t length) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclRead(uint32_t index, void* data, uint32_t length) {
|
||||
Memset(data, '\0', length);
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclWriteLock(uint32_t index) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclReadLock(uint32_t index) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclAssertPhysicalPresence(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclPhysicalPresenceCMDEnable(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclFinalizePhysicalPresence(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclAssertPhysicalPresenceResult(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclLockPhysicalPresence(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclSetNvLocked(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
int TlclIsOwned(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t TlclForceClear(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclSetEnable(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclClearEnable(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclSetDeactivated(uint8_t flag) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclGetPermanentFlags(TPM_PERMANENT_FLAGS* pflags) {
|
||||
Memset(pflags, '\0', sizeof(*pflags));
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclGetSTClearFlags(TPM_STCLEAR_FLAGS* vflags) {
|
||||
Memset(vflags, '\0', sizeof(*vflags));
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclGetFlags(uint8_t* disable,
|
||||
uint8_t* deactivated,
|
||||
uint8_t *nvlocked) {
|
||||
*disable = 0;
|
||||
*deactivated = 0;
|
||||
*nvlocked = 0;
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclSetGlobalLock(void) {
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclExtend(int pcr_num, const uint8_t* in_digest,
|
||||
uint8_t* out_digest) {
|
||||
Memcpy(out_digest, in_digest, kPcrDigestLength);
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t TlclGetPermissions(uint32_t index, uint32_t* permissions) {
|
||||
*permissions = 0;
|
||||
return TPM_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user