| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /* Routines for verifying a file's signature. Useful in testing the core | 6 /* Routines for verifying a file's signature. Useful in testing the core |
| 7 * RSA verification implementation. | 7 * RSA verification implementation. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #include <inttypes.h> /* For PRIu64 macro */ | 10 #include <inttypes.h> /* For PRIu64 macro */ |
| 11 #include <stdio.h> | 11 #include <stdio.h> |
| 12 #include <stdlib.h> | 12 #include <stdlib.h> |
| 13 #include <string.h> | 13 #include <string.h> |
| 14 #include <sys/types.h> | 14 #include <sys/types.h> |
| 15 | 15 |
| 16 #include "load_kernel_fw.h" | 16 #include "load_kernel_fw.h" |
| 17 #include "boot_device.h" | 17 #include "boot_device.h" |
| 18 #include "host_common.h" | 18 #include "host_common.h" |
| 19 #include "rollback_index.h" | 19 #include "rollback_index.h" |
| 20 #include "utility.h" | 20 #include "utility.h" |
| 21 #include "vboot_kernel.h" | 21 #include "vboot_kernel.h" |
| 22 | 22 |
| 23 /* ANSI Color coding sequences. */ | |
| 24 #define COL_GREEN "\e[1;32m" | |
| 25 #define COL_RED "\e[0;31m" | |
| 26 #define COL_STOP "\e[m" | |
| 27 | |
| 28 | |
| 29 #define LBA_BYTES 512 | 23 #define LBA_BYTES 512 |
| 30 #define KERNEL_BUFFER_SIZE 0x600000 | 24 #define KERNEL_BUFFER_SIZE 0x600000 |
| 31 | 25 |
| 32 /* Global variables for stub functions */ | 26 /* Global variables for stub functions */ |
| 33 static LoadKernelParams lkp; | 27 static LoadKernelParams lkp; |
| 34 static FILE *image_file = NULL; | 28 static FILE *image_file = NULL; |
| 35 | 29 |
| 36 | 30 |
| 37 /* Boot device stub implementations to read from the image file */ | 31 /* Boot device stub implementations to read from the image file */ |
| 38 int BootDeviceReadLBA(uint64_t lba_start, uint64_t lba_count, void *buffer) { | 32 int BootDeviceReadLBA(uint64_t lba_start, uint64_t lba_count, void *buffer) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 if (LOAD_KERNEL_SUCCESS == rv) { | 130 if (LOAD_KERNEL_SUCCESS == rv) { |
| 137 printf("Partition number: %" PRIu64 "\n", lkp.partition_number); | 131 printf("Partition number: %" PRIu64 "\n", lkp.partition_number); |
| 138 printf("Bootloader address: %" PRIu64 "\n", lkp.bootloader_address); | 132 printf("Bootloader address: %" PRIu64 "\n", lkp.bootloader_address); |
| 139 printf("Bootloader size: %" PRIu64 "\n", lkp.bootloader_size); | 133 printf("Bootloader size: %" PRIu64 "\n", lkp.bootloader_size); |
| 140 } | 134 } |
| 141 | 135 |
| 142 fclose(image_file); | 136 fclose(image_file); |
| 143 Free(lkp.kernel_buffer); | 137 Free(lkp.kernel_buffer); |
| 144 return 0; | 138 return 0; |
| 145 } | 139 } |
| OLD | NEW |