1 /*
2  * Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6 #ifndef VBOOT_REFERENCE_FUTILITY_VB1_HELPER_H_
7 #define VBOOT_REFERENCE_FUTILITY_VB1_HELPER_H_
8 
9 uint8_t *ReadConfigFile(const char *config_file, uint64_t *config_size);
10 
11 uint8_t *CreateKernelBlob(uint8_t *vmlinuz_buf, uint64_t vmlinuz_size,
12 			  enum arch_t arch, uint64_t kernel_body_load_address,
13 			  uint8_t *config_data, uint64_t config_size,
14 			  uint8_t *bootloader_data, uint64_t bootloader_size,
15 			  uint64_t *blob_size_ptr);
16 
17 uint8_t *SignKernelBlob(uint8_t *kernel_blob, uint64_t kernel_size,
18 			uint64_t padding,
19 			int version, uint64_t kernel_body_load_address,
20 			VbKeyBlockHeader *keyblock, VbPrivateKey *signpriv_key,
21 			uint32_t flags, uint64_t *vblock_size_ptr);
22 
23 int WriteSomeParts(const char *outfile,
24 		   void *part1_data, uint64_t part1_size,
25 		   void *part2_data, uint64_t part2_size);
26 
27 uint8_t *UnpackKPart(uint8_t *kpart_data, uint64_t kpart_size,
28 		     uint64_t padding,
29 		     VbKeyBlockHeader **keyblock_ptr,
30 		     VbKernelPreambleHeader **preamble_ptr,
31 		     uint64_t *blob_size_ptr);
32 
33 int UpdateKernelBlobConfig(uint8_t *kblob_data, uint64_t kblob_size,
34 			   uint8_t *config_data, uint64_t config_size);
35 
36 int VerifyKernelBlob(uint8_t *kernel_blob,
37 		     uint64_t kernel_size,
38 		     VbPublicKey *signpub_key,
39 		     const char *keyblock_outfile,
40 		     uint64_t min_version);
41 
42 uint64_t KernelCmdLineOffset(VbKernelPreambleHeader *preamble);
43 
44 #endif	/* VBOOT_REFERENCE_FUTILITY_VB1_HELPER_H_ */
45