Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: src/platform/vboot_reference/tests/test_common.c

Issue 2292001: Make kernel signature a part of the kernel preamble. (Closed) Base URL: ssh://git@gitrw.chromium.org/chromiumos
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * Common functions used by tests. 5 * Common functions used by tests.
6 */ 6 */
7 7
8 #include "test_common.h" 8 #include "test_common.h"
9 9
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 15 matching lines...) Expand all
26 fprintf(stderr, "%s Test " COL_GREEN "PASSED\n" COL_STOP, testname); 26 fprintf(stderr, "%s Test " COL_GREEN "PASSED\n" COL_STOP, testname);
27 return 1; 27 return 1;
28 } 28 }
29 else { 29 else {
30 fprintf(stderr, "%s Test " COL_RED "FAILED\n" COL_STOP, testname); 30 fprintf(stderr, "%s Test " COL_RED "FAILED\n" COL_STOP, testname);
31 gTestSuccess = 0; 31 gTestSuccess = 0;
32 return 0; 32 return 0;
33 } 33 }
34 } 34 }
35 35
36 int TEST_NEQ(int result, int not_expected_result, char* testname) {
37 if (result != not_expected_result) {
38 fprintf(stderr, "%s Test " COL_GREEN "PASSED\n" COL_STOP, testname);
39 return 1;
40 }
41 else {
42 fprintf(stderr, "%s Test " COL_RED "FAILED\n" COL_STOP, testname);
43 gTestSuccess = 0;
44 return 0;
45 }
46 }
47
36 FirmwareImage* GenerateTestFirmwareImage(int algorithm, 48 FirmwareImage* GenerateTestFirmwareImage(int algorithm,
37 const uint8_t* firmware_sign_key, 49 const uint8_t* firmware_sign_key,
38 int firmware_key_version, 50 int firmware_key_version,
39 int firmware_version, 51 int firmware_version,
40 uint64_t firmware_len, 52 uint64_t firmware_len,
41 const char* root_key_file, 53 const char* root_key_file,
42 const char* firmware_key_file, 54 const char* firmware_key_file,
43 uint8_t firmware_data_fill_char) { 55 uint8_t firmware_data_fill_char) {
44 FirmwareImage* image = FirmwareImageNew(); 56 FirmwareImage* image = FirmwareImageNew();
45 57
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 if (!image) 246 if (!image)
235 return NULL; 247 return NULL;
236 if (is_corrupt) { 248 if (is_corrupt) {
237 /* Invalidate image. */ 249 /* Invalidate image. */
238 Memset(image->kernel_data, 'X', image->kernel_len); 250 Memset(image->kernel_data, 'X', image->kernel_len);
239 } 251 }
240 kernel_blob = GetKernelBlob(image, &len); 252 kernel_blob = GetKernelBlob(image, &len);
241 KernelImageFree(image); 253 KernelImageFree(image);
242 return kernel_blob; 254 return kernel_blob;
243 } 255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698