Randall Spangler | 729b872 | 2010-06-11 11:16:20 -0700 | [diff] [blame] | 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 |
| 3 | * found in the LICENSE file. |
| 4 | * |
| 5 | * Host-side functions for verified boot. |
| 6 | */ |
| 7 | |
| 8 | #ifndef VBOOT_REFERENCE_HOST_KEYBLOCK_H_ |
| 9 | #define VBOOT_REFERENCE_HOST_KEYBLOCK_H_ |
| 10 | |
Randall Spangler | 729b872 | 2010-06-11 11:16:20 -0700 | [diff] [blame] | 11 | #include "host_key.h" |
| 12 | #include "vboot_struct.h" |
| 13 | |
| 14 | |
| 15 | /* Create a key block header containing [data_key] and [flags], signed |
| 16 | * by [signing_key]. Caller owns the returned pointer, and must free |
| 17 | * it with Free(). */ |
| 18 | VbKeyBlockHeader* KeyBlockCreate(const VbPublicKey* data_key, |
| 19 | const VbPrivateKey* signing_key, |
| 20 | uint64_t flags); |
| 21 | |
| 22 | |
| 23 | /* Read a key block from a .keyblock file. Caller owns the returned |
| 24 | * pointer, and must free it with Free(). |
| 25 | * |
| 26 | * Returns NULL if error. */ |
| 27 | VbKeyBlockHeader* KeyBlockRead(const char* filename); |
| 28 | |
| 29 | |
| 30 | /* Write a key block to a file in .keyblock format. */ |
| 31 | int KeyBlockWrite(const char* filename, const VbKeyBlockHeader* key_block); |
| 32 | |
| 33 | #endif /* VBOOT_REFERENCE_HOST_KEYBLOCK_H_ */ |