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 */ |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 lkp.ending_lba = (ftell(image_file) / LBA_BYTES) - 1; | 110 lkp.ending_lba = (ftell(image_file) / LBA_BYTES) - 1; |
111 rewind(image_file); | 111 rewind(image_file); |
112 printf("Ending LBA: %" PRIu64 "\n", lkp.ending_lba); | 112 printf("Ending LBA: %" PRIu64 "\n", lkp.ending_lba); |
113 | 113 |
114 /* Allocate a buffer for the kernel */ | 114 /* Allocate a buffer for the kernel */ |
115 lkp.kernel_buffer = Malloc(KERNEL_BUFFER_SIZE); | 115 lkp.kernel_buffer = Malloc(KERNEL_BUFFER_SIZE); |
116 if(!lkp.kernel_buffer) { | 116 if(!lkp.kernel_buffer) { |
117 fprintf(stderr, "Unable to allocate kernel buffer.\n"); | 117 fprintf(stderr, "Unable to allocate kernel buffer.\n"); |
118 return 1; | 118 return 1; |
119 } | 119 } |
120 lkp.kernel_buffer_size = KERNEL_BUFFER_SIZE; | |
vb
2010/07/22 16:50:08
how could this ever work before your fix?
| |
120 | 121 |
121 /* Need to skip the address check, since we're putting it somewhere on the | 122 /* Need to skip the address check, since we're putting it somewhere on the |
122 * heap instead of its actual target address in the firmware. */ | 123 * heap instead of its actual target address in the firmware. */ |
123 if (argc == 4) { | 124 if (argc == 4) { |
124 lkp.boot_flags = atoi(argv[3]) | BOOT_FLAG_SKIP_ADDR_CHECK; | 125 lkp.boot_flags = atoi(argv[3]) | BOOT_FLAG_SKIP_ADDR_CHECK; |
125 } else { | 126 } else { |
126 /* Default to recovery. */ | 127 /* Default to recovery. */ |
127 lkp.boot_flags = BOOT_FLAG_SKIP_ADDR_CHECK | BOOT_FLAG_RECOVERY; | 128 lkp.boot_flags = BOOT_FLAG_SKIP_ADDR_CHECK | BOOT_FLAG_RECOVERY; |
128 } | 129 } |
129 /* Call LoadKernel() */ | 130 /* Call LoadKernel() */ |
130 rv = LoadKernel(&lkp); | 131 rv = LoadKernel(&lkp); |
131 printf("LoadKernel() returned %d\n", rv); | 132 printf("LoadKernel() returned %d\n", rv); |
132 | 133 |
133 if (LOAD_KERNEL_SUCCESS == rv) { | 134 if (LOAD_KERNEL_SUCCESS == rv) { |
134 printf("Partition number: %" PRIu64 "\n", lkp.partition_number); | 135 printf("Partition number: %" PRIu64 "\n", lkp.partition_number); |
135 printf("Bootloader address: %" PRIu64 "\n", lkp.bootloader_address); | 136 printf("Bootloader address: %" PRIu64 "\n", lkp.bootloader_address); |
136 printf("Bootloader size: %" PRIu64 "\n", lkp.bootloader_size); | 137 printf("Bootloader size: %" PRIu64 "\n", lkp.bootloader_size); |
137 } | 138 } |
138 | 139 |
139 fclose(image_file); | 140 fclose(image_file); |
140 Free(lkp.kernel_buffer); | 141 Free(lkp.kernel_buffer); |
141 return rv != LOAD_KERNEL_SUCCESS; | 142 return rv != LOAD_KERNEL_SUCCESS; |
142 } | 143 } |
OLD | NEW |