From 9adf2aa24307937380debb703ac07b8093a25f61 Mon Sep 17 00:00:00 2001 From: Joel Kitching Date: Tue, 20 Aug 2019 17:43:50 +0800 Subject: vboot: fix up some headers, includes, comments, spacing BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id97f544da845f7070555e5e8cc6e782b2d45c300 Signed-off-by: Joel Kitching Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758151 Tested-by: Joel Kitching Reviewed-by: Joel Kitching Commit-Queue: Joel Kitching --- Makefile | 12 ++++++------ cgpt/cgpt.h | 13 +++++++------ cgpt/cgpt_add.c | 7 ++++--- cgpt/cgpt_boot.c | 7 ++++--- cgpt/cgpt_create.c | 8 ++++---- cgpt/cgpt_edit.c | 7 ++++--- cgpt/cgpt_endian.h | 7 ++++--- cgpt/cgpt_find.c | 7 ++++--- cgpt/cgpt_legacy.c | 7 ++++--- cgpt/cgpt_nor.h | 6 +++--- cgpt/cgpt_prioritize.c | 7 ++++--- cgpt/cgpt_repair.c | 8 ++++---- cgpt/cgpt_show.c | 7 ++++--- cgpt/cmd_add.c | 7 ++++--- cgpt/cmd_boot.c | 7 ++++--- cgpt/cmd_create.c | 7 ++++--- cgpt/cmd_edit.c | 7 ++++--- cgpt/cmd_find.c | 7 ++++--- cgpt/cmd_legacy.c | 7 ++++--- cgpt/cmd_prioritize.c | 7 ++++--- cgpt/cmd_repair.c | 7 ++++--- cgpt/cmd_show.c | 8 +++++--- firmware/2lib/2crc8.c | 10 ++++++---- firmware/2lib/include/2api.h | 13 ++++++------- firmware/2lib/include/2common.h | 6 +++--- firmware/2lib/include/2crc8.h | 14 ++++++++++---- firmware/2lib/include/2crypto.h | 7 ++++--- firmware/2lib/include/2fw_hash_tags.h | 7 ++++--- firmware/2lib/include/2gbb.h | 6 +++--- firmware/2lib/include/2gbb_flags.h | 6 +++--- firmware/2lib/include/2hmac.h | 6 +++--- firmware/2lib/include/2id.h | 7 ++++--- firmware/2lib/include/2misc.h | 6 +++--- firmware/2lib/include/2nvstorage.h | 6 +++--- firmware/2lib/include/2nvstorage_fields.h | 6 +++--- firmware/2lib/include/2recovery_reasons.h | 6 +++--- firmware/2lib/include/2return_codes.h | 6 +++--- firmware/2lib/include/2secdata.h | 10 +++++++--- firmware/2lib/include/2struct.h | 7 ++++--- firmware/2lib/include/2sysincludes.h | 6 +++--- firmware/include/gpt.h | 2 ++ firmware/include/gpt_misc.h | 6 +++--- firmware/include/tlcl.h | 11 +++++------ firmware/include/tpm1_tss_constants.h | 10 +++++----- firmware/include/tpm2_marshaling.h | 10 +++++----- firmware/include/tpm2_tss_constants.h | 9 ++++----- firmware/include/tss_constants.h | 2 +- firmware/include/vb2_api.h | 11 +++++------ firmware/include/vb2_sha.h | 2 +- firmware/include/vboot_api.h | 6 +++--- firmware/include/vboot_struct.h | 1 + firmware/include/vboot_test.h | 5 ++--- firmware/lib/cgptlib/include/cgptlib_internal.h | 2 +- firmware/lib/cgptlib/include/crc32.h | 7 ++++--- firmware/lib/include/utility.h | 4 +--- firmware/lib/include/vboot_audio.h | 3 +-- firmware/lib/include/vboot_display.h | 3 +-- firmware/lib/include/vboot_ui_menu_private.h | 2 +- firmware/lib/rollback_index.c | 2 +- firmware/lib/tpm2_lite/marshaling.c | 3 +-- firmware/lib/tpm2_lite/tlcl.c | 8 +++----- firmware/lib/tpm_lite/include/tlcl_internal.h | 6 +++--- firmware/lib/tpm_lite/include/tpm_error_messages.h | 11 +++++------ firmware/lib/vboot_api_kernel.c | 2 ++ firmware/lib/vboot_kernel.c | 2 +- firmware/lib/vboot_ui.c | 4 ++-- firmware/lib/vboot_ui_common.c | 3 +-- firmware/lib/vboot_ui_menu.c | 2 +- firmware/lib20/include/vb2_struct.h | 1 + firmware/lib21/include/vb21_struct.h | 1 + futility/cmd_dump_fmap.c | 4 ++-- futility/cmd_gbb_utility.c | 4 ++-- futility/cmd_load_fmap.c | 4 ++-- futility/cmd_pcr.c | 3 +-- futility/cmd_show.c | 3 +-- futility/cmd_sign.c | 4 ++-- futility/cmd_update.c | 3 +-- futility/cmd_validate_rec_mrc.c | 3 +-- futility/cmd_vbutil_kernel.c | 3 +-- futility/file_type.c | 3 +-- futility/file_type.h | 10 +++++----- futility/file_type_bios.c | 4 ++-- futility/file_type_bios.h | 11 ++++++----- futility/file_type_rwsig.c | 7 ++----- futility/file_type_usbpd1.c | 7 ++----- futility/futility.c | 3 +-- futility/futility.h | 7 ++++--- futility/futility_options.h | 10 ++++------ futility/kernel_blob.h | 3 ++- futility/misc.c | 3 +-- futility/ryu_root_header.c | 4 ++-- futility/updater.c | 3 +-- futility/updater.h | 4 ++-- futility/updater_archive.c | 3 +-- futility/updater_quirks.c | 3 +-- futility/vb1_helper.c | 3 +-- futility/vb1_helper.h | 9 ++++----- futility/vb2_helper.c | 3 +-- host/include/cgpt_params.h | 6 +++--- host/include/crossystem.h | 2 +- host/include/vboot_host.h | 7 ++++--- host/lib/fmap.c | 3 +-- host/lib/include/crossystem_arch.h | 2 +- host/lib/include/fmap.h | 9 ++++----- tests/cgptlib_test.h | 3 ++- tests/crc32_test.h | 1 + tests/futility/binary_editor.c | 3 +-- tests/futility/test_file_types.c | 4 ++-- tests/futility/test_not_really.c | 4 ++-- tests/sha_test_vectors.h | 6 +++--- tests/test_common.h | 1 - tests/timer_utils.h | 2 +- tests/tpm_lite/tlcl_tests.h | 11 +++++------ tests/vboot_api_kernel5_tests.c | 3 ++- utility/include/gbb_utility.h | 10 +++++----- utility/include/tpmextras.h | 10 ++++------ 116 files changed, 334 insertions(+), 327 deletions(-) diff --git a/Makefile b/Makefile index 300a873d..e88ee73c 100644 --- a/Makefile +++ b/Makefile @@ -701,7 +701,7 @@ TEST_NAMES = \ tests/vboot_api_kernel4_tests \ tests/vboot_api_kernel5_tests \ tests/vboot_detach_menu_tests \ -tests/vboot_common_tests \ + tests/vboot_common_tests \ tests/vboot_display_tests \ tests/vboot_kernel_tests \ tests/verify_kernel @@ -713,7 +713,7 @@ TEST_NAMES += \ tests/rollback_index2_tests endif -TEST_FUTIL_NAMES = \ +TEST_FUTIL_NAMES = \ tests/futility/binary_editor \ tests/futility/test_file_types \ tests/futility/test_not_really @@ -762,15 +762,15 @@ ifeq (${TPM2_MODE},) TLCL_TEST_NAMES = \ tests/tpm_lite/tpmtest_earlyextend \ tests/tpm_lite/tpmtest_earlynvram \ - tests/tpm_lite/tpmtest_earlynvram2 \ + tests/tpm_lite/tpmtest_earlynvram2 \ tests/tpm_lite/tpmtest_enable \ tests/tpm_lite/tpmtest_fastenable \ tests/tpm_lite/tpmtest_globallock \ - tests/tpm_lite/tpmtest_redefine_unowned \ - tests/tpm_lite/tpmtest_spaceperm \ + tests/tpm_lite/tpmtest_redefine_unowned \ + tests/tpm_lite/tpmtest_spaceperm \ tests/tpm_lite/tpmtest_testsetup \ tests/tpm_lite/tpmtest_timing \ - tests/tpm_lite/tpmtest_writelimit + tests/tpm_lite/tpmtest_writelimit else # TODO(apronin): tests for TPM2 case? TLCL_TEST_NAMES = diff --git a/cgpt/cgpt.h b/cgpt/cgpt.h index 6cf58998..2cf9ef5a 100644 --- a/cgpt/cgpt.h +++ b/cgpt/cgpt.h @@ -1,9 +1,10 @@ -// 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. +/* 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. + */ -#ifndef VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_ -#define VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_ +#ifndef VBOOT_REFERENCE_CGPT_H_ +#define VBOOT_REFERENCE_CGPT_H_ #include #ifndef HAVE_MACOS @@ -207,4 +208,4 @@ const char *GptError(int errnum); exit(1); } \ } while (0) -#endif // VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_ +#endif /* VBOOT_REFERENCE_CGPT_H_ */ diff --git a/cgpt/cgpt_add.c b/cgpt/cgpt_add.c index 786f2bc5..95815db8 100644 --- a/cgpt/cgpt_add.c +++ b/cgpt/cgpt_add.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include diff --git a/cgpt/cgpt_boot.c b/cgpt/cgpt_boot.c index d8976c42..932cd457 100644 --- a/cgpt/cgpt_boot.c +++ b/cgpt/cgpt_boot.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cgpt_create.c b/cgpt/cgpt_create.c index 77980bfc..fac89925 100644 --- a/cgpt/cgpt_create.c +++ b/cgpt/cgpt_create.c @@ -1,7 +1,7 @@ -// 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. - +/* 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. + */ #include diff --git a/cgpt/cgpt_edit.c b/cgpt/cgpt_edit.c index c7781ffc..e0d32f48 100644 --- a/cgpt/cgpt_edit.c +++ b/cgpt/cgpt_edit.c @@ -1,6 +1,7 @@ -// Copyright 2018 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. +/* Copyright 2018 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 "cgpt.h" #include "cgpt_params.h" diff --git a/cgpt/cgpt_endian.h b/cgpt/cgpt_endian.h index 49439ccf..a40b2c18 100644 --- a/cgpt/cgpt_endian.h +++ b/cgpt/cgpt_endian.h @@ -3,8 +3,8 @@ * found in the LICENSE file. */ -#ifndef VBOOT_REFERENCE_UTILITY_CGPT_ENDIAN_H_ -#define VBOOT_REFERENCE_UTILITY_CGPT_ENDIAN_H_ +#ifndef VBOOT_REFERENCE_CGPT_ENDIAN_H_ +#define VBOOT_REFERENCE_CGPT_ENDIAN_H_ // Newer distros already have this. For those that don't, we add it here. #ifndef HAVE_MACOS @@ -50,4 +50,5 @@ # endif #endif -#endif // VBOOT_REFERENCE_UTILITY_CGPT_ENDIAN_H_ + +#endif /* VBOOT_REFERENCE_CGPT_ENDIAN_H_ */ diff --git a/cgpt/cgpt_find.c b/cgpt/cgpt_find.c index 9cf87dd2..1c8c72dc 100644 --- a/cgpt/cgpt_find.c +++ b/cgpt/cgpt_find.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cgpt_legacy.c b/cgpt/cgpt_legacy.c index cf84821c..e51495ad 100644 --- a/cgpt/cgpt_legacy.c +++ b/cgpt/cgpt_legacy.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include diff --git a/cgpt/cgpt_nor.h b/cgpt/cgpt_nor.h index b01f88d8..47460895 100644 --- a/cgpt/cgpt_nor.h +++ b/cgpt/cgpt_nor.h @@ -6,8 +6,8 @@ * and write to NOR flash. */ -#ifndef VBOOT_REFERCENCE_CGPT_CGPT_NOR_H_ -#define VBOOT_REFERCENCE_CGPT_CGPT_NOR_H_ +#ifndef VBOOT_REFERENCE_CGPT_NOR_H_ +#define VBOOT_REFERENCE_CGPT_NOR_H_ // Obtain the MTD size from its sysfs node. |mtd_device| should point to // a dev node such as /dev/mtd0. This function returns 0 on success. @@ -31,4 +31,4 @@ int ReadNorFlash(char *temp_dir_template); // Write "rw_gpt" back to NOR flash. We write the file in two parts for safety. int WriteNorFlash(const char *dir); -#endif // VBOOT_REFERCENCE_CGPT_CGPT_NOR_H_ +#endif /* VBOOT_REFERENCE_CGPT_NOR_H_ */ diff --git a/cgpt/cgpt_prioritize.c b/cgpt/cgpt_prioritize.c index b59005f7..f81ca8a2 100644 --- a/cgpt/cgpt_prioritize.c +++ b/cgpt/cgpt_prioritize.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include diff --git a/cgpt/cgpt_repair.c b/cgpt/cgpt_repair.c index ebe034b1..fc650883 100644 --- a/cgpt/cgpt_repair.c +++ b/cgpt/cgpt_repair.c @@ -1,7 +1,7 @@ -// 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. - +/* 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. + */ #include diff --git a/cgpt/cgpt_show.c b/cgpt/cgpt_show.c index 5f20988b..af4d88fa 100644 --- a/cgpt/cgpt_show.c +++ b/cgpt/cgpt_show.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #define __STDC_FORMAT_MACROS diff --git a/cgpt/cmd_add.c b/cgpt/cmd_add.c index f10489ac..ef6f729d 100644 --- a/cgpt/cmd_add.c +++ b/cgpt/cmd_add.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cmd_boot.c b/cgpt/cmd_boot.c index a556b53b..07cf5b4d 100644 --- a/cgpt/cmd_boot.c +++ b/cgpt/cmd_boot.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cmd_create.c b/cgpt/cmd_create.c index d4ef44c7..22d49568 100644 --- a/cgpt/cmd_create.c +++ b/cgpt/cmd_create.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cmd_edit.c b/cgpt/cmd_edit.c index fb4d9192..3daf3895 100644 --- a/cgpt/cmd_edit.c +++ b/cgpt/cmd_edit.c @@ -1,6 +1,7 @@ -// Copyright 2018 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. +/* Copyright 2018 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 diff --git a/cgpt/cmd_find.c b/cgpt/cmd_find.c index 511518d5..bf7c3953 100644 --- a/cgpt/cmd_find.c +++ b/cgpt/cmd_find.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cmd_legacy.c b/cgpt/cmd_legacy.c index 911384d6..5468e8a9 100644 --- a/cgpt/cmd_legacy.c +++ b/cgpt/cmd_legacy.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cmd_prioritize.c b/cgpt/cmd_prioritize.c index 006f1f12..92d1debe 100644 --- a/cgpt/cmd_prioritize.c +++ b/cgpt/cmd_prioritize.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cmd_repair.c b/cgpt/cmd_repair.c index f2534a17..18e79ca2 100644 --- a/cgpt/cmd_repair.c +++ b/cgpt/cmd_repair.c @@ -1,6 +1,7 @@ -// 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. +/* 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. + */ #include #include diff --git a/cgpt/cmd_show.c b/cgpt/cmd_show.c index 6f31b3b5..22d31841 100644 --- a/cgpt/cmd_show.c +++ b/cgpt/cmd_show.c @@ -1,8 +1,10 @@ -// 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. +/* 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. + */ #define __STDC_FORMAT_MACROS + #include #include #include diff --git a/firmware/2lib/2crc8.c b/firmware/2lib/2crc8.c index 9df0a00f..d5284de6 100644 --- a/firmware/2lib/2crc8.c +++ b/firmware/2lib/2crc8.c @@ -1,21 +1,23 @@ /* Copyright (c) 2014 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. + * + * Very simple 8-bit CRC function. */ #include "2sysincludes.h" #include "2crc8.h" +/* Uses CRC-8 ITU version, with x^8 + x^2 + x + 1 polynomial. + Note that result will evaluate to zero for a buffer of all zeroes. */ uint8_t vb2_crc8(const void *vptr, uint32_t size) { const uint8_t *data = vptr; unsigned crc = 0; uint32_t i, j; - /* - * Calculate CRC-8 directly. A table-based algorithm would be faster, - * but for only a few bytes it isn't worth the code size. - */ + /* Calculate CRC-8 directly. A table-based algorithm would be faster, + but for only a few bytes it isn't worth the code size. */ for (j = size; j; j--, data++) { crc ^= (*data << 8); for(i = 8; i; i--) { diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h index 12aa14e8..b091731b 100644 --- a/firmware/2lib/include/2api.h +++ b/firmware/2lib/include/2api.h @@ -1,9 +1,8 @@ /* 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. - */ - -/* APIs between calling firmware and vboot_reference + * + * APIs between calling firmware and vboot_reference * * General notes: * @@ -17,9 +16,8 @@ * must be done elsewhere, and VB2_NV_DEBUG_RESET_MODE is ignored. */ -#ifndef VBOOT_2_API_H_ -#define VBOOT_2_API_H_ -#include +#ifndef VBOOT_REFERENCE_2API_H_ +#define VBOOT_REFERENCE_2API_H_ #include "2constants.h" #include "2crypto.h" @@ -28,6 +26,7 @@ #include "2id.h" #include "2recovery_reasons.h" #include "2return_codes.h" +#include "2secdata.h" /* Modes for vb2ex_tpm_set_mode. */ enum vb2_tpm_mode { @@ -740,4 +739,4 @@ vb2_error_t vb2ex_hwcrypto_digest_finalize(uint8_t *digest, */ vb2_error_t vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val); -#endif /* VBOOT_2_API_H_ */ +#endif /* VBOOT_REFERENCE_2API_H_ */ diff --git a/firmware/2lib/include/2common.h b/firmware/2lib/include/2common.h index ccc0bfc4..d49074f8 100644 --- a/firmware/2lib/include/2common.h +++ b/firmware/2lib/include/2common.h @@ -5,8 +5,8 @@ * Common functions between firmware and kernel verified boot. */ -#ifndef VBOOT_REFERENCE_VBOOT_2COMMON_H_ -#define VBOOT_REFERENCE_VBOOT_2COMMON_H_ +#ifndef VBOOT_REFERENCE_2COMMON_H_ +#define VBOOT_REFERENCE_2COMMON_H_ #include "2api.h" #include "2gbb.h" @@ -261,4 +261,4 @@ int vb2_verify_packed_key_inside(const void *parent, uint32_t parent_size, const struct vb2_packed_key *key); -#endif /* VBOOT_REFERENCE_VBOOT_2COMMON_H_ */ +#endif /* VBOOT_REFERENCE_2COMMON_H_ */ diff --git a/firmware/2lib/include/2crc8.h b/firmware/2lib/include/2crc8.h index f01eabd9..f9e0ccee 100644 --- a/firmware/2lib/include/2crc8.h +++ b/firmware/2lib/include/2crc8.h @@ -5,11 +5,17 @@ * Very simple 8-bit CRC function. */ -#ifndef VBOOT_REFERENCE_2_CRC8_H_ -#define VBOOT_REFERENCE_2_CRC8_H_ +#ifndef VBOOT_REFERENCE_2CRC8_H_ +#define VBOOT_REFERENCE_2CRC8_H_ + +#include "2sysincludes.h" /** - * Calculate CRC-8 of the data, using x^8 + x^2 + x + 1 polynomial. + * Calculate CRC-8 of the data, using the ITU version. + * + * Calculate CRC-8 ITU version of the given buffer, using x^8 + x^2 + x + 1 + * polynomial. Note that the CRC-8 will evaluate to zero for a buffer of all + * zeroes. * * @param data Data to CRC * @param size Size of data in bytes @@ -17,4 +23,4 @@ */ uint8_t vb2_crc8(const void *data, uint32_t size); -#endif /* VBOOT_REFERENCE_2_CRC8_H_ */ +#endif /* VBOOT_REFERENCE_2CRC8_H_ */ diff --git a/firmware/2lib/include/2crypto.h b/firmware/2lib/include/2crypto.h index e786614c..f595fd4f 100644 --- a/firmware/2lib/include/2crypto.h +++ b/firmware/2lib/include/2crypto.h @@ -5,8 +5,9 @@ * Crypto constants for verified boot */ -#ifndef VBOOT_REFERENCE_VBOOT_2CRYPTO_H_ -#define VBOOT_REFERENCE_VBOOT_2CRYPTO_H_ +#ifndef VBOOT_REFERENCE_2CRYPTO_H_ +#define VBOOT_REFERENCE_2CRYPTO_H_ + #include /* Verified boot crypto algorithms */ @@ -72,4 +73,4 @@ enum vb2_hash_algorithm { VB2_HASH_ALG_COUNT, }; -#endif /* VBOOT_REFERENCE_VBOOT_2CRYPTO_H_ */ +#endif /* VBOOT_REFERENCE_2CRYPTO_H_ */ diff --git a/firmware/2lib/include/2fw_hash_tags.h b/firmware/2lib/include/2fw_hash_tags.h index 0c061f56..1ecec6e0 100644 --- a/firmware/2lib/include/2fw_hash_tags.h +++ b/firmware/2lib/include/2fw_hash_tags.h @@ -5,8 +5,9 @@ * Firmware hash tags for verified boot */ -#ifndef VBOOT_REFERENCE_VBOOT_2FW_HASH_TAGS_H_ -#define VBOOT_REFERENCE_VBOOT_2FW_HASH_TAGS_H_ +#ifndef VBOOT_REFERENCE_2FW_HASH_TAGS_H_ +#define VBOOT_REFERENCE_2FW_HASH_TAGS_H_ + #include /* @@ -37,4 +38,4 @@ enum vb2_hash_tag { VB2_HASH_TAG_CALLER_BASE = 0x40000000 }; -#endif /* VBOOT_REFERENCE_VBOOT_2FW_HASH_TAGS_H_ */ +#endif /* VBOOT_REFERENCE_2FW_HASH_TAGS_H_ */ diff --git a/firmware/2lib/include/2gbb.h b/firmware/2lib/include/2gbb.h index 4e4bd906..58da6637 100644 --- a/firmware/2lib/include/2gbb.h +++ b/firmware/2lib/include/2gbb.h @@ -5,8 +5,8 @@ * GBB accessor functions. */ -#ifndef VBOOT_REFERENCE_VBOOT_2GBB_H_ -#define VBOOT_REFERENCE_VBOOT_2GBB_H_ +#ifndef VBOOT_REFERENCE_2GBB_H_ +#define VBOOT_REFERENCE_2GBB_H_ #include "2common.h" @@ -43,4 +43,4 @@ vb2_error_t vb2_gbb_read_recovery_key(struct vb2_context *ctx, struct vb2_packed_key **keyp, uint32_t *size, struct vb2_workbuf *wb); -#endif /* VBOOT_REFERENCE_VBOOT_2GBB_H_ */ +#endif /* VBOOT_REFERENCE_2GBB_H_ */ diff --git a/firmware/2lib/include/2gbb_flags.h b/firmware/2lib/include/2gbb_flags.h index 6749aa3f..e90dfb15 100644 --- a/firmware/2lib/include/2gbb_flags.h +++ b/firmware/2lib/include/2gbb_flags.h @@ -7,8 +7,8 @@ * Should be imported externally via vb2_api.h. */ -#ifndef VBOOT_2_GBB_FLAGS_H_ -#define VBOOT_2_GBB_FLAGS_H_ +#ifndef VBOOT_REFERENCE_2GBB_FLAGS_H_ +#define VBOOT_REFERENCE_2GBB_FLAGS_H_ enum vb2_gbb_flag { /* @@ -84,4 +84,4 @@ enum vb2_gbb_flag { VB2_GBB_FLAG_ENABLE_UDC = 1 << 16, }; -#endif /* VBOOT_2_GBB_FLAGS_H_ */ +#endif /* VBOOT_REFERENCE_2GBB_FLAGS_H_ */ diff --git a/firmware/2lib/include/2hmac.h b/firmware/2lib/include/2hmac.h index 1df19397..2f8d8f7c 100644 --- a/firmware/2lib/include/2hmac.h +++ b/firmware/2lib/include/2hmac.h @@ -3,8 +3,8 @@ * found in the LICENSE file. */ -#ifndef VBOOT_REFERENCE_VBOOT_2HMAC_H_ -#define VBOOT_REFERENCE_VBOOT_2HMAC_H_ +#ifndef VBOOT_REFERENCE_2HMAC_H_ +#define VBOOT_REFERENCE_2HMAC_H_ #include #include "2crypto.h" @@ -26,4 +26,4 @@ int hmac(enum vb2_hash_algorithm alg, const void *msg, uint32_t msg_size, uint8_t *mac, uint32_t mac_size); -#endif +#endif /* VBOOT_REFERENCE_2HMAC_H_ */ diff --git a/firmware/2lib/include/2id.h b/firmware/2lib/include/2id.h index 28ba5538..d1897fda 100644 --- a/firmware/2lib/include/2id.h +++ b/firmware/2lib/include/2id.h @@ -8,8 +8,9 @@ * resistant to collisions and easy to compare. */ -#ifndef VBOOT_REFERENCE_VBOOT_2ID_H_ -#define VBOOT_REFERENCE_VBOOT_2ID_H_ +#ifndef VBOOT_REFERENCE_2ID_H_ +#define VBOOT_REFERENCE_2ID_H_ + #include #ifdef __cplusplus @@ -33,4 +34,4 @@ struct vb2_id { } #endif /* __cplusplus */ -#endif /* VBOOT_REFERENCE_VBOOT_2ID_H_ */ +#endif /* VBOOT_REFERENCE_2ID_H_ */ diff --git a/firmware/2lib/include/2misc.h b/firmware/2lib/include/2misc.h index 3b61bda4..c7970d68 100644 --- a/firmware/2lib/include/2misc.h +++ b/firmware/2lib/include/2misc.h @@ -5,8 +5,8 @@ * Misc functions which need access to vb2_context but are not public APIs */ -#ifndef VBOOT_REFERENCE_VBOOT_2MISC_H_ -#define VBOOT_REFERENCE_VBOOT_2MISC_H_ +#ifndef VBOOT_REFERENCE_2MISC_H_ +#define VBOOT_REFERENCE_2MISC_H_ #include "2api.h" #include "2struct.h" @@ -185,4 +185,4 @@ vb2_error_t vb2_load_kernel_keyblock(struct vb2_context *ctx); */ vb2_error_t vb2_load_kernel_preamble(struct vb2_context *ctx); -#endif /* VBOOT_REFERENCE_VBOOT_2MISC_H_ */ +#endif /* VBOOT_REFERENCE_2MISC_H_ */ diff --git a/firmware/2lib/include/2nvstorage.h b/firmware/2lib/include/2nvstorage.h index 1a6ab8ad..36dbaa03 100644 --- a/firmware/2lib/include/2nvstorage.h +++ b/firmware/2lib/include/2nvstorage.h @@ -5,8 +5,8 @@ * Non-volatile storage routines */ -#ifndef VBOOT_REFERENCE_VBOOT_2NVSTORAGE_H_ -#define VBOOT_REFERENCE_VBOOT_2NVSTORAGE_H_ +#ifndef VBOOT_REFERENCE_2NVSTORAGE_H_ +#define VBOOT_REFERENCE_2NVSTORAGE_H_ struct vb2_context; @@ -232,4 +232,4 @@ void vb2_nv_set(struct vb2_context *ctx, enum vb2_nv_param param, uint32_t value); -#endif /* VBOOT_REFERENCE_VBOOT_2NVSTORAGE_H_ */ +#endif /* VBOOT_REFERENCE_2NVSTORAGE_H_ */ diff --git a/firmware/2lib/include/2nvstorage_fields.h b/firmware/2lib/include/2nvstorage_fields.h index 11a9f8fb..c9641407 100644 --- a/firmware/2lib/include/2nvstorage_fields.h +++ b/firmware/2lib/include/2nvstorage_fields.h @@ -5,8 +5,8 @@ * Non-volatile storage bitfields */ -#ifndef VBOOT_REFERENCE_VBOOT_2NVSTORAGE_FIELDS_H_ -#define VBOOT_REFERENCE_VBOOT_2NVSTORAGE_FIELDS_H_ +#ifndef VBOOT_REFERENCE_2NVSTORAGE_FIELDS_H_ +#define VBOOT_REFERENCE_2NVSTORAGE_FIELDS_H_ /* * Constants for NV storage. We use this rather than structs and bitfields so @@ -111,4 +111,4 @@ enum vb2_nv_offset { #define VB2_NV_MISC_DEPRECATED_DISABLE_ALT_OS 0x20 #define VB2_NV_MISC_POST_EC_SYNC_DELAY 0x40 -#endif /* VBOOT_REFERENCE_VBOOT_2NVSTORAGE_FIELDS_H_ */ +#endif /* VBOOT_REFERENCE_2NVSTORAGE_FIELDS_H_ */ diff --git a/firmware/2lib/include/2recovery_reasons.h b/firmware/2lib/include/2recovery_reasons.h index f8e6dbe9..870df1f0 100644 --- a/firmware/2lib/include/2recovery_reasons.h +++ b/firmware/2lib/include/2recovery_reasons.h @@ -5,8 +5,8 @@ * Recovery reasons */ -#ifndef VBOOT_REFERENCE_VBOOT_2RECOVERY_REASONS_H_ -#define VBOOT_REFERENCE_VBOOT_2RECOVERY_REASONS_H_ +#ifndef VBOOT_REFERENCE_2RECOVERY_REASONS_H_ +#define VBOOT_REFERENCE_2RECOVERY_REASONS_H_ /* Recovery reason codes */ enum vb2_nv_recovery { @@ -250,4 +250,4 @@ enum vb2_nv_recovery { VB2_RECOVERY_US_UNSPECIFIED = 0xff, }; -#endif /* VBOOT_REFERENCE_VBOOT_2RECOVERY_REASONS_H_ */ +#endif /* VBOOT_REFERENCE_2RECOVERY_REASONS_H_ */ diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h index 68edff38..f12f2c1a 100644 --- a/firmware/2lib/include/2return_codes.h +++ b/firmware/2lib/include/2return_codes.h @@ -3,8 +3,8 @@ * found in the LICENSE file. */ -#ifndef VBOOT_2_RETURN_CODES_H_ -#define VBOOT_2_RETURN_CODES_H_ +#ifndef VBOOT_REFERENCE_2RETURN_CODES_H_ +#define VBOOT_REFERENCE_2RETURN_CODES_H_ /* * Functions which return an error all return this type. This is a 32-bit @@ -905,4 +905,4 @@ enum vb2_return_code { VB2_ERROR_MAX = VB2_ERROR_BASE + 0x1fffffff, }; -#endif /* VBOOT_2_RETURN_CODES_H_ */ +#endif /* VBOOT_REFERENCE_2RETURN_CODES_H_ */ diff --git a/firmware/2lib/include/2secdata.h b/firmware/2lib/include/2secdata.h index bcd308b9..7acdb610 100644 --- a/firmware/2lib/include/2secdata.h +++ b/firmware/2lib/include/2secdata.h @@ -5,8 +5,12 @@ * Secure non-volatile storage routines */ -#ifndef VBOOT_REFERENCE_VBOOT_2SECDATA_H_ -#define VBOOT_REFERENCE_VBOOT_2SECDATA_H_ +#ifndef VBOOT_REFERENCE_2SECDATA_H_ +#define VBOOT_REFERENCE_2SECDATA_H_ + +/* Avoid circular dependency with 2api.h */ +struct vb2_context; +typedef uint32_t vb2_error_t; /*****************************************************************************/ /* Firmware version space */ @@ -161,4 +165,4 @@ vb2_error_t vb2_secdatak_get(struct vb2_context *ctx, vb2_error_t vb2_secdatak_set(struct vb2_context *ctx, enum vb2_secdatak_param param, uint32_t value); -#endif /* VBOOT_REFERENCE_VBOOT_2SECDATA_H_ */ +#endif /* VBOOT_REFERENCE_2SECDATA_H_ */ diff --git a/firmware/2lib/include/2struct.h b/firmware/2lib/include/2struct.h index a045fef3..17294ce6 100644 --- a/firmware/2lib/include/2struct.h +++ b/firmware/2lib/include/2struct.h @@ -13,8 +13,9 @@ * have trouble with accessing unaligned integers. */ -#ifndef VBOOT_REFERENCE_VBOOT_2STRUCT_H_ -#define VBOOT_REFERENCE_VBOOT_2STRUCT_H_ +#ifndef VBOOT_REFERENCE_2STRUCT_H_ +#define VBOOT_REFERENCE_2STRUCT_H_ + #include "2constants.h" #include "2crypto.h" #include "2sysincludes.h" @@ -333,4 +334,4 @@ struct vb2_packed_key { #define EXPECTED_VB2_PACKED_KEY_SIZE 32 -#endif /* VBOOT_REFERENCE_VBOOT_2STRUCT_H_ */ +#endif /* VBOOT_REFERENCE_2STRUCT_H_ */ diff --git a/firmware/2lib/include/2sysincludes.h b/firmware/2lib/include/2sysincludes.h index 792ece43..c23054a1 100644 --- a/firmware/2lib/include/2sysincludes.h +++ b/firmware/2lib/include/2sysincludes.h @@ -10,8 +10,8 @@ * fixed up for platforms which don't have all the system includes. */ -#ifndef VBOOT_REFERENCE_2_SYSINCLUDES_H_ -#define VBOOT_REFERENCE_2_SYSINCLUDES_H_ +#ifndef VBOOT_REFERENCE_2SYSINCLUDES_H_ +#define VBOOT_REFERENCE_2SYSINCLUDES_H_ #include #include /* For PRIu64 */ @@ -25,4 +25,4 @@ #include #endif -#endif /* VBOOT_REFERENCE_2_SYSINCLUDES_H_ */ +#endif /* VBOOT_REFERENCE_2SYSINCLUDES_H_ */ diff --git a/firmware/include/gpt.h b/firmware/include/gpt.h index 0f27cef5..80e1ea52 100644 --- a/firmware/include/gpt.h +++ b/firmware/include/gpt.h @@ -7,8 +7,10 @@ * To download UEFI standard, please visit UEFI homepage: * http://www.uefi.org/ */ + #ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_ #define VBOOT_REFERENCE_CGPTLIB_GPT_H_ + #include #ifdef __cplusplus diff --git a/firmware/include/gpt_misc.h b/firmware/include/gpt_misc.h index b3b062b1..aa46094f 100644 --- a/firmware/include/gpt_misc.h +++ b/firmware/include/gpt_misc.h @@ -3,8 +3,8 @@ * found in the LICENSE file. */ -#ifndef VBOOT_REFERENCE_CGPT_MISC_H_ -#define VBOOT_REFERENCE_CGPT_MISC_H_ +#ifndef VBOOT_REFERENCE_GPT_MISC_H_ +#define VBOOT_REFERENCE_GPT_MISC_H_ #include "gpt.h" #include "vboot_api.h" @@ -217,4 +217,4 @@ void SetEntryTries(GptEntry *e, int tries); } #endif /* __cplusplus */ -#endif /* VBOOT_REFERENCE_CGPT_MISC_H_ */ +#endif /* VBOOT_REFERENCE_GPT_MISC_H_ */ diff --git a/firmware/include/tlcl.h b/firmware/include/tlcl.h index 383be2ef..03195c13 100644 --- a/firmware/include/tlcl.h +++ b/firmware/include/tlcl.h @@ -1,16 +1,15 @@ /* 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. - */ - -/* + * * TPM Lightweight Command Library. * * A low-level library for interfacing to TPM hardware or an emulator. */ -#ifndef TPM_LITE_TLCL_H_ -#define TPM_LITE_TLCL_H_ +#ifndef VBOOT_REFERENCE_TLCL_H_ +#define VBOOT_REFERENCE_TLCL_H_ + #include #include "tss_constants.h" @@ -322,4 +321,4 @@ uint32_t TlclReadDelegationFamilyTable(TPM_FAMILY_TABLE_ENTRY *table, } #endif -#endif /* TPM_LITE_TLCL_H_ */ +#endif /* VBOOT_REFERENCE_TLCL_H_ */ diff --git a/firmware/include/tpm1_tss_constants.h b/firmware/include/tpm1_tss_constants.h index 8d92bef2..6edc4914 100644 --- a/firmware/include/tpm1_tss_constants.h +++ b/firmware/include/tpm1_tss_constants.h @@ -1,13 +1,13 @@ -/* - * Copyright 2016 The Chromium OS Authors. All rights reserved. +/* Copyright 2016 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. * * Some TPM constants and type definitions for standalone compilation for use * in the firmware */ -#ifndef __VBOOT_REFERENCE_FIRMWARE_INCLUDE_TPM1_TSS_CONSTANTS_H -#define __VBOOT_REFERENCE_FIRMWARE_INCLUDE_TPM1_TSS_CONSTANTS_H + +#ifndef VBOOT_REFERENCE_TPM1_TSS_CONSTANTS_H_ +#define VBOOT_REFERENCE_TPM1_TSS_CONSTANTS_H_ #include @@ -259,4 +259,4 @@ typedef struct tdTPM_NV_AUTH_POLICY } #endif /* __cplusplus */ -#endif /* ! __VBOOT_REFERENCE_FIRMWARE_INCLUDE_TPM1_TSS_CONSTANTS_H */ +#endif /* VBOOT_REFERENCE_TPM1_TSS_CONSTANTS_H_ */ diff --git a/firmware/include/tpm2_marshaling.h b/firmware/include/tpm2_marshaling.h index 929f0fcd..9fd79da6 100644 --- a/firmware/include/tpm2_marshaling.h +++ b/firmware/include/tpm2_marshaling.h @@ -1,10 +1,10 @@ -/* - * Copyright 2016 The Chromium OS Authors. All rights reserved. +/* Copyright 2016 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 __SRC_LIB_TPM2_MARSHALING_H -#define __SRC_LIB_TPM2_MARSHALING_H + +#ifndef VBOOT_REFERENCE_TPM2_MARSHALING_H_ +#define VBOOT_REFERENCE_TPM2_MARSHALING_H_ #include "tss_constants.h" @@ -94,4 +94,4 @@ int tpm_is_ph_disabled(void); } #endif /* __cplusplus */ -#endif // __SRC_LIB_TPM2_MARSHALING_H +#endif /* VBOOT_REFERENCE_TPM2_MARSHALING_H_ */ diff --git a/firmware/include/tpm2_tss_constants.h b/firmware/include/tpm2_tss_constants.h index 162993e2..73747352 100644 --- a/firmware/include/tpm2_tss_constants.h +++ b/firmware/include/tpm2_tss_constants.h @@ -1,5 +1,4 @@ -/* - * Copyright 2016 The Chromium OS Authors. All rights reserved. +/* Copyright 2016 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. * @@ -7,8 +6,8 @@ * in the firmware */ -#ifndef __VBOOT_REFERENCE_FIRMWARE_INCLUDE_TPM2_TSS_CONSTANTS_H -#define __VBOOT_REFERENCE_FIRMWARE_INCLUDE_TPM2_TSS_CONSTANTS_H +#ifndef VBOOT_REFERENCE_TPM2_TSS_CONSTANTS_H_ +#define VBOOT_REFERENCE_TPM2_TSS_CONSTANTS_H_ #ifdef __cplusplus extern "C" { @@ -319,4 +318,4 @@ typedef struct tdTPM_IFX_FIELDUPGRADEINFO } #endif /* __cplusplus */ -#endif /* ! __VBOOT_REFERENCE_FIRMWARE_INCLUDE_TPM2_TSS_CONSTANTS_H */ +#endif /* VBOOT_REFERENCE_TPM2_TSS_CONSTANTS_H_ */ diff --git a/firmware/include/tss_constants.h b/firmware/include/tss_constants.h index d579933e..e73b4ef1 100644 --- a/firmware/include/tss_constants.h +++ b/firmware/include/tss_constants.h @@ -1,11 +1,11 @@ /* 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_TSS_CONSTANTS_H_ #define VBOOT_REFERENCE_TSS_CONSTANTS_H_ + #include #define TPM_SUCCESS ((uint32_t) 0x00000000) diff --git a/firmware/include/vb2_api.h b/firmware/include/vb2_api.h index e9a1e7b5..4774a1a8 100644 --- a/firmware/include/vb2_api.h +++ b/firmware/include/vb2_api.h @@ -1,9 +1,8 @@ /* Copyright (c) 2014 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. - */ - -/* APIs between calling firmware and vboot_reference + * + * APIs between calling firmware and vboot_reference * * DO NOT INCLUDE THE HEADERS BELOW DIRECTLY! ONLY INCLUDE THIS FILE! * @@ -18,8 +17,8 @@ * this switch is a bug, and it should be removed when it is no longer used. */ -#ifndef VBOOT_VB2_API_H_ -#define VBOOT_VB2_API_H_ +#ifndef VBOOT_REFERENCE_VB2_API_H_ +#define VBOOT_REFERENCE_VB2_API_H_ /* Standard APIs */ #include "../2lib/include/2api.h" @@ -40,4 +39,4 @@ #include "../lib20/include/vb2_struct.h" #endif -#endif /* VBOOT_VB2_API_H_ */ +#endif /* VBOOT_REFERENCE_VB2_API_H_ */ diff --git a/firmware/include/vb2_sha.h b/firmware/include/vb2_sha.h index fe8b2aaf..41ef0501 100644 --- a/firmware/include/vb2_sha.h +++ b/firmware/include/vb2_sha.h @@ -2,7 +2,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * - * This header may be imported to expose vboot SHA implemenation. + * This header may be imported to expose vboot SHA implementation. */ #ifndef VBOOT_REFERENCE_VB2_SHA_H_ diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index a1825952..ace9afa1 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -1,9 +1,8 @@ /* 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. - */ - -/* APIs provided by firmware to vboot_reference. + * + * APIs provided by firmware to vboot_reference. * * General notes: * @@ -21,6 +20,7 @@ #ifndef VBOOT_REFERENCE_VBOOT_API_H_ #define VBOOT_REFERENCE_VBOOT_API_H_ + #include #include diff --git a/firmware/include/vboot_struct.h b/firmware/include/vboot_struct.h index 021be1b8..6e16c910 100644 --- a/firmware/include/vboot_struct.h +++ b/firmware/include/vboot_struct.h @@ -8,6 +8,7 @@ #ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_ #define VBOOT_REFERENCE_VBOOT_STRUCT_H_ + #include /* diff --git a/firmware/include/vboot_test.h b/firmware/include/vboot_test.h index 03dc54db..a825bd9c 100644 --- a/firmware/include/vboot_test.h +++ b/firmware/include/vboot_test.h @@ -1,14 +1,13 @@ /* Copyright 2019 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. - * + * + * This header is for APIs that are only used by test code. */ #ifndef VBOOT_REFERENCE_TEST_API_H_ #define VBOOT_REFERENCE_TEST_API_H_ -/* This header is for APIs that are only used by test code. */ - /* * Internal functions from 2rsa.c that have error conditions we can't trigger * from the public APIs. These include checks for bad algorithms where the diff --git a/firmware/lib/cgptlib/include/cgptlib_internal.h b/firmware/lib/cgptlib/include/cgptlib_internal.h index b9331b93..d58a35f6 100644 --- a/firmware/lib/cgptlib/include/cgptlib_internal.h +++ b/firmware/lib/cgptlib/include/cgptlib_internal.h @@ -166,4 +166,4 @@ const char *GptErrorText(int error_code); */ size_t CalculateEntriesSectors(GptHeader* h, uint32_t sector_bytes); -#endif /* VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ */ +#endif /* VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ */ diff --git a/firmware/lib/cgptlib/include/crc32.h b/firmware/lib/cgptlib/include/crc32.h index e2825ced..1f3e2a3d 100644 --- a/firmware/lib/cgptlib/include/crc32.h +++ b/firmware/lib/cgptlib/include/crc32.h @@ -2,11 +2,12 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#ifndef VBOOT_REFERENCE_GPT_CRC32_H_ -#define VBOOT_REFERENCE_GPT_CRC32_H_ + +#ifndef VBOOT_REFERENCE_CRC32_H_ +#define VBOOT_REFERENCE_CRC32_H_ #include "2sysincludes.h" uint32_t Crc32(const void *buffer, uint32_t len); -#endif /* VBOOT_REFERENCE_GPT_CRC32_H_ */ +#endif /* VBOOT_REFERENCE_CRC32_H_ */ diff --git a/firmware/lib/include/utility.h b/firmware/lib/include/utility.h index 879950b1..cf39f16a 100644 --- a/firmware/lib/include/utility.h +++ b/firmware/lib/include/utility.h @@ -1,9 +1,7 @@ /* 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. - */ - -/* + * * Helper functions/wrappers for memory allocations, manipulation and * comparison. */ diff --git a/firmware/lib/include/vboot_audio.h b/firmware/lib/include/vboot_audio.h index 05f22f92..64cf0a78 100644 --- a/firmware/lib/include/vboot_audio.h +++ b/firmware/lib/include/vboot_audio.h @@ -20,5 +20,4 @@ void vb2_audio_start(struct vb2_context *ctx); */ int vb2_audio_looping(void); -#endif /* VBOOT_REFERENCE_VBOOT_AUDIO_H_ */ - +#endif /* VBOOT_REFERENCE_VBOOT_AUDIO_H_ */ diff --git a/firmware/lib/include/vboot_display.h b/firmware/lib/include/vboot_display.h index 6dfaeaa9..8621d860 100644 --- a/firmware/lib/include/vboot_display.h +++ b/firmware/lib/include/vboot_display.h @@ -22,5 +22,4 @@ vb2_error_t VbCheckDisplayKey(struct vb2_context *ctx, uint32_t key, */ const char *RecoveryReasonString(uint8_t code); -#endif /* VBOOT_REFERENCE_VBOOT_DISPLAY_H_ */ - +#endif /* VBOOT_REFERENCE_VBOOT_DISPLAY_H_ */ diff --git a/firmware/lib/include/vboot_ui_menu_private.h b/firmware/lib/include/vboot_ui_menu_private.h index b92fb5da..09688b48 100644 --- a/firmware/lib/include/vboot_ui_menu_private.h +++ b/firmware/lib/include/vboot_ui_menu_private.h @@ -90,4 +90,4 @@ typedef enum _VB_OPTIONS_MENU { VB_OPTIONS_COUNT, } VB_OPTIONS_MENU; -#endif +#endif /* VBOOT_REFERENCE_VBOOT_UI_MENU_PRIVATE_H_ */ diff --git a/firmware/lib/rollback_index.c b/firmware/lib/rollback_index.c index b4b49fab..c04a282d 100644 --- a/firmware/lib/rollback_index.c +++ b/firmware/lib/rollback_index.c @@ -31,7 +31,7 @@ uint32_t WriteSpaceKernel(RollbackSpaceKernel *rsk); /* * Compiling for unit test, so we need the real implementations of * rollback functions. The unit test mocks the underlying tlcl - * functions, so this is ok to run on the host. + * functions, so this is okay to run on the host. */ #undef CHROMEOS_ENVIRONMENT #undef DISABLE_ROLLBACK_TPM diff --git a/firmware/lib/tpm2_lite/marshaling.c b/firmware/lib/tpm2_lite/marshaling.c index 1a3e84a2..fb1b8022 100644 --- a/firmware/lib/tpm2_lite/marshaling.c +++ b/firmware/lib/tpm2_lite/marshaling.c @@ -1,5 +1,4 @@ -/* - * Copyright 2016 The Chromium OS Authors. All rights reserved. +/* Copyright 2016 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/firmware/lib/tpm2_lite/tlcl.c b/firmware/lib/tpm2_lite/tlcl.c index 9e6bc49f..02d1a91b 100644 --- a/firmware/lib/tpm2_lite/tlcl.c +++ b/firmware/lib/tpm2_lite/tlcl.c @@ -1,5 +1,4 @@ -/* - * Copyright 2016 The Chromium OS Authors. All rights reserved. +/* Copyright 2016 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. * @@ -7,13 +6,12 @@ * in the firmware */ -#include "2sysincludes.h" #include "2common.h" - #include "rollback_index.h" +#include "2sysincludes.h" +#include "tlcl.h" #include "tpm2_marshaling.h" #include "utility.h" -#include "tlcl.h" /* Global buffer for deserialized responses. */ struct tpm2_response tpm2_resp; diff --git a/firmware/lib/tpm_lite/include/tlcl_internal.h b/firmware/lib/tpm_lite/include/tlcl_internal.h index 28eff1d9..98903990 100644 --- a/firmware/lib/tpm_lite/include/tlcl_internal.h +++ b/firmware/lib/tpm_lite/include/tlcl_internal.h @@ -3,8 +3,8 @@ * found in the LICENSE file. */ -#ifndef TPM_LITE_TLCL_INTERNAL_H_ -#define TPM_LITE_TLCL_INTERNAL_H_ +#ifndef VBOOT_REFERENCE_TLCL_INTERNAL_H_ +#define VBOOT_REFERENCE_TLCL_INTERNAL_H_ /* * These numbers derive from adding the sizes of command fields as shown in the @@ -84,4 +84,4 @@ static inline uint16_t ReadTpmUint16(const uint8_t **buffer) { return value; } -#endif /* TPM_LITE_TLCL_INTERNAL_H_ */ +#endif /* VBOOT_REFERENCE_TLCL_INTERNAL_H_ */ diff --git a/firmware/lib/tpm_lite/include/tpm_error_messages.h b/firmware/lib/tpm_lite/include/tpm_error_messages.h index 834ba2d0..ad2692c4 100644 --- a/firmware/lib/tpm_lite/include/tpm_error_messages.h +++ b/firmware/lib/tpm_lite/include/tpm_error_messages.h @@ -1,16 +1,15 @@ /* 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. - */ - -/* TPM error codes. + * + * TPM error codes. * * Copy-pasted and lightly edited from TCG TPM Main Part 2 TPM Structures * Version 1.2 Level 2 Revision 103 26 October 2006 Draft. */ -#ifndef TPM_ERROR_MESSAGES_H -#define TPM_ERROR_MESSAGES_H +#ifndef VBOOT_REFERENCE_TPM_ERROR_MESSAGES_H_ +#define VBOOT_REFERENCE_TPM_ERROR_MESSAGES_H_ #define TPM_E_BASE 0x0 #define TPM_E_NON_FATAL 0x800 @@ -247,4 +246,4 @@ because the ordinal required resources that have not been tested" }, time-out period" }, }; -#endif /* TPM_ERROR_MESSAGES_H */ +#endif /* VBOOT_REFERENCE_TPM_ERROR_MESSAGES_H_ */ diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index ae1df41e..621aa7fe 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -10,6 +10,8 @@ #include "2misc.h" #include "2nvstorage.h" #include "2rsa.h" +#include "2secdata.h" +#include "2sysincludes.h" #include "ec_sync.h" #include "load_kernel_fw.h" #include "rollback_index.h" diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c index 0d1545c9..1d54ef6f 100644 --- a/firmware/lib/vboot_kernel.c +++ b/firmware/lib/vboot_kernel.c @@ -6,12 +6,12 @@ * (Firmware portion) */ -#include "2sysincludes.h" #include "2common.h" #include "2misc.h" #include "2nvstorage.h" #include "2rsa.h" #include "2sha.h" +#include "2sysincludes.h" #include "cgptlib.h" #include "cgptlib_internal.h" #include "gpt_misc.h" diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c index 88bbfb65..ee770ccd 100644 --- a/firmware/lib/vboot_ui.c +++ b/firmware/lib/vboot_ui.c @@ -531,9 +531,9 @@ static vb2_error_t vb2_developer_ui(struct vb2_context *ctx) /* Check if the default is to boot using disk, usb, or legacy */ uint32_t default_boot = vb2_nv_get(ctx, VB2_NV_DEV_DEFAULT_BOOT); - if(default_boot == VB2_DEV_DEFAULT_BOOT_USB) + if (default_boot == VB2_DEV_DEFAULT_BOOT_USB) use_usb = 1; - if(default_boot == VB2_DEV_DEFAULT_BOOT_LEGACY) + if (default_boot == VB2_DEV_DEFAULT_BOOT_LEGACY) use_legacy = 1; /* Handle GBB flag override */ diff --git a/firmware/lib/vboot_ui_common.c b/firmware/lib/vboot_ui_common.c index 09c96071..4255deb0 100644 --- a/firmware/lib/vboot_ui_common.c +++ b/firmware/lib/vboot_ui_common.c @@ -5,10 +5,9 @@ * High-level firmware wrapper API - user interface for RW firmware */ -#include "2sysincludes.h" #include "2common.h" - #include "rollback_index.h" +#include "2sysincludes.h" #include "vboot_api.h" #include "vboot_kernel.h" #include "vboot_ui_common.h" diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c index 3c202c28..1b1db811 100644 --- a/firmware/lib/vboot_ui_menu.c +++ b/firmware/lib/vboot_ui_menu.c @@ -5,11 +5,11 @@ * High-level firmware wrapper API - user interface for RW firmware */ -#include "2sysincludes.h" #include "2common.h" #include "2misc.h" #include "2nvstorage.h" #include "2rsa.h" +#include "2sysincludes.h" #include "ec_sync.h" #include "load_kernel_fw.h" #include "rollback_index.h" diff --git a/firmware/lib20/include/vb2_struct.h b/firmware/lib20/include/vb2_struct.h index 59304db8..2024bde5 100644 --- a/firmware/lib20/include/vb2_struct.h +++ b/firmware/lib20/include/vb2_struct.h @@ -15,6 +15,7 @@ #ifndef VBOOT_REFERENCE_VB2_STRUCT_H_ #define VBOOT_REFERENCE_VB2_STRUCT_H_ + #include /* diff --git a/firmware/lib21/include/vb21_struct.h b/firmware/lib21/include/vb21_struct.h index bd1273c0..5bb2b63e 100644 --- a/firmware/lib21/include/vb21_struct.h +++ b/firmware/lib21/include/vb21_struct.h @@ -10,6 +10,7 @@ #ifndef VBOOT_REFERENCE_VB21_STRUCT_H_ #define VBOOT_REFERENCE_VB21_STRUCT_H_ + #include #include "2id.h" diff --git a/futility/cmd_dump_fmap.c b/futility/cmd_dump_fmap.c index 2ab981bc..2ed0ff6b 100644 --- a/futility/cmd_dump_fmap.c +++ b/futility/cmd_dump_fmap.c @@ -1,8 +1,8 @@ -/* - * Copyright (c) 2013 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. */ + #include #include #include diff --git a/futility/cmd_gbb_utility.c b/futility/cmd_gbb_utility.c index 84531c4a..2a76ecb1 100644 --- a/futility/cmd_gbb_utility.c +++ b/futility/cmd_gbb_utility.c @@ -1,8 +1,8 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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 #include #include diff --git a/futility/cmd_load_fmap.c b/futility/cmd_load_fmap.c index eefa9fec..20da8015 100644 --- a/futility/cmd_load_fmap.c +++ b/futility/cmd_load_fmap.c @@ -1,8 +1,8 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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 #include #include diff --git a/futility/cmd_pcr.c b/futility/cmd_pcr.c index 051bd8d5..3b9b0ae8 100644 --- a/futility/cmd_pcr.c +++ b/futility/cmd_pcr.c @@ -1,5 +1,4 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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/futility/cmd_show.c b/futility/cmd_show.c index 207cee15..e3fea0fb 100644 --- a/futility/cmd_show.c +++ b/futility/cmd_show.c @@ -1,5 +1,4 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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/futility/cmd_sign.c b/futility/cmd_sign.c index d6ce4e08..9393cdaa 100644 --- a/futility/cmd_sign.c +++ b/futility/cmd_sign.c @@ -1,8 +1,8 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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 #include #include diff --git a/futility/cmd_update.c b/futility/cmd_update.c index abf1dcab..ebb5d335 100644 --- a/futility/cmd_update.c +++ b/futility/cmd_update.c @@ -1,5 +1,4 @@ -/* - * Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 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/futility/cmd_validate_rec_mrc.c b/futility/cmd_validate_rec_mrc.c index 2f609156..a269681a 100644 --- a/futility/cmd_validate_rec_mrc.c +++ b/futility/cmd_validate_rec_mrc.c @@ -1,5 +1,4 @@ -/* - * Copyright 2016 The Chromium OS Authors. All rights reserved. +/* Copyright 2016 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/futility/cmd_vbutil_kernel.c b/futility/cmd_vbutil_kernel.c index 669dd7a2..17dae146 100644 --- a/futility/cmd_vbutil_kernel.c +++ b/futility/cmd_vbutil_kernel.c @@ -1,5 +1,4 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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/futility/file_type.c b/futility/file_type.c index 2e24b75f..b55d13f1 100644 --- a/futility/file_type.c +++ b/futility/file_type.c @@ -1,5 +1,4 @@ -/* - * Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 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/futility/file_type.h b/futility/file_type.h index a389713b..e1efe760 100644 --- a/futility/file_type.h +++ b/futility/file_type.h @@ -1,10 +1,10 @@ -/* - * Copyright (c) 2013 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_FUTILITY_FILE_TYPE_H_ -#define VBOOT_REFERENCE_FUTILITY_FILE_TYPE_H_ + +#ifndef VBOOT_REFERENCE_FILE_TYPE_H_ +#define VBOOT_REFERENCE_FILE_TYPE_H_ /* What type of things do I know how to handle? */ enum futil_file_type { @@ -76,4 +76,4 @@ int futil_file_type_sign(enum futil_file_type type, #undef R_ #pragma GCC diagnostic pop -#endif /* VBOOT_REFERENCE_FUTILITY_FILE_TYPE_H_ */ +#endif /* VBOOT_REFERENCE_FILE_TYPE_H_ */ diff --git a/futility/file_type_bios.c b/futility/file_type_bios.c index 6ef9211c..6cbd5835 100644 --- a/futility/file_type_bios.c +++ b/futility/file_type_bios.c @@ -1,8 +1,8 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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 #include #include diff --git a/futility/file_type_bios.h b/futility/file_type_bios.h index 3cd2e797..ef401077 100644 --- a/futility/file_type_bios.h +++ b/futility/file_type_bios.h @@ -1,10 +1,11 @@ -/* - * Copyright (c) 2013 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_FUTILITY_FILE_TYPE_BIOS_H_ -#define VBOOT_REFERENCE_FUTILITY_FILE_TYPE_BIOS_H_ + +#ifndef VBOOT_REFERENCE_FILE_TYPE_BIOS_H_ +#define VBOOT_REFERENCE_FILE_TYPE_BIOS_H_ + #include /* @@ -39,4 +40,4 @@ struct bios_state_s { struct bios_area_s rootkey; }; -#endif /* VBOOT_REFERENCE_FUTILITY_FILE_TYPE_BIOS_H_ */ +#endif /* VBOOT_REFERENCE_FILE_TYPE_BIOS_H_ */ diff --git a/futility/file_type_rwsig.c b/futility/file_type_rwsig.c index 0776f26d..9173a9bd 100644 --- a/futility/file_type_rwsig.c +++ b/futility/file_type_rwsig.c @@ -1,10 +1,7 @@ -/* - * Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 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. - */ - -/* + * * Some instances of the Chrome OS embedded controller firmware can't do a * normal software sync handshake at boot, but will verify their own RW images * instead. This is typically done by putting a struct vb2_packed_key in the RO diff --git a/futility/file_type_usbpd1.c b/futility/file_type_usbpd1.c index d5dbe953..34f8b455 100644 --- a/futility/file_type_usbpd1.c +++ b/futility/file_type_usbpd1.c @@ -1,10 +1,7 @@ -/* - * Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 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. - */ - -/* + * * The USB Type-C chargers released with Samus ("Pixel (2015)") have upgradable * firmware. Due to space considerations, we don't have room for handy things * like an FMAP or headers for the signatures. Accordingly, all the normally diff --git a/futility/futility.c b/futility/futility.c index 4507f820..0f262c2e 100644 --- a/futility/futility.c +++ b/futility/futility.c @@ -1,5 +1,4 @@ -/* - * Copyright 2013 The Chromium OS Authors. All rights reserved. +/* Copyright 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/futility/futility.h b/futility/futility.h index f82986f1..3bce1106 100644 --- a/futility/futility.h +++ b/futility/futility.h @@ -1,10 +1,11 @@ -/* - * Copyright (c) 2013 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_FUTILITY_H_ #define VBOOT_REFERENCE_FUTILITY_H_ + #include #include "2common.h" @@ -165,4 +166,4 @@ enum arch_t { ARCH_MIPS }; -#endif /* VBOOT_REFERENCE_FUTILITY_H_ */ +#endif /* VBOOT_REFERENCE_FUTILITY_H_ */ diff --git a/futility/futility_options.h b/futility/futility_options.h index dbb8e14b..368cc4f2 100644 --- a/futility/futility_options.h +++ b/futility/futility_options.h @@ -1,16 +1,14 @@ -/* - * Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 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. - */ - -/* + * * We centralize option parsing but may split operations into multiple files, * so let's declare the option structures in a single place (here). */ #ifndef VBOOT_REFERENCE_FUTILITY_OPTIONS_H_ #define VBOOT_REFERENCE_FUTILITY_OPTIONS_H_ + #include #include "vboot_common.h" #include "file_type.h" @@ -72,4 +70,4 @@ extern struct sign_option_s sign_option; /* Return true if hash_alg was identified, either by name or number */ int vb2_lookup_hash_alg(const char *str, enum vb2_hash_algorithm *alg); -#endif /* VBOOT_REFERENCE_FUTILITY_OPTIONS_H_ */ +#endif /* VBOOT_REFERENCE_FUTILITY_OPTIONS_H_ */ diff --git a/futility/kernel_blob.h b/futility/kernel_blob.h index 1ee4ea7b..332b1d35 100644 --- a/futility/kernel_blob.h +++ b/futility/kernel_blob.h @@ -4,6 +4,7 @@ * * Constants describing the kernel blob content. */ + #ifndef VBOOT_REFERENCE_KERNEL_BLOB_H_ #define VBOOT_REFERENCE_KERNEL_BLOB_H_ @@ -63,4 +64,4 @@ struct linux_kernel_params { e820_entries[E820_ENTRY_MAX]; /* 2d0-cd0 */ } __attribute__ ((packed)); -#endif /* VBOOT_REFERENCE_KERNEL_BLOB_H_ */ +#endif /* VBOOT_REFERENCE_KERNEL_BLOB_H_ */ diff --git a/futility/misc.c b/futility/misc.c index 82385c1a..46bf24bb 100644 --- a/futility/misc.c +++ b/futility/misc.c @@ -1,5 +1,4 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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/futility/ryu_root_header.c b/futility/ryu_root_header.c index 48aef431..fff807be 100644 --- a/futility/ryu_root_header.c +++ b/futility/ryu_root_header.c @@ -1,8 +1,8 @@ -/* - * Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 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 #include #include diff --git a/futility/updater.c b/futility/updater.c index c3ffb66f..ef75d747 100644 --- a/futility/updater.c +++ b/futility/updater.c @@ -1,5 +1,4 @@ -/* - * Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 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/futility/updater.h b/futility/updater.h index 74ba2045..51526998 100644 --- a/futility/updater.h +++ b/futility/updater.h @@ -1,10 +1,10 @@ -/* - * Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 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. * * A reference implementation for AP (and supporting images) firmware updater. */ + #ifndef VBOOT_REFERENCE_FUTILITY_UPDATER_H_ #define VBOOT_REFERENCE_FUTILITY_UPDATER_H_ diff --git a/futility/updater_archive.c b/futility/updater_archive.c index 1dd6d1d1..da2e99ee 100644 --- a/futility/updater_archive.c +++ b/futility/updater_archive.c @@ -1,5 +1,4 @@ -/* - * Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 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/futility/updater_quirks.c b/futility/updater_quirks.c index eb277b71..d5f5ec62 100644 --- a/futility/updater_quirks.c +++ b/futility/updater_quirks.c @@ -1,5 +1,4 @@ -/* - * Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 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/futility/vb1_helper.c b/futility/vb1_helper.c index ab72f05a..d99c45fa 100644 --- a/futility/vb1_helper.c +++ b/futility/vb1_helper.c @@ -1,5 +1,4 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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/futility/vb1_helper.h b/futility/vb1_helper.h index f0904a90..0699998e 100644 --- a/futility/vb1_helper.h +++ b/futility/vb1_helper.h @@ -1,10 +1,9 @@ -/* - * Copyright (c) 2014 The Chromium OS Authors. All rights reserved. +/* Copyright (c) 2014 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_FUTILITY_VB1_HELPER_H_ -#define VBOOT_REFERENCE_FUTILITY_VB1_HELPER_H_ +#ifndef VBOOT_REFERENCE_VB1_HELPER_H_ +#define VBOOT_REFERENCE_VB1_HELPER_H_ struct vb2_kernel_preamble; struct vb2_keyblock; @@ -67,4 +66,4 @@ int VerifyKernelBlob(uint8_t *kernel_blob, uint64_t kernel_cmd_line_offset(const struct vb2_kernel_preamble *preamble); -#endif /* VBOOT_REFERENCE_FUTILITY_VB1_HELPER_H_ */ +#endif /* VBOOT_REFERENCE_VB1_HELPER_H_ */ diff --git a/futility/vb2_helper.c b/futility/vb2_helper.c index ba04db33..cdaff888 100644 --- a/futility/vb2_helper.c +++ b/futility/vb2_helper.c @@ -1,5 +1,4 @@ -/* - * Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 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/cgpt_params.h b/host/include/cgpt_params.h index 955524d9..b17a0b48 100644 --- a/host/include/cgpt_params.h +++ b/host/include/cgpt_params.h @@ -3,8 +3,8 @@ * found in the LICENSE file. */ -#ifndef VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_ -#define VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_ +#ifndef VBOOT_REFERENCE_CGPT_PARAMS_H_ +#define VBOOT_REFERENCE_CGPT_PARAMS_H_ #include @@ -139,4 +139,4 @@ typedef struct CgptLegacyParams { } #endif /* __cplusplus */ -#endif /* VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_ */ +#endif /* VBOOT_REFERENCE_CGPT_PARAMS_H_ */ diff --git a/host/include/crossystem.h b/host/include/crossystem.h index 42b1b040..63e9ec76 100644 --- a/host/include/crossystem.h +++ b/host/include/crossystem.h @@ -49,4 +49,4 @@ int VbSetSystemPropertyString(const char* name, const char* value); } #endif -#endif /* VBOOT_REFERENCE__CROSSYSTEM_H_ */ +#endif /* VBOOT_REFERENCE_CROSSYSTEM_H_ */ diff --git a/host/include/vboot_host.h b/host/include/vboot_host.h index a8ad3154..81c5434f 100644 --- a/host/include/vboot_host.h +++ b/host/include/vboot_host.h @@ -5,8 +5,9 @@ * vboot-related functions exported for use by userspace programs */ -#ifndef VBOOT_HOST_H_ -#define VBOOT_HOST_H_ +#ifndef VBOOT_REFERENCE_VBOOT_HOST_H_ +#define VBOOT_REFERENCE_VBOOT_HOST_H_ + #include #include #include @@ -76,4 +77,4 @@ int ExtractVmlinuz(void *kpart_data, size_t kpart_size, } #endif /* __cplusplus */ -#endif /* VBOOT_HOST_H_ */ +#endif /* VBOOT_REFERENCE_VBOOT_HOST_H_ */ diff --git a/host/lib/fmap.c b/host/lib/fmap.c index 347eef19..2609064d 100644 --- a/host/lib/fmap.c +++ b/host/lib/fmap.c @@ -1,5 +1,4 @@ -/* - * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +/* 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. */ diff --git a/host/lib/include/crossystem_arch.h b/host/lib/include/crossystem_arch.h index f02e0f73..6b94d445 100644 --- a/host/lib/include/crossystem_arch.h +++ b/host/lib/include/crossystem_arch.h @@ -93,4 +93,4 @@ int VbSetArchPropertyInt(const char* name, int value); * Returns 0 if success, -1 if error. */ int VbSetArchPropertyString(const char* name, const char* value); -#endif /* VBOOT_REFERENCE__CROSSYSTEM_ARCH_H_ */ +#endif /* VBOOT_REFERENCE_CROSSYSTEM_ARCH_H_ */ diff --git a/host/lib/include/fmap.h b/host/lib/include/fmap.h index 02f97c2d..4fddaae8 100644 --- a/host/lib/include/fmap.h +++ b/host/lib/include/fmap.h @@ -1,11 +1,10 @@ -/* - * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +/* 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. */ -#ifndef __FMAP_H__ -#define __FMAP_H__ +#ifndef VBOOT_REFERENCE_FMAP_H_ +#define VBOOT_REFERENCE_FMAP_H_ #include #include @@ -55,4 +54,4 @@ uint8_t *fmap_find_by_name(uint8_t *ptr, size_t size, /* optional, return pointer to entry if not NULL */ FmapAreaHeader **ah); -#endif /* __FMAP_H__ */ +#endif /* VBOOT_REFERENCE_FMAP_H_ */ diff --git a/tests/cgptlib_test.h b/tests/cgptlib_test.h index 21ea6b9c..e78c25ae 100644 --- a/tests/cgptlib_test.h +++ b/tests/cgptlib_test.h @@ -2,6 +2,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #ifndef VBOOT_REFERENCE_CGPTLIB_TEST_H_ #define VBOOT_REFERENCE_CGPTLIB_TEST_H_ @@ -27,4 +28,4 @@ typedef int (*test_func)(void); } \ } while (0) -#endif /* VBOOT_REFERENCE_CGPTLIB_TEST_H_ */ +#endif /* VBOOT_REFERENCE_CGPTLIB_TEST_H_ */ diff --git a/tests/crc32_test.h b/tests/crc32_test.h index 18530f98..20987075 100644 --- a/tests/crc32_test.h +++ b/tests/crc32_test.h @@ -2,6 +2,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #ifndef VBOOT_REFERENCE_CRC32_TEST_H_ #define VBOOT_REFERENCE_CRC32_TEST_H_ diff --git a/tests/futility/binary_editor.c b/tests/futility/binary_editor.c index f6a971d3..f5d6a664 100644 --- a/tests/futility/binary_editor.c +++ b/tests/futility/binary_editor.c @@ -1,5 +1,4 @@ -/* - * Copyright 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 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/tests/futility/test_file_types.c b/tests/futility/test_file_types.c index 9999223d..82f51486 100644 --- a/tests/futility/test_file_types.c +++ b/tests/futility/test_file_types.c @@ -1,8 +1,8 @@ -/* - * Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 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 #include #include diff --git a/tests/futility/test_not_really.c b/tests/futility/test_not_really.c index 1d69d44d..1a7cf24c 100644 --- a/tests/futility/test_not_really.c +++ b/tests/futility/test_not_really.c @@ -1,8 +1,8 @@ -/* - * Copyright (c) 2014 The Chromium OS Authors. All rights reserved. +/* Copyright (c) 2014 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 #include "2struct.h" #include "test_common.h" diff --git a/tests/sha_test_vectors.h b/tests/sha_test_vectors.h index d2532b9f..a096bb49 100644 --- a/tests/sha_test_vectors.h +++ b/tests/sha_test_vectors.h @@ -1,10 +1,10 @@ /* 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. + * + * FIPS 180-2 test vectors for SHA-1, SHA-256 and SHA-512 */ -/* FIPS 180-2 test vectors for SHA-1, SHA-256 and SHA-512 */ - #ifndef VBOOT_REFERENCE_SHA_TEST_VECTORS_H_ #define VBOOT_REFERENCE_SHA_TEST_VECTORS_H_ @@ -88,4 +88,4 @@ uint8_t sha512_results[][VB2_SHA512_DIGEST_SIZE] = { } }; -#endif /* VBOOT_REFERENCE_SHA_TEST_VECTORS_H_ */ +#endif /* VBOOT_REFERENCE_SHA_TEST_VECTORS_H_ */ diff --git a/tests/test_common.h b/tests/test_common.h index 25f39d9c..8d98f5cc 100644 --- a/tests/test_common.h +++ b/tests/test_common.h @@ -1,7 +1,6 @@ /* 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. - * */ #ifndef VBOOT_REFERENCE_TEST_COMMON_H_ diff --git a/tests/timer_utils.h b/tests/timer_utils.h index 78099807..74351bd8 100644 --- a/tests/timer_utils.h +++ b/tests/timer_utils.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. + /* 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. */ diff --git a/tests/tpm_lite/tlcl_tests.h b/tests/tpm_lite/tlcl_tests.h index 2b6bd6b8..7b0d295c 100644 --- a/tests/tpm_lite/tlcl_tests.h +++ b/tests/tpm_lite/tlcl_tests.h @@ -1,13 +1,12 @@ /* 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. + * + * Common definitions for test programs. */ -/* Common definitions for test programs. - */ - -#ifndef TLCL_TESTS_H -#define TLCL_TESTS_H +#ifndef VBOOT_REFERENCE_TLCL_TESTS_H_ +#define VBOOT_REFERENCE_TLCL_TESTS_H_ /* Standard testing indexes. */ #define INDEX0 0xcafe @@ -32,4 +31,4 @@ */ uint32_t TlclStartupIfNeeded(void); -#endif // TLCL_TESTS_H +#endif /* VBOOT_REFERENCE_TLCL_TESTS_H_ */ diff --git a/tests/vboot_api_kernel5_tests.c b/tests/vboot_api_kernel5_tests.c index 82cc0767..bd584395 100644 --- a/tests/vboot_api_kernel5_tests.c +++ b/tests/vboot_api_kernel5_tests.c @@ -108,7 +108,8 @@ static void copy_kbh(void) memcpy(kernel_buffer, &kbh, sizeof(kbh)); } -/* Mocks */ +/* Mock functions */ + struct vb2_gbb_header *vb2_get_gbb(struct vb2_context *c) { return &gbb; diff --git a/utility/include/gbb_utility.h b/utility/include/gbb_utility.h index f1c850fe..da4504be 100644 --- a/utility/include/gbb_utility.h +++ b/utility/include/gbb_utility.h @@ -1,7 +1,7 @@ -// 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. - +/* 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. + */ #ifndef VBOOT_REFERENCE_GBB_UTILITY_H_ #define VBOOT_REFERENCE_GBB_UTILITY_H_ @@ -99,4 +99,4 @@ class GoogleBinaryBlockUtil { } // namespace vboot_reference -#endif // VBOOT_REFERENCE_GBB_UTILITY_H_ +#endif /* VBOOT_REFERENCE_GBB_UTILITY_H_ */ diff --git a/utility/include/tpmextras.h b/utility/include/tpmextras.h index 23813e82..10802fce 100644 --- a/utility/include/tpmextras.h +++ b/utility/include/tpmextras.h @@ -1,14 +1,12 @@ /* 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. - */ - -/* + * * TPM definitions not available in any TSS include file :-( */ -#ifndef TPM_LITE_TPMEXTRAS_H_ -#define TPM_LITE_TPMEXTRAS_H_ +#ifndef VBOOT_REFERENCE_TPMEXTRAS_H_ +#define VBOOT_REFERENCE_TPMEXTRAS_H_ #define TPM_MAX_COMMAND_SIZE 4096 #define TPM_LARGE_ENOUGH_COMMAND_SIZE 256 /* saves space in the firmware */ @@ -21,4 +19,4 @@ typedef struct tdTPM_WRITE_INFO { uint32_t dataSize; } TPM_WRITE_INFO; -#endif +#endif /* VBOOT_REFERENCE_TPMEXTRAS_H_ */ -- cgit v1.2.1