Massive refactoring of external header files.

This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.

BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023

  sudo FEATURES=test emerge vboot_reference
  FEATURES=test emerge-$BOARD \
                vboot_reference \
                chromeos-cryptohome \
                chromeos-installer \
                chromeos-u-boot \
                peach-u-boot \
                depthcharge

Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Bill Richardson
2013-03-29 11:09:30 -07:00
committed by ChromeBot
parent 28b65ca99f
commit 0c3ba249ab
136 changed files with 278 additions and 180 deletions

View File

@@ -160,6 +160,9 @@ endif
# Create / use dependency files # Create / use dependency files
CFLAGS += -MMD -MF $@.d CFLAGS += -MMD -MF $@.d
# These are required to access large disks and files on 32-bit systems.
CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
# Code coverage # Code coverage
ifneq (${COV},) ifneq (${COV},)
COV_FLAGS = -O0 --coverage COV_FLAGS = -O0 --coverage
@@ -659,8 +662,9 @@ ${FWLIB}: ${FWLIB_OBJS}
hostlib: ${HOSTLIB} ${BUILD}/host/linktest/main hostlib: ${HOSTLIB} ${BUILD}/host/linktest/main
${BUILD}/host/% ${HOSTLIB}: INCLUDES += \ ${BUILD}/host/% ${HOSTLIB}: INCLUDES += \
-Ihost/include\ -Ihost/include \
-Ihost/arch/${ARCH}/include -Ihost/arch/${ARCH}/include \
-Ihost/lib/include
# TODO: better way to make .a than duplicating this recipe each time? # TODO: better way to make .a than duplicating this recipe each time?
${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS} ${HOSTLIB}: ${HOSTLIB_OBJS} ${FWLIB_OBJS}
@@ -687,6 +691,8 @@ ${TINYHOSTLIB}: ${TINYHOSTLIB_OBJS}
.PHONY: cgpt .PHONY: cgpt
cgpt: ${CGPT} cgpt: ${CGPT}
${CGPT_OBJS}: INCLUDES += -Ihost/include
${CGPT}: LDFLAGS += -static ${CGPT}: LDFLAGS += -static
${CGPT}: LDLIBS += -luuid ${CGPT}: LDLIBS += -luuid
@@ -704,7 +710,10 @@ cgpt_install: ${CGPT}
# Utilities # Utilities
# These have their own headers too. # These have their own headers too.
${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include ${BUILD}/utility/%: INCLUDES += \
-Ihost/include \
-Ihost/lib/include \
-Iutility/include
# Utilities for auto-update toolkits must be statically linked. # Utilities for auto-update toolkits must be statically linked.
${UTIL_BINS_STATIC}: LDFLAGS += -static ${UTIL_BINS_STATIC}: LDFLAGS += -static
@@ -855,7 +864,7 @@ ${BUILD}/utility/bmpblk_font: ${BUILD}/utility/image_types.o
# Allow multiple definitions, so tests can mock functions from other libraries # Allow multiple definitions, so tests can mock functions from other libraries
${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition ${BUILD}/tests/%: CFLAGS += -Xlinker --allow-multiple-definition
${BUILD}/tests/%: INCLUDES += -Ihost/include ${BUILD}/tests/%: INCLUDES += -Ihost/include -Ihost/lib/include
${BUILD}/tests/%: LDLIBS += -lrt -luuid ${BUILD}/tests/%: LDLIBS += -lrt -luuid
${BUILD}/tests/%: LIBS += ${TESTLIB} ${BUILD}/tests/%: LIBS += ${TESTLIB}

View File

@@ -6,13 +6,14 @@
* files for more details. * files for more details.
*/ */
#include "cgpt.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <uuid/uuid.h> #include <uuid/uuid.h>
#include "cgpt.h"
#include "vboot_host.h"
const char* progname; const char* progname;
const char* command; const char* command;
void (*uuid_generator)(uint8_t* buffer); void (*uuid_generator)(uint8_t* buffer);

View File

@@ -5,11 +5,6 @@
#ifndef VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_ #ifndef VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
#define VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_ #define VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#define _FILE_OFFSET_BITS 64
#include <fcntl.h> #include <fcntl.h>
#include <features.h> #include <features.h>
#include <stdint.h> #include <stdint.h>
@@ -20,13 +15,6 @@
#include "cgptlib.h" #include "cgptlib.h"
// Just for clarity
enum {
CGPT_OK = 0,
CGPT_FAILED,
};
struct legacy_partition { struct legacy_partition {
uint8_t status; uint8_t status;
uint8_t f_head; uint8_t f_head;
@@ -67,19 +55,6 @@ int DriveOpen(const char *drive_path, struct drive *drive, int mode);
int DriveClose(struct drive *drive, int update_as_needed); int DriveClose(struct drive *drive, int update_as_needed);
int CheckValid(const struct drive *drive); int CheckValid(const struct drive *drive);
/* GUID conversion functions. Accepted format:
*
* "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
*
* At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing
* '\0').
*/
#define GUID_STRLEN 37
int StrToGuid(const char *str, Guid *guid);
void GuidToStr(const Guid *guid, char *str, unsigned int buflen);
int GuidEqual(const Guid *guid1, const Guid *guid2);
int GuidIsZero(const Guid *guid);
/* Constant global type values to compare against */ /* Constant global type values to compare against */
extern const Guid guid_chromeos_firmware; extern const Guid guid_chromeos_firmware;
extern const Guid guid_chromeos_kernel; extern const Guid guid_chromeos_kernel;

View File

@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <string.h> #include <string.h>
#include "cgptlib_internal.h"
#include "cgpt_params.h"
#define _STUB_IMPLEMENTATION_ #define _STUB_IMPLEMENTATION_
#include "cgpt.h"
#include "cgpt_params.h"
#include "cgptlib_internal.h"
#include "utility.h" #include "utility.h"
#include "vboot_host.h"
static const char* DumpCgptAddParams(const CgptAddParams *params) { static const char* DumpCgptAddParams(const CgptAddParams *params) {
static char buf[256]; static char buf[256];

View File

@@ -11,7 +11,7 @@
#include "cgpt_params.h" #include "cgpt_params.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "endian.h" #include "endian.h"
#include "vboot_host.h"
int CgptGetBootPartitionNumber(CgptBootParams *params) { int CgptGetBootPartitionNumber(CgptBootParams *params) {
struct drive drive; struct drive drive;

View File

@@ -6,8 +6,6 @@
* files for more details. * files for more details.
*/ */
#include "cgpt.h"
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <getopt.h> #include <getopt.h>
@@ -22,8 +20,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include "cgpt.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "crc32.h" #include "crc32.h"
#include "vboot_host.h"
void Error(const char *format, ...) { void Error(const char *format, ...) {
va_list ap; va_list ap;

View File

@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <string.h> #include <string.h>
#include "cgpt.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "cgpt_params.h" #include "vboot_host.h"
int CgptCreate(CgptCreateParams *params) { int CgptCreate(CgptCreateParams *params) {
struct drive drive; struct drive drive;

View File

@@ -8,8 +8,8 @@
#include <unistd.h> #include <unistd.h>
#include "cgpt.h" #include "cgpt.h"
#include "cgpt_params.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "vboot_host.h"
#define BUFSIZE 1024 #define BUFSIZE 1024
// FIXME: currently we only support 512-byte sectors. // FIXME: currently we only support 512-byte sectors.

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <string.h> #include <string.h>
#include "cgpt.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "cgpt_params.h" #include "vboot_host.h"
int CgptLegacy(CgptLegacyParams *params) { int CgptLegacy(CgptLegacyParams *params) {
struct drive drive; struct drive drive;

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <string.h> #include <string.h>
#include "cgpt.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "cgpt_params.h" #include "vboot_host.h"
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// We need a sorted list of priority groups, where each element in the list // We need a sorted list of priority groups, where each element in the list

View File

@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <string.h> #include <string.h>
#include "cgpt.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "cgpt_params.h" #include "vboot_host.h"
int CgptRepair(CgptRepairParams *params) { int CgptRepair(CgptRepairParams *params) {
struct drive drive; struct drive drive;

View File

@@ -2,15 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#include <string.h> #include <string.h>
#include "cgpt.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "cgpt_params.h"
#include "crc32.h" #include "crc32.h"
#include "vboot_host.h"
/* Generate output like: /* Generate output like:
* *

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <getopt.h> #include <getopt.h>
#include <string.h> #include <string.h>
#include "cgpt_params.h" #include "cgpt.h"
#include "vboot_host.h"
static void Usage(void) static void Usage(void)
{ {

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <getopt.h> #include <getopt.h>
#include <string.h> #include <string.h>
#include "cgpt_params.h" #include "cgpt.h"
#include "vboot_host.h"
static void Usage(void) static void Usage(void)
{ {

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <getopt.h> #include <getopt.h>
#include <string.h> #include <string.h>
#include "cgpt_params.h" #include "cgpt.h"
#include "vboot_host.h"
static void Usage(void) static void Usage(void)
{ {

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <getopt.h> #include <getopt.h>
#include <string.h> #include <string.h>
#include "cgpt_params.h" #include "cgpt.h"
#include "vboot_host.h"
static void Usage(void) static void Usage(void)
{ {

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <getopt.h> #include <getopt.h>
#include <string.h> #include <string.h>
#include "cgpt_params.h" #include "cgpt.h"
#include "vboot_host.h"
static void Usage(void) static void Usage(void)
{ {

View File

@@ -8,7 +8,8 @@
#include <string.h> #include <string.h>
#include <uuid/uuid.h> #include <uuid/uuid.h>
#include "cgpt_params.h" #include "cgpt.h"
#include "vboot_host.h"
static void Usage(void) static void Usage(void)
{ {

View File

@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#include <getopt.h> #include <getopt.h>
#include <string.h> #include <string.h>
#include "cgpt_params.h" #include "cgpt.h"
#include "vboot_host.h"
static void Usage(void) static void Usage(void)
{ {

View File

@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "cgpt.h"
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#include <getopt.h> #include <getopt.h>
#include <inttypes.h> #include <inttypes.h>
#include <string.h> #include <string.h>
#include "cgpt_params.h"
#include "cgpt.h"
#include "vboot_host.h"
static void Usage(void) static void Usage(void)
{ {

View File

@@ -41,11 +41,9 @@
* | List of locale names | * | List of locale names |
* +-----------------------------------------+ * +-----------------------------------------+
*/ */
#ifndef VBOOT_REFERENCE_BMPBLK_HEADER_H_ #ifndef VBOOT_REFERENCE_BMPBLK_HEADER_H_
#define VBOOT_REFERENCE_BMPBLK_HEADER_H_ #define VBOOT_REFERENCE_BMPBLK_HEADER_H_
#include <stdint.h>
#include "sysincludes.h"
#define BMPBLOCK_SIGNATURE "$BMP" #define BMPBLOCK_SIGNATURE "$BMP"
#define BMPBLOCK_SIGNATURE_SIZE (4) #define BMPBLOCK_SIGNATURE_SIZE (4)
@@ -130,14 +128,6 @@ typedef enum ImageFormat {
FORMAT_FONT, FORMAT_FONT,
} ImageFormat; } ImageFormat;
/* Constants for ImageInfo.compression */
typedef enum Compression {
COMPRESS_NONE = 0,
COMPRESS_EFIv1, /* The x86 BIOS only supports this */
COMPRESS_LZMA1, /* The ARM BIOS supports LZMA1 */
MAX_COMPRESS,
} Compression;
/* /*
* These magic image names can be used in the .yaml file to indicate that the * These magic image names can be used in the .yaml file to indicate that the
* ASCII HWID should be displayed. For RENDER_HWID, the image coordinates * ASCII HWID should be displayed. For RENDER_HWID, the image coordinates

View File

@@ -4,11 +4,9 @@
* *
* Data structure of Google Binary Block (GBB) * Data structure of Google Binary Block (GBB)
*/ */
#ifndef VBOOT_REFERENCE_GBB_HEADER_H_ #ifndef VBOOT_REFERENCE_GBB_HEADER_H_
#define VBOOT_REFERENCE_GBB_HEADER_H_ #define VBOOT_REFERENCE_GBB_HEADER_H_
#include <stdint.h>
#include "sysincludes.h"
#define GBB_HEADER_SIZE 128 #define GBB_HEADER_SIZE 128

View File

@@ -9,8 +9,7 @@
*/ */
#ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_ #ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_
#define VBOOT_REFERENCE_CGPTLIB_GPT_H_ #define VBOOT_REFERENCE_CGPTLIB_GPT_H_
#include <stdint.h>
#include "sysincludes.h"
#define GPT_HEADER_SIGNATURE "EFI PART" #define GPT_HEADER_SIGNATURE "EFI PART"
#define GPT_HEADER_SIGNATURE2 "CHROMEOS" #define GPT_HEADER_SIGNATURE2 "CHROMEOS"

View File

@@ -11,8 +11,8 @@
#ifndef TPM_LITE_TLCL_H_ #ifndef TPM_LITE_TLCL_H_
#define TPM_LITE_TLCL_H_ #define TPM_LITE_TLCL_H_
#include <stdint.h>
#include "sysincludes.h"
#include "tss_constants.h" #include "tss_constants.h"
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -5,11 +5,9 @@
* Some TPM constants and type definitions for standalone compilation for use * Some TPM constants and type definitions for standalone compilation for use
* in the firmware * in the firmware
*/ */
#ifndef VBOOT_REFERENCE_TSS_CONSTANTS_H_ #ifndef VBOOT_REFERENCE_TSS_CONSTANTS_H_
#define VBOOT_REFERENCE_TSS_CONSTANTS_H_ #define VBOOT_REFERENCE_TSS_CONSTANTS_H_
#include <stdint.h>
#include "sysincludes.h"
#define TPM_MAX_COMMAND_SIZE 4096 #define TPM_MAX_COMMAND_SIZE 4096
#define TPM_LARGE_ENOUGH_COMMAND_SIZE 256 /* saves space in the firmware */ #define TPM_LARGE_ENOUGH_COMMAND_SIZE 256 /* saves space in the firmware */

View File

@@ -21,9 +21,7 @@
#ifndef VBOOT_REFERENCE_VBOOT_API_H_ #ifndef VBOOT_REFERENCE_VBOOT_API_H_
#define VBOOT_REFERENCE_VBOOT_API_H_ #define VBOOT_REFERENCE_VBOOT_API_H_
#include <stdint.h>
#include "sysincludes.h"
#include "bmpblk_header.h"
/*****************************************************************************/ /*****************************************************************************/
/* Error codes */ /* Error codes */
@@ -814,6 +812,14 @@ VbError_t VbExDecompress(void *inbuf, uint32_t in_size,
uint32_t compression_type, uint32_t compression_type,
void *outbuf, uint32_t *out_size); void *outbuf, uint32_t *out_size);
/* Constants for compression_type */
enum {
COMPRESS_NONE = 0,
COMPRESS_EFIv1, /* The x86 BIOS only supports this */
COMPRESS_LZMA1, /* The ARM BIOS supports LZMA1 */
MAX_COMPRESS,
};
/** /**
* Execute legacy boot option. * Execute legacy boot option.
*/ */

View File

@@ -7,6 +7,7 @@
#ifndef VBOOT_REFERENCE_NVSTORAGE_H_ #ifndef VBOOT_REFERENCE_NVSTORAGE_H_
#define VBOOT_REFERENCE_NVSTORAGE_H_ #define VBOOT_REFERENCE_NVSTORAGE_H_
#include <stdint.h>
#define VBNV_BLOCK_SIZE 16 /* Size of NV storage block in bytes */ #define VBNV_BLOCK_SIZE 16 /* Size of NV storage block in bytes */

View File

@@ -8,8 +8,7 @@
#ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_ #ifndef VBOOT_REFERENCE_VBOOT_STRUCT_H_
#define VBOOT_REFERENCE_VBOOT_STRUCT_H_ #define VBOOT_REFERENCE_VBOOT_STRUCT_H_
#include <stdint.h>
#include "sysincludes.h"
/* Public key data */ /* Public key data */
typedef struct VbPublicKey { typedef struct VbPublicKey {

View File

@@ -3,6 +3,8 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "sysincludes.h"
#include "cgptlib.h" #include "cgptlib.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "crc32.h" #include "crc32.h"

View File

@@ -3,6 +3,8 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "sysincludes.h"
#include "cgptlib.h" #include "cgptlib.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"
#include "crc32.h" #include "crc32.h"

View File

@@ -39,6 +39,8 @@
/* polynomial $edb88320 */ /* polynomial $edb88320 */
/* */ /* */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
#include "sysincludes.h"
#include "crc32.h" #include "crc32.h"
static uint32_t crc32_tab[] = { static uint32_t crc32_tab[] = {

View File

@@ -3,6 +3,8 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "sysincludes.h"
#include "crc8.h" #include "crc8.h"
/** /**

View File

@@ -5,6 +5,8 @@
* arrays corresponding to various combinations of algorithms for RSA signatures. * arrays corresponding to various combinations of algorithms for RSA signatures.
*/ */
#include "sysincludes.h"
#include "cryptolib.h" #include "cryptolib.h"

View File

@@ -8,6 +8,8 @@
* support multiple RSA key lengths and hash digest algorithms. * support multiple RSA key lengths and hash digest algorithms.
*/ */
#include "sysincludes.h"
#include "cryptolib.h" #include "cryptolib.h"
#include "vboot_api.h" #include "vboot_api.h"
#include "utility.h" #include "utility.h"

View File

@@ -5,6 +5,8 @@
* Implementation of RSA utility functions. * Implementation of RSA utility functions.
*/ */
#include "sysincludes.h"
#include "cryptolib.h" #include "cryptolib.h"
#include "stateful_util.h" #include "stateful_util.h"
#include "utility.h" #include "utility.h"

View File

@@ -6,6 +6,8 @@
* Open Source Project (platorm/system/core.git/libmincrypt/sha.c * Open Source Project (platorm/system/core.git/libmincrypt/sha.c
*/ */
#include "sysincludes.h"
#include "cryptolib.h" #include "cryptolib.h"
#include "utility.h" #include "utility.h"

View File

@@ -35,6 +35,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "sysincludes.h"
#include "cryptolib.h" #include "cryptolib.h"
#include "utility.h" #include "utility.h"

View File

@@ -35,6 +35,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "sysincludes.h"
#include "cryptolib.h" #include "cryptolib.h"
#include "utility.h" #include "utility.h"

View File

@@ -5,6 +5,8 @@
* Utility functions for message digest functions. * Utility functions for message digest functions.
*/ */
#include "sysincludes.h"
#include "cryptolib.h" #include "cryptolib.h"
#include "utility.h" #include "utility.h"
#include "vboot_api.h" #include "vboot_api.h"

View File

@@ -9,7 +9,6 @@
#ifndef VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ #ifndef VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_
#define VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_ #define VBOOT_REFERENCE_LOAD_FIRMWARE_FW_H_
#include "sysincludes.h"
#include "vboot_api.h" #include "vboot_api.h"
#include "vboot_nvstorage.h" #include "vboot_nvstorage.h"
#include "vboot_struct.h" #include "vboot_struct.h"

View File

@@ -9,7 +9,6 @@
#ifndef VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ #ifndef VBOOT_REFERENCE_LOAD_KERNEL_FW_H_
#define VBOOT_REFERENCE_LOAD_KERNEL_FW_H_ #define VBOOT_REFERENCE_LOAD_KERNEL_FW_H_
#include "sysincludes.h"
#include "vboot_api.h" #include "vboot_api.h"
#include "vboot_nvstorage.h" #include "vboot_nvstorage.h"

View File

@@ -6,6 +6,8 @@
* stored in the TPM NVRAM. * stored in the TPM NVRAM.
*/ */
#include "sysincludes.h"
#include "rollback_index.h" #include "rollback_index.h"
#include "tss_constants.h" #include "tss_constants.h"

View File

@@ -5,8 +5,9 @@
* Functions for updating the TPM state with the status of boot path. * Functions for updating the TPM state with the status of boot path.
*/ */
#include "tpm_bootmode.h" #include "sysincludes.h"
#include "tpm_bootmode.h"
#include "tss_constants.h" #include "tss_constants.h"
const char* kBootStateSHA1Digests[] = { const char* kBootStateSHA1Digests[] = {

View File

@@ -6,6 +6,8 @@
* stored in the TPM NVRAM. * stored in the TPM NVRAM.
*/ */
#include "sysincludes.h"
#include "crc8.h" #include "crc8.h"
#include "rollback_index.h" #include "rollback_index.h"
#include "tlcl.h" #include "tlcl.h"

View File

@@ -5,6 +5,8 @@
* Implementations of stateful memory operations. * Implementations of stateful memory operations.
*/ */
#include "sysincludes.h"
#include "stateful_util.h" #include "stateful_util.h"
#include "utility.h" #include "utility.h"

View File

@@ -5,9 +5,10 @@
* Functions for updating the TPM state with the status of boot path. * Functions for updating the TPM state with the status of boot path.
*/ */
#include "tpm_bootmode.h" #include "sysincludes.h"
#include "tlcl.h" #include "tlcl.h"
#include "tpm_bootmode.h"
#include "utility.h" #include "utility.h"
#include "vboot_api.h" #include "vboot_api.h"

View File

@@ -3,6 +3,8 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "sysincludes.h"
#include "tlcl.h" #include "tlcl.h"
#include "tlcl_internal.h" #include "tlcl_internal.h"
#include "utility.h" #include "utility.h"

View File

@@ -15,6 +15,7 @@
*/ */
#include "sysincludes.h" #include "sysincludes.h"
#include "tlcl.h" #include "tlcl.h"
#include "tlcl_internal.h" #include "tlcl_internal.h"
#include "tlcl_structures.h" #include "tlcl_structures.h"

View File

@@ -6,6 +6,7 @@
*/ */
#include "sysincludes.h" #include "sysincludes.h"
#include "utility.h" #include "utility.h"
int SafeMemcmp(const void *s1, const void *s2, size_t n) { int SafeMemcmp(const void *s1, const void *s2, size_t n) {

View File

@@ -6,6 +6,7 @@
*/ */
#include "sysincludes.h" #include "sysincludes.h"
#include "utility.h" #include "utility.h"

View File

@@ -5,6 +5,8 @@
* High-level firmware wrapper API - entry points for init, firmware selection * High-level firmware wrapper API - entry points for init, firmware selection
*/ */
#include "sysincludes.h"
#include "gbb_header.h" #include "gbb_header.h"
#include "load_firmware_fw.h" #include "load_firmware_fw.h"
#include "rollback_index.h" #include "rollback_index.h"

View File

@@ -5,6 +5,8 @@
* High-level firmware wrapper API - entry points for init, firmware selection * High-level firmware wrapper API - entry points for init, firmware selection
*/ */
#include "sysincludes.h"
#include "gbb_header.h" #include "gbb_header.h"
#include "load_firmware_fw.h" #include "load_firmware_fw.h"
#include "rollback_index.h" #include "rollback_index.h"

View File

@@ -5,6 +5,8 @@
* High-level firmware wrapper API - entry points for kernel selection * High-level firmware wrapper API - entry points for kernel selection
*/ */
#include "sysincludes.h"
#include "gbb_header.h" #include "gbb_header.h"
#include "load_kernel_fw.h" #include "load_kernel_fw.h"
#include "rollback_index.h" #include "rollback_index.h"

View File

@@ -5,6 +5,8 @@
* Delay/beep functions used in dev-mode kernel selection. * Delay/beep functions used in dev-mode kernel selection.
*/ */
#include "sysincludes.h"
#include "crc32.h" #include "crc32.h"
#include "gbb_header.h" #include "gbb_header.h"
#include "utility.h" #include "utility.h"

View File

@@ -6,6 +6,8 @@
* (Firmware portion) * (Firmware portion)
*/ */
#include "sysincludes.h"
#include "vboot_api.h" #include "vboot_api.h"
#include "vboot_common.h" #include "vboot_common.h"
#include "utility.h" #include "utility.h"

View File

@@ -6,6 +6,8 @@
* (Firmware portion) * (Firmware portion)
*/ */
#include "sysincludes.h"
#include "vboot_api.h" #include "vboot_api.h"
#include "vboot_common.h" #include "vboot_common.h"
#include "utility.h" #include "utility.h"

View File

@@ -5,6 +5,8 @@
* Display functions used in kernel selection. * Display functions used in kernel selection.
*/ */
#include "sysincludes.h"
#include "bmpblk_font.h" #include "bmpblk_font.h"
#include "gbb_header.h" #include "gbb_header.h"
#include "utility.h" #include "utility.h"

View File

@@ -6,6 +6,8 @@
* (Firmware portion) * (Firmware portion)
*/ */
#include "sysincludes.h"
#include "gbb_header.h" #include "gbb_header.h"
#include "load_firmware_fw.h" #include "load_firmware_fw.h"
#include "utility.h" #include "utility.h"

View File

@@ -6,6 +6,7 @@
* (Firmware portion) * (Firmware portion)
*/ */
#include "sysincludes.h"
#include "cgptlib.h" #include "cgptlib.h"
#include "cgptlib_internal.h" #include "cgptlib_internal.h"

View File

@@ -5,6 +5,8 @@
/* Non-volatile storage routines. /* Non-volatile storage routines.
*/ */
#include "sysincludes.h"
#include "crc8.h" #include "crc8.h"
#include "utility.h" #include "utility.h"

View File

@@ -3,6 +3,8 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "sysincludes.h"
#include "cgptlib.h" #include "cgptlib.h"
#include "load_firmware_fw.h" #include "load_firmware_fw.h"
#include "load_kernel_fw.h" #include "load_kernel_fw.h"

View File

@@ -3,6 +3,8 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "sysincludes.h"
#include "vboot_api.h" #include "vboot_api.h"
int main(void) int main(void)

View File

@@ -3,6 +3,8 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "sysincludes.h"
#include "vboot_api.h" #include "vboot_api.h"
int main(void) int main(void)

View File

@@ -6,6 +6,8 @@
* equivalents. * equivalents.
*/ */
#include <stdint.h>
#define _STUB_IMPLEMENTATION_ #define _STUB_IMPLEMENTATION_
#include "tlcl.h" #include "tlcl.h"
#include "tlcl_internal.h" #include "tlcl_internal.h"
@@ -24,6 +26,7 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#define TPM_DEVICE_PATH "/dev/tpm0" #define TPM_DEVICE_PATH "/dev/tpm0"
/* Retry failed open()s for 5 seconds in 10ms polling intervals. */ /* Retry failed open()s for 5 seconds in 10ms polling intervals. */
#define OPEN_RETRY_DELAY_NS (10 * 1000 * 1000) #define OPEN_RETRY_DELAY_NS (10 * 1000 * 1000)

View File

@@ -6,6 +6,8 @@
* equivalents. * equivalents.
*/ */
#include <stdint.h>
#define _STUB_IMPLEMENTATION_ #define _STUB_IMPLEMENTATION_
#include "utility.h" #include "utility.h"

View File

@@ -5,6 +5,8 @@
* Stub implementations of firmware-provided API functions. * Stub implementations of firmware-provided API functions.
*/ */
#include <stdint.h>
#define _STUB_IMPLEMENTATION_ #define _STUB_IMPLEMENTATION_
#include <stdarg.h> #include <stdarg.h>

View File

@@ -5,6 +5,8 @@
* Stub implementations of disk APIs. * Stub implementations of disk APIs.
*/ */
#include <stdint.h>
#define _STUB_IMPLEMENTATION_ #define _STUB_IMPLEMENTATION_
#include <stdarg.h> #include <stdarg.h>

View File

@@ -5,6 +5,8 @@
* Stub implementations of firmware-provided API functions. * Stub implementations of firmware-provided API functions.
*/ */
#include <stdint.h>
#define _STUB_IMPLEMENTATION_ #define _STUB_IMPLEMENTATION_
#include <stdarg.h> #include <stdarg.h>

View File

@@ -5,6 +5,8 @@
* Stub implementations of firmware-provided API functions. * Stub implementations of firmware-provided API functions.
*/ */
#include <stdint.h>
#define _STUB_IMPLEMENTATION_ #define _STUB_IMPLEMENTATION_
#include <stdarg.h> #include <stdarg.h>

View File

@@ -4,7 +4,6 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#define _GNU_SOURCE
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>

View File

@@ -7,6 +7,7 @@
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <linux/nvram.h> #include <linux/nvram.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@@ -14,10 +15,9 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include "host_common.h"
#include "crossystem.h" #include "crossystem.h"
#include "crossystem_arch.h" #include "crossystem_arch.h"
#include "host_common.h"
#include "utility.h" #include "utility.h"
#include "vboot_common.h" #include "vboot_common.h"
#include "vboot_nvstorage.h" #include "vboot_nvstorage.h"

View File

@@ -1,15 +1,17 @@
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved. // Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_ #ifndef VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
#define VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_ #define VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_
#include <stdint.h>
#include "cgpt.h" #include "gpt.h"
// This file defines the internal methods that use the user-mode cgpt programatically. enum {
// This is the interface for the callers such as the cgpt tool or the C++ post installer CGPT_OK = 0,
// executable. CGPT_FAILED,
};
typedef struct CgptCreateParams { typedef struct CgptCreateParams {
char *drive_name; char *drive_name;
@@ -46,8 +48,6 @@ typedef struct CgptShowParams {
uint32_t partition; uint32_t partition;
int single_item; int single_item;
int debug; int debug;
// This is filled in by the relevant methods in CgptShow.c
int num_partitions; int num_partitions;
} CgptShowParams; } CgptShowParams;
@@ -65,7 +65,6 @@ typedef struct CgptBootParams {
typedef struct CgptPrioritizeParams { typedef struct CgptPrioritizeParams {
char *drive_name; char *drive_name;
uint32_t set_partition; uint32_t set_partition;
int set_friends; int set_friends;
int max_priority; int max_priority;
@@ -74,7 +73,6 @@ typedef struct CgptPrioritizeParams {
typedef struct CgptFindParams { typedef struct CgptFindParams {
char *drive_name; char *drive_name;
int verbose; int verbose;
int set_unique; int set_unique;
int set_type; int set_type;
@@ -89,7 +87,7 @@ typedef struct CgptFindParams {
Guid type_guid; Guid type_guid;
char *label; char *label;
int hits; int hits;
int match_partnum; // 0 for no match, 1-N for match int match_partnum; /* 1-based; 0 means no match */
} CgptFindParams; } CgptFindParams;
typedef struct CgptLegacyParams { typedef struct CgptLegacyParams {
@@ -97,32 +95,4 @@ typedef struct CgptLegacyParams {
int efipart; int efipart;
} CgptLegacyParams; } CgptLegacyParams;
// create related methods.
int CgptCreate(CgptCreateParams *params);
// add/attribute/details related methods
int CgptAdd(CgptAddParams *params);
int CgptSetAttributes(CgptAddParams *params);
int CgptGetPartitionDetails(CgptAddParams *params);
// boot related methods.
int CgptBoot(CgptBootParams *params);
int CgptGetBootPartitionNumber(CgptBootParams *params);
// show/get related methods.
int CgptShow(CgptShowParams *params);
int CgptGetNumNonEmptyPartitions(CgptShowParams *params);
// repair related methods.
int CgptRepair(CgptRepairParams *params);
// priority related methods.
int CgptPrioritize(CgptPrioritizeParams *params);
// find related methods.
void CgptFind(CgptFindParams *params);
// legacy related methods.
int CgptLegacy(CgptLegacyParams *params);
#endif // VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_ #endif // VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. * found in the LICENSE file.
*/ */

62
host/include/vboot_host.h Normal file
View File

@@ -0,0 +1,62 @@
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* vboot-related functions exported for use by userspace programs
*/
#ifndef VBOOT_HOST_H_
#define VBOOT_HOST_H_
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
/****************************************************************************/
/* EFI GPT manipulation */
#include "cgpt_params.h"
/* partition table manipulation */
int CgptCreate(CgptCreateParams *params);
int CgptAdd(CgptAddParams *params);
int CgptSetAttributes(CgptAddParams *params);
int CgptGetPartitionDetails(CgptAddParams *params);
int CgptBoot(CgptBootParams *params);
int CgptGetBootPartitionNumber(CgptBootParams *params);
int CgptShow(CgptShowParams *params);
int CgptGetNumNonEmptyPartitions(CgptShowParams *params);
int CgptRepair(CgptRepairParams *params);
int CgptPrioritize(CgptPrioritizeParams *params);
void CgptFind(CgptFindParams *params);
int CgptLegacy(CgptLegacyParams *params);
/* GUID conversion functions. Accepted format:
*
* "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
*
* At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing
* '\0').
*/
#define GUID_STRLEN 37
int StrToGuid(const char *str, Guid *guid);
void GuidToStr(const Guid *guid, char *str, unsigned int buflen);
int GuidEqual(const Guid *guid1, const Guid *guid2);
int GuidIsZero(const Guid *guid);
/****************************************************************************/
/* Kernel command line */
/* TODO(wfrichar): This needs a better location */
#define MAX_KERNEL_CONFIG_SIZE 4096
/* Use this to obtain the body load address from the kernel preamble */
#define USE_PREAMBLE_LOAD_ADDR (~0)
/* Returns a new copy of the kernel cmdline. The caller must free it. */
char *FindKernelConfig(const char *filename,
uint64_t kernel_body_load_address);
/****************************************************************************/
#endif /* VBOOT_HOST_H_ */

View File

@@ -6,6 +6,7 @@
* is a quick and dirty test for detecting integer overflow issues. * is a quick and dirty test for detecting integer overflow issues.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -6,6 +6,7 @@
* is a quick and dirty test for detecting integer overflow issues. * is a quick and dirty test for detecting integer overflow issues.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Tests for firmware image library. * Tests for firmware image library.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Tests for checking firmware rollback-prevention logic. * Tests for checking firmware rollback-prevention logic.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Splicing tests for the firmware image verification library. * Splicing tests for the firmware image verification library.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Timing benchmark for verifying a firmware image. * Timing benchmark for verifying a firmware image.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Tests for kernel image library. * Tests for kernel image library.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Tests for checking kernel rollback-prevention logic. * Tests for checking kernel rollback-prevention logic.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Splicing tests for the kernel image verification library. * Splicing tests for the kernel image verification library.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Timing benchmark for verifying a firmware image. * Timing benchmark for verifying a firmware image.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -5,6 +5,7 @@
* Tests for rollback_index functions * Tests for rollback_index functions
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@@ -5,6 +5,7 @@
* Tests for do-nothing rollback_index functions with disabled TPM * Tests for do-nothing rollback_index functions with disabled TPM
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@@ -35,6 +35,7 @@
#include "utility.h" #include "utility.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>

View File

@@ -4,6 +4,7 @@
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include "cryptolib.h" #include "cryptolib.h"

View File

@@ -4,6 +4,7 @@
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#define _STUB_IMPLEMENTATION_ #define _STUB_IMPLEMENTATION_

Some files were not shown because too many files have changed in this diff Show More