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

Side by Side Diff: src/platform/vboot_reference/vfirmware/firmware_image.c

Issue 2255006: StatefulMem* functions should be library functions. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Created 10 years, 6 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 * Functions for generating and manipulating a verified boot firmware image. 5 * Functions for generating and manipulating a verified boot firmware image.
6 */ 6 */
7 7
8 #include "firmware_image.h" 8 #include "firmware_image.h"
9 9
10 #include <sys/types.h> 10 #include <sys/types.h>
11 #include <sys/stat.h> 11 #include <sys/stat.h>
12 #include <fcntl.h> 12 #include <fcntl.h>
13 #include <unistd.h> 13 #include <unistd.h>
14 14
15 #include "cryptolib.h" 15 #include "cryptolib.h"
16 #include "file_keys.h" 16 #include "file_keys.h"
17 #include "signature_digest.h" 17 #include "signature_digest.h"
18 #include "utility.h" 18 #include "stateful_util.h"
19 19
20 /* Macro to determine the size of a field structure in the FirmwareImage 20 /* Macro to determine the size of a field structure in the FirmwareImage
21 * structure. */ 21 * structure. */
22 #define FIELD_LEN(field) (sizeof(((FirmwareImage*)0)->field)) 22 #define FIELD_LEN(field) (sizeof(((FirmwareImage*)0)->field))
23 23
24 FirmwareImage* FirmwareImageNew(void) { 24 FirmwareImage* FirmwareImageNew(void) {
25 FirmwareImage* image = (FirmwareImage*) Malloc(sizeof(FirmwareImage)); 25 FirmwareImage* image = (FirmwareImage*) Malloc(sizeof(FirmwareImage));
26 if (image) { 26 if (image) {
27 image->firmware_sign_key = NULL; 27 image->firmware_sign_key = NULL;
28 image->preamble_signature = NULL; 28 image->preamble_signature = NULL;
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 Free(firmware_buf); 472 Free(firmware_buf);
473 return 0; 473 return 0;
474 } 474 }
475 image->firmware_signature = (uint8_t*) Malloc(signature_len); 475 image->firmware_signature = (uint8_t*) Malloc(signature_len);
476 Memcpy(image->firmware_signature, firmware_signature, signature_len); 476 Memcpy(image->firmware_signature, firmware_signature, signature_len);
477 Free(firmware_signature); 477 Free(firmware_signature);
478 Free(firmware_buf); 478 Free(firmware_buf);
479 Free(preamble_blob); 479 Free(preamble_blob);
480 return 1; 480 return 1;
481 } 481 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698