summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-03-29 11:09:30 -0700
committerChromeBot <chrome-bot@google.com>2013-04-02 14:12:52 -0700
commit0c3ba249abb1dc60f5ebabccf84ff13206440b83 (patch)
tree81cd2ada3845b8bb4b83fde6e27050483d5b941e
parent28b65ca99f4042fcc1218a4c18297f7ffb32ea15 (diff)
downloadvboot-0c3ba249abb1dc60f5ebabccf84ff13206440b83.tar.gz
Massive refactoring of external header files.
This reduces the number of exported header files to the minimum needed by the existing userspace utilities and firmware implementations. BUG=chromium:221544 BRANCH=none TEST=manual, trybots CQ-DEPEND=CL:47019,CL:47022,CL:47023 sudo FEATURES=test emerge vboot_reference FEATURES=test emerge-$BOARD \ vboot_reference \ chromeos-cryptohome \ chromeos-installer \ chromeos-u-boot \ peach-u-boot \ depthcharge Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47021 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--Makefile17
-rw-r--r--cgpt/cgpt.c5
-rw-r--r--cgpt/cgpt.h25
-rw-r--r--cgpt/cgpt_add.c9
-rw-r--r--cgpt/cgpt_boot.c2
-rw-r--r--cgpt/cgpt_common.c4
-rw-r--r--cgpt/cgpt_create.c4
-rw-r--r--cgpt/cgpt_find.c2
-rw-r--r--cgpt/cgpt_legacy.c5
-rw-r--r--cgpt/cgpt_prioritize.c5
-rw-r--r--cgpt/cgpt_repair.c4
-rw-r--r--cgpt/cgpt_show.c5
-rw-r--r--cgpt/cmd_add.c5
-rw-r--r--cgpt/cmd_boot.c5
-rw-r--r--cgpt/cmd_create.c5
-rw-r--r--cgpt/cmd_find.c5
-rw-r--r--cgpt/cmd_legacy.c5
-rw-r--r--cgpt/cmd_prioritize.c3
-rw-r--r--cgpt/cmd_repair.c5
-rw-r--r--cgpt/cmd_show.c6
-rw-r--r--firmware/include/bmpblk_header.h12
-rw-r--r--firmware/include/gbb_header.h4
-rw-r--r--firmware/include/gpt.h (renamed from firmware/lib/cgptlib/include/gpt.h)3
-rw-r--r--firmware/include/tlcl.h2
-rw-r--r--firmware/include/tss_constants.h4
-rw-r--r--firmware/include/vboot_api.h12
-rw-r--r--firmware/include/vboot_nvstorage.h1
-rw-r--r--firmware/include/vboot_struct.h3
-rw-r--r--firmware/lib/cgptlib/cgptlib.c2
-rw-r--r--firmware/lib/cgptlib/cgptlib_internal.c2
-rw-r--r--firmware/lib/cgptlib/crc32.c2
-rw-r--r--firmware/lib/crc8.c2
-rw-r--r--firmware/lib/cryptolib/padding.c2
-rw-r--r--firmware/lib/cryptolib/rsa.c2
-rw-r--r--firmware/lib/cryptolib/rsa_utility.c2
-rw-r--r--firmware/lib/cryptolib/sha1.c2
-rw-r--r--firmware/lib/cryptolib/sha256.c2
-rw-r--r--firmware/lib/cryptolib/sha512.c2
-rw-r--r--firmware/lib/cryptolib/sha_utility.c2
-rw-r--r--firmware/lib/include/load_firmware_fw.h (renamed from firmware/include/load_firmware_fw.h)1
-rw-r--r--firmware/lib/include/load_kernel_fw.h (renamed from firmware/include/load_kernel_fw.h)1
-rw-r--r--firmware/lib/include/sysincludes.h (renamed from firmware/include/sysincludes.h)0
-rw-r--r--firmware/lib/include/utility.h (renamed from firmware/include/utility.h)0
-rw-r--r--firmware/lib/mocked_rollback_index.c2
-rw-r--r--firmware/lib/mocked_tpm_bootmode.c3
-rw-r--r--firmware/lib/rollback_index.c2
-rw-r--r--firmware/lib/stateful_util.c2
-rw-r--r--firmware/lib/tpm_bootmode.c3
-rw-r--r--firmware/lib/tpm_lite/mocked_tlcl.c2
-rw-r--r--firmware/lib/tpm_lite/tlcl.c1
-rw-r--r--firmware/lib/utility.c1
-rw-r--r--firmware/lib/utility_string.c1
-rw-r--r--firmware/lib/vboot_api_firmware.c2
-rw-r--r--firmware/lib/vboot_api_init.c2
-rw-r--r--firmware/lib/vboot_api_kernel.c2
-rw-r--r--firmware/lib/vboot_audio.c2
-rw-r--r--firmware/lib/vboot_common.c2
-rw-r--r--firmware/lib/vboot_common_init.c2
-rw-r--r--firmware/lib/vboot_display.c2
-rw-r--r--firmware/lib/vboot_firmware.c2
-rw-r--r--firmware/lib/vboot_kernel.c1
-rw-r--r--firmware/lib/vboot_nvstorage.c2
-rw-r--r--firmware/linktest/main.c2
-rw-r--r--firmware/linktest/main_vbinit.c2
-rw-r--r--firmware/linktest/main_vbsf.c2
-rw-r--r--firmware/stub/tpm_lite_stub.c3
-rw-r--r--firmware/stub/utility_stub.c2
-rw-r--r--firmware/stub/vboot_api_stub.c2
-rw-r--r--firmware/stub/vboot_api_stub_disk.c2
-rw-r--r--firmware/stub/vboot_api_stub_init.c2
-rw-r--r--firmware/stub/vboot_api_stub_sf.c2
-rw-r--r--futility/futility.c1
-rw-r--r--host/arch/x86/lib/crossystem_arch.c4
-rw-r--r--host/include/cgpt_params.h (renamed from cgpt/cgpt_params.h)46
-rw-r--r--host/include/crossystem.h2
-rw-r--r--host/include/vboot_host.h62
-rw-r--r--host/lib/include/crossystem_arch.h (renamed from host/include/crossystem_arch.h)0
-rw-r--r--host/lib/include/file_keys.h (renamed from host/include/file_keys.h)0
-rw-r--r--host/lib/include/fmap.h (renamed from host/include/fmap.h)0
-rw-r--r--host/lib/include/host_common.h (renamed from host/include/host_common.h)0
-rw-r--r--host/lib/include/host_key.h (renamed from host/include/host_key.h)0
-rw-r--r--host/lib/include/host_keyblock.h (renamed from host/include/host_keyblock.h)0
-rw-r--r--host/lib/include/host_misc.h (renamed from host/include/host_misc.h)0
-rw-r--r--host/lib/include/host_signature.h (renamed from host/include/host_signature.h)0
-rw-r--r--host/lib/include/signature_digest.h (renamed from host/include/signature_digest.h)0
-rw-r--r--tests/big_firmware_tests.c1
-rw-r--r--tests/big_kernel_tests.c1
-rw-r--r--tests/firmware_image_tests.c1
-rw-r--r--tests/firmware_rollback_tests.c1
-rw-r--r--tests/firmware_splicing_tests.c1
-rw-r--r--tests/firmware_verify_benchmark.c1
-rw-r--r--tests/kernel_image_tests.c1
-rw-r--r--tests/kernel_rollback_tests.c1
-rw-r--r--tests/kernel_splicing_tests.c1
-rw-r--r--tests/kernel_verify_benchmark.c1
-rw-r--r--tests/rollback_index2_tests.c1
-rw-r--r--tests/rollback_index3_tests.c1
-rw-r--r--tests/rollback_index_test.c1
-rw-r--r--tests/rsa_padding_test.c1
-rw-r--r--tests/rsa_utility_tests.c1
-rw-r--r--tests/rsa_verify_benchmark.c1
-rw-r--r--tests/sha_benchmark.c1
-rw-r--r--tests/sha_tests.c1
-rw-r--r--tests/stateful_util_tests.c1
-rw-r--r--tests/test_common.c1
-rw-r--r--tests/tlcl_tests.c1
-rw-r--r--tests/tpm_bootmode_tests.c1
-rw-r--r--tests/tpm_lite/tlcl_tests.c2
-rw-r--r--tests/utility_string_tests.c1
-rw-r--r--tests/utility_tests.c1
-rw-r--r--tests/vboot_api_devmode_tests.c1
-rw-r--r--tests/vboot_api_firmware_tests.c1
-rw-r--r--tests/vboot_api_init_tests.c1
-rw-r--r--tests/vboot_api_kernel2_tests.c1
-rw-r--r--tests/vboot_api_kernel3_tests.c1
-rw-r--r--tests/vboot_api_kernel4_tests.c1
-rw-r--r--tests/vboot_api_kernel_tests.c1
-rw-r--r--tests/vboot_audio_tests.c1
-rw-r--r--tests/vboot_common2_tests.c1
-rw-r--r--tests/vboot_common3_tests.c1
-rw-r--r--tests/vboot_common_tests.c1
-rw-r--r--tests/vboot_display_tests.c1
-rw-r--r--tests/vboot_firmware_tests.c1
-rw-r--r--tests/vboot_kernel_tests.c1
-rw-r--r--tests/vboot_nvstorage_test.c1
-rw-r--r--tests/verify_firmware_fuzz_driver.c1
-rw-r--r--tests/verify_kernel_fuzz_driver.c1
-rw-r--r--utility/bmpblk_font.c2
-rw-r--r--utility/bmpblk_util.c4
-rw-r--r--utility/bmpblk_utility.cc8
-rw-r--r--utility/dump_kernel_config.c6
-rw-r--r--utility/dump_kernel_config_lib.c2
-rw-r--r--utility/gbb_utility.cc5
-rw-r--r--utility/include/dump_kernel_config.h24
-rw-r--r--utility/tpm_init_temp_fix.c1
-rw-r--r--utility/tpmc.c2
136 files changed, 278 insertions, 180 deletions
diff --git a/Makefile b/Makefile
index 94677791..d1708ef1 100644
--- a/Makefile
+++ b/Makefile
@@ -160,6 +160,9 @@ endif
# Create / use dependency files
CFLAGS += -MMD -MF $@.d
+# These are required to access large disks and files on 32-bit systems.
+CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+
# Code coverage
ifneq (${COV},)
COV_FLAGS = -O0 --coverage
@@ -659,8 +662,9 @@ ${FWLIB}: ${FWLIB_OBJS}
hostlib: ${HOSTLIB} ${BUILD}/host/linktest/main
${BUILD}/host/% ${HOSTLIB}: INCLUDES += \
- -Ihost/include\
- -Ihost/arch/${ARCH}/include
+ -Ihost/include \
+ -Ihost/arch/${ARCH}/include \
+ -Ihost/lib/include
# TODO: better way to make .a than duplicating this recipe each time?
${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS}
@@ -687,6 +691,8 @@ ${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS}
.PHONY: cgpt
cgpt: ${CGPT}
+${CGPT_OBJS}: INCLUDES += -Ihost/include
+
${CGPT}: LDFLAGS += -static
${CGPT}: LDLIBS += -luuid
@@ -704,7 +710,10 @@ cgpt_install: ${CGPT}
# Utilities
# These have their own headers too.
-${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include
+${BUILD}/utility/%: INCLUDES += \
+ -Ihost/include \
+ -Ihost/lib/include \
+ -Iutility/include
# Utilities for auto-update toolkits must be statically linked.
${UTIL_BINS_STATIC}: LDFLAGS += -static
@@ -855,7 +864,7 @@ ${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o
# Allow multiple definitions, so tests can mock functions from other libraries
${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition
-${BUILD}/tests/%: INCLUDES += -Ihost/include
+${BUILD}/tests/%: INCLUDES += -Ihost/include -Ihost/lib/include
${BUILD}/tests/%: LDLIBS += -lrt -luuid
${BUILD}/tests/%: LIBS += ${TESTLIB}
diff --git a/cgpt/cgpt.c b/cgpt/cgpt.c
index ac7aecdd..a3b20d99 100644
--- a/cgpt/cgpt.c
+++ b/cgpt/cgpt.c
@@ -6,13 +6,14 @@
* files for more details.
*/
-#include "cgpt.h"
-
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <uuid/uuid.h>
+#include "cgpt.h"
+#include "vboot_host.h"
+
const char* progname;
const char* command;
void (*uuid_generator)(uint8_t* buffer);
diff --git a/cgpt/cgpt.h b/cgpt/cgpt.h
index 47630928..3d09fb97 100644
--- a/cgpt/cgpt.h
+++ b/cgpt/cgpt.h
@@ -5,11 +5,6 @@
#ifndef VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
#define VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#define _FILE_OFFSET_BITS 64
#include <fcntl.h>
#include <features.h>
#include <stdint.h>
@@ -20,13 +15,6 @@
#include "cgptlib.h"
-// Just for clarity
-enum {
- CGPT_OK = 0,
- CGPT_FAILED,
-};
-
-
struct legacy_partition {
uint8_t status;
uint8_t f_head;
@@ -67,19 +55,6 @@ int DriveOpen(const char *drive_path, struct drive *drive, int mode);
int DriveClose(struct drive *drive, int update_as_needed);
int CheckValid(const struct drive *drive);
-/* GUID conversion functions. Accepted format:
- *
- * "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
- *
- * At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing
- * '\0').
- */
-#define GUID_STRLEN 37
-int StrToGuid(const char *str, Guid *guid);
-void GuidToStr(const Guid *guid, char *str, unsigned int buflen);
-int GuidEqual(const Guid *guid1, const Guid *guid2);
-int GuidIsZero(const Guid *guid);
-
/* Constant global type values to compare against */
extern const Guid guid_chromeos_firmware;
extern const Guid guid_chromeos_kernel;
diff --git a/cgpt/cgpt_add.c b/cgpt/cgpt_add.c
index 684d4d2f..eaf0b73e 100644
--- a/cgpt/cgpt_add.c
+++ b/cgpt/cgpt_add.c
@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <string.h>
-#include "cgptlib_internal.h"
-#include "cgpt_params.h"
#define _STUB_IMPLEMENTATION_
+
+#include "cgpt.h"
+#include "cgpt_params.h"
+#include "cgptlib_internal.h"
#include "utility.h"
+#include "vboot_host.h"
static const char* DumpCgptAddParams(const CgptAddParams *params) {
static char buf[256];
diff --git a/cgpt/cgpt_boot.c b/cgpt/cgpt_boot.c
index 4de9c4c5..00b783f4 100644
--- a/cgpt/cgpt_boot.c
+++ b/cgpt/cgpt_boot.c
@@ -11,7 +11,7 @@
#include "cgpt_params.h"
#include "cgptlib_internal.h"
#include "endian.h"
-
+#include "vboot_host.h"
int CgptGetBootPartitionNumber(CgptBootParams *params) {
struct drive drive;
diff --git a/cgpt/cgpt_common.c b/cgpt/cgpt_common.c
index dc42d41f..dec26d12 100644
--- a/cgpt/cgpt_common.c
+++ b/cgpt/cgpt_common.c
@@ -6,8 +6,6 @@
* files for more details.
*/
-#include "cgpt.h"
-
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
@@ -22,8 +20,10 @@
#include <sys/types.h>
#include <unistd.h>
+#include "cgpt.h"
#include "cgptlib_internal.h"
#include "crc32.h"
+#include "vboot_host.h"
void Error(const char *format, ...) {
va_list ap;
diff --git a/cgpt/cgpt_create.c b/cgpt/cgpt_create.c
index f4d67d58..b0256c51 100644
--- a/cgpt/cgpt_create.c
+++ b/cgpt/cgpt_create.c
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
#include <string.h>
+#include "cgpt.h"
#include "cgptlib_internal.h"
-#include "cgpt_params.h"
+#include "vboot_host.h"
int CgptCreate(CgptCreateParams *params) {
struct drive drive;
diff --git a/cgpt/cgpt_find.c b/cgpt/cgpt_find.c
index 795eab62..c7c77b0c 100644
--- a/cgpt/cgpt_find.c
+++ b/cgpt/cgpt_find.c
@@ -8,8 +8,8 @@
#include <unistd.h>
#include "cgpt.h"
-#include "cgpt_params.h"
#include "cgptlib_internal.h"
+#include "vboot_host.h"
#define BUFSIZE 1024
// FIXME: currently we only support 512-byte sectors.
diff --git a/cgpt/cgpt_legacy.c b/cgpt/cgpt_legacy.c
index ac2d4f04..932fbb92 100644
--- a/cgpt/cgpt_legacy.c
+++ b/cgpt/cgpt_legacy.c
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <string.h>
+#include "cgpt.h"
#include "cgptlib_internal.h"
-#include "cgpt_params.h"
+#include "vboot_host.h"
int CgptLegacy(CgptLegacyParams *params) {
struct drive drive;
diff --git a/cgpt/cgpt_prioritize.c b/cgpt/cgpt_prioritize.c
index dd74ccf3..7cd73c0a 100644
--- a/cgpt/cgpt_prioritize.c
+++ b/cgpt/cgpt_prioritize.c
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <string.h>
+#include "cgpt.h"
#include "cgptlib_internal.h"
-#include "cgpt_params.h"
+#include "vboot_host.h"
//////////////////////////////////////////////////////////////////////////////
// We need a sorted list of priority groups, where each element in the list
diff --git a/cgpt/cgpt_repair.c b/cgpt/cgpt_repair.c
index aeac0b93..e591c75b 100644
--- a/cgpt/cgpt_repair.c
+++ b/cgpt/cgpt_repair.c
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
#include <string.h>
+#include "cgpt.h"
#include "cgptlib_internal.h"
-#include "cgpt_params.h"
+#include "vboot_host.h"
int CgptRepair(CgptRepairParams *params) {
struct drive drive;
diff --git a/cgpt/cgpt_show.c b/cgpt/cgpt_show.c
index 6c2160ca..cb5e2759 100644
--- a/cgpt/cgpt_show.c
+++ b/cgpt/cgpt_show.c
@@ -2,15 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#define __STDC_FORMAT_MACROS
#include <string.h>
+#include "cgpt.h"
#include "cgptlib_internal.h"
-#include "cgpt_params.h"
#include "crc32.h"
+#include "vboot_host.h"
/* Generate output like:
*
diff --git a/cgpt/cmd_add.c b/cgpt/cmd_add.c
index 500633b0..a48ab336 100644
--- a/cgpt/cmd_add.c
+++ b/cgpt/cmd_add.c
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <getopt.h>
#include <string.h>
-#include "cgpt_params.h"
+#include "cgpt.h"
+#include "vboot_host.h"
static void Usage(void)
{
diff --git a/cgpt/cmd_boot.c b/cgpt/cmd_boot.c
index d2e63b7f..caa94bc7 100644
--- a/cgpt/cmd_boot.c
+++ b/cgpt/cmd_boot.c
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <getopt.h>
#include <string.h>
-#include "cgpt_params.h"
+#include "cgpt.h"
+#include "vboot_host.h"
static void Usage(void)
{
diff --git a/cgpt/cmd_create.c b/cgpt/cmd_create.c
index c2b8adfc..0d91b08a 100644
--- a/cgpt/cmd_create.c
+++ b/cgpt/cmd_create.c
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <getopt.h>
#include <string.h>
-#include "cgpt_params.h"
+#include "cgpt.h"
+#include "vboot_host.h"
static void Usage(void)
{
diff --git a/cgpt/cmd_find.c b/cgpt/cmd_find.c
index 4b2964d4..1a3dc696 100644
--- a/cgpt/cmd_find.c
+++ b/cgpt/cmd_find.c
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <getopt.h>
#include <string.h>
-#include "cgpt_params.h"
+#include "cgpt.h"
+#include "vboot_host.h"
static void Usage(void)
{
diff --git a/cgpt/cmd_legacy.c b/cgpt/cmd_legacy.c
index 593d2ece..a1269493 100644
--- a/cgpt/cmd_legacy.c
+++ b/cgpt/cmd_legacy.c
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <getopt.h>
#include <string.h>
-#include "cgpt_params.h"
+#include "cgpt.h"
+#include "vboot_host.h"
static void Usage(void)
{
diff --git a/cgpt/cmd_prioritize.c b/cgpt/cmd_prioritize.c
index 05e7e0e6..3a692b8d 100644
--- a/cgpt/cmd_prioritize.c
+++ b/cgpt/cmd_prioritize.c
@@ -8,7 +8,8 @@
#include <string.h>
#include <uuid/uuid.h>
-#include "cgpt_params.h"
+#include "cgpt.h"
+#include "vboot_host.h"
static void Usage(void)
{
diff --git a/cgpt/cmd_repair.c b/cgpt/cmd_repair.c
index 3c313303..ac5578af 100644
--- a/cgpt/cmd_repair.c
+++ b/cgpt/cmd_repair.c
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#include <getopt.h>
#include <string.h>
-#include "cgpt_params.h"
+#include "cgpt.h"
+#include "vboot_host.h"
static void Usage(void)
{
diff --git a/cgpt/cmd_show.c b/cgpt/cmd_show.c
index 2df199d3..1b31f392 100644
--- a/cgpt/cmd_show.c
+++ b/cgpt/cmd_show.c
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cgpt.h"
-
#define __STDC_FORMAT_MACROS
#include <getopt.h>
#include <inttypes.h>
#include <string.h>
-#include "cgpt_params.h"
+
+#include "cgpt.h"
+#include "vboot_host.h"
static void Usage(void)
{
diff --git a/firmware/include/bmpblk_header.h b/firmware/include/bmpblk_header.h
index 1b04bf70..4889a6a8 100644
--- a/firmware/include/bmpblk_header.h
+++ b/firmware/include/bmpblk_header.h
@@ -41,11 +41,9 @@
* | List of locale names |
* +-----------------------------------------+
*/
-
#ifndef VBOOT_REFERENCE_BMPBLK_HEADER_H_
#define VBOOT_REFERENCE_BMPBLK_HEADER_H_
-
-#include "sysincludes.h"
+#include <stdint.h>
#define BMPBLOCK_SIGNATURE "$BMP"
#define BMPBLOCK_SIGNATURE_SIZE (4)
@@ -130,14 +128,6 @@ typedef enum ImageFormat {
FORMAT_FONT,
} ImageFormat;
-/* Constants for ImageInfo.compression */
-typedef enum Compression {
- COMPRESS_NONE = 0,
- COMPRESS_EFIv1, /* The x86 BIOS only supports this */
- COMPRESS_LZMA1, /* The ARM BIOS supports LZMA1 */
- MAX_COMPRESS,
-} Compression;
-
/*
* These magic image names can be used in the .yaml file to indicate that the
* ASCII HWID should be displayed. For RENDER_HWID, the image coordinates
diff --git a/firmware/include/gbb_header.h b/firmware/include/gbb_header.h
index 5ab5121b..43aa3e76 100644
--- a/firmware/include/gbb_header.h
+++ b/firmware/include/gbb_header.h
@@ -4,11 +4,9 @@
*
* Data structure of Google Binary Block (GBB)
*/
-
#ifndef VBOOT_REFERENCE_GBB_HEADER_H_
#define VBOOT_REFERENCE_GBB_HEADER_H_
-
-#include "sysincludes.h"
+#include <stdint.h>
#define GBB_HEADER_SIZE 128
diff --git a/firmware/lib/cgptlib/include/gpt.h b/firmware/include/gpt.h
index 0418655b..fa537397 100644
--- a/firmware/lib/cgptlib/include/gpt.h
+++ b/firmware/include/gpt.h
@@ -9,8 +9,7 @@
*/
#ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_
#define VBOOT_REFERENCE_CGPTLIB_GPT_H_
-
-#include "sysincludes.h"
+#include <stdint.h>
#define GPT_HEADER_SIGNATURE "EFI PART"
#define GPT_HEADER_SIGNATURE2 "CHROMEOS"
diff --git a/firmware/include/tlcl.h b/firmware/include/tlcl.h
index 5ce05638..a71136b6 100644
--- a/firmware/include/tlcl.h
+++ b/firmware/include/tlcl.h
@@ -11,8 +11,8 @@
#ifndef TPM_LITE_TLCL_H_
#define TPM_LITE_TLCL_H_
+#include <stdint.h>
-#include "sysincludes.h"
#include "tss_constants.h"
/*****************************************************************************/
diff --git a/firmware/include/tss_constants.h b/firmware/include/tss_constants.h
index bcceded8..883a5ad8 100644
--- a/firmware/include/tss_constants.h
+++ b/firmware/include/tss_constants.h
@@ -5,11 +5,9 @@
* Some TPM constants and type definitions for standalone compilation for use
* in the firmware
*/
-
#ifndef VBOOT_REFERENCE_TSS_CONSTANTS_H_
#define VBOOT_REFERENCE_TSS_CONSTANTS_H_
-
-#include "sysincludes.h"
+#include <stdint.h>
#define TPM_MAX_COMMAND_SIZE 4096
#define TPM_LARGE_ENOUGH_COMMAND_SIZE 256 /* saves space in the firmware */
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 31e91a7b..dc8be1c4 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -21,9 +21,7 @@
#ifndef VBOOT_REFERENCE_VBOOT_API_H_
#define VBOOT_REFERENCE_VBOOT_API_H_
-
-#include "sysincludes.h"
-#include "bmpblk_header.h"
+#include <stdint.h>
/*****************************************************************************/
/* Error codes */
@@ -814,6 +812,14 @@ VbError_t VbExDecompress(void *inbuf, uint32_t in_size,
uint32_t compression_type,
void *outbuf, uint32_t *out_size);
+/* Constants for compression_type */
+enum {
+ COMPRESS_NONE = 0,
+ COMPRESS_EFIv1, /* The x86 BIOS only supports this */
+ COMPRESS_LZMA1, /* The ARM BIOS supports LZMA1 */
+ MAX_COMPRESS,
+};
+
/**
* Execute legacy boot option.
*/
diff --git a/firmware/include/vboot_nvstorage.h b/firmware/include/vboot_nvstorage.h
index 943a5664..e6b014aa 100644
--- a/firmware/include/vboot_nvstorage.h
+++ b/firmware/include/vboot_nvstorage.h
@@ -7,6 +7,7 @@
#ifndef VBOOT_REFERENCE_NVSTORAGE_H_
#define VBOOT_REFERENCE_NVSTORAGE_H_
+#include <stdint.h>
#define VBNV_BLOCK_SIZE 16 /* Size of NV storage block in bytes */
diff --git a/firmware/include/vboot_struct.h b/firmware/include/vboot_struct.h
index ee912a30..e20b0aa9 100644
--- a/firmware/include/vboot_struct.h
+++ b/firmware/include/vboot_struct.h
@@ -8,8 +8,7 @@
#ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_
#define VBOOT_REFERENCE_VBOOT_STRUCT_H_
-
-#include "sysincludes.h"
+#include <stdint.h>
/* Public key data */
typedef struct VbPublicKey {
diff --git a/firmware/lib/cgptlib/cgptlib.c b/firmware/lib/cgptlib/cgptlib.c
index 370530f1..6fc29f62 100644
--- a/firmware/lib/cgptlib/cgptlib.c
+++ b/firmware/lib/cgptlib/cgptlib.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include "sysincludes.h"
+
#include "cgptlib.h"
#include "cgptlib_internal.h"
#include "crc32.h"
diff --git a/firmware/lib/cgptlib/cgptlib_internal.c b/firmware/lib/cgptlib/cgptlib_internal.c
index d51ce33b..c87f981c 100644
--- a/firmware/lib/cgptlib/cgptlib_internal.c
+++ b/firmware/lib/cgptlib/cgptlib_internal.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include "sysincludes.h"
+
#include "cgptlib.h"
#include "cgptlib_internal.h"
#include "crc32.h"
diff --git a/firmware/lib/cgptlib/crc32.c b/firmware/lib/cgptlib/crc32.c
index 002c5b9a..286cfa09 100644
--- a/firmware/lib/cgptlib/crc32.c
+++ b/firmware/lib/cgptlib/crc32.c
@@ -39,6 +39,8 @@
/* polynomial $edb88320 */
/* */
/* -------------------------------------------------------------------- */
+#include "sysincludes.h"
+
#include "crc32.h"
static uint32_t crc32_tab[] = {
diff --git a/firmware/lib/crc8.c b/firmware/lib/crc8.c
index b0ee8679..0e38e1eb 100644
--- a/firmware/lib/crc8.c
+++ b/firmware/lib/crc8.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include "sysincludes.h"
+
#include "crc8.h"
/**
diff --git a/firmware/lib/cryptolib/padding.c b/firmware/lib/cryptolib/padding.c
index 24b1c15d..4fc939a5 100644
--- a/firmware/lib/cryptolib/padding.c
+++ b/firmware/lib/cryptolib/padding.c
@@ -5,6 +5,8 @@
* arrays corresponding to various combinations of algorithms for RSA signatures.
*/
+#include "sysincludes.h"
+
#include "cryptolib.h"
diff --git a/firmware/lib/cryptolib/rsa.c b/firmware/lib/cryptolib/rsa.c
index 897816e8..6d61a216 100644
--- a/firmware/lib/cryptolib/rsa.c
+++ b/firmware/lib/cryptolib/rsa.c
@@ -8,6 +8,8 @@
* support multiple RSA key lengths and hash digest algorithms.
*/
+#include "sysincludes.h"
+
#include "cryptolib.h"
#include "vboot_api.h"
#include "utility.h"
diff --git a/firmware/lib/cryptolib/rsa_utility.c b/firmware/lib/cryptolib/rsa_utility.c
index ab4650c0..f6eefe2b 100644
--- a/firmware/lib/cryptolib/rsa_utility.c
+++ b/firmware/lib/cryptolib/rsa_utility.c
@@ -5,6 +5,8 @@
* Implementation of RSA utility functions.
*/
+#include "sysincludes.h"
+
#include "cryptolib.h"
#include "stateful_util.h"
#include "utility.h"
diff --git a/firmware/lib/cryptolib/sha1.c b/firmware/lib/cryptolib/sha1.c
index 0a3f8f6a..b34b8a95 100644
--- a/firmware/lib/cryptolib/sha1.c
+++ b/firmware/lib/cryptolib/sha1.c
@@ -6,6 +6,8 @@
* Open Source Project (platorm/system/core.git/libmincrypt/sha.c
*/
+#include "sysincludes.h"
+
#include "cryptolib.h"
#include "utility.h"
diff --git a/firmware/lib/cryptolib/sha256.c b/firmware/lib/cryptolib/sha256.c
index 6d3c08dd..664b876c 100644
--- a/firmware/lib/cryptolib/sha256.c
+++ b/firmware/lib/cryptolib/sha256.c
@@ -35,6 +35,8 @@
* SUCH DAMAGE.
*/
+#include "sysincludes.h"
+
#include "cryptolib.h"
#include "utility.h"
diff --git a/firmware/lib/cryptolib/sha512.c b/firmware/lib/cryptolib/sha512.c
index 66c9a35f..96b2bef6 100644
--- a/firmware/lib/cryptolib/sha512.c
+++ b/firmware/lib/cryptolib/sha512.c
@@ -35,6 +35,8 @@
* SUCH DAMAGE.
*/
+#include "sysincludes.h"
+
#include "cryptolib.h"
#include "utility.h"
diff --git a/firmware/lib/cryptolib/sha_utility.c b/firmware/lib/cryptolib/sha_utility.c
index bd7e1400..6c7aa493 100644
--- a/firmware/lib/cryptolib/sha_utility.c
+++ b/firmware/lib/cryptolib/sha_utility.c
@@ -5,6 +5,8 @@
* Utility functions for message digest functions.
*/
+#include "sysincludes.h"
+
#include "cryptolib.h"
#include "utility.h"
#include "vboot_api.h"
diff --git a/firmware/include/load_firmware_fw.h b/firmware/lib/include/load_firmware_fw.h
index f582e880..555cf6fd 100644
--- a/firmware/include/load_firmware_fw.h
+++ b/firmware/lib/include/load_firmware_fw.h
@@ -9,7 +9,6 @@
#ifndef VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_
#define VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_
-#include "sysincludes.h"
#include "vboot_api.h"
#include "vboot_nvstorage.h"
#include "vboot_struct.h"
diff --git a/firmware/include/load_kernel_fw.h b/firmware/lib/include/load_kernel_fw.h
index 7439e57c..dd6e1a84 100644
--- a/firmware/include/load_kernel_fw.h
+++ b/firmware/lib/include/load_kernel_fw.h
@@ -9,7 +9,6 @@
#ifndef VBOOT_REFERENCE_LOAD_KERNEL_FW_H_
#define VBOOT_REFERENCE_LOAD_KERNEL_FW_H_
-#include "sysincludes.h"
#include "vboot_api.h"
#include "vboot_nvstorage.h"
diff --git a/firmware/include/sysincludes.h b/firmware/lib/include/sysincludes.h
index 490b51cc..490b51cc 100644
--- a/firmware/include/sysincludes.h
+++ b/firmware/lib/include/sysincludes.h
diff --git a/firmware/include/utility.h b/firmware/lib/include/utility.h
index f6575ed5..f6575ed5 100644
--- a/firmware/include/utility.h
+++ b/firmware/lib/include/utility.h
diff --git a/firmware/lib/mocked_rollback_index.c b/firmware/lib/mocked_rollback_index.c
index 65dfd4de..e866f137 100644
--- a/firmware/lib/mocked_rollback_index.c
+++ b/firmware/lib/mocked_rollback_index.c
@@ -6,6 +6,8 @@
* stored in the TPM NVRAM.
*/
+#include "sysincludes.h"
+
#include "rollback_index.h"
#include "tss_constants.h"
diff --git a/firmware/lib/mocked_tpm_bootmode.c b/firmware/lib/mocked_tpm_bootmode.c
index b42c2c79..e9d82def 100644
--- a/firmware/lib/mocked_tpm_bootmode.c
+++ b/firmware/lib/mocked_tpm_bootmode.c
@@ -5,8 +5,9 @@
* Functions for updating the TPM state with the status of boot path.
*/
-#include "tpm_bootmode.h"
+#include "sysincludes.h"
+#include "tpm_bootmode.h"
#include "tss_constants.h"
const char* kBootStateSHA1Digests[] = {
diff --git a/firmware/lib/rollback_index.c b/firmware/lib/rollback_index.c
index e430bea6..3744f4bb 100644
--- a/firmware/lib/rollback_index.c
+++ b/firmware/lib/rollback_index.c
@@ -6,6 +6,8 @@
* stored in the TPM NVRAM.
*/
+#include "sysincludes.h"
+
#include "crc8.h"
#include "rollback_index.h"
#include "tlcl.h"
diff --git a/firmware/lib/stateful_util.c b/firmware/lib/stateful_util.c
index 6db03fc5..fbbc48c9 100644
--- a/firmware/lib/stateful_util.c
+++ b/firmware/lib/stateful_util.c
@@ -5,6 +5,8 @@
* Implementations of stateful memory operations.
*/
+#include "sysincludes.h"
+
#include "stateful_util.h"
#include "utility.h"
diff --git a/firmware/lib/tpm_bootmode.c b/firmware/lib/tpm_bootmode.c
index 218db207..a8e1a7cc 100644
--- a/firmware/lib/tpm_bootmode.c
+++ b/firmware/lib/tpm_bootmode.c
@@ -5,9 +5,10 @@
* Functions for updating the TPM state with the status of boot path.
*/
-#include "tpm_bootmode.h"
+#include "sysincludes.h"
#include "tlcl.h"
+#include "tpm_bootmode.h"
#include "utility.h"
#include "vboot_api.h"
diff --git a/firmware/lib/tpm_lite/mocked_tlcl.c b/firmware/lib/tpm_lite/mocked_tlcl.c
index e977cd5d..2657cb63 100644
--- a/firmware/lib/tpm_lite/mocked_tlcl.c
+++ b/firmware/lib/tpm_lite/mocked_tlcl.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include "sysincludes.h"
+
#include "tlcl.h"
#include "tlcl_internal.h"
#include "utility.h"
diff --git a/firmware/lib/tpm_lite/tlcl.c b/firmware/lib/tpm_lite/tlcl.c
index 50b3877b..c015e895 100644
--- a/firmware/lib/tpm_lite/tlcl.c
+++ b/firmware/lib/tpm_lite/tlcl.c
@@ -15,6 +15,7 @@
*/
#include "sysincludes.h"
+
#include "tlcl.h"
#include "tlcl_internal.h"
#include "tlcl_structures.h"
diff --git a/firmware/lib/utility.c b/firmware/lib/utility.c
index 66b8eff3..2f8c90dc 100644
--- a/firmware/lib/utility.c
+++ b/firmware/lib/utility.c
@@ -6,6 +6,7 @@
*/
#include "sysincludes.h"
+
#include "utility.h"
int SafeMemcmp(const void *s1, const void *s2, size_t n) {
diff --git a/firmware/lib/utility_string.c b/firmware/lib/utility_string.c
index 4a7e3e38..361d1809 100644
--- a/firmware/lib/utility_string.c
+++ b/firmware/lib/utility_string.c
@@ -6,6 +6,7 @@
*/
#include "sysincludes.h"
+
#include "utility.h"
diff --git a/firmware/lib/vboot_api_firmware.c b/firmware/lib/vboot_api_firmware.c
index 5889e939..e0c93a37 100644
--- a/firmware/lib/vboot_api_firmware.c
+++ b/firmware/lib/vboot_api_firmware.c
@@ -5,6 +5,8 @@
* High-level firmware wrapper API - entry points for init, firmware selection
*/
+#include "sysincludes.h"
+
#include "gbb_header.h"
#include "load_firmware_fw.h"
#include "rollback_index.h"
diff --git a/firmware/lib/vboot_api_init.c b/firmware/lib/vboot_api_init.c
index 39c90562..b6c70642 100644
--- a/firmware/lib/vboot_api_init.c
+++ b/firmware/lib/vboot_api_init.c
@@ -5,6 +5,8 @@
* High-level firmware wrapper API - entry points for init, firmware selection
*/
+#include "sysincludes.h"
+
#include "gbb_header.h"
#include "load_firmware_fw.h"
#include "rollback_index.h"
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 483d47ed..3f1dfc5c 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -5,6 +5,8 @@
* High-level firmware wrapper API - entry points for kernel selection
*/
+#include "sysincludes.h"
+
#include "gbb_header.h"
#include "load_kernel_fw.h"
#include "rollback_index.h"
diff --git a/firmware/lib/vboot_audio.c b/firmware/lib/vboot_audio.c
index d89bc43f..2694b0eb 100644
--- a/firmware/lib/vboot_audio.c
+++ b/firmware/lib/vboot_audio.c
@@ -5,6 +5,8 @@
* Delay/beep functions used in dev-mode kernel selection.
*/
+#include "sysincludes.h"
+
#include "crc32.h"
#include "gbb_header.h"
#include "utility.h"
diff --git a/firmware/lib/vboot_common.c b/firmware/lib/vboot_common.c
index 3e3375f1..bd937102 100644
--- a/firmware/lib/vboot_common.c
+++ b/firmware/lib/vboot_common.c
@@ -6,6 +6,8 @@
* (Firmware portion)
*/
+#include "sysincludes.h"
+
#include "vboot_api.h"
#include "vboot_common.h"
#include "utility.h"
diff --git a/firmware/lib/vboot_common_init.c b/firmware/lib/vboot_common_init.c
index 9d6670ea..0e5e9f3e 100644
--- a/firmware/lib/vboot_common_init.c
+++ b/firmware/lib/vboot_common_init.c
@@ -6,6 +6,8 @@
* (Firmware portion)
*/
+#include "sysincludes.h"
+
#include "vboot_api.h"
#include "vboot_common.h"
#include "utility.h"
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index adf4a3f3..f79dfe13 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -5,6 +5,8 @@
* Display functions used in kernel selection.
*/
+#include "sysincludes.h"
+
#include "bmpblk_font.h"
#include "gbb_header.h"
#include "utility.h"
diff --git a/firmware/lib/vboot_firmware.c b/firmware/lib/vboot_firmware.c
index 405a545a..8d165f2a 100644
--- a/firmware/lib/vboot_firmware.c
+++ b/firmware/lib/vboot_firmware.c
@@ -6,6 +6,8 @@
* (Firmware portion)
*/
+#include "sysincludes.h"
+
#include "gbb_header.h"
#include "load_firmware_fw.h"
#include "utility.h"
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 41d44f6a..d63d4eed 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -6,6 +6,7 @@
* (Firmware portion)
*/
+#include "sysincludes.h"
#include "cgptlib.h"
#include "cgptlib_internal.h"
diff --git a/firmware/lib/vboot_nvstorage.c b/firmware/lib/vboot_nvstorage.c
index 618c7124..9b2eca1b 100644
--- a/firmware/lib/vboot_nvstorage.c
+++ b/firmware/lib/vboot_nvstorage.c
@@ -5,6 +5,8 @@
/* Non-volatile storage routines.
*/
+#include "sysincludes.h"
+
#include "crc8.h"
#include "utility.h"
diff --git a/firmware/linktest/main.c b/firmware/linktest/main.c
index c5ce2c1c..2a55248c 100644
--- a/firmware/linktest/main.c
+++ b/firmware/linktest/main.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include "sysincludes.h"
+
#include "cgptlib.h"
#include "load_firmware_fw.h"
#include "load_kernel_fw.h"
diff --git a/firmware/linktest/main_vbinit.c b/firmware/linktest/main_vbinit.c
index a3d50196..0300c915 100644
--- a/firmware/linktest/main_vbinit.c
+++ b/firmware/linktest/main_vbinit.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include "sysincludes.h"
+
#include "vboot_api.h"
int main(void)
diff --git a/firmware/linktest/main_vbsf.c b/firmware/linktest/main_vbsf.c
index 1a3825a8..db5c2660 100644
--- a/firmware/linktest/main_vbsf.c
+++ b/firmware/linktest/main_vbsf.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include "sysincludes.h"
+
#include "vboot_api.h"
int main(void)
diff --git a/firmware/stub/tpm_lite_stub.c b/firmware/stub/tpm_lite_stub.c
index 6818f2b1..5e6c7192 100644
--- a/firmware/stub/tpm_lite_stub.c
+++ b/firmware/stub/tpm_lite_stub.c
@@ -6,6 +6,8 @@
* equivalents.
*/
+#include <stdint.h>
+
#define _STUB_IMPLEMENTATION_
#include "tlcl.h"
#include "tlcl_internal.h"
@@ -24,6 +26,7 @@
#include <time.h>
#include <unistd.h>
+
#define TPM_DEVICE_PATH "/dev/tpm0"
/* Retry failed open()s for 5 seconds in 10ms polling intervals. */
#define OPEN_RETRY_DELAY_NS (10 * 1000 * 1000)
diff --git a/firmware/stub/utility_stub.c b/firmware/stub/utility_stub.c
index 549ee851..a1daed08 100644
--- a/firmware/stub/utility_stub.c
+++ b/firmware/stub/utility_stub.c
@@ -6,6 +6,8 @@
* equivalents.
*/
+#include <stdint.h>
+
#define _STUB_IMPLEMENTATION_
#include "utility.h"
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
index fd531ac7..36d56032 100644
--- a/firmware/stub/vboot_api_stub.c
+++ b/firmware/stub/vboot_api_stub.c
@@ -5,6 +5,8 @@
* Stub implementations of firmware-provided API functions.
*/
+#include <stdint.h>
+
#define _STUB_IMPLEMENTATION_
#include <stdarg.h>
diff --git a/firmware/stub/vboot_api_stub_disk.c b/firmware/stub/vboot_api_stub_disk.c
index aca38afa..186cd97d 100644
--- a/firmware/stub/vboot_api_stub_disk.c
+++ b/firmware/stub/vboot_api_stub_disk.c
@@ -5,6 +5,8 @@
* Stub implementations of disk APIs.
*/
+#include <stdint.h>
+
#define _STUB_IMPLEMENTATION_
#include <stdarg.h>
diff --git a/firmware/stub/vboot_api_stub_init.c b/firmware/stub/vboot_api_stub_init.c
index 76052da1..9e4f6370 100644
--- a/firmware/stub/vboot_api_stub_init.c
+++ b/firmware/stub/vboot_api_stub_init.c
@@ -5,6 +5,8 @@
* Stub implementations of firmware-provided API functions.
*/
+#include <stdint.h>
+
#define _STUB_IMPLEMENTATION_
#include <stdarg.h>
diff --git a/firmware/stub/vboot_api_stub_sf.c b/firmware/stub/vboot_api_stub_sf.c
index 96eeb85c..e2f1c1ae 100644
--- a/firmware/stub/vboot_api_stub_sf.c
+++ b/firmware/stub/vboot_api_stub_sf.c
@@ -5,6 +5,8 @@
* Stub implementations of firmware-provided API functions.
*/
+#include <stdint.h>
+
#define _STUB_IMPLEMENTATION_
#include <stdarg.h>
diff --git a/futility/futility.c b/futility/futility.c
index c30e3e8e..69ce57f4 100644
--- a/futility/futility.c
+++ b/futility/futility.c
@@ -4,7 +4,6 @@
* found in the LICENSE file.
*/
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c
index 23a3bcec..85c5c6b2 100644
--- a/host/arch/x86/lib/crossystem_arch.c
+++ b/host/arch/x86/lib/crossystem_arch.c
@@ -7,6 +7,7 @@
#include <dirent.h>
#include <errno.h>
#include <linux/nvram.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
@@ -14,10 +15,9 @@
#include <sys/types.h>
#include <unistd.h>
-#include "host_common.h"
-
#include "crossystem.h"
#include "crossystem_arch.h"
+#include "host_common.h"
#include "utility.h"
#include "vboot_common.h"
#include "vboot_nvstorage.h"
diff --git a/cgpt/cgpt_params.h b/host/include/cgpt_params.h
index 470e0ffb..c8567e5b 100644
--- a/cgpt/cgpt_params.h
+++ b/host/include/cgpt_params.h
@@ -1,15 +1,17 @@
-// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2013 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.
#ifndef VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
#define VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
+#include <stdint.h>
-#include "cgpt.h"
+#include "gpt.h"
-// This file defines the internal methods that use the user-mode cgpt programatically.
-// This is the interface for the callers such as the cgpt tool or the C++ post installer
-// executable.
+enum {
+ CGPT_OK = 0,
+ CGPT_FAILED,
+};
typedef struct CgptCreateParams {
char *drive_name;
@@ -46,8 +48,6 @@ typedef struct CgptShowParams {
uint32_t partition;
int single_item;
int debug;
-
- // This is filled in by the relevant methods in CgptShow.c
int num_partitions;
} CgptShowParams;
@@ -65,7 +65,6 @@ typedef struct CgptBootParams {
typedef struct CgptPrioritizeParams {
char *drive_name;
-
uint32_t set_partition;
int set_friends;
int max_priority;
@@ -74,7 +73,6 @@ typedef struct CgptPrioritizeParams {
typedef struct CgptFindParams {
char *drive_name;
-
int verbose;
int set_unique;
int set_type;
@@ -89,7 +87,7 @@ typedef struct CgptFindParams {
Guid type_guid;
char *label;
int hits;
- int match_partnum; // 0 for no match, 1-N for match
+ int match_partnum; /* 1-based; 0 means no match */
} CgptFindParams;
typedef struct CgptLegacyParams {
@@ -97,32 +95,4 @@ typedef struct CgptLegacyParams {
int efipart;
} CgptLegacyParams;
-// create related methods.
-int CgptCreate(CgptCreateParams *params);
-
-// add/attribute/details related methods
-int CgptAdd(CgptAddParams *params);
-int CgptSetAttributes(CgptAddParams *params);
-int CgptGetPartitionDetails(CgptAddParams *params);
-
-// boot related methods.
-int CgptBoot(CgptBootParams *params);
-int CgptGetBootPartitionNumber(CgptBootParams *params);
-
-// show/get related methods.
-int CgptShow(CgptShowParams *params);
-int CgptGetNumNonEmptyPartitions(CgptShowParams *params);
-
-// repair related methods.
-int CgptRepair(CgptRepairParams *params);
-
-// priority related methods.
-int CgptPrioritize(CgptPrioritizeParams *params);
-
-// find related methods.
-void CgptFind(CgptFindParams *params);
-
-// legacy related methods.
-int CgptLegacy(CgptLegacyParams *params);
-
#endif // VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
diff --git a/host/include/crossystem.h b/host/include/crossystem.h
index 70e51d10..71acc841 100644
--- a/host/include/crossystem.h
+++ b/host/include/crossystem.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2013 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.
*/
diff --git a/host/include/vboot_host.h b/host/include/vboot_host.h
new file mode 100644
index 00000000..b22eea2d
--- /dev/null
+++ b/host/include/vboot_host.h
@@ -0,0 +1,62 @@
+/* Copyright (c) 2013 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.
+ *
+ * vboot-related functions exported for use by userspace programs
+ */
+
+#ifndef VBOOT_HOST_H_
+#define VBOOT_HOST_H_
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/****************************************************************************/
+/* EFI GPT manipulation */
+
+#include "cgpt_params.h"
+
+/* partition table manipulation */
+int CgptCreate(CgptCreateParams *params);
+int CgptAdd(CgptAddParams *params);
+int CgptSetAttributes(CgptAddParams *params);
+int CgptGetPartitionDetails(CgptAddParams *params);
+int CgptBoot(CgptBootParams *params);
+int CgptGetBootPartitionNumber(CgptBootParams *params);
+int CgptShow(CgptShowParams *params);
+int CgptGetNumNonEmptyPartitions(CgptShowParams *params);
+int CgptRepair(CgptRepairParams *params);
+int CgptPrioritize(CgptPrioritizeParams *params);
+void CgptFind(CgptFindParams *params);
+int CgptLegacy(CgptLegacyParams *params);
+
+/* GUID conversion functions. Accepted format:
+ *
+ * "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
+ *
+ * At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing
+ * '\0').
+ */
+#define GUID_STRLEN 37
+int StrToGuid(const char *str, Guid *guid);
+void GuidToStr(const Guid *guid, char *str, unsigned int buflen);
+int GuidEqual(const Guid *guid1, const Guid *guid2);
+int GuidIsZero(const Guid *guid);
+
+
+/****************************************************************************/
+/* Kernel command line */
+
+/* TODO(wfrichar): This needs a better location */
+#define MAX_KERNEL_CONFIG_SIZE 4096
+
+/* Use this to obtain the body load address from the kernel preamble */
+#define USE_PREAMBLE_LOAD_ADDR (~0)
+
+/* Returns a new copy of the kernel cmdline. The caller must free it. */
+char *FindKernelConfig(const char *filename,
+ uint64_t kernel_body_load_address);
+
+/****************************************************************************/
+
+#endif /* VBOOT_HOST_H_ */
diff --git a/host/include/crossystem_arch.h b/host/lib/include/crossystem_arch.h
index 4044c749..4044c749 100644
--- a/host/include/crossystem_arch.h
+++ b/host/lib/include/crossystem_arch.h
diff --git a/host/include/file_keys.h b/host/lib/include/file_keys.h
index 39fdc5ac..39fdc5ac 100644
--- a/host/include/file_keys.h
+++ b/host/lib/include/file_keys.h
diff --git a/host/include/fmap.h b/host/lib/include/fmap.h
index 7da2dd90..7da2dd90 100644
--- a/host/include/fmap.h
+++ b/host/lib/include/fmap.h
diff --git a/host/include/host_common.h b/host/lib/include/host_common.h
index 40ce212a..40ce212a 100644
--- a/host/include/host_common.h
+++ b/host/lib/include/host_common.h
diff --git a/host/include/host_key.h b/host/lib/include/host_key.h
index 018c25d3..018c25d3 100644
--- a/host/include/host_key.h
+++ b/host/lib/include/host_key.h
diff --git a/host/include/host_keyblock.h b/host/lib/include/host_keyblock.h
index ea88f19b..ea88f19b 100644
--- a/host/include/host_keyblock.h
+++ b/host/lib/include/host_keyblock.h
diff --git a/host/include/host_misc.h b/host/lib/include/host_misc.h
index 22b31415..22b31415 100644
--- a/host/include/host_misc.h
+++ b/host/lib/include/host_misc.h
diff --git a/host/include/host_signature.h b/host/lib/include/host_signature.h
index fb03c6c5..fb03c6c5 100644
--- a/host/include/host_signature.h
+++ b/host/lib/include/host_signature.h
diff --git a/host/include/signature_digest.h b/host/lib/include/signature_digest.h
index 40c27036..40c27036 100644
--- a/host/include/signature_digest.h
+++ b/host/lib/include/signature_digest.h
diff --git a/tests/big_firmware_tests.c b/tests/big_firmware_tests.c
index ca1dea8e..efb81d14 100644
--- a/tests/big_firmware_tests.c
+++ b/tests/big_firmware_tests.c
@@ -6,6 +6,7 @@
* is a quick and dirty test for detecting integer overflow issues.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/big_kernel_tests.c b/tests/big_kernel_tests.c
index cc4ceca0..6d83aae4 100644
--- a/tests/big_kernel_tests.c
+++ b/tests/big_kernel_tests.c
@@ -6,6 +6,7 @@
* is a quick and dirty test for detecting integer overflow issues.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/firmware_image_tests.c b/tests/firmware_image_tests.c
index 96cf9551..6201d473 100644
--- a/tests/firmware_image_tests.c
+++ b/tests/firmware_image_tests.c
@@ -5,6 +5,7 @@
* Tests for firmware image library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/firmware_rollback_tests.c b/tests/firmware_rollback_tests.c
index 14c0475c..09673a39 100644
--- a/tests/firmware_rollback_tests.c
+++ b/tests/firmware_rollback_tests.c
@@ -5,6 +5,7 @@
* Tests for checking firmware rollback-prevention logic.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/firmware_splicing_tests.c b/tests/firmware_splicing_tests.c
index 97d16dfc..17c327f4 100644
--- a/tests/firmware_splicing_tests.c
+++ b/tests/firmware_splicing_tests.c
@@ -5,6 +5,7 @@
* Splicing tests for the firmware image verification library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/firmware_verify_benchmark.c b/tests/firmware_verify_benchmark.c
index 61f23abd..3cdceff8 100644
--- a/tests/firmware_verify_benchmark.c
+++ b/tests/firmware_verify_benchmark.c
@@ -5,6 +5,7 @@
* Timing benchmark for verifying a firmware image.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/kernel_image_tests.c b/tests/kernel_image_tests.c
index 4890de3a..8125e681 100644
--- a/tests/kernel_image_tests.c
+++ b/tests/kernel_image_tests.c
@@ -5,6 +5,7 @@
* Tests for kernel image library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/kernel_rollback_tests.c b/tests/kernel_rollback_tests.c
index 731d45c9..2ecb05fc 100644
--- a/tests/kernel_rollback_tests.c
+++ b/tests/kernel_rollback_tests.c
@@ -5,6 +5,7 @@
* Tests for checking kernel rollback-prevention logic.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/kernel_splicing_tests.c b/tests/kernel_splicing_tests.c
index 241f1096..296af473 100644
--- a/tests/kernel_splicing_tests.c
+++ b/tests/kernel_splicing_tests.c
@@ -5,6 +5,7 @@
* Splicing tests for the kernel image verification library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/kernel_verify_benchmark.c b/tests/kernel_verify_benchmark.c
index c16dfcb8..3ba113c5 100644
--- a/tests/kernel_verify_benchmark.c
+++ b/tests/kernel_verify_benchmark.c
@@ -5,6 +5,7 @@
* Timing benchmark for verifying a firmware image.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/rollback_index2_tests.c b/tests/rollback_index2_tests.c
index d5f29743..1a07cb02 100644
--- a/tests/rollback_index2_tests.c
+++ b/tests/rollback_index2_tests.c
@@ -5,6 +5,7 @@
* Tests for rollback_index functions
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/rollback_index3_tests.c b/tests/rollback_index3_tests.c
index 30af89df..9434a5a7 100644
--- a/tests/rollback_index3_tests.c
+++ b/tests/rollback_index3_tests.c
@@ -5,6 +5,7 @@
* Tests for do-nothing rollback_index functions with disabled TPM
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/rollback_index_test.c b/tests/rollback_index_test.c
index a86ebde2..d84b8ea2 100644
--- a/tests/rollback_index_test.c
+++ b/tests/rollback_index_test.c
@@ -35,6 +35,7 @@
#include "utility.h"
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
diff --git a/tests/rsa_padding_test.c b/tests/rsa_padding_test.c
index fa04dacc..2f2423b9 100644
--- a/tests/rsa_padding_test.c
+++ b/tests/rsa_padding_test.c
@@ -4,6 +4,7 @@
*/
+#include <stdint.h>
#include <stdio.h>
#include "cryptolib.h"
diff --git a/tests/rsa_utility_tests.c b/tests/rsa_utility_tests.c
index 8944652e..47c483b2 100644
--- a/tests/rsa_utility_tests.c
+++ b/tests/rsa_utility_tests.c
@@ -4,6 +4,7 @@
*/
+#include <stdint.h>
#include <stdio.h>
#define _STUB_IMPLEMENTATION_
diff --git a/tests/rsa_verify_benchmark.c b/tests/rsa_verify_benchmark.c
index b359b62b..7b27f9e8 100644
--- a/tests/rsa_verify_benchmark.c
+++ b/tests/rsa_verify_benchmark.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/sha_benchmark.c b/tests/sha_benchmark.c
index a5bfc538..2193b781 100644
--- a/tests/sha_benchmark.c
+++ b/tests/sha_benchmark.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/sha_tests.c b/tests/sha_tests.c
index b462ccc0..ad85b9ea 100644
--- a/tests/sha_tests.c
+++ b/tests/sha_tests.c
@@ -5,6 +5,7 @@
/* FIPS 180-2 Tests for message digest functions. */
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/stateful_util_tests.c b/tests/stateful_util_tests.c
index e41feacb..9a306d5f 100644
--- a/tests/stateful_util_tests.c
+++ b/tests/stateful_util_tests.c
@@ -5,6 +5,7 @@
* Tests for statful_util functions.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/test_common.c b/tests/test_common.c
index e57fe21e..2fa445f6 100644
--- a/tests/test_common.c
+++ b/tests/test_common.c
@@ -7,6 +7,7 @@
#include "test_common.h"
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
diff --git a/tests/tlcl_tests.c b/tests/tlcl_tests.c
index 4765cff3..ef543d48 100644
--- a/tests/tlcl_tests.c
+++ b/tests/tlcl_tests.c
@@ -5,6 +5,7 @@
* Tests for TPM lite library
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/tpm_bootmode_tests.c b/tests/tpm_bootmode_tests.c
index 48552c58..c39094d0 100644
--- a/tests/tpm_bootmode_tests.c
+++ b/tests/tpm_bootmode_tests.c
@@ -5,6 +5,7 @@
* Tests for tpm_bootmode functions
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/tpm_lite/tlcl_tests.c b/tests/tpm_lite/tlcl_tests.c
index 59180e40..f36021f9 100644
--- a/tests/tpm_lite/tlcl_tests.c
+++ b/tests/tpm_lite/tlcl_tests.c
@@ -6,6 +6,8 @@
/* Shared code for tests.
*/
+#include "sysincludes.h"
+
#include "tlcl.h"
#include "tlcl_tests.h"
diff --git a/tests/utility_string_tests.c b/tests/utility_string_tests.c
index fe11d70b..d7601931 100644
--- a/tests/utility_string_tests.c
+++ b/tests/utility_string_tests.c
@@ -5,6 +5,7 @@
* Tests for string utility functions.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/utility_tests.c b/tests/utility_tests.c
index 7e21c77a..978f768c 100644
--- a/tests/utility_tests.c
+++ b/tests/utility_tests.c
@@ -5,6 +5,7 @@
* Tests for utility functions
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index af20030f..b10bba67 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -6,6 +6,7 @@
*/
#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_api_firmware_tests.c b/tests/vboot_api_firmware_tests.c
index a31b532e..9e7c441d 100644
--- a/tests/vboot_api_firmware_tests.c
+++ b/tests/vboot_api_firmware_tests.c
@@ -5,6 +5,7 @@
* Tests for vboot_api_firmware
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_api_init_tests.c b/tests/vboot_api_init_tests.c
index 7834b907..e04554a7 100644
--- a/tests/vboot_api_init_tests.c
+++ b/tests/vboot_api_init_tests.c
@@ -5,6 +5,7 @@
* Tests for vboot_api_init
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index 9b921cd2..aa3e20dc 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -5,6 +5,7 @@
* Tests for vboot_api_kernel, part 2
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_api_kernel3_tests.c b/tests/vboot_api_kernel3_tests.c
index 9ec6f19b..5b69845d 100644
--- a/tests/vboot_api_kernel3_tests.c
+++ b/tests/vboot_api_kernel3_tests.c
@@ -5,6 +5,7 @@
* Tests for vboot_api_kernel, part 3 - software sync
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_api_kernel4_tests.c b/tests/vboot_api_kernel4_tests.c
index 414279e5..af8d2b67 100644
--- a/tests/vboot_api_kernel4_tests.c
+++ b/tests/vboot_api_kernel4_tests.c
@@ -5,6 +5,7 @@
* Tests for vboot_api_kernel, part 4 - select and load kernel
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_api_kernel_tests.c b/tests/vboot_api_kernel_tests.c
index 8c04814e..56cb2104 100644
--- a/tests/vboot_api_kernel_tests.c
+++ b/tests/vboot_api_kernel_tests.c
@@ -6,6 +6,7 @@
*/
#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_audio_tests.c b/tests/vboot_audio_tests.c
index a1ecf71b..23667b1e 100644
--- a/tests/vboot_audio_tests.c
+++ b/tests/vboot_audio_tests.c
@@ -6,6 +6,7 @@
*/
#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_common2_tests.c b/tests/vboot_common2_tests.c
index b154e50b..564518ac 100644
--- a/tests/vboot_common2_tests.c
+++ b/tests/vboot_common2_tests.c
@@ -5,6 +5,7 @@
* Tests for firmware image library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/vboot_common3_tests.c b/tests/vboot_common3_tests.c
index c4f81cd3..b5499f66 100644
--- a/tests/vboot_common3_tests.c
+++ b/tests/vboot_common3_tests.c
@@ -5,6 +5,7 @@
* Tests for firmware image library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/vboot_common_tests.c b/tests/vboot_common_tests.c
index df4fdc21..852be795 100644
--- a/tests/vboot_common_tests.c
+++ b/tests/vboot_common_tests.c
@@ -5,6 +5,7 @@
* Tests for firmware vboot_common.c
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_display_tests.c b/tests/vboot_display_tests.c
index 3093534d..8e4a3a27 100644
--- a/tests/vboot_display_tests.c
+++ b/tests/vboot_display_tests.c
@@ -5,6 +5,7 @@
* Tests for firmware display library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/vboot_firmware_tests.c b/tests/vboot_firmware_tests.c
index 24a6c285..f6b96fec 100644
--- a/tests/vboot_firmware_tests.c
+++ b/tests/vboot_firmware_tests.c
@@ -5,6 +5,7 @@
* Tests for vboot_firmware library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c
index 1ee1528f..6992e94a 100644
--- a/tests/vboot_kernel_tests.c
+++ b/tests/vboot_kernel_tests.c
@@ -5,6 +5,7 @@
* Tests for vboot_kernel.c
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/vboot_nvstorage_test.c b/tests/vboot_nvstorage_test.c
index 91e8a89a..7ffec614 100644
--- a/tests/vboot_nvstorage_test.c
+++ b/tests/vboot_nvstorage_test.c
@@ -5,6 +5,7 @@
* Tests for firmware NV storage library.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tests/verify_firmware_fuzz_driver.c b/tests/verify_firmware_fuzz_driver.c
index f04a7d5d..3868d74f 100644
--- a/tests/verify_firmware_fuzz_driver.c
+++ b/tests/verify_firmware_fuzz_driver.c
@@ -5,6 +5,7 @@
* Utility for aiding fuzz testing of firmware image verification code.
*/
+#include <stdint.h>
#include <stdio.h>
#include "file_keys.h"
diff --git a/tests/verify_kernel_fuzz_driver.c b/tests/verify_kernel_fuzz_driver.c
index 10272638..e429f5e0 100644
--- a/tests/verify_kernel_fuzz_driver.c
+++ b/tests/verify_kernel_fuzz_driver.c
@@ -5,6 +5,7 @@
* Utility for aiding fuzz testing of kernel image verification code.
*/
+#include <stdint.h>
#include <stdio.h>
#include "file_keys.h"
diff --git a/utility/bmpblk_font.c b/utility/bmpblk_font.c
index 493e87f0..75c33859 100644
--- a/utility/bmpblk_font.c
+++ b/utility/bmpblk_font.c
@@ -7,6 +7,7 @@
#include <getopt.h>
#include <limits.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,6 +18,7 @@
#include "bmpblk_font.h"
#include "image_types.h"
+#include "vboot_api.h"
static char *progname;
diff --git a/utility/bmpblk_util.c b/utility/bmpblk_util.c
index 49573af9..abcac0d3 100644
--- a/utility/bmpblk_util.c
+++ b/utility/bmpblk_util.c
@@ -6,6 +6,8 @@
#include <fcntl.h>
#include <limits.h>
#include <lzma.h>
+#include <stdint.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
@@ -15,7 +17,7 @@
#include "bmpblk_util.h"
#include "eficompress.h"
-
+#include "vboot_api.h"
// Returns pointer to buffer containing entire file, sets length.
static void *read_entire_file(const char *filename, size_t *length) {
diff --git a/utility/bmpblk_utility.cc b/utility/bmpblk_utility.cc
index ea04c222..b3af1414 100644
--- a/utility/bmpblk_utility.cc
+++ b/utility/bmpblk_utility.cc
@@ -5,19 +5,21 @@
// Utility for manipulating firmware screen block (BMPBLOCK) in GBB.
//
-#include "bmpblk_utility.h"
-#include "image_types.h"
-
#include <assert.h>
#include <errno.h>
#include <getopt.h>
#include <lzma.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <yaml.h>
+#include "bmpblk_utility.h"
+#include "image_types.h"
+#include "vboot_api.h"
+
extern "C" {
#include "eficompress.h"
}
diff --git a/utility/dump_kernel_config.c b/utility/dump_kernel_config.c
index e733a0d0..ec0ee5ab 100644
--- a/utility/dump_kernel_config.c
+++ b/utility/dump_kernel_config.c
@@ -11,9 +11,7 @@
#include <sys/mman.h>
#include <unistd.h>
-#include "dump_kernel_config.h"
-#include "kernel_blob.h"
-#include "vboot_api.h"
+#include "vboot_host.h"
enum {
OPT_KLOADADDR = 1000,
@@ -76,7 +74,7 @@ int main(int argc, char* argv[]) {
return PrintHelp();
if (!infile || !*infile) {
- VbExError("Must specify filename\n");
+ fprintf(stderr, "Must specify filename\n");
return 1;
}
diff --git a/utility/dump_kernel_config_lib.c b/utility/dump_kernel_config_lib.c
index 464e349b..819ca921 100644
--- a/utility/dump_kernel_config_lib.c
+++ b/utility/dump_kernel_config_lib.c
@@ -9,10 +9,10 @@
#include <string.h>
#include <sys/mman.h>
-#include "dump_kernel_config.h"
#include "host_common.h"
#include "kernel_blob.h"
#include "vboot_api.h"
+#include "vboot_host.h"
static uint8_t* GetKernelConfig(uint8_t* blob, size_t blob_size,
uint64_t kernel_body_load_address) {
diff --git a/utility/gbb_utility.cc b/utility/gbb_utility.cc
index e68bd9b1..980521c5 100644
--- a/utility/gbb_utility.cc
+++ b/utility/gbb_utility.cc
@@ -5,10 +5,9 @@
// Utility for manipulating Google Binary Block (GBB)
//
-#include "gbb_utility.h"
-
#include <assert.h>
#include <getopt.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,6 +16,8 @@
#include <vector>
#include <algorithm>
+#include "gbb_utility.h"
+
using std::string;
///////////////////////////////////////////////////////////////////////
diff --git a/utility/include/dump_kernel_config.h b/utility/include/dump_kernel_config.h
deleted file mode 100644
index cacc5619..00000000
--- a/utility/include/dump_kernel_config.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (c) 2012 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.
- *
- * Exports the kernel commandline from a given partition/image file.
- */
-
-#ifndef DUMP_KERNEL_CONFIG_UTILITY_H_
-#define DUMP_KERNEL_CONFIG_UTILITY_H_
-
-#include <inttypes.h>
-#include <stdlib.h>
-
-/* TODO(wfrichar): This needs a better location */
-#define MAX_KERNEL_CONFIG_SIZE 4096
-
-/* Use this to obtain the body load address from the kernel preamble */
-#define USE_PREAMBLE_LOAD_ADDR (~0)
-
-/* Returns a new copy of the kernel cmdline. The caller must free it. */
-char *FindKernelConfig(const char *filename,
- uint64_t kernel_body_load_address);
-
-#endif // DUMP_KERNEL_CONFIG_UTILITY_H_
diff --git a/utility/tpm_init_temp_fix.c b/utility/tpm_init_temp_fix.c
index d3004a62..8964bee4 100644
--- a/utility/tpm_init_temp_fix.c
+++ b/utility/tpm_init_temp_fix.c
@@ -17,6 +17,7 @@
* "success" when everything worked.
*/
+#include <stdint.h>
#include <stdio.h>
#include <syslog.h>
diff --git a/utility/tpmc.c b/utility/tpmc.c
index 9302dd1e..98004e80 100644
--- a/utility/tpmc.c
+++ b/utility/tpmc.c
@@ -9,6 +9,8 @@
* for other errors.
*/
+#include <stdint.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>