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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 lkp.header_sign_key_blob = ReadFile(argv[optind+1], &key_size); | 137 lkp.header_sign_key_blob = ReadFile(argv[optind+1], &key_size); |
138 if (!lkp.header_sign_key_blob) { | 138 if (!lkp.header_sign_key_blob) { |
139 fprintf(stderr, "Unable to read key file %s\n", argv[optind+1]); | 139 fprintf(stderr, "Unable to read key file %s\n", argv[optind+1]); |
140 return 1; | 140 return 1; |
141 } | 141 } |
142 } | 142 } |
143 /* Need to skip the address check, since we're putting it somewhere on the | 143 /* Need to skip the address check, since we're putting it somewhere on the |
144 * heap instead of its actual target address in the firmware. */ | 144 * heap instead of its actual target address in the firmware. */ |
145 lkp.boot_flags |= BOOT_FLAG_SKIP_ADDR_CHECK; | 145 lkp.boot_flags |= BOOT_FLAG_SKIP_ADDR_CHECK; |
146 | 146 |
| 147 /* If the boot flags are for developer mode, non-recovery, add the dev-type |
| 148 * firmware bit. LoadKernel() masks off the developer bit if the dev |
| 149 * firmware bit is absent, to keep normal firmware from verifying dev |
| 150 * kernels. */ |
| 151 if ((lkp.boot_flags & BOOT_FLAG_DEVELOPER) |
| 152 && !(lkp.boot_flags & BOOT_FLAG_RECOVERY)) { |
| 153 lkp.boot_flags |= BOOT_FLAG_DEV_FIRMWARE; |
| 154 } |
| 155 |
147 printf("bootflags = %" PRIu64 "\n", lkp.boot_flags); | 156 printf("bootflags = %" PRIu64 "\n", lkp.boot_flags); |
148 | 157 |
149 /* Get image size */ | 158 /* Get image size */ |
150 printf("Reading from image: %s\n", image_name); | 159 printf("Reading from image: %s\n", image_name); |
151 image_file = fopen(image_name, "rb"); | 160 image_file = fopen(image_name, "rb"); |
152 if (!image_file) { | 161 if (!image_file) { |
153 fprintf(stderr, "Unable to open image file %s\n", image_name); | 162 fprintf(stderr, "Unable to open image file %s\n", image_name); |
154 return 1; | 163 return 1; |
155 } | 164 } |
156 fseek(image_file, 0, SEEK_END); | 165 fseek(image_file, 0, SEEK_END); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 lkp.partition_guid[12], | 201 lkp.partition_guid[12], |
193 lkp.partition_guid[13], | 202 lkp.partition_guid[13], |
194 lkp.partition_guid[14], | 203 lkp.partition_guid[14], |
195 lkp.partition_guid[15]); | 204 lkp.partition_guid[15]); |
196 } | 205 } |
197 | 206 |
198 fclose(image_file); | 207 fclose(image_file); |
199 Free(lkp.kernel_buffer); | 208 Free(lkp.kernel_buffer); |
200 return rv != LOAD_KERNEL_SUCCESS; | 209 return rv != LOAD_KERNEL_SUCCESS; |
201 } | 210 } |
OLD | NEW |