mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
This enhances the futility show command to recognize and identify our public and private key files, for both the old vboot 1.0 format and the new vboot 2.1 format. BUG=chromium:231547 BRANCH=ToT TEST=make runtests vboot 1.0: futility show tests/devkeys/*.vbp* vboot 2.1: futility create tests/testkeys/key_rsa2048.pem foo futility show foo.vbp* Change-Id: I9d7641db03e480b416790a7da6b473215444128a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246767 Reviewed-by: Randall Spangler <rspangler@chromium.org>
56 lines
2.1 KiB
C
56 lines
2.1 KiB
C
/*
|
|
* 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_
|
|
|
|
/* What type of things do I know how to handle? */
|
|
enum futil_file_type {
|
|
FILE_TYPE_UNKNOWN,
|
|
FILE_TYPE_PUBKEY, /* VbPublicKey */
|
|
FILE_TYPE_KEYBLOCK, /* VbKeyBlockHeader */
|
|
FILE_TYPE_FW_PREAMBLE, /* VbFirmwarePreambleHeader */
|
|
FILE_TYPE_GBB, /* GoogleBinaryBlockHeader */
|
|
FILE_TYPE_BIOS_IMAGE, /* Chrome OS BIOS image */
|
|
FILE_TYPE_OLD_BIOS_IMAGE, /* Old Chrome OS BIOS image */
|
|
FILE_TYPE_KERN_PREAMBLE, /* VbKernelPreambleHeader */
|
|
|
|
/* These are FILE_TYPE_UNKNOWN, but we've been told more about them */
|
|
FILE_TYPE_RAW_FIRMWARE, /* FW_MAIN_A, etc. */
|
|
FILE_TYPE_RAW_KERNEL, /* vmlinuz, *.uimg, etc. */
|
|
|
|
FILE_TYPE_CHROMIUMOS_DISK, /* At least it has a GPT */
|
|
FILE_TYPE_PRIVKEY, /* VbPrivateKey */
|
|
FILE_TYPE_VB2_PUBKEY, /* struct vb2_public_key */
|
|
FILE_TYPE_VB2_PRIVKEY, /* struct vb2_private_key */
|
|
|
|
NUM_FILE_TYPES
|
|
};
|
|
|
|
/* Names for them */
|
|
const char * const futil_file_type_str(enum futil_file_type type);
|
|
|
|
/*
|
|
* This tries to match the buffer content to one of the known file types.
|
|
*/
|
|
enum futil_file_type futil_file_type_buf(uint8_t *buf, uint32_t len);
|
|
|
|
/*
|
|
* This opens a file and tries to match it to one of the known file types.
|
|
* It's not an error if it returns FILE_TYPE_UKNOWN.
|
|
*/
|
|
enum futil_file_err futil_file_type(const char *filename,
|
|
enum futil_file_type *type);
|
|
|
|
/* Routines to identify particular file types. */
|
|
enum futil_file_type recognize_bios_image(uint8_t *buf, uint32_t len);
|
|
enum futil_file_type recognize_gbb(uint8_t *buf, uint32_t len);
|
|
enum futil_file_type recognize_vblock1(uint8_t *buf, uint32_t len);
|
|
enum futil_file_type recognize_gpt(uint8_t *buf, uint32_t len);
|
|
enum futil_file_type recognize_vb1_key(uint8_t *buf, uint32_t len);
|
|
enum futil_file_type recognize_vb2_key(uint8_t *buf, uint32_t len);
|
|
|
|
#endif /* VBOOT_REFERENCE_FUTILITY_FILE_TYPE_H_ */
|