vboot/secdata: rename rollback_index to secdata_tpm

These secure spaces are now used for more than just rollback
versions and should be renamed thus.

Note: Originally this rename operation was batched into the CL
which rewrites the functions in rollback_index/secdata_tpm, but
it made reviewing in Gerrit a pain, since it couldn't pick up on
the file renames, and instead showed them as deletes/adds.

Doing the rename separately helps ensure all references to
rollback_index are updated, and gives us a better review
experience in Gerrit.

BUG=b:124141368, chromium:972956
TEST=make clean && make runtests
BRANCH=none

Change-Id: I51e5c731e0d7a071d384c28da56e7adce64ba943
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776279
Commit-Queue: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Joel Kitching 2019-08-29 13:27:23 +08:00 committed by Commit Bot
parent 0961b80b9d
commit 110df5cafa
22 changed files with 35 additions and 69 deletions

View File

@ -395,11 +395,11 @@ endif
# Support real TPM unless BIOS sets MOCK_TPM
ifeq (${MOCK_TPM},)
FWLIB_SRCS += \
firmware/lib/rollback_index.c \
firmware/lib/secdata_tpm.c \
${TLCL_SRCS}
else
FWLIB_SRCS += \
firmware/lib/mocked_rollback_index.c \
firmware/lib/mocked_secdata_tpm.c \
firmware/lib/tpm_lite/mocked_tlcl.c
endif
@ -691,10 +691,10 @@ TEST_NAMES = \
ifeq (${TPM2_MODE}${MOCK_TPM},)
# TODO(apronin): tests for TPM2 case?
# tlcl_tests and rollback_index2_tests only work when MOCK_TPM is disabled
# secdata_tpm_tests and tlcl_tests only work when MOCK_TPM is disabled
TEST_NAMES += \
tests/tlcl_tests \
tests/rollback_index2_tests
tests/secdata_tpm_tests \
tests/tlcl_tests
endif
TEST_FUTIL_NAMES = \
@ -1255,9 +1255,9 @@ runmisctests: test_setup
${RUNTEST} ${BUILD_RUN}/tests/ec_sync_tests
ifeq (${TPM2_MODE}${MOCK_TPM},)
# TODO(apronin): tests for TPM2 case?
# tlcl_tests and rollback_index2_tests only work when MOCK_TPM is disabled
# secdata_tpm_tests and tlcl_tests only work when MOCK_TPM is disabled
${RUNTEST} ${BUILD_RUN}/tests/secdata_tpm_tests
${RUNTEST} ${BUILD_RUN}/tests/tlcl_tests
${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests
endif
${RUNTEST} ${BUILD_RUN}/tests/utility_string_tests
${RUNTEST} ${BUILD_RUN}/tests/vboot_api_devmode_tests

View File

@ -2,12 +2,12 @@
* 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
* Functions for querying, manipulating and locking secure data spaces
* stored in the TPM NVRAM.
*/
#ifndef VBOOT_REFERENCE_ROLLBACK_INDEX_H_
#define VBOOT_REFERENCE_ROLLBACK_INDEX_H_
#ifndef VBOOT_REFERENCE_SECDATA_TPM_H_
#define VBOOT_REFERENCE_SECDATA_TPM_H_
#include "2return_codes.h"
#include "2sysincludes.h"
@ -170,4 +170,4 @@ uint32_t SafeWrite(uint32_t index, const void *data, uint32_t length);
*/
vb2_error_t SetVirtualDevMode(int val);
#endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */
#endif /* VBOOT_REFERENCE_SECDATA_TPM_H_ */

View File

@ -2,12 +2,12 @@
* 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
* Functions for querying, manipulating and locking secure data spaces
* stored in the TPM NVRAM.
*/
#include "utility.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "tss_constants.h"
vb2_error_t SetVirtualDevMode(int val)

View File

@ -2,14 +2,14 @@
* 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
* Functions for querying, manipulating and locking secure data spaces
* stored in the TPM NVRAM.
*/
#include "2sysincludes.h"
#include "2common.h"
#include "2crc8.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "tlcl.h"
#include "tss_constants.h"
#include "vboot_api.h"
@ -17,7 +17,7 @@
#define RETURN_ON_FAILURE(tpm_command) do { \
uint32_t result_; \
if ((result_ = (tpm_command)) != TPM_SUCCESS) { \
VB2_DEBUG("Rollback: %08x returned by " #tpm_command \
VB2_DEBUG("TPM: 0x%x returned by " #tpm_command \
"\n", (int)result_); \
return result_; \
} \

View File

@ -7,7 +7,7 @@
*/
#include "2common.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "2sysincludes.h"
#include "tlcl.h"
#include "tpm2_marshaling.h"

View File

@ -14,7 +14,7 @@
#include "2sysincludes.h"
#include "ec_sync.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "utility.h"
#include "vb2_common.h"
#include "vboot_api.h"

View File

@ -17,7 +17,7 @@
#include "cgptlib_internal.h"
#include "gpt_misc.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "utility.h"
#include "vb2_common.h"
#include "vboot_api.h"

View File

@ -13,7 +13,7 @@
#include "2secdata.h"
#include "ec_sync.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "tlcl.h"
#include "utility.h"
#include "vb2_common.h"

View File

@ -6,7 +6,7 @@
*/
#include "2common.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "2sysincludes.h"
#include "vboot_api.h"
#include "vboot_kernel.h"

View File

@ -13,7 +13,7 @@
#include "2sysincludes.h"
#include "ec_sync.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "utility.h"
#include "vb2_common.h"
#include "vboot_api.h"

View File

@ -6,7 +6,7 @@
#include "2sysincludes.h"
#include "cgptlib.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "tlcl.h"
#include "vboot_common.h"
#include "vboot_kernel.h"
@ -22,7 +22,7 @@ int main(void)
/* load_kernel_fw.h */
LoadKernel(0, 0);
/* rollback_index.h */
/* secdata_tpm.h */
RollbackKernelRead(0);
RollbackKernelWrite(0);
RollbackKernelLock(0);

View File

@ -16,7 +16,7 @@
#include "ec_sync.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "vboot_audio.h"
#include "vboot_common.h"

View File

@ -1,34 +0,0 @@
# Copyright (c) 2010 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.
# Rollback code exhaustive test.
#
# INSTRUCTIONS. Put this file in /etc/init. Move /etc/init/tcsd.conf to
# /etc/init/tcsd.confxxx to disable it. Then boot with the device connected by
# wired ethernet. The test will start and reboot the host after every cycle.
# Unplug the ethernet cable to stop testing. If left alone, the test will stop
# at the first failure or when all the states have been tested.
#
# Reminder: rollback_index_test only works with TPM-agnostic firmware.
# Connecting to tcsd requires that "localhost" be reachable, so we wait for
# shill to start, but that's not enough, and in the while loop below we also
# wait for pinging to localhost to succeed.
start on started shill
script
cable=""
while [ "$cable" != "yes" ]; do
cable=$(/usr/sbin/ethtool eth0 | grep Link | cut -f 3 -d ' ')
logger "rbtest: cable is $cable"
ping -c 1 localhost || cable=""
sleep 2
done
# ideally we would like to issue a "stop tcsd", but this doesn't work
# (upstart race?) so we must manually disable tcsd.conf
### stop tcsd
logger "starting rbtest"
/usr/bin/rollback_index_test > /tmp/rbtest.out 2>&1
end script

View File

@ -2,7 +2,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Tests for rollback_index functions
* Tests for secdata_tpm functions
*/
#include <stdint.h>
@ -11,7 +11,7 @@
#include <string.h>
#include "2crc8.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "tlcl.h"

View File

@ -18,7 +18,7 @@
#include "crc32.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "vboot_common.h"
#include "vboot_display.h"

View File

@ -15,7 +15,7 @@
#include "2secdata.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "vboot_audio.h"
#include "vboot_common.h"

View File

@ -17,7 +17,7 @@
#include "ec_sync.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "vboot_audio.h"
#include "vboot_common.h"

View File

@ -19,7 +19,7 @@
#include "2struct.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "vb2_common.h"
#include "vboot_api.h"

View File

@ -14,7 +14,7 @@
#include "2common.h"
#include "2nvstorage.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "utility.h"
#include "vboot_api.h"

View File

@ -15,7 +15,7 @@
#include "2secdata.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "vboot_api.h"
#include "vboot_audio.h"

View File

@ -22,7 +22,7 @@
#include "gpt.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "test_common.h"
#include "vb2_common.h"
#include "vb2_struct.h"

View File

@ -15,7 +15,7 @@
#include "2misc.h"
#include "host_common.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "secdata_tpm.h"
#include "vboot_common.h"
#include "vboot_kernel.h"