summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/2lib/2crc8.c10
-rw-r--r--firmware/2lib/include/2api.h13
-rw-r--r--firmware/2lib/include/2common.h6
-rw-r--r--firmware/2lib/include/2crc8.h14
-rw-r--r--firmware/2lib/include/2crypto.h7
-rw-r--r--firmware/2lib/include/2fw_hash_tags.h7
-rw-r--r--firmware/2lib/include/2gbb.h6
-rw-r--r--firmware/2lib/include/2gbb_flags.h6
-rw-r--r--firmware/2lib/include/2hmac.h6
-rw-r--r--firmware/2lib/include/2id.h7
-rw-r--r--firmware/2lib/include/2misc.h6
-rw-r--r--firmware/2lib/include/2nvstorage.h6
-rw-r--r--firmware/2lib/include/2nvstorage_fields.h6
-rw-r--r--firmware/2lib/include/2recovery_reasons.h6
-rw-r--r--firmware/2lib/include/2return_codes.h6
-rw-r--r--firmware/2lib/include/2secdata.h10
-rw-r--r--firmware/2lib/include/2struct.h7
-rw-r--r--firmware/2lib/include/2sysincludes.h6
-rw-r--r--firmware/include/gpt.h2
-rw-r--r--firmware/include/gpt_misc.h6
-rw-r--r--firmware/include/tlcl.h11
-rw-r--r--firmware/include/tpm1_tss_constants.h10
-rw-r--r--firmware/include/tpm2_marshaling.h10
-rw-r--r--firmware/include/tpm2_tss_constants.h9
-rw-r--r--firmware/include/tss_constants.h2
-rw-r--r--firmware/include/vb2_api.h11
-rw-r--r--firmware/include/vb2_sha.h2
-rw-r--r--firmware/include/vboot_api.h6
-rw-r--r--firmware/include/vboot_struct.h1
-rw-r--r--firmware/include/vboot_test.h5
-rw-r--r--firmware/lib/cgptlib/include/cgptlib_internal.h2
-rw-r--r--firmware/lib/cgptlib/include/crc32.h7
-rw-r--r--firmware/lib/include/utility.h4
-rw-r--r--firmware/lib/include/vboot_audio.h3
-rw-r--r--firmware/lib/include/vboot_display.h3
-rw-r--r--firmware/lib/include/vboot_ui_menu_private.h2
-rw-r--r--firmware/lib/rollback_index.c2
-rw-r--r--firmware/lib/tpm2_lite/marshaling.c3
-rw-r--r--firmware/lib/tpm2_lite/tlcl.c8
-rw-r--r--firmware/lib/tpm_lite/include/tlcl_internal.h6
-rw-r--r--firmware/lib/tpm_lite/include/tpm_error_messages.h11
-rw-r--r--firmware/lib/vboot_api_kernel.c2
-rw-r--r--firmware/lib/vboot_kernel.c2
-rw-r--r--firmware/lib/vboot_ui.c4
-rw-r--r--firmware/lib/vboot_ui_common.c3
-rw-r--r--firmware/lib/vboot_ui_menu.c2
-rw-r--r--firmware/lib20/include/vb2_struct.h1
-rw-r--r--firmware/lib21/include/vb21_struct.h1
48 files changed, 143 insertions, 133 deletions
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 <stdint.h>
+#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 <stdint.h>
/* 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 <stdint.h>
/*
@@ -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 <stdint.h>
#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 <stdint.h>
#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 <ctype.h>
#include <inttypes.h> /* For PRIu64 */
@@ -25,4 +25,4 @@
#include <memory.h>
#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 <stdint.h>
#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 <stdint.h>
#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 <stdint.h>
@@ -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 <stdint.h>
#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 <stdint.h>
#include <stdlib.h>
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 <stdint.h>
/*
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 <stdint.h>
/*
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 <stdint.h>
#include "2id.h"