summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2015-02-06 15:35:34 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-09 02:13:51 +0000
commit864fae2d78f88a1ec3865c6eeffa9eb605cc6b38 (patch)
tree658069d189f96b560c7bb342fa584761320f5e63
parentb550fb180487f161b3f704056f6e05a9cce9d308 (diff)
downloadvboot-factory-auron-6772.B.tar.gz
Check the correct length of the GPT header signaturestabilize-6771.Bfactory-auron-6772.B
The length of the signature is 8 bytes. We've been checking 9 bytes instead, pretty much forever. All the tests have passed because although the signature we're looking for is an 8-byte string followed by a '\0', the next field in the header contains the revision number 0x00010000, so the 9th byte is always zero. We should follow the spec, though. BUG=none BRANCH=none TEST=make runtests Change-Id: I7cc6370250fa36a193f4a9fa5bc0099aea465618 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/247331 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--firmware/include/gpt.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/firmware/include/gpt.h b/firmware/include/gpt.h
index fa537397..15918a70 100644
--- a/firmware/include/gpt.h
+++ b/firmware/include/gpt.h
@@ -2,19 +2,22 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
- * Defines EFI related structure. See more details in EFI 2.3 spec.
+ * Defines UEFI related structure. See more details in the UEFI spec.
*
- * To download EFI standard, please visit UEFI homepage:
+ * 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>
+/* From the specification */
+#define GPT_HEADER_SIGNATURE_SIZE 8
+#define GPT_HEADER_REVISION 0x00010000
#define GPT_HEADER_SIGNATURE "EFI PART"
+
+/* From https://chromium-review.googlesource.com/31264 */
#define GPT_HEADER_SIGNATURE2 "CHROMEOS"
-#define GPT_HEADER_SIGNATURE_SIZE sizeof(GPT_HEADER_SIGNATURE)
-#define GPT_HEADER_REVISION 0x00010000
/*
* The first 3 numbers should be stored in network-endian format according to
@@ -43,7 +46,7 @@
#define UUID_NODE_LEN 6
#define GUID_SIZE 16
-/* GUID definition. Defined in appendix A of EFI standard. */
+/* GUID definition. Defined in appendix A of UEFI standard. */
typedef struct {
union {
struct {
@@ -63,12 +66,12 @@ typedef struct {
/*
* GPT header defines how many partitions exist on a drive and sectors managed.
* For every drive device, there are 2 headers, primary and secondary. Most of
- * fields are duplicated except my_lba and entries_lba.
+ * the fields are duplicates except my_lba and entries_lba.
*
- * You may find more details in chapter 5 of EFI standard.
+ * You may find more details in chapter 5 of the UEFI standard.
*/
typedef struct {
- char signature[8];
+ char signature[GPT_HEADER_SIGNATURE_SIZE];
uint32_t revision;
uint32_t size;
uint32_t header_crc32;
@@ -91,7 +94,7 @@ typedef struct {
* GPT partition entry defines the starting and ending LBAs of a partition. It
* also contains the unique GUID, type, and attribute bits.
*
- * You may find more details in chapter 5 of EFI standard.
+ * You may find more details in chapter 5 of the UEFI standard.
*/
typedef struct {
Guid type;